function redirect($request, $match, $view) { return new Redirect(URL::forView($view[0], $view[1])); }
public function testViewInSub2() { $views = array(array('regex' => '#^/#', 'sub' => array(array('regex' => '#^$#', 'view' => array('\\helloworld\\views\\Views', 'you'), 'name' => 'home')))); $tests = array(array('/', 'home', array(''))); foreach ($tests as $t) { $this->assertequals($t[0], URL::reverse($views, $t[1], $t[2])); } }
/** * Display the URL of a view. * * @param $view View name * @param $params Parameters for the view (array()) * @param $get_params Extra get parameters (array()) */ function start($view, $params = array(), $get_params = array()) { echo \photon\core\URL::forView($view, $params, $get_params); }
public function redirect($request, $match) { $url = URL::forView('hello_view'); return new Redirect($url); }
/** * Dump from a view name defined in the configuration * * @param string path of the file to create (i.e. /home/foobar/index.html). * @param string View. * @param array Parameters for the view (array()). * @param array Extra GET parameters for the view (array()). */ static function fromView($path, $view, $params = array(), $get_params = array()) { $url = \photon\core\URL::forView($view, $params, $get_params); static::fromURL($path, $url); }
/** * The $request object is used to know what the post login * redirect url should be. * * If the action url of the login page is not set, it will try to * get the url from the login view from the 'login_view' * configuration key. * * @param Request The request object of the current page. * @param string The full url of the login page (null) */ function __construct($request, $loginurl = null) { $redirect = array('_redirect_after' => \photon\crypto\Sign::dumps($request->path, Conf::f('secret_key'))); if ($loginurl !== null) { $url = URL::generate($loginurl, $redirect, false); $encoded = URL::generate($loginurl, $redirect); } else { $url = URL::forView(Conf::f('login_view', 'login_view'), array(), $redirect, false); $encoded = URL::forView(Conf::f('login_view', 'login_view'), array(), $redirect); } $content = sprintf(__('<a href="%s">Please, click here to be redirected</a>.'), $encoded); parent::__construct($content); $this->headers['Location'] = $url; $this->status_code = 302; }