16 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_condition/trigger_condition.inc';
17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
50 public static function evaluate($settings, &$state)
54 if (empty($state[
'asset'])) {
56 if (empty($state[
'assetid'])) {
59 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
63 if (empty($settings[
'pattern'])) {
69 if (isset($_SERVER[
'REQUEST_URI'])) {
70 $matches = strpos($_SERVER[
'REQUEST_URI'], $settings[
'pattern']);
72 if ($settings[
'match'] && $matches !== FALSE) {
74 }
else if (!$settings[
'match'] && $matches === FALSE) {
93 public static function getInterface($settings, $prefix, $write_access=FALSE)
96 $form_element_extras =
'disabled="disabled"';
98 $form_element_extras =
'';
101 $pattern = (isset($settings[
'pattern'])) ? $settings[
'pattern'] :
'';
102 $match = (isset($settings[
'match'])) ? $settings[
'match'] : FALSE;
107 text_box($prefix.
'[pattern]', $pattern,
'100',
'', FALSE, $form_element_extras);
110 radio_button($prefix.
'[match]',
'1', $match, NULL, $form_element_extras);
111 echo
' Must be in URL<br>';
112 radio_button($prefix.
'[match]',
'0', !$match, NULL, $form_element_extras);
113 echo
' Must not be in URL<br>';
114 echo
'Note: this condition only checks the query string ($_SERVER["REQUEST_URI"]) part of the URL';
116 $match_str = ($match) ?
'must be in URL' :
'must not be in URL';
117 echo
"\"$pattern\" $match_str .";
119 $basic_part_1 = ob_get_contents();
122 return ' URL pattern '.$basic_part_1;
138 $pattern = array_get_index($request_data,
'pattern', FALSE);
140 return 'No URL pattern entered';
142 $settings[
'pattern'] = $pattern;
144 $settings[
'match'] = array_get_index($request_data,
'match', FALSE);