Changeset 19843
- Timestamp:
- 07/03/09 14:45:44 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/jeMinifyJsCssPlugin/config/app.yml
r19787 r19843 1 1 #dev: 2 # sf_combine_filter_plugin:2 # je_minify_js_css_plugin: 3 3 # enabled: false 4 4 5 5 6 6 all: # these are the defaults, you should override them in your application/config/app.yml file 7 sf_combine_filter_plugin:7 je_minify_js_css_plugin: 8 8 #css_filtered_paths: [%SF_ROOT_DIR%, plugins/, web/] # you want to end your paths (comma seperated) with a / 9 9 css_filtered_paths: [%SF_ROOT_DIR%/config/themes, %SF_ROOT_DIR%/web, ["=%SF_ROOT_DIR%/plugins/(\w+)/web/(.*)=", "$1/$2" ]] # you want to end your paths (comma seperated) with a / … … 12 12 13 13 #defaults 14 javascripts: true14 javascripts: false 15 15 stylesheets: true 16 16 minimize_js: true 17 minimize_css: true17 minimize_css: false 18 18 enabled: true 19 19 #root_js_only: false plugins/jeMinifyJsCssPlugin/lib/jeMinifyJsCssFilter.class.php
r19787 r19843 32 32 $filterChain->execute(); 33 33 34 if(sfConfig::get('app_sf_combine_filter_plugin_enabled')) { 35 ezDbg::err('ALALA'); 34 if(sfConfig::get('app_je_minify_js_css_plugin_enabled')) { 36 35 sfContext::getInstance()->getConfiguration()->loadHelpers('Asset'); 37 $this->response = $this->getContext()->getResponse();38 $this->request = $this->getContext()->getRequest();36 $this->response = $this->getContext()->getResponse(); 37 $this->request = $this->getContext()->getRequest(); 39 38 $this->sf_relative_url_root = $this->request->getRelativeUrlRoot(). $this->request->getScriptName(); 40 39 … … 42 41 { 43 42 44 if (sfConfig::get('app_ sf_combine_filter_plugin_javascripts',true))43 if (sfConfig::get('app_je_minify_js_css_plugin_javascripts',true)) 45 44 { 46 45 $this->type = 'javascript'; … … 50 49 } 51 50 52 if (sfConfig::get('app_ sf_combine_filter_plugin_stylesheets',true))51 if (sfConfig::get('app_je_minify_js_css_plugin_stylesheets',true)) 53 52 { 54 53 $this->type = 'css'; … … 63 62 protected function getCombinedJavascripts() 64 63 { 65 $root_js_only = sfConfig::get('app_ sf_combine_filter_plugin_root_js_only', false);64 $root_js_only = sfConfig::get('app_je_minify_js_css_plugin_root_js_only', false); 66 65 67 66 $already_seen = array(); … … 91 90 92 91 // do not include, when in exclude array 93 foreach (sfConfig::get('app_ sf_combine_filter_plugin_js_exclude_files', array()) as $exclude)92 foreach (sfConfig::get('app_je_minify_js_css_plugin_js_exclude_files', array()) as $exclude) 94 93 { 95 94 if (strpos($path, $exclude)!==false) continue 2; … … 123 122 protected function cacheFile($cacheFileName, $file_extension) 124 123 { 125 ezDbg::err('super cachefile='.$cacheFileName); 126 127 $cache_fname = sfConfig::get('sf_cache_dir'). "/" . self::PACK_CACHE_FOLDER . "/" . $cacheFileName . "." . $file_extension; 128 129 if(false){ 130 //get an instance of the file cache object. We grab the web root then get the name of the cache folder 131 //we don't want to use sf_cache_dir because that is application and environment specific 132 //we don't want to a path relative to sf_web_dir because the sf_root_dir can be changed, better to start from there 133 $cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_cache_dir'). "/" . self::PACK_CACHE_FOLDER)); 134 135 //cached files are in the 'packed_files' name space 136 137 //Next we see if we can pull the file from the cache. 138 if($cache->has($cacheFileName)) 139 { 140 //Ok! We have a cached copy of the file! 141 return true; 142 } 143 }else{ 124 $cache_dname = sfConfig::get('sf_cache_dir')."/".self::PACK_CACHE_FOLDER; 125 // create $cache_dname if needed 126 if( !is_dir($cache_dname) ) mkdir($cache_dname, 0777); 127 128 // determine the filename of the cache file 129 $cache_fname = $cache_dname."/".$cacheFileName.".".$file_extension; 130 131 // if the file already exists, return now 144 132 if(file_exists($cache_fname)) return true; 145 }146 133 147 134 { … … 154 141 $con = "\n\n".'/* include css file: '.$path." */\n\n"; 155 142 $cssPath = $path; 156 $filtered_paths = sfConfig::get('app_ sf_combine_filter_plugin_css_filtered_paths');143 $filtered_paths = sfConfig::get('app_je_minify_js_css_plugin_css_filtered_paths'); 157 144 foreach($filtered_paths as $filtered_path){ 158 145 if( is_string($filtered_path) ){ … … 162 149 } 163 150 } 164 ezDbg::err('css REPLACE:', $path, $cssPath);151 ezDbg::err('cssE REPLACE:', $path, $cssPath); 165 152 $con .= $this->fixCssPaths(file_get_contents($path), $cssPath); 153 ezDbg::err($this->fixCssPaths(file_get_contents($path), $cssPath)); 166 154 } 167 155 else … … 175 163 } 176 164 177 if ($this->type=='javascript'&& sfConfig::get('app_ sf_combine_filter_plugin_minimize_js', false))165 if ($this->type=='javascript'&& sfConfig::get('app_je_minify_js_css_plugin_minimize_js', false)) 178 166 { 179 167 if(false){ … … 202 190 } 203 191 } 204 elseif($this->type=='css'&& sfConfig::get('app_ sf_combine_filter_plugin_minimize_css', true))192 elseif($this->type=='css'&& sfConfig::get('app_je_minify_js_css_plugin_minimize_css', true)) 205 193 { 206 194 if(true){ … … 218 206 } 219 207 220 //Write the file data to the cache 221 if(false){ 222 $cache->set($cacheFileName, $contents); 223 }else{ 208 //Write the file data to the cache 224 209 $written_len = file_put_contents($cache_fname, $contents); 225 210 if( $written_len != strlen($contents) ) return false; 226 } 211 227 212 return true; 228 213 } … … 314 299 protected function getCombinedStylesheets() 315 300 { 316 $root_css_only = sfConfig::get('app_ sf_combine_filter_plugin_root_css_only', false);301 $root_css_only = sfConfig::get('app_je_minify_js_css_plugin_root_css_only', false); 317 302 $already_seen = array(); 318 303 $combined_sources = array();

