Example #1
0
 public function test_reversing()
 {
     $cfg = \System\Settings::get('domains');
     $list = array_keys($cfg);
     $host = $list[0];
     $this->assertEquals(\System\Router::get_url($host, 'system_resource', array('static', 'a', 'b')), '/static/a/b');
 }
Example #2
0
<?php

\System\Database::init();
if (Godmode\Router::entered($request)) {
    Godmode\Router::init();
    if ($request->logged_in()) {
        if (!\Godmode\Gatekeeper::canAccessGodmode($request->user)) {
            throw new \System\Error\AccessDenied();
        }
    } else {
        $url_login = \System\Router::get_url($request->host, 'god_login');
        if ($request->path != $url_login) {
            redirect_now($url_login);
        }
    }
}
Example #3
0
 /**
  * URL alias for reponse::url
  *
  * @param string $name Named route name
  * @param array  $args Arguments for route
  * @param int    $var  Variation number of URL
  * @return string
  */
 public function url($name, array $args = array(), $var = 0)
 {
     return \System\Router::get_url($this->request->host, $name, $args, $var);
 }
Example #4
0
 public static function url(\System\Http\Request $request, array $link_god, $action = 'list', array $args = array())
 {
     return \System\Router::get_url($request->host, sprintf(self::LINK_MODEL, implode('_', $link_god), $action), $args);
 }
Example #5
0
 /**
  * Gets you full URL
  *
  * @param String $name
  * @param array  $args
  * @param int    $variation
  * @return String
  */
 public function url_full($name, array $args = array(), $variation = 0)
 {
     return $this->request->protocol . '://' . $this->request->host . \System\Router::get_url($this->request->host, $name, $args, $variation);
 }