/** * Constructor */ public function __construct() { $root = Server::getScriptPath(); $parent = dirname($root); $this->addPath($root); $this->addPath($parent); $this->addPath($parent . "/source"); }
/** * Constructor */ public function __construct() { // resolve some local paths $this->_path_root = Server::getDocRoot(); $this->_path_script = Server::getScriptPath(); $this->_path_base = $this->_path_script . '/areas'; // resolve request method verb $method = Utils::getValue(@$_SERVER['REQUEST_METHOD'], 'GET'); $method = Utils::getValue(@$_SERVER['HTTP_X_HTTP_METHOD'], $method); $this->_method = strtolower(trim($method)); }
/** * Take a full path and make relative to the application root */ public static function relativePath($path) { if (!empty($path) && is_string($path)) { $path = Sanitize::toPath($path); $root = Server::getScriptPath(); $levels = array($root, dirname($root), dirname(dirname($root)), dirname(dirname(dirname($root)))); foreach ($levels as $level) { if (empty($level) || $levels === "/") { continue; } $path = str_replace($level, "", $path); } } return $path; }
/** * Get the url where public resources are loaded from */ public function getPublicUrl($append = '') { $base = str_replace(Server::getScriptPath(), '', $this->_base); return Server::getBaseUrl($base . $append); }