From d38f3d021976b9787c1735ea1ec21c162536fe17 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Fri, 28 Mar 2008 00:52:37 +0000 Subject: [PATCH] + // shortcut for doc_root --- lib/Minify/Source.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Minify/Source.php b/lib/Minify/Source.php index 82537c1..c375e56 100644 --- a/lib/Minify/Source.php +++ b/lib/Minify/Source.php @@ -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']);