CFDBSearchEvaluator

The Contact Form DB CFDBSearchEvaluator class.

Defined (1)

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

/CFDBSearchEvaluator.php  
  1. class CFDBSearchEvaluator implements CFDBEvaluator { 
  2.  
  3. var $search; 
  4.  
  5. public function setSearch($search) { 
  6. $this->search = strtolower($search); 
  7.  
  8. /** 
  9. * Evaluate expression against input data. This is intended to mimic the search field on DataTables 
  10. * @param $data array [ key => value] 
  11. * @return boolean result of evaluating $data against expression 
  12. */ 
  13. public function evaluate(&$data) { 
  14. if (!$this->search) { 
  15. return true; 
  16. foreach ($data as $key => $value) { 
  17. // Any field can match, case insensitive 
  18. if (false !== strrpos(strtolower($value), $this->search)) { 
  19. return true; 
  20. return false; 
  21.