17 require_once SQ_CORE_PACKAGE_PATH.
'/system/conditions/condition/condition.inc';
42 parent::__construct($assetid);
58 if (!isset($condition_data[
'keyword']) || !isset($condition_data[
'keyword_match'])) {
62 if (isset($condition_data[
'keyword_value'])) {
64 if (!preg_match(
'/^%globals_/', $condition_data[
'keyword_value'])) {
65 $keyword_replacement = $condition_data[
'keyword_value'];
72 $keyword_replacement = replace_global_keywords($condition_data[
'keyword_value']);
75 $keyword_replacement = self::getRegExpKeywordReplacement($asset, $condition_data);
78 $keyword_match = $condition_data[
'keyword_match'];
80 if (array_get_index($condition_data,
'replace_keyword_in_match',
'0') ==
'1') {
82 replace_global_keywords($keyword_match);
85 $keywords = retrieve_keywords_replacements($keyword_match);
86 $replacements = Array();
87 foreach ($keywords as $keyword) {
90 replace_keywords($keyword_match, $replacements);
93 $matches = preg_match(
'/'.str_replace(
'/',
'\\'.
'/', $keyword_match).
'/i', $keyword_replacement);
94 return ($matches > 0);
112 if (preg_match(
'/^globals_/', $condition_data[
'keyword'])) {
113 $ret =
'%'.$condition_data[
'keyword'].
'%';
114 replace_global_keywords($ret);
138 public static function updateKeywords(Array $logical_keywords, Array &$condition_data)
140 $keyword_name = parse_keyword($condition_data[
'keyword'], $modifiers);
142 if (count($modifiers) >= 1) {
143 $condition_data[
'keyword_value'] =
'%'.$condition_data[
'keyword'].
'%';
145 $condition_data[
'keyword_value'] = isset($logical_keywords[$keyword_name]) ? $logical_keywords[$keyword_name] :
'';
166 return Array($condition_data[
'keyword']);