/**
  *@return singleton instance
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new FormAccessValidator();
     }
     return self::$instance;
 }
 public function startFormProcess()
 {
     if (isset($_POST['confirm'])) {
         $form = FormAccessValidator::getInstance();
         $form->addValidation('quantity', 'number');
         $form->addValidation('price', 'stringNumber');
         if ($form->init()) {
             $this->switchActionType();
             return true;
         }
         return false;
     }
 }
예제 #3
0
 /**
  *@ login form initializer
  */
 public function loginUser()
 {
     $form = FormAccessValidator::getInstance();
     $form->addValidation('password', 'password', array('min_length' => 5));
     $form->addValidation('email', 'email', 'email');
     if (isset($_POST['submit']) && $form->init()) {
         if (self::getUserConnection()) {
             return true;
         }
         return false;
     }
     self::setError($form->getErrors());
     return false;
 }