static function mount($config) { static::$config = $config; //not configurables static::$root = ROOT; static::$php = ROOT . '.app/'; static::$ctrl = ROOT . '.app/controller/'; static::$html = ROOT . '.app/html/'; static::$upload = ROOT . '.app/upload/'; static::$style = ROOT . 'css/'; static::$script = ROOT . 'js/'; //Detect SSL access if (!isset($_SERVER['SERVER_PORT'])) { $_SERVER['SERVER_PORT'] = 80; } $http = isset($_SERVER['HTTPS']) && ($_SERVER["HTTPS"] == "on" || $_SERVER["HTTPS"] == 1 || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://'; //What's base??! $base = isset($_SERVER['PHAR_SCRIPT_NAME']) ? dirname($_SERVER['PHAR_SCRIPT_NAME']) : rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), ' /'); if ($_SERVER['SERVER_PORT'] != 80) { $base .= ':' . $_SERVER['SERVER_PORT']; } //URL & REQST Constants: defined('RQST') || define('RQST', urldecode(isset($_SERVER['REQUEST_URI']) ? urldecode(trim(str_replace($base, '', trim($_SERVER['REQUEST_URI'])), ' /')) : '')); defined('URL') || define('URL', isset($_SERVER['SERVER_NAME']) ? $http . $_SERVER['SERVER_NAME'] . $base . '/' : ''); static::$url = URL; static::$rqst = explode('/', RQST); static::$files = URL . 'files/'; }
static function mount(Router $router) { static::$router = $router; static::$root = WEB_PATH; static::$php = APP_PATH . ''; static::$ctrl = APP_PATH . 'controller/'; static::$html = HTML_PATH . ''; static::$upload = APP_PATH . 'upload/'; static::$style = WEB_PATH . 'css/'; static::$script = WEB_PATH . 'js/'; static::$url = URL; static::$rqst = explode('/', RQST); static::$files = URL . 'files/'; }