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; }
public static function all() { if (strtolower(Request::getInstance()->method()) == 'post') { return static::post(); } if (strtolower(Request::getInstance()->method()) == 'get') { return static::get(); } return NULL; }
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; } }
public function withoutParams() { return \Request::scheme() . "://" . \Request::root() . $this->uri(); }