|
@@ -440,13 +440,6 @@ class File
|
|
|
'x-world/x-vrml' => 'wrl',
|
|
|
);
|
|
|
|
|
|
- /**
|
|
|
- * Stores the absolute path to the document root directory.
|
|
|
- *
|
|
|
- * @var string
|
|
|
- */
|
|
|
- static protected $documentRoot;
|
|
|
-
|
|
|
/**
|
|
|
* The absolute path to the file without dots.
|
|
|
*
|
|
@@ -454,30 +447,6 @@ class File
|
|
|
*/
|
|
|
protected $path;
|
|
|
|
|
|
- /**
|
|
|
- * Sets the path to the document root directory.
|
|
|
- *
|
|
|
- * @param string $documentRoot
|
|
|
- */
|
|
|
- static public function setDocumentRoot($documentRoot)
|
|
|
- {
|
|
|
- if (!is_dir($documentRoot)) {
|
|
|
- throw new \LogicException($documentRoot . ' is not a directory.');
|
|
|
- }
|
|
|
-
|
|
|
- self::$documentRoot = realpath($documentRoot);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the path to the document root directory.
|
|
|
- *
|
|
|
- * @return string
|
|
|
- */
|
|
|
- static public function getDocumentRoot()
|
|
|
- {
|
|
|
- return self::$documentRoot;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Constructs a new file from the given path.
|
|
|
*
|
|
@@ -566,26 +535,6 @@ class File
|
|
|
return $this->path;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Returns the path relative to the document root.
|
|
|
- *
|
|
|
- * You can set the document root using the static method setDocumentRoot().
|
|
|
- * If the file is outside of the document root, this method returns an
|
|
|
- * empty string.
|
|
|
- *
|
|
|
- * @return string The relative file path
|
|
|
- */
|
|
|
- public function getWebPath()
|
|
|
- {
|
|
|
- $root = self::$documentRoot;
|
|
|
-
|
|
|
- if (false === strpos($this->path, $root)) {
|
|
|
- return '';
|
|
|
- }
|
|
|
-
|
|
|
- return str_replace(array($root, DIRECTORY_SEPARATOR), array('', '/'), $this->path);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Returns the mime type of the file.
|
|
|
*
|