From 25e77b331db122d008dfab5e1b98eec66a971ba4 Mon Sep 17 00:00:00 2001 From: Michael Lehmkuhl Date: Tue, 4 Nov 2014 22:56:35 -0600 Subject: [PATCH 1/4] Added support for parent::__construct() in Aoe_JsCssTstamp_Model_Package now that it exists in Magento CE 1.9.0.1 and EE 1.14.0.1 --- app/code/local/Aoe/JsCssTstamp/Model/Package.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/local/Aoe/JsCssTstamp/Model/Package.php b/app/code/local/Aoe/JsCssTstamp/Model/Package.php index 50fed86..e05b7fd 100644 --- a/app/code/local/Aoe/JsCssTstamp/Model/Package.php +++ b/app/code/local/Aoe/JsCssTstamp/Model/Package.php @@ -32,6 +32,10 @@ public function __construct() { $this->storageJs = Mage::getStoreConfig('dev/js/storage'); $this->addTstampToAssets = Mage::getStoreConfig('dev/css/addTstampToAssets'); + + if (is_callable('parent::__construct')) { + parent::__construct(); + } } /** From b8b8809c9593b08c97f9cecca0e568e5da7a2c7c Mon Sep 17 00:00:00 2001 From: Michael Lehmkuhl Date: Thu, 13 Nov 2014 16:43:27 -0600 Subject: [PATCH 2/4] Enforced a semicolon at the beginning of each JavaScript file to avoid browser complaints --- app/code/local/Aoe/JsCssTstamp/Model/Package.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/local/Aoe/JsCssTstamp/Model/Package.php b/app/code/local/Aoe/JsCssTstamp/Model/Package.php index e05b7fd..fa21de9 100644 --- a/app/code/local/Aoe/JsCssTstamp/Model/Package.php +++ b/app/code/local/Aoe/JsCssTstamp/Model/Package.php @@ -161,9 +161,14 @@ public function beforeMergeJs($file, $contents) { * @param string $contents * @return string */ - public function beforeMergeCss($file, $contents) { - $contents = "\n\n/* FILE: " . basename($file) . " */\n" . $contents; - return parent::beforeMergeCss($file, $contents); + public function beforeMergeJs($file, $contents) { + + // In some cases, browsers will choke if the component files don't end + // with a statement ending, so we'll force one here to be safe. + $contents = ";"; + + $contents .= "\n\n/* FILE: " . basename($file) . " */\n" . $contents; + return $contents; } /** From 8937a16788996d7476544359a1652d4e836fcfd5 Mon Sep 17 00:00:00 2001 From: Michael Lehmkuhl Date: Thu, 13 Nov 2014 16:59:58 -0600 Subject: [PATCH 3/4] Fixing the semicolon fix - long day here --- app/code/local/Aoe/JsCssTstamp/Model/Package.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/local/Aoe/JsCssTstamp/Model/Package.php b/app/code/local/Aoe/JsCssTstamp/Model/Package.php index fa21de9..4953aad 100644 --- a/app/code/local/Aoe/JsCssTstamp/Model/Package.php +++ b/app/code/local/Aoe/JsCssTstamp/Model/Package.php @@ -165,9 +165,7 @@ public function beforeMergeJs($file, $contents) { // In some cases, browsers will choke if the component files don't end // with a statement ending, so we'll force one here to be safe. - $contents = ";"; - - $contents .= "\n\n/* FILE: " . basename($file) . " */\n" . $contents; + $contents = ";\n\n/* FILE: " . basename($file) . " */\n" . $contents; return $contents; } From 6d0741b054064f424f093bb82bc300b303b30b1d Mon Sep 17 00:00:00 2001 From: Michael Lehmkuhl Date: Thu, 13 Nov 2014 17:14:07 -0600 Subject: [PATCH 4/4] Restored stomped beforeMergeCss() --- app/code/local/Aoe/JsCssTstamp/Model/Package.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/local/Aoe/JsCssTstamp/Model/Package.php b/app/code/local/Aoe/JsCssTstamp/Model/Package.php index 4953aad..7ad9746 100644 --- a/app/code/local/Aoe/JsCssTstamp/Model/Package.php +++ b/app/code/local/Aoe/JsCssTstamp/Model/Package.php @@ -150,7 +150,10 @@ public function getMergedJsUrl($files) { * @return string */ public function beforeMergeJs($file, $contents) { - $contents = "\n\n/* FILE: " . basename($file) . " */\n" . $contents; + + // In some cases, browsers will choke if the component files don't end + // with a statement ending, so we'll force one here to be safe. + $contents = ";\n\n/* FILE: " . basename($file) . " */\n" . $contents; return $contents; } @@ -161,12 +164,9 @@ public function beforeMergeJs($file, $contents) { * @param string $contents * @return string */ - public function beforeMergeJs($file, $contents) { - - // In some cases, browsers will choke if the component files don't end - // with a statement ending, so we'll force one here to be safe. - $contents = ";\n\n/* FILE: " . basename($file) . " */\n" . $contents; - return $contents; + public function beforeMergeCss($file, $contents) { + $contents = "\n\n/* FILE: " . basename($file) . " */\n" . $contents; + return parent::beforeMergeCss($file, $contents); } /**