static function getPath($path) { //Add front slash if (substr($path, 0, 1) != "/") { $path = "/" . $path; } //Remove end slash if (substr($path, -1) == "/") { $path = substr($path, 0, strlen($path) - 1); } //Set a path if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $path) && is_dir($path)) { //Absoulute Path self::$fullPath = $path; self::$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT'])); } else { //DocumentRoot Path if (!is_null($path)) { self::$fullPath = $_SERVER['DOCUMENT_ROOT'] . $path; self::$path = $path; } else { self::$fullPath = $_SERVER['DOCUMENT_ROOT']; } } }