__allRegexp = $regexp->find('all'); } /** * replace the current value according to the regexp rules, or block blacklisted regular expressions * * @param Model $Model * @param unknown_type $array */ public function runRegexp(Model $Model, $type, $value) { foreach ($this->__allRegexp as $regexp) { if (!empty($regexp['Regexp']['replacement']) && !empty($regexp['Regexp']['regexp']) && ($regexp['Regexp']['type'] === 'ALL' || $regexp['Regexp']['type'] === $type)) { $value = preg_replace($regexp['Regexp']['regexp'], $regexp['Regexp']['replacement'], $value); } if (empty($regexp['Regexp']['replacement']) && preg_match($regexp['Regexp']['regexp'], $value) && ($regexp['Regexp']['type'] === 'ALL' || $regexp['Regexp']['type'] === $type)) { return false; } } return $value; } }