This allows per-source minification options and the mixing of files with content from other sources.
저자: Stephen Clay (steve@mrclay.org)
예제 #1
0
파일: Minify.php 프로젝트: mover5/imobackup
 /**
  * Make a unique cache id for for this request.
  * 
  * Any settings that could affect output are taken into consideration  
  *
  * @param string $prefix
  *
  * @return string
  */
 protected static function _getCacheId($prefix = 'minify')
 {
     $name = preg_replace('/[^a-zA-Z0-9\\.=_,]/', '', self::$_controller->selectionId);
     $name = preg_replace('/\\.+/', '.', $name);
     $name = substr($name, 0, 200 - 34 - strlen($prefix));
     $md5 = md5(serialize(array(Minify_Source::getDigest(self::$_controller->sources), self::$_options['minifiers'], self::$_options['minifierOptions'], self::$_options['postprocessor'], self::$_options['bubbleCssImports'], self::VERSION)));
     return "{$prefix}_{$name}_{$md5}";
 }
예제 #2
0
파일: Base.php 프로젝트: Kevin-ZK/vaneDisk
 /**
  * Analyze sources (if there are any) and set $options 'contentType' 
  * and 'lastModifiedTime' if they already aren't.
  * 
  * @param array $options options for Minify
  * 
  * @return array options for Minify
  */
 public final function analyzeSources($options = array())
 {
     if ($this->sources) {
         if (!isset($options['contentType'])) {
             $options['contentType'] = Minify_Source::getContentType($this->sources);
         }
         // last modified is needed for caching, even if setExpires is set
         if (!isset($options['lastModifiedTime'])) {
             $max = 0;
             foreach ($this->sources as $source) {
                 $max = max($source->lastModified, $max);
             }
             $options['lastModifiedTime'] = $max;
         }
     }
     return $options;
 }
예제 #3
0
 /**
  * Make a unique cache id for for this request.
  * 
  * Any settings that could affect output are taken into consideration  
  *
  * @return string
  */
 protected static function _getCacheId()
 {
     return md5(serialize(array(
         Minify_Source::getDigest(self::$_controller->sources)
         ,self::$_options['minifiers'] 
         ,self::$_options['minifierOptions']
         ,self::$_options['postprocessor']
         ,self::$_options['bubbleCssImports']
     )));
 }
예제 #4
0
 /**
  * @inheritdoc
  */
 public function __construct(array $spec, Minify_CacheInterface $cache)
 {
     parent::__construct($spec);
     $this->cache = $cache;
 }
예제 #5
0
 /**
  * Make a unique cache id for for this request.
  * 
  * Any settings that could affect output are taken into consideration  
  *
  * @param string $prefix
  *
  * @return string
  */
 protected static function _getCacheId($prefix = 'minify')
 {
     // BEGIN BWP Minify Customization
     if (!empty(self::$cacheId)) {
         return self::$cacheId;
     }
     // switch cache path and create new directory if needed, this is for
     // multisite compatible, this is reserved for future version
     if (!empty($blog_id) && 1 == 2) {
         global $min_cacheFileLocking, $min_cachePath;
         $blog_dir = str_pad($blog_id, 4, '0', STR_PAD_LEFT);
         $cache_dir = $min_cachePath . '/' . $blog_dir;
         // only switch to blog cache dir if it has been set, if not we
         // let Minify handle the cache dir
         if (!empty($min_cachePath)) {
             if (!file_exists($cache_dir)) {
                 mkdir($cache_dir, 0755);
             }
             self::setCache($cache_dir, $min_cacheFileLocking);
         }
     }
     // END BWP Minify Customization
     $name = preg_replace('/[^a-zA-Z0-9\\.=_,]/', '', self::$_controller->selectionId);
     $name = preg_replace('/\\.+/', '.', $name);
     $name = substr($name, 0, 100 - 34 - strlen($prefix));
     $md5 = md5(serialize(array(Minify_Source::getDigest(self::$_controller->sources), self::$_options['minifiers'], self::$_options['minifierOptions'], self::$_options['postprocessor'], self::$_options['bubbleCssImports'], self::VERSION)));
     return "{$prefix}_{$name}_{$md5}";
 }
예제 #6
0
 /**
  * Make a unique cache id for for this request.
  * 
  * Any settings that could affect output are taken into consideration  
  *
  * @return string
  */
 protected static function _getCacheId()
 {
     $requestURI = @$_SERVER['REQUEST_URI'];
     return md5(serialize(array(Minify_Source::getDigest(self::$_controller->sources), self::$_options['minifiers'], self::$_options['minifierOptions'], self::$_options['postprocessor'], self::$_options['bubbleCssImports'], $requestURI)));
 }
예제 #7
0
 /**
  * Make a unique cache id for for this request.
  * 
  * Any settings that could affect output are taken into consideration  
  *
  * @param string $prefix
  *
  * @return string
  */
 protected static function _getCacheId($prefix = 'minify')
 {
     $name = preg_replace('/[^a-zA-Z0-9\\.=_,]/', '', self::$_controller->selectionId);
     $name = preg_replace('/\\.+/', '.', $name);
     /******************** Hack by Simon *****************************
      * Reduced the length of the cache file name here, as on Windows systems, the full path to a file is
      * limited to 200-250ish characters (yeah, dumb!)
      * So just making it shorter here.  The md5 should still prevent conflicts (I'm hoping!)
      ****************************************************************/
     $name = substr($name, -140 + 34 + strlen($prefix));
     /****************************************************************/
     $md5 = md5(serialize(array(Minify_Source::getDigest(self::$_controller->sources), self::$_options['minifiers'], self::$_options['minifierOptions'], self::$_options['postprocessor'], self::$_options['bubbleCssImports'], self::VERSION)));
     return "{$prefix}_{$name}_{$md5}";
 }