Version Notes
Fresh uploaded
Download this release
Release Info
| Developer | Commerce Pundit |
| Extension | CP_Mergecss |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
app/code/community/CP/Margecss/Block/Page/Html/Head.php
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Commerce Pundit Technologies
|
| 16 |
+
* @package CP_Margecss
|
| 17 |
+
* @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
|
| 18 |
+
* @author <<Manan Ladola>>
|
| 19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
class CP_Margecss_Block_Page_Html_Head extends Mage_Page_Block_Html_Head
|
| 23 |
+
{
|
| 24 |
+
public function getCssJsHtml()
|
| 25 |
+
{
|
| 26 |
+
// separate items by types
|
| 27 |
+
$lines = array();
|
| 28 |
+
foreach ($this->_data['items'] as $item) {
|
| 29 |
+
if (!is_null($item['cond']) && !$this->getData($item['cond']) || !isset($item['name'])) {
|
| 30 |
+
continue;
|
| 31 |
+
}
|
| 32 |
+
$if = !empty($item['if']) ? $item['if'] : '';
|
| 33 |
+
$params = !empty($item['params']) ? $item['params'] : '';
|
| 34 |
+
switch ($item['type']) {
|
| 35 |
+
case 'js': // js/*.js
|
| 36 |
+
case 'skin_js': // skin/*/*.js
|
| 37 |
+
case 'js_css': // js/*.css
|
| 38 |
+
case 'skin_css': // skin/*/*.css
|
| 39 |
+
$lines[$if][$item['type']][$params][$item['name']] = $item['name'];
|
| 40 |
+
break;
|
| 41 |
+
default:
|
| 42 |
+
$this->_separateOtherHtmlHeadElements($lines, $if, $item['type'], $params, $item['name'], $item);
|
| 43 |
+
break;
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// prepare HTML
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
$shouldMergeJs = Mage::getStoreConfigFlag('dev/js/merge_files');
|
| 51 |
+
|
| 52 |
+
// track Ie9 Browser then make merge css false;
|
| 53 |
+
if(preg_match('/(?i)msie [8-8]/',Mage::helper('core/http')->getHttpUserAgent())):
|
| 54 |
+
$shouldMergeCss =false;
|
| 55 |
+
else:
|
| 56 |
+
$shouldMergeCss = Mage::getStoreConfigFlag('dev/css/merge_css_files');
|
| 57 |
+
endif;
|
| 58 |
+
|
| 59 |
+
$html = '';
|
| 60 |
+
foreach ($lines as $if => $items) {
|
| 61 |
+
if (empty($items)) {
|
| 62 |
+
continue;
|
| 63 |
+
}
|
| 64 |
+
if (!empty($if)) {
|
| 65 |
+
// open !IE conditional using raw value
|
| 66 |
+
if (strpos($if, "><!-->") !== false) {
|
| 67 |
+
$html .= $if . "\n";
|
| 68 |
+
} else {
|
| 69 |
+
$html .= '<!--[if '.$if.']>' . "\n";
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
// static and skin css
|
| 74 |
+
$html .= $this->_prepareStaticAndSkinElements('<link rel="stylesheet" type="text/css" href="%s"%s />'."\n",
|
| 75 |
+
empty($items['js_css']) ? array() : $items['js_css'],
|
| 76 |
+
empty($items['skin_css']) ? array() : $items['skin_css'],
|
| 77 |
+
$shouldMergeCss ? array(Mage::getDesign(), 'getMergedCssUrl') : null
|
| 78 |
+
);
|
| 79 |
+
|
| 80 |
+
// static and skin javascripts
|
| 81 |
+
$html .= $this->_prepareStaticAndSkinElements('<script type="text/javascript" src="%s"%s></script>' . "\n",
|
| 82 |
+
empty($items['js']) ? array() : $items['js'],
|
| 83 |
+
empty($items['skin_js']) ? array() : $items['skin_js'],
|
| 84 |
+
$shouldMergeJs ? array(Mage::getDesign(), 'getMergedJsUrl') : null
|
| 85 |
+
);
|
| 86 |
+
|
| 87 |
+
// other stuff
|
| 88 |
+
if (!empty($items['other'])) {
|
| 89 |
+
$html .= $this->_prepareOtherHtmlHeadElements($items['other']) . "\n";
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
if (!empty($if)) {
|
| 93 |
+
// close !IE conditional comments correctly
|
| 94 |
+
if (strpos($if, "><!-->") !== false) {
|
| 95 |
+
$html .= '<!--<![endif]-->' . "\n";
|
| 96 |
+
} else {
|
| 97 |
+
$html .= '<![endif]-->' . "\n";
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
return $html;
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
|
app/code/community/CP/Margecss/etc/config.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magento
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category Commerce Pundit Technologies
|
| 17 |
+
* @package CP_Margecss
|
| 18 |
+
* @copyright Copyright (c) 2016 Commerce Pundit Technologies. (http://www.commercepundit.com)
|
| 19 |
+
* @author <<Manan Ladola>>
|
| 20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 21 |
+
*/
|
| 22 |
+
-->
|
| 23 |
+
|
| 24 |
+
<config>
|
| 25 |
+
<modules>
|
| 26 |
+
<CP_Margecss>
|
| 27 |
+
<version>0.1.0</version>
|
| 28 |
+
</CP_Margecss>
|
| 29 |
+
</modules>
|
| 30 |
+
<global>
|
| 31 |
+
<blocks>
|
| 32 |
+
<margecss>
|
| 33 |
+
<class>CP_Margecss_Block</class>
|
| 34 |
+
</margecss>
|
| 35 |
+
<page>
|
| 36 |
+
<rewrite>
|
| 37 |
+
<html_head>CP_Margecss_Block_Page_Html_Head</html_head>
|
| 38 |
+
</rewrite>
|
| 39 |
+
</page>
|
| 40 |
+
</blocks>
|
| 41 |
+
</global>
|
| 42 |
+
</config>
|
app/etc/modules/CP_Margecss.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<CP_Margecss>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<version>0.1.0</version>
|
| 8 |
+
</CP_Margecss>
|
| 9 |
+
</modules>
|
| 10 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>CP_Margecss</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>devel</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>A Margecss is automatically unmerge css when detect IE browser.</summary>
|
| 10 |
+
<description>A Margecss is automatically unmerge css when detect IE browser.</description>
|
| 11 |
+
<notes>Fresh uploaded</notes>
|
| 12 |
+
<authors><author><name>Commerce Pundit</name><user>CPExtensions</user><email>support@commercepundit.com</email></author></authors>
|
| 13 |
+
<date>2016-01-08</date>
|
| 14 |
+
<time>13:59:42</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="CP"><dir name="Margecss"><dir name="Block"><dir name="Page"><dir name="Html"><file name="Head.php" hash="5c971f852dd323efeb7e64b48f4f6c21"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0053cf743769eccf52a0520d45f5b2cc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CP_Margecss.xml" hash="979e7521b134d4cffc1d1c407a72e0e4"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
|
| 18 |
+
</package>
|
