You are here

function _watchdog_triggers_preg_match_patterns in Logging and alerts 6.2

Same name and namespace in other branches
  1. 6 watchdog_triggers/watchdog_triggers.module \_watchdog_triggers_preg_match_patterns()
  2. 7.2 watchdog_triggers/watchdog_triggers.module \_watchdog_triggers_preg_match_patterns()
  3. 7 watchdog_triggers/watchdog_triggers.module \_watchdog_triggers_preg_match_patterns()

Helper function, preg_matches contents of an array.

1 call to _watchdog_triggers_preg_match_patterns()
watchdog_triggers_watchdog in watchdog_triggers/watchdog_triggers.module
Implementation of hook_watchdog().

File

watchdog_triggers/watchdog_triggers.module, line 269
Provides a Trigger and Action integration for watchdog events.

Code

function _watchdog_triggers_preg_match_patterns($array, $target) {
  $match_results = FALSE;
  foreach ($array as $pattern) {
    $pattern = trim($pattern);
    $matches = array();
    if (!empty($pattern)) {
      $number_matches = preg_match_all($pattern, $target, $matches);
      if ($number_matches > 0 && $number_matches !== FALSE) {
        $match_results = TRUE;
      }
    }
  }
  return $match_results;
}