コード例 #1
0
ファイル: Validator.php プロジェクト: flo5581/lubaframework
 public function run()
 {
     if (Request::is('post')) {
         $this->validateToken();
     }
     foreach ($this->fields as $field) {
         if ($field instanceof Label) {
             continue;
         }
         foreach ($field->getValidatorAttributes() as $rule) {
             if (stripos($rule, 'requiredWith:') !== false) {
                 if (!$this->requiredWith($field->getName(), str_replace('requiredWith:', '', $rule))) {
                     $this->passed = false;
                     break;
                 }
             } elseif (stripos($rule, 'requiredWithout:') !== false) {
                 if (!$this->requiredWithout($field->getName(), str_replace('requiredWithout:', '', $rule))) {
                     $this->passed = false;
                     break;
                 }
             } elseif (!$this->{$rule}($field->getName())) {
                 $this->passed = false;
                 break;
             }
         }
         Session::set('__forminputs', $this->postVars);
     }
     Session::set('__formerrors', $this->errors);
     return $this->passed;
 }
コード例 #2
0
ファイル: Input.php プロジェクト: flo5581/lubaframework
 public static function all()
 {
     if (strtolower(Request::getInstance()->method()) == 'post') {
         return static::post();
     }
     if (strtolower(Request::getInstance()->method()) == 'get') {
         return static::get();
     }
     return NULL;
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: flo5581/lubaframework
 public final function checkAction($action)
 {
     if ($this->global) {
         return true;
     }
     if (array_search($action, $this->get_actions) !== false && strtolower(Request::getInstance()->method()) == 'get') {
         return true;
     } elseif (array_search($action, $this->post_actions) !== false && strtolower(Request::getInstance()->method()) == 'post') {
         return true;
     } elseif (array_search($action, $this->actions) !== false) {
         return true;
     } else {
         return false;
     }
 }
コード例 #4
0
ファイル: URL.php プロジェクト: flo5581/lubaframework
 public function withoutParams()
 {
     return \Request::scheme() . "://" . \Request::root() . $this->uri();
 }