当前位置: 首页>>代码示例>>PHP>>正文


PHP CSSMin::run方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:34,代码来源:views.php

示例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);
开发者ID:kalle0045,项目名称:BigTree-CMS,代码行数:31,代码来源:router.php

示例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);
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:13,代码来源:CSSmin.php

示例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;
开发者ID:trungjc,项目名称:collegeprospectnetwork,代码行数:31,代码来源:css.php


注:本文中的CSSMin::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。