From 5471779099fea1c259c49e89ae8308de4a8138e9 Mon Sep 17 00:00:00 2001 From: Tymoteusz Motylewski Date: Fri, 20 Sep 2013 18:40:25 +0200 Subject: [PATCH] [FEATURE] Append timestamp to not merged css and js Now js and css files will have timestamp appended even if they are not bundled into one file. This change also adds timestamp to files included directly in the template e.g. --- .../local/Aoe/JsCssTstamp/Model/Package.php | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/app/code/local/Aoe/JsCssTstamp/Model/Package.php b/app/code/local/Aoe/JsCssTstamp/Model/Package.php index ae20e2c..d0b3076 100755 --- a/app/code/local/Aoe/JsCssTstamp/Model/Package.php +++ b/app/code/local/Aoe/JsCssTstamp/Model/Package.php @@ -307,7 +307,6 @@ protected function _prepareUrl($uri) } if ($this->addTstampToAssets) { - Mage::log('Aoe_JsCssTsamp: ' . $uri); $matches = array(); if (preg_match('/(.*)\.(gif|png|jpg)$/i', $uri, $matches)) { $uri = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2]; @@ -316,4 +315,40 @@ protected function _prepareUrl($uri) return $uri; } + + /** + * Get skin file url + * + * @param string $file + * @param array $params + * @return string + */ + public function getSkinUrl($file = null, array $params = array()) + { + Varien_Profiler::start(__METHOD__); + if (empty($params['_type'])) { + $params['_type'] = 'skin'; + } + if (empty($params['_default'])) { + $params['_default'] = false; + } + $this->updateParamDefaults($params); + if (!empty($file)) { + $result = $this->_fallback($file, $params, array( + array(), + array('_theme' => $this->getFallbackTheme()), + array('_theme' => self::DEFAULT_THEME), + )); + } + $result = $this->getSkinBaseUrl($params) . (empty($file) ? '' : $file); + Varien_Profiler::stop(__METHOD__); + + if ($this->addTstampToAssets) { + $matches = array(); + if (preg_match('/(.*)\.(css|js)$/i', $result, $matches)) { + $result = $matches[1] . '.' . $this->getVersionKey() . '.' . $matches[2]; + } + } + return $result; + } }