diff options
| author | Jano Slota <jano@alokal.eu> | 2014-05-05 22:55:36 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-05-07 11:17:32 +0200 |
| commit | c25b8f01c560ca97ca8a9dc217b495966aaa4d7f (patch) | |
| tree | 54d4c0aaa98a7cb581832094de4e707c9ae9ac93 /inc/lib/minify/Minify/HTML | |
| parent | 593560956c629fb2df9b97b5afe9c1eb2666652b (diff) | |
Updated minify, jQuery, MixItUp and Tooltipster
Diffstat (limited to 'inc/lib/minify/Minify/HTML')
| -rwxr-xr-x | inc/lib/minify/Minify/HTML/Helper.php | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/inc/lib/minify/Minify/HTML/Helper.php b/inc/lib/minify/Minify/HTML/Helper.php index 807fdc9c..f92ab854 100755 --- a/inc/lib/minify/Minify/HTML/Helper.php +++ b/inc/lib/minify/Minify/HTML/Helper.php @@ -15,10 +15,10 @@ class Minify_HTML_Helper { public $minAppUri = '/min'; public $groupsConfigFile = ''; - /* + /** * Get an HTML-escaped Minify URI for a group or set of files * - * @param mixed $keyOrFiles a group key or array of filepaths/URIs + * @param string|array $keyOrFiles a group key or array of filepaths/URIs * @param array $opts options: * 'farExpires' : (default true) append a modified timestamp for cache revving * 'debug' : (default false) append debug flag @@ -51,8 +51,12 @@ class Minify_HTML_Helper { return htmlspecialchars($uri, ENT_QUOTES, $opts['charset']); } - /* + /** * Get non-HTML-escaped URI to minify the specified files + * + * @param bool $farExpires + * @param bool $debug + * @return string */ public function getRawUri($farExpires = true, $debug = false) { @@ -74,6 +78,12 @@ class Minify_HTML_Helper { return $path; } + /** + * Set the files that will comprise the URI we're building + * + * @param array $files + * @param bool $checkLastModified + */ public function setFiles($files, $checkLastModified = true) { $this->_groupKey = null; @@ -94,6 +104,12 @@ class Minify_HTML_Helper { $this->_filePaths = $files; } + /** + * Set the group of files that will comprise the URI we're building + * + * @param string $key + * @param bool $checkLastModified + */ public function setGroup($key, $checkLastModified = true) { $this->_groupKey = $key; @@ -103,13 +119,23 @@ class Minify_HTML_Helper { } if (is_file($this->groupsConfigFile)) { $gc = (require $this->groupsConfigFile); - if (isset($gc[$key])) { - $this->_lastModified = self::getLastModified($gc[$key]); + $keys = explode(',', $key); + foreach ($keys as $key) { + if (isset($gc[$key])) { + $this->_lastModified = self::getLastModified($gc[$key], $this->_lastModified); + } } } } } - + + /** + * Get the max(lastModified) of all files + * + * @param array|string $sources + * @param int $lastModified + * @return int + */ public static function getLastModified($sources, $lastModified = 0) { $max = $lastModified; @@ -142,13 +168,19 @@ class Minify_HTML_Helper { * @return mixed a common char or '' if any do not match */ protected static function _getCommonCharAtPos($arr, $pos) { - $l = count($arr); + if (!isset($arr[0][$pos])) { + return ''; + } $c = $arr[0][$pos]; - if ($c === '' || $l === 1) + $l = count($arr); + if ($l === 1) { return $c; - for ($i = 1; $i < $l; ++$i) - if ($arr[$i][$pos] !== $c) + } + for ($i = 1; $i < $l; ++$i) { + if ($arr[$i][$pos] !== $c) { return ''; + } + } return $c; } @@ -157,11 +189,11 @@ class Minify_HTML_Helper { * * @param array $paths root-relative URIs of files * @param string $minRoot root-relative URI of the "min" application + * @return string */ protected static function _getShortestUri($paths, $minRoot = '/min/') { $pos = 0; $base = ''; - $c; while (true) { $c = self::_getCommonCharAtPos($paths, $pos); if ($c === '') { |
