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


PHP Minify_Controller_Base::loadMinifier方法代码示例

本文整理汇总了PHP中Minify_Controller_Base::loadMinifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Minify_Controller_Base::loadMinifier方法的具体用法?PHP Minify_Controller_Base::loadMinifier怎么用?PHP Minify_Controller_Base::loadMinifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Minify_Controller_Base的用法示例。


在下文中一共展示了Minify_Controller_Base::loadMinifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadMinifier

 /**
  * @see Minify_Controller_Base::loadMinifier()
  */
 public function loadMinifier($minifierCallback)
 {
     if ($this->_loadCssJsMinifiers) {
         // Minify will not call for these so we must manually load
         // them when Minify/HTML.php is called for.
     }
     parent::loadMinifier($minifierCallback);
     // load Minify/HTML.php
 }
开发者ID:oyatel,项目名称:minify,代码行数:12,代码来源:Page.php

示例2: loadMinifier

 /**
  * @see Minify_Controller_Base::loadMinifier()
  */
 public function loadMinifier($minifierCallback)
 {
     if ($this->_loadCssJsMinifiers) {
         // Minify will not call for these so we must manually load
         // them when Minify/HTML.php is called for.
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS.php';
         require_once W3TC_LIB_MINIFY_DIR . '/JSMin.php';
     }
     parent::loadMinifier($minifierCallback);
     // load Minify/HTML.php
 }
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:14,代码来源:Page.php

示例3: _combineMinify

 /**
  * Combines sources and minifies the result.
  *
  * @return string
  */
 protected static function _combineMinify()
 {
     $type = self::$_options['contentType'];
     // ease readability
     // when combining scripts, make sure all statements separated and
     // trailing single line comment is terminated
     $implodeSeparator = $type === self::TYPE_JS ? "\n;" : '';
     // allow the user to pass a particular array of options to each
     // minifier (designated by type). source objects may still override
     // these
     $defaultOptions = isset(self::$_options['minifierOptions'][$type]) ? self::$_options['minifierOptions'][$type] : array();
     // if minifier not set, default is no minification. source objects
     // may still override this
     $defaultMinifier = isset(self::$_options['minifiers'][$type]) ? self::$_options['minifiers'][$type] : false;
     // process groups of sources with identical minifiers/options
     $content = array();
     $i = 0;
     $l = count(self::$_controller->sources);
     $groupToProcessTogether = array();
     $lastMinifier = null;
     $lastOptions = null;
     do {
         // get next source
         $source = null;
         if ($i < $l) {
             $source = self::$_controller->sources[$i];
             /* @var Minify_Source $source */
             $sourceContent = $source->getContent();
             // allow the source to override our minifier and options
             $minifier = null !== $source->minifier ? $source->minifier : $defaultMinifier;
             $options = null !== $source->minifyOptions ? array_merge($defaultOptions, $source->minifyOptions) : $defaultOptions;
         }
         // do we need to process our group right now?
         if ($i > 0 && (!$source || $type === self::TYPE_CSS || $minifier !== $lastMinifier || $options !== $lastOptions)) {
             // minify previous sources with last settings
             $imploded = implode($implodeSeparator, $groupToProcessTogether);
             $groupToProcessTogether = array();
             if ($lastMinifier) {
                 self::$_controller->loadMinifier($lastMinifier);
                 try {
                     $content[] = call_user_func($lastMinifier, $imploded, $lastOptions);
                 } catch (Exception $e) {
                     throw new Exception("Exception in minifier: " . $e->getMessage());
                 }
             } else {
                 $content[] = $imploded;
             }
         }
         // add content to the group
         if ($source) {
             $groupToProcessTogether[] = $sourceContent;
             $lastMinifier = $minifier;
             $lastOptions = $options;
         }
         $i++;
     } while ($source);
     $content = implode($implodeSeparator, $content);
     if ($type === self::TYPE_CSS && false !== strpos($content, '@import')) {
         $content = self::_handleCssImports($content);
     }
     // do any post-processing (esp. for editing build URIs)
     if (self::$_options['postprocessorRequire']) {
         require_once self::$_options['postprocessorRequire'];
     }
     if (self::$_options['postprocessor']) {
         $content = call_user_func(self::$_options['postprocessor'], $content, $type);
     }
     return $content;
 }
开发者ID:mover5,项目名称:imobackup,代码行数:74,代码来源:Minify.php


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