diff --git a/min/README.txt b/min/README.txt index ffc9f55..2f59d41 100644 --- a/min/README.txt +++ b/min/README.txt @@ -93,6 +93,7 @@ source control revision number. If not, the utility function Minify_groupUri() will return "versioned" Minify URIs for use in your HTML. E.g.: * * @param string $uri + * @param boolean $forceAmpersand (default = false) Force the use of ampersand to + * append the timestamp to the URI. * @return string */ - public function uri($uri) { - $sep = strpos($uri, '?') === false - ? '?' - : self::$ampersand; + public function uri($uri, $forceAmpersand = false) { + $sep = ($forceAmpersand || strpos($uri, '?') !== false) + ? self::$ampersand + : '?'; return "{$uri}{$sep}{$this->lastModified}"; } diff --git a/min/utils.php b/min/utils.php index e9fe77e..c735941 100644 --- a/min/utils.php +++ b/min/utils.php @@ -1,11 +1,13 @@ "> * * + * If you do not want ampersands as HTML entities, set Minify_Build::$ampersand = "&" + * before using this function. + * * @param string $group a key from groupsConfig.php - * @param string $ampersand '&' or '&' (default '&') + * @param boolean $forceAmpersand (default false) Set to true if the RewriteRule + * directives in .htaccess are functional. This will remove the "?" from URIs, making them + * more cacheable by proxies. * @return string */ -function Minify_groupUri($group, $ampersand = '&') +function Minify_groupUri($group, $forceAmpersand = false) { - Minify_Build::$ampersand = $ampersand; - return _Minify_getBuild($group)->uri('/' . basename(dirname(__FILE__)) . '/?g=' . $group); + $path = $forceAmpersand + ? "/g={$group}" + : "/?g={$group}"; + return _Minify_getBuild($group)->uri( + '/' . basename(dirname(__FILE__)) . $path + ,$forceAmpersand + ); }