示例#1
0
 private function _checkForm($form)
 {
     $captcha = new My_Plugin_Image();
     $captchaID = $form['captchaID'];
     $captcha->removeImg($captchaID);
     $error = array();
     if (empty($form['contact_first_name'])) {
         $error[] = 'First Name is required!';
     }
     if (empty($form['contact_last_name'])) {
         $error[] = 'Last Name is required!';
     }
     if (empty($form['contact_email'])) {
         $error[] = 'Email is required!';
     }
     if (empty($form['contact_phone'])) {
         $error[] = 'Phone number is required!';
     }
     if (empty($form['message'])) {
         $error[] = 'Message is required!';
     }
     $validator = new My_Plugin_Captcha($captchaID);
     if (!$validator->isValid($form['captcha'])) {
         $message = $validator->getMessages();
         $error[] = current($message);
     }
     return $error;
 }
示例#2
0
 private function _checkForm($form)
 {
     $error = array();
     if (empty($form['full_name'])) {
         $error[] = 'Bạn chưa nhập tên!';
     }
     if (empty($form['email'])) {
         $error[] = 'Bạn chưa nhập email!';
     }
     if (empty($form['phone'])) {
         $error[] = 'Bạn chưa nhập số điện thoại!';
     }
     if (empty($form['address'])) {
         $error[] = 'Bạn chưa nhập địa chỉ!';
     }
     $validator = new My_Plugin_Captcha($captchaID);
     if (!$validator->isValid($form['captcha'])) {
         $message = $validator->getMessages();
         $error[] = current($message);
     }
     return $error;
 }