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


PHP Minify_CSS_Compressor::process方法代码示例

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


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

示例1: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  *
  * 'removeCharsets': (default true) remove all @charset at-rules
  * 
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  *
  * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
  * see Minify_CSS_UriRewriter::rewrite
  * 
  * @return string
  */
 public static function minify($css, $options = array())
 {
     $options = array_merge(array('compress' => true, 'removeCharsets' => true, 'preserveComments' => true, 'currentDir' => null, 'docRoot' => $_SERVER['DOCUMENT_ROOT'], 'prependRelativePath' => null, 'symlinks' => array()), $options);
     if ($options['removeCharsets']) {
         $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
     }
     if ($options['compress']) {
         if (!$options['preserveComments']) {
             require_once 'Compressor.php';
             $css = Minify_CSS_Compressor::process($css, $options);
         } else {
             require_once 'CommentPreserver.php';
             require_once 'Compressor.php';
             $css = Minify_CommentPreserver::process($css, array('Minify_CSS_Compressor', 'process'), array($options));
         }
     }
     if (!$options['currentDir'] && !$options['prependRelativePath']) {
         return $css;
     }
     require_once 'UriRewriter.php';
     if ($options['currentDir']) {
         return Minify_CSS_UriRewriter::rewrite($css, $options['currentDir'], $options['docRoot'], $options['symlinks']);
     } else {
         return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']);
     }
 }
开发者ID:rswiders,项目名称:core,代码行数:63,代码来源:CSS.php

