exampleCallback

Check if the string 'Release' is in the text content of any matched nodes.

Description

exampleCallback( $index, $item ); 

Returns TRUE if the text is found, FALSE otherwise. Anytime a filter callback returns FALSE, QueryPath will remove it from the matches.

Note that $item is a DOMNode (actually, a DOMElement). So if we wanted to do QueryPath manipulations on it, we could wrap it in a qp()..

Parameters (2)

0. $index
The index.
1. $item
The item.

Usage

  1. if ( !function_exists( 'exampleCallback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-pdf/vendor/querypath/querypath/examples/matching_text_content.php'; 
  3.  
  4. // The index. 
  5. $index = null; 
  6.  
  7. // The item. 
  8. $item = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = exampleCallback($index, $item); 
  12.  

Defined (1)

The function is defined in the following location(s).

/vendor/querypath/querypath/examples/matching_text_content.php  
  1. function exampleCallback($index, $item) { 
  2. $text = qp($item)->text(); 
  3. return strpos($text, 'Release') !== FALSE;