/** * Create a new view instance. * * @param string $view * @param array $data * @return void */ public function __construct($view, $data = array()) { $this->view = $view; $this->data = $data; $this->path = $this->path($view); // If a session driver has been specified, we will bind an instance of // the validation error message container to every view. If an errors // instance exists in the session, we will use that instance. // // This makes the implementation of the Post/Redirect/Get pattern very // convenient since each view can assume it has a message container. if (Config::$items['session']['driver'] !== '' and IoC::core('session')->started()) { $this->data['errors'] = IoC::core('session')->get('errors', function () { return new Messages(); }); } }
/** * Determine if the request has been forged. * * The session CSRF token will be compared to the CSRF token in the request input. * * @return bool */ public static function forged() { return static::csrf_token() !== IoC::core('session')->token(); }
/** * Generate a hidden field containing the current CSRF token. * * @return string */ public static function token() { return static::input('hidden', Session::csrf_token, IoC::core('session')->token()); }
/** * Determine if the request has been forged. * * The session CSRF token will be compared to the CSRF token in the request input. * * @return bool */ public static function forged() { return Input::get(Session::csrf_token) !== IoC::core('session')->token(); }