本文整理汇总了PHP中CSSMin::run方法的典型用法代码示例。如果您正苦于以下问题:PHP CSSMin::run方法的具体用法?PHP CSSMin::run怎么用?PHP CSSMin::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSSMin
的用法示例。
在下文中一共展示了CSSMin::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _elgg_views_minify
/**
* Minifies simplecache CSS and JS views by handling the "simplecache:generate" hook
*
* @param string $hook The name of the hook
* @param string $type View type (css, js, or unknown)
* @param string $content Content of the view
* @param array $params Array of parameters
*
* @return string|null View content minified (if css/js type)
* @access private
*/
function _elgg_views_minify($hook, $type, $content, $params)
{
static $autoload_registered;
if (!$autoload_registered) {
$path = elgg_get_root_path() . 'vendors/minify/lib';
elgg_get_class_loader()->addFallback($path);
$autoload_registered = true;
}
if (preg_match('~[\\.-]min\\.~', $params['view'])) {
// bypass minification
return;
}
if ($type == 'js') {
if (elgg_get_config('simplecache_minify_js')) {
return JSMin::minify($content);
}
} elseif ($type == 'css') {
if (elgg_get_config('simplecache_minify_css')) {
$cssmin = new CSSMin();
return $cssmin->run($content);
}
}
}
示例2: foreach
}
}
$data .= $style . "\n";
}
}
// Should only loop once, not with every file
if (is_array($bigtree["config"]["css"]["vars"])) {
foreach ($bigtree["config"]["css"]["vars"] as $key => $val) {
$data = str_replace('$' . $key, $val, $data);
}
}
// Replace roots
$data = str_replace(array('$www_root', 'www_root/', '$static_root', 'static_root/', '$admin_root/', 'admin_root/'), array(WWW_ROOT, WWW_ROOT, STATIC_ROOT, STATIC_ROOT, ADMIN_ROOT, ADMIN_ROOT), $data);
if ($bigtree["config"]["css"]["minify"]) {
$minifier = new CSSMin();
$data = $minifier->run($data);
}
BigTree::putFile($cfile, $data);
header("Content-type: text/css");
die($data);
} else {
// Added a line to .htaccess to hopefully give us IF_MODIFIED_SINCE when running as CGI
if (function_exists("apache_request_headers")) {
$headers = apache_request_headers();
$ims = $headers["If-Modified-Since"];
} else {
$ims = $_SERVER["HTTP_IF_MODIFIED_SINCE"];
}
if (!$ims || strtotime($ims) != $last_modified) {
header("Content-type: text/css");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT', true, 200);
示例3: go
/**
* Minify CSS
*
* @uses __construct()
* @uses min()
* @param string $js Javascript to be minified
* @return string
*/
public static function go($css)
{
$cssmin = new CSSMin();
return $cssmin->run($css);
}
示例4: header
if ($sapi_name == 'cgi' or $sapi_name == 'cgi-fcgi') {
header('Status: 304 Not Modified');
} else {
header('HTTP/1.1 304 Not Modified');
}
// remove the content-type and X-Powered headers to emulate a 304 Not Modified response as close as possible
header('Content-Type:');
header('X-Powered-By:');
exit;
}
$cssfiles = array();
$cssfiles = explode(",", $_REQUEST['file']);
$output = '';
if ($cssfiles) {
foreach ($cssfiles as $cssfile) {
if (file_exists("css/{$cssfile}")) {
$output .= file_get_contents("css/{$cssfile}") . "\r\n";
}
}
include 'CSSMin.php';
$CSSMin = new CSSMin();
$returntext = $CSSMin->run($output);
$output = $returntext;
}
header('Content-Type: text/css');
header('Cache-control: max-age=31536000, private');
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 31536000) . ' GMT');
header('Pragma:');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $style['dateline']) . ' GMT');
header('Content-Length: ' . strlen($output));
echo $output;