form->getId(); //$errorfound = _accua_forms_json_encode($this->errorfound); //$errorsfound = _accua_forms_json_encode($this->errorsfound); echo <<errorfound = __('The following error was found:', 'contact-forms'); $this->errorsfound = __('The following @errorsize errors were found:', 'contact-forms'); $this->configure($properties); } public function setErrorsFound($text = '') { $this->errorsfound = $text; } public function setErrorFound($text = '') { $this->errorfound = $text; } private function parse($errors) { $list = array(); if(!empty($errors)) { $keys = array_keys($errors); $keySize = sizeof($keys); for($k = 0; $k < $keySize; ++$k) $list = array_merge($list, $errors[$keys[$k]]); } return $list; } public function render() { $errors = $this->parse($this->form->getErrors()); if(!empty($errors)) { $size = sizeof($errors); if($size == 1) $format = $this->errorfound; else $format = str_replace('@errorsize', $size, $this->errorsfound); echo '
', $format, '
"; } } public function getAjaxErrorResponse() { return $this->parse($this->form->getErrors()); } public function renderAjaxErrorResponse() { $errors = $this->parse($this->form->getErrors()); if(!empty($errors)) { header("Content-type: application/json"); print _accua_forms_json_encode(array("errors" => $errors)); } } }