示例2: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  * 
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  * 
  * @return string
  */
 static public function minify($css, $options = array()) 
 {
     require_once 'Minify/CSS/Compressor.php';
     if (isset($options['preserveComments']) 
         && !$options['preserveComments']) {
         $css = Minify_CSS_Compressor::process($css, $options);
     } else {
         require_once 'Minify/CommentPreserver.php';
         $css = Minify_CommentPreserver::process(
             $css
             ,array('Minify_CSS_Compressor', 'process')
             ,array($options)
         );
     }
     if (! isset($options['currentDir']) && ! isset($options['prependRelativePath'])) {
         return $css;
     }
     require_once 'Minify/CSS/UriRewriter.php';
     if (isset($options['currentDir'])) {
         return Minify_CSS_UriRewriter::rewrite(
             $css
             ,$options['currentDir']
             ,isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT']
             ,isset($options['symlinks']) ? $options['symlinks'] : array()
         );  
     } else {
         return Minify_CSS_UriRewriter::prepend(
             $css
             ,$options['prependRelativePath']
         );
     }
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:64,代码来源:CSS.php

示例3: doProcessFile

 public function doProcessFile($file, $replace = false)
 {
     $optimizedContent = Minify_CSS_Compressor::process(file_get_contents($file));
     if ($replace) {
         return parent::replaceFile($file, $optimizedContent);
     } else {
         return $optimizedContent;
     }
 }
开发者ID:rande,项目名称:swCombinePlugin,代码行数:9,代码来源:swDriverMinifyCssCompressor.class.php

示例4: buildApiCss

 private function buildApiCss()
 {
     // copy file
     $this->getFilesystem()->copy(sfConfig::get('sf_web_dir') . '/css/api_sources/button.css', sfConfig::get('sf_web_dir') . '/css/v1/button.css', array('override' => true));
     // replace wildcards
     $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir') . '/css/v1/button.css', '##', '##', array('YIID_WIDGET_HOST' => sfConfig::get('app_settings_widgets_host'), 'YIID_BUTTON_HOST' => sfConfig::get('app_settings_button_url')));
     $lCssMin = Minify_CSS_Compressor::process(file_get_contents(sfConfig::get('sf_web_dir') . '/css/v1/button.css'));
     $lCssMinFile = fopen(sfConfig::get('sf_web_dir') . '/css/v1/button.css', 'w+');
     $lDone = fwrite($lCssMinFile, $lCssMin);
     fclose($lCssMinFile);
 }
开发者ID:42medien,项目名称:spreadly,代码行数:11,代码来源:BuildCssTask.class.php

示例5: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  *
  * 'removeCharsets': (default true) remove all @charset at-rules
  * 
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  *
  * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
  * see Minify_CSS_UriRewriter::rewrite
  * 
  * @return string
  */
 public static function minify($css, $options = array())
 {
     $options = array_merge(array('removeCharsets' => true, 'preserveComments' => true), $options);
     if ($options['removeCharsets']) {
         $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
     }
     if (!$options['preserveComments']) {
         $css = Minify_CSS_Compressor::process($css, $options);
     } else {
         $css = Minify_CommentPreserver::process($css, array('Minify_CSS_Compressor', 'process'), array($options));
     }
     return $css;
 }
开发者ID:jarridb,项目名称:Compressor,代码行数:50,代码来源:CSS.php

示例6: minify

 /**
  * Minify a CSS string
  *
  * @param string $css
  *
  * @param array $options available options:
  *
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  *
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  *
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because
  * paths need to be normalized for this to work, use "//" to substitute
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  *
  * @return string
  */
 public static function minify($css, $options = array())
 {
     require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/Compressor.php';
     if (isset($options['preserveComments']) && $options['preserveComments']) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CommentPreserver.php';
         $css = Minify_CommentPreserver::process($css, array('Minify_CSS_Compressor', 'process'), array($options));
     } else {
         $css = Minify_CSS_Compressor::process($css, $options);
     }
     require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
     $css = Minify_CSS_UriRewriter::rewrite($css, $options);
     return $css;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:45,代码来源:CSS.php

示例7: min

 public function min()
 {
     $this->_options = array_merge(array('remove_charsets' => true, 'preserve_comments' => true, 'current_dir' => null, 'doc_root' => $_SERVER['DOCUMENT_ROOT'], 'prepend_relative_path' => null, 'symlinks' => array()), $this->_options);
     if ($this->_options['remove_charsets']) {
         $this->_css = preg_replace('/@charset[^;]+;\\s*/', '', $this->_css);
     }
     if (!$this->_options['preserve_comments']) {
         $this->_css = Minify_CSS_Compressor::process($this->_css, $this->_options);
     } else {
         $this->_css = Minify_CSS_Comment_Preserver::process($this->_css, array('Minify_CSS_Compressor', 'process'), array($this->_options));
     }
     if (!$this->_options['current_dir'] && !$this->_options['prepend_relative_path']) {
         return $this->_css;
     }
     if ($this->_options['current_dir']) {
         return Minify_CSS_Uri_Rewriter::rewrite($this->_css, $this->_options['current_dir'], $this->_options['doc_root'], $this->_options['symlinks']);
     } else {
         return Minify_CSS_Uri_Rewriter::prepend($this->_css, $this->_options['prepend_relative_path']);
     }
 }
开发者ID:nguyennv,项目名称:kohana-minify,代码行数:20,代码来源:css.php

示例8: execute

 /**
  * Execute preprocessor
  *
  * This will take all CSS files from the source dir, minify each one and 
  * then combine them into one file.
  *
  * @param array $options Options for execution
  * @return void
  */
 public function execute($options = array())
 {
     $cssFiles = FileOps::rglob("*.css", 0, $this->getSourceDir());
     if (empty($cssFiles)) {
         return false;
     }
     FileOps::ensurePathExists($this->getDestinationDir());
     // Just get the basename of the main style sheet, this will be written
     // to the destination dir
     $mainStylesheet = basename($options['main_stylesheet']);
     $mainStylesheet = $this->getDestinationDir() . DIRECTORY_SEPARATOR . $mainStylesheet;
     $buffer = array();
     foreach ($cssFiles as $file) {
         $content = file_get_contents($file);
         $newContent = \Minify_CSS_Compressor::process($content);
         $buffer[] = $newContent;
     }
     if ($buffer) {
         file_put_contents($mainStylesheet, implode("\n", $buffer));
     }
 }
开发者ID:sumpygump,项目名称:holograph,代码行数:30,代码来源:Minify.php

示例9: doExecute

 /**
  * doExecute
  *
  * @return  int
  */
 protected function doExecute()
 {
     $path = $this->getArgument(0);
     $package = $this->getOption('p');
     $folder = $this->console->get('asset.folder', 'asset');
     if ($package = PackageHelper::getPackage($package)) {
         $path = $package->getDir() . '/Resources/asset/' . $path;
     } else {
         $path = WINDWALKER_PUBLIC . '/' . trim($folder, '/') . '/' . $path;
     }
     if (is_file($path)) {
         $files = array(new \SplFileInfo($path));
     } elseif (is_dir($path)) {
         $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::FOLLOW_SYMLINKS));
     } else {
         throw new \InvalidArgumentException('No path');
     }
     /** @var \SplFileInfo $file */
     foreach ($files as $file) {
         $ext = File::getExtension($file->getPathname());
         if (StringHelper::endsWith($file->getBasename(), '.min.' . $ext)) {
             continue;
         }
         if ($ext == 'css') {
             $this->out('[<comment>Compressing</comment>] ' . $file);
             $data = \Minify_CSS_Compressor::process(file_get_contents($file));
             $data = str_replace("\n", ' ', $data);
         } elseif ($ext == 'js') {
             $this->out('[<comment>Compressing</comment>] ' . $file);
             $data = \JSMinPlus::minify(file_get_contents($file));
             $data = str_replace("\n", ';', $data);
         } else {
             continue;
         }
         $newName = $file->getPath() . '/' . File::stripExtension($file->getBasename()) . '.min.' . $ext;
         file_put_contents($newName, $data);
         $this->out('[<info>Compressed</info>] ' . $newName);
     }
 }
