1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-11 00:24:11 +02:00

+ // shortcut for doc_root

This commit is contained in:
Steve Clay
2008-03-28 00:52:37 +00:00
parent 17455e5fbd
commit d38f3d0219

View File

@@ -37,12 +37,18 @@ class Minify_Source {
* file (existence will not be checked!) or give 'id' (unique string for
* the content), 'content' (the string content) and 'lastModified'
* (unixtime of last update).
*
* As a shortcut, the controller will replace "//" at the beginning
* of a filepath with $_SERVER['DOCUMENT_ROOT'] . '/'.
*
* @param array $spec options
*/
public function __construct($spec)
{
if (isset($spec['filepath'])) {
if (0 === strpos($spec['filepath'], '//')) {
$spec['filepath'] = $_SERVER['DOCUMENT_ROOT'] . substr($spec['filepath'], 1);
}
$this->_filepath = $spec['filepath'];
$this->_id = $spec['filepath'];
$this->lastModified = filemtime($spec['filepath']);