public function validate($retType) { parent::validate($retType); copyArray($_POST, $fv, 'name', 'email', 'msg'); if (trim($fv['name']) == '') { $rets[] = array('msg' => 'Please enter your name!', 'field' => 'name'); } if (filter_var($fv['email'], FILTER_VALIDATE_EMAIL) === FALSE) { $rets[] = array('msg' => 'Invalid email!', 'field' => 'email'); } if (trim($fv['msg']) == '') { $rets[] = array('msg' => 'Please enter your message!', 'field' => 'msg'); } if (ReCaptcha::checkAnswer() == false && isset($retType) && $retType == RT_JSON) { $rets[] = array('msg' => 'The reCAPTCHA wasn\'t entered correctly!', 'field' => 'recaptcha'); } if (isset($retType) && $retType == RT_JSON && isset($rets)) return outputJson($rets); return $rets; }