开发者ID:ventoviro,项目名称:phoenix,代码行数:44,代码来源:MinifyCommand.php

示例10: minify

 /**
  * @see sfCombineMinifierInterface
  */
 public static function minify($content, array $options = array())
 {
     return Minify_CSS_Compressor::process($content, $options);
 }
开发者ID:limitium,项目名称:uberlov,代码行数:7,代码来源:sfCombineMinifierMinifyCss.class.php

示例11: optimizecss


//.........这里部分代码省略.........
					}

					$stylesheets = array($url => $stylesheet); // empty - begin a new group
					$selcounts = $selcount;
				} else {

					$stylesheets[$url] = $stylesheet;
					$selcounts += $selcount;
				}

			} else {
				// first get all the stylsheets up to this point, and get them into
				// the items array
				if(count($stylesheets)){
					$cssgroup = array();
					$groupname = array();
					foreach ( $stylesheets as $gurl => $gsheet ) {
						$cssgroup[$gurl] = $gsheet;
						$groupname[] = $gurl;
					}

					$cssgroup['groupname'] = implode('', $groupname);
					$cssgroups[] = $cssgroup;
				}

				//mark ignore current stylesheet
				$cssgroup = array($url => $stylesheet, 'ignore' => true);
				$cssgroups[] = $cssgroup;

				$stylesheets = array(); // empty - begin a new group
			}
		}
		
		if(count($stylesheets)){
			$cssgroup = array();
			$groupname = array();
			foreach ( $stylesheets as $gurl => $gsheet ) {
				$cssgroup[$gurl] = $gsheet;
				$groupname[] = $gurl;
			}

			$cssgroup['groupname'] = implode('', $groupname);
			$cssgroups[] = $cssgroup;
		}
		
		//======================= Group css ================= //

		$output = array();
		foreach ($cssgroups as $cssgroup) {
			if(isset($cssgroup['ignore'])){
				
				unset($cssgroup['ignore']);
				foreach ($cssgroup as $furl => $fsheet) {
					$output[$furl] = $fsheet;
				}

			} else {

				$groupname = 'css-' . substr(md5($cssgroup['groupname']), 0, 5) . '.css';
				$groupfile = $outputpath . '/' . $groupname;
				$grouptime = JFile::exists($groupfile) ? @filemtime($groupfile) : -1;
				$rebuild = $grouptime < 0; //filemtime == -1 => rebuild

				unset($cssgroup['groupname']);
				foreach ($cssgroup as $furl => $fsheet) {
					if(!$rebuild && @filemtime($fsheet['path']) > $grouptime){
						$rebuild = true;
					}
				}

				if($rebuild){

					$cssdata = array();
					foreach ($cssgroup as $furl => $fsheet) {
						$cssdata[] = "\n\n/*===============================";
						$cssdata[] = $furl;
						$cssdata[] = "================================================================================*/";
						
						$cssmin = Minify_CSS_Compressor::process($fsheet['data']);
						$cssmin = T3Path::updateUrl($cssmin, T3Path::relativePath($outputurl, dirname($furl)));

						$cssdata[] = $cssmin;
					}

					$cssdata = implode("\n", $cssdata);
					JFile::write($groupfile, $cssdata);
					@chmod($groupfile, 0644);
				}

				$output[$outputurl . '/' . $groupname] = array(
					'mime' => 'text/css',
					'media' => null,
					'attribs' => array()
					);
			}
		}

		//apply the change make change
		$doc->_styleSheets = $output;
	}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:101,代码来源:minify.php

示例12: foreach

        require_once 'includes/class.JavaScriptPacker.php';
        foreach ($strFiles as $key => $script) {
            if (!strpos($key, 'uncompressed')) {
                $packer = new JavaScriptPacker($script, $encoding, $fast_decode, $special_char);
                $strFiles[$key] = $packer->pack();
            }
        }
        break;
}
//compress CSS files...
require_once 'includes/minify_css.php';
$cssFiles = array();
foreach ($cssSrc as $key => $src) {
    $cssFiles[$key] = array();
    $cssFiles[$key]['uncompressed'] = $src;
    $cssFiles[$key]['compressed'] = Minify_CSS_Compressor::process($src);
}
$licenseFile['jxlib'] = removeBOM(file_get_contents('src' . DS . 'jxlib' . DS . 'Source' . DS . 'license.js'));
$licenseFile['core'] = '/*' . removeBOM(file_get_contents('src' . DS . 'core' . DS . 'Source' . DS . 'license.txt')) . '*/';
//add license file(s)
foreach ($strFiles as $key => $value) {
    if (strpos($key, 'jxlib')) {
        $strFiles[$key] = $licenseFile['jxlib'] . "\n" . $value;
    } else {
        $strFiles[$key] = $licenseFile['core'] . "\n" . $value;
    }
}
function guid()
{
    $g = '';
    if (function_exists('com_create_guid')) {
开发者ID:JxLib,项目名称:JxLib,代码行数:31,代码来源:builder.php

示例13: sp_combine_plugin_css_files


//.........这里部分代码省略.........
    $css_files_modify = array();
    $css_files = array();
    if (is_array($sp_plugin_styles->queue)) {
        # is there anything in the queue?
        $sp_plugin_styles->all_deps($sp_plugin_styles->queue);
        # preparing the queue taking dependencies into account
        foreach ($css_concat as $css => $value) {
            # going through all the already found css files, checking that they are still required
            if (!in_array(substr($css, 4), $sp_plugin_styles->to_do) && substr($css, 0, 4) == 'css-') {
                # if the css is not queued, rewrite the file
                $css_media = $value['type'];
                $css_files_modify[$css_media] = true;
                unset($css_concat[$css]);
            }
        }
        foreach ($sp_plugin_styles->to_do as $css) {
            $css_src = $sp_plugin_styles->registered[$css]->src;
            $css_media = $sp_plugin_styles->registered[$css]->args;
            # is the css is hosted localy AND is a css file?
            if ((!(strpos($css_src, get_bloginfo('url')) === false) || substr($css_src, 0, 1) === '/' || substr($css_src, 0, 1) === '.') && (substr($css_src, strrpos($css_src, '.'), 4) == '.css' || substr($css_src, strrpos($css_src, '.'), 4) == '.php')) {
                if (!is_array($css_files) || !array_key_exists($css_media, $css_files)) {
                    $css_files[$css_media] = array();
                }
                if (strpos($css_src, get_bloginfo('url')) === false) {
                    $css_relative_url = substr($css_src, 1);
                } else {
                    $css_relative_url = substr($css_src, strlen(get_bloginfo('url')) + 1);
                }
                if (strpos($css_relative_url, '?')) {
                    $css_relative_url = substr($css_relative_url, 0, strpos($css_relative_url, '?'));
                }
                # removing parameters
                $css_m_time = null;
                @($css_m_time = filemtime($css_relative_url));
                # getting the mofified time of the css file. extracting the file's dir
                if ($css_m_time) {
                    # only add the file if it's accessible
                    # check for php theme file indicating main theme file and save whole url vs just relative
                    if (substr($css_src, strrpos($css_src, '.'), 4) == '.php') {
                        array_push($css_files[$css_media], $css_src);
                    } else {
                        array_push($css_files[$css_media], $css_relative_url);
                    }
                    if (!file_exists(SP_COMBINED_CACHE_DIR . SP_COMBINED_CSS_BASE_NAME . $css_media . '.css') || isset($css_concat['css-' . $css]) && ($css_m_time != $css_concat['css-' . $css]['modified'] || $css_concat['css-' . $css]['type'] != $css_media) || !isset($css_concat['css-' . $css])) {
                        # css file is first identified
                        $css_files_modify[$css_media] = true;
                        # the combined file containing this media type css should be changed
                        if (isset($css_concat['css-' . $css]) && $css_concat['css-' . $css]['type'] != $css_media) {
                            # if the media type changed - rewrite both css files
                            $tmp = $css_concat['css-' . $css]['type'];
                            $css_files_modify[$tmp] = true;
                        }
                        if (!is_array($css_concat['css-' . $css])) {
                            $css_concat['css-' . $css] = array();
                        }
                        $css_concat['css-' . $css]['modified'] = $css_m_time;
                        # write the new modified date
                        $css_concat['css-' . $css]['type'] = $css_media;
                    }
                    $sp_plugin_styles->remove($css);
                    # removes the css file from the queue
                }
            }
        }
    }
    foreach ($css_files_modify as $key => $value) {
        $combined_file = fopen(SP_COMBINED_CACHE_DIR . SP_COMBINED_CSS_BASE_NAME . $key . '.css', 'w');
        if ($combined_file) {
            $css_content = '';
            if (is_array($css_files[$key])) {
                foreach ($css_files[$key] as $css_src) {
                    $css_content .= "\n" . sp_get_css_content($css_src) . "\n";
                }
            }
            if (!isset($css_concat['ver'][$key])) {
                $css_concat['ver'][$key] = 0;
            }
            $css_concat['ver'][$key]++;
            # compress the css before writing it out
            require 'sp-api-class-css-compressor.php';
            $css_content = Minify_CSS_Compressor::process($css_content);
            fwrite($combined_file, $css_content);
            fclose($combined_file);
        } else {
            # couldnt open file for writing so revert back to enqueueing all the styles
            if (!empty($saved_styles)) {
                foreach ($saved_styles->queue as $handle) {
                    wp_enqueue_style($handle, $saved_styles->registered[$handle]->src);
                }
            }
            return;
            # enqueued through wp now so bail
        }
    }
    foreach ($css_files as $key => $value) {
        # enqueue the combined css files
        wp_enqueue_style(SP_COMBINED_CSS_BASE_NAME . $key, SP_COMBINED_CACHE_URL . SP_COMBINED_CSS_BASE_NAME . $key . '.css', array(), $css_concat['ver'][$key]);
    }
    sp_update_option($option, $css_concat);
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:101,代码来源:sp-api-plugins.php

示例14: minifyFile

 /**
  * Minify the given $content according to the file type indicated in $filename
  *
  * @param string $filename
  * @param string $content
  * @return string
  */
 protected function minifyFile($filename, $content)
 {
     // if we have a javascript file and jsmin is enabled, minify the content
     $isJS = stripos($filename, '.js');
     require_once 'thirdparty/jsmin/jsmin.php';
     require_once BASE_PATH . '/minify/code/thirdparty/Compressor.php';
     require_once BASE_PATH . '/minify/code/thirdparty/UriRewriter.php';
     increase_time_limit_to();
     if ($isJS) {
         $content = JSMin::minify($content) . ";\n";
     } else {
         $content = Minify_CSS_UriRewriter::rewrite($content, Director::baseFolder() . "/" . dirname($filename), Director::baseFolder());
         $content = Minify_CSS_Compressor::process($content) . "\n";
     }
     return $content;
 }
开发者ID:andrelohmann,项目名称:silverstripe-minify,代码行数:23,代码来源:Minify_Requirements_Backend.php

示例15: minify

 /**
  * Minify text
  *
  * @access	public
  * @param	string		Text to minify
  * @param	string		Type to minify (css/html). Default is css
  * @return	string		Minified text
  */
 public function minify($text, $type = 'css')
 {
     $type = strtolower($type);
     /* What to do? */
     if ($type == 'css') {
         require_once IPS_PUBLIC_PATH . 'min/lib/Minify/CSS/Compressor.php';
         /*noLibHook*/
         $text = Minify_CSS_Compressor::process($text);
     } else {
         if ($type == 'html') {
             require_once IPS_PUBLIC_PATH . 'min/lib/Minify/HTML.php';
             /*noLibHook*/
             $text = Minify_HTML::minify($text, array('xhtml' => 1));
         }
     }
     return $text;
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:25,代码来源:skinFunctions.php


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