* * * * * @param string $group a key from groupsConfig.php * @param string $ampersand '&' or '&' (default '&') * @return string */ function Minify_groupUri($group, $ampersand = '&') { Minify_Build::$ampersand = $ampersand; return _Minify_getBuild($group)->uri('/' . basename(dirname(__FILE__)) . '/?g=' . $group); } /** * Get the last modification time of the source js/css files used by Minify to * build the page. * * If you're caching the output of Minify_groupUri(), you'll want to rebuild * the cache if it's older than this timestamp. * * * // simplistic HTML cache system * $file = '/path/to/cache/file'; * if (! file_exists($file) || filemtime($file) < Minify_groupsMtime(array('js', 'css'))) { * // (re)build cache * $page = buildPage(); // this calls Minify_groupUri() for js and css * file_put_contents($file, $page); * echo $page; * exit(); * } * readfile($file); * * * @param array $groups an array of keys from groupsConfig.php * @return int Unix timestamp of the latest modification */ function Minify_groupsMtime($groups) { $max = 0; foreach ((array)$groups as $group) { $max = max($max, _Minify_getBuild($group)->lastModified); } return $max; } /** * @param string $group a key from groupsConfig.php * @return Minify_Build * @private */ function _Minify_getBuild($group) { static $builds = array(); static $cg = false; if (false === $gc) { $gc = (require dirname(__FILE__) . '/groupsConfig.php'); } if (! isset($builds[$group])) { $builds[$group] = new Minify_Build($gc[$group]); } return $builds[$group]; }