public function test($object, Validation_Errors $errors, $array_access = false) { Core::load('CMS.Protect'); $value = trim($this->value_of_attribute($object, $this->attribute, $array_access)); $code = $this->value_of_attribute($object, CMS_Fields_Types_Protect::field_code($this->attribute), $array_access); $key = CMS_Protect::key($code); if ($value == '' || $value != $key) { $errors->reject_value($this->attribute, $this->message); } return false; }
protected function not_found($uri, $env, $r) { if ($m = Core_Regexps::match_with_results('{^([^?]+)\\?}', $uri)) { $uri = $m[1]; } if ($m = Core_Regexps::match_with_results('{^/digital-protect/(.*)}', $uri)) { Core::load('CMS.Protect'); CMS_Protect::draw($m[1]); die; } if ($m = Core_Regexps::match_with_results('{^/check-digital-protect/([^/]+)/(.*)}', $uri)) { Core::load('CMS.Protect'); CMS_Protect::check($m[1], $m[2]); die; } return $r; }