コード例 #1
0
ファイル: Router.php プロジェクト: JanFoerste/blivy
 /**
  * ### Sets the formatted request uri
  *
  * Router constructor.
  */
 public function __construct()
 {
     $request = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
     $_SESSION['REQUEST_URI'] = $request;
     $this->uri = $this->formatURI($request);
     $this->routes = json_decode(file_get_contents(httpdir() . 'routes.json'), true);
 }
コード例 #2
0
ファイル: helpers.php プロジェクト: JanFoerste/blivy
/**
 * ### Returns the uri for a named route
 *
 * @param $name
 * @return int|string
 */
function route($name)
{
    $routes = json_decode(file_get_contents(httpdir() . 'routes.json'), true);
    foreach ($routes as $uri => $route) {
        if (array_key_exists('name', $route) && $route['name'] === $name) {
            return $uri;
        }
    }
    return '#';
}
コード例 #3
0
ファイル: helpers.php プロジェクト: JanFoerste/blivy-website
/**
 * ### Gets the full path to the template directory
 *
 * @return string
 */
function viewdir()
{
    return realpath(httpdir() . 'resources/views/') . '/';
}