Example #1
0
 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;
 }