Author: rande
Date: 2010-03-22 00:56:36 +0100 (Mon, 22 Mar 2010)
New Revision: 28657

Modified:
   plugins/swCombinePlugin/trunk/lib/combine/swCombineStylesheet.class.php
Log:
[swCombinePlugin] made the asset version optional

Modified: 
plugins/swCombinePlugin/trunk/lib/combine/swCombineStylesheet.class.php
===================================================================
--- plugins/swCombinePlugin/trunk/lib/combine/swCombineStylesheet.class.php     
2010-03-21 22:34:03 UTC (rev 28656)
+++ plugins/swCombinePlugin/trunk/lib/combine/swCombineStylesheet.class.php     
2010-03-21 23:56:36 UTC (rev 28657)
@@ -36,19 +36,24 @@
       throw new Exception('unable to read the asset : '.$asset);
     }
     
+    // remove BOM
     $contents = $this->removeBom($contents);
     
+    // import css from external declarations
     $contents = $this->fixImportStatement($path, $include);
     
-    // get the version, otherwise set to the current time
-    // so each time the cache is cleared then the image are reload from the 
webserver
-    $version = sfConfig::get('app_swCombine_asset_version', strtotime('now'));
+    // get the version so each time the cache is cleared then the image are 
reload 
+    // from the webserver
+    $params  = sfConfig::get('app_swToolbox_swCombine', array('version' => 
false));
+    $version = $params['version'];
+    if($version)
+    {
+      $pattern = '/url\(("|\'|)(.*)("|\'|)\)/smU';
+      $replacement = "url(\${2}?_sw=${version})";
+
+      $contents = preg_replace($pattern, $replacement, $contents, -1);
+    }
     
-    $pattern = '/url\(("|\'|)(.*)("|\'|)\)/smU';
-    $replacement = "url(\${2}?${version})";
-    
-    $contents = preg_replace($pattern, $replacement, $contents, -1);
-    
     // remove the '@CHARSET UTF-8'
     $charset_pattern = '/@charset ([^;]*);/i';
     $contents = preg_replace($charset_pattern, '', $contents);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to