public static function getRouters() { static $routers = array(); if (empty($routers)) { foreach (glob(Config::getBasePath() . '/routers/*.php') as $routerFile) { $name = basename($routerFile, '.php'); $routers[] = Lib::router($name); } } return $routers; }
public static function url($target, $options = array(), $external = false) { $values = array(); $router = Config::$sef ? Lib::router($target) : false; $base = $external ? Config::getBaseUrl() . '/' . Config::getBaseFolder() . '/' : ''; if (!$router) { foreach ($options as $k => $v) { $values[] = $k . '=' . $v; } $queries = implode('&', $values); if (!empty($queries)) { $queries = '?' . $queries; } return $base . $target . '.php' . $queries; } $link = $base . $router->build($options); return $link; }