Version Notes
* Fixed few small issues with admin blocks
* Code standards improvements
Download this release
Release Info
Developer | Apptrian |
Extension | Apptrian_Minify_HTML_CSS_JS |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.5.0 to 1.5.1
- app/code/community/Apptrian/Minify/Block/About.php +0 -43
- app/code/community/Apptrian/Minify/Block/Adminhtml/About.php +49 -0
- app/code/community/Apptrian/Minify/Block/Adminhtml/Button/Minify.php +45 -41
- app/code/community/Apptrian/Minify/Block/Adminhtml/Info.php +101 -0
- app/code/community/Apptrian/Minify/Block/Info.php +0 -70
- app/code/community/Apptrian/Minify/Helper/Data.php +168 -135
- app/code/community/Apptrian/Minify/Model/Cron.php +0 -67
- app/code/community/Apptrian/Minify/Model/Observer.php +177 -157
- app/code/community/Apptrian/Minify/controllers/Adminhtml/Apptrian/MinifyController.php +55 -33
- app/code/community/Apptrian/Minify/etc/config.xml +120 -132
- app/code/community/Apptrian/Minify/etc/system.xml +144 -154
- app/etc/modules/Apptrian_Minify.xml +22 -22
- package.xml +7 -7
app/code/community/Apptrian/Minify/Block/About.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category Apptrian
|
4 |
-
* @package Apptrian_Minify
|
5 |
-
* @author Apptrian
|
6 |
-
* @copyright Copyright (c) 2015 Apptrian (http://www.apptrian.com)
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Block_About
|
10 |
-
extends Mage_Adminhtml_Block_Abstract
|
11 |
-
implements Varien_Data_Form_Element_Renderer_Interface
|
12 |
-
{
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Render fieldset html
|
16 |
-
*
|
17 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
21 |
-
{
|
22 |
-
$version = Mage::helper('apptrian_minify')->getExtensionVersion();
|
23 |
-
$logopath = 'http://www.apptrian.com/media/apptrian.gif';
|
24 |
-
$html = <<<HTML
|
25 |
-
<div style="background:url('$logopath') no-repeat scroll 15px 15px #e7efef; border:1px solid #ccc; min-height:100px; margin:5px 0; padding:15px 15px 15px 140px;">
|
26 |
-
<p>
|
27 |
-
<strong>Apptrian Minify HTML CSS JS Extension v$version</strong><br />
|
28 |
-
Minify HTML CSS JS including inline CSS/JS and speed up your site. Works with default Magento CSS/JS merger.
|
29 |
-
</p>
|
30 |
-
<p>
|
31 |
-
Website: <a href="http://www.apptrian.com" target="_blank">www.apptrian.com</a><br />
|
32 |
-
Like, share and follow us on
|
33 |
-
<a href="https://www.facebook.com/apptrian" target="_blank">Facebook</a>,
|
34 |
-
<a href="https://plus.google.com/+ApptrianCom" target="_blank">Google+</a>,
|
35 |
-
<a href="http://www.pinterest.com/apptrian" target="_blank">Pinterest</a>, and
|
36 |
-
<a href="http://twitter.com/apptrian" target="_blank">Twitter</a>.<br />
|
37 |
-
If you have any questions send email at <a href="mailto:service@apptrian.com">service@apptrian.com</a>.
|
38 |
-
</p>
|
39 |
-
</div>
|
40 |
-
HTML;
|
41 |
-
return $html;
|
42 |
-
}
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Apptrian/Minify/Block/Adminhtml/About.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
+
*/
|
9 |
+
class Apptrian_Minify_Block_Adminhtml_About
|
10 |
+
extends Mage_Adminhtml_Block_Abstract
|
11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Render fieldset html
|
16 |
+
*
|
17 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
21 |
+
{
|
22 |
+
$element = null;
|
23 |
+
$version = Mage::helper('apptrian_minify')->getExtensionVersion();
|
24 |
+
$logopath = 'http://www.apptrian.com/media/apptrian.gif';
|
25 |
+
$html = <<<HTML
|
26 |
+
<div style="background:url('$logopath') no-repeat scroll 15px 15px #e7efef;
|
27 |
+
border:1px solid #ccc; min-height:100px; margin:5px 0;
|
28 |
+
padding:15px 15px 15px 140px;">
|
29 |
+
<p>
|
30 |
+
<strong>Apptrian Minify HTML CSS JS Extension v$version</strong><br />
|
31 |
+
Minify HTML CSS JS including inline CSS/JS and speed up your site. Works with
|
32 |
+
default Magento CSS/JS merger.
|
33 |
+
</p>
|
34 |
+
<p>
|
35 |
+
Website:
|
36 |
+
<a href="http://www.apptrian.com" target="_blank">www.apptrian.com</a><br />
|
37 |
+
Like, share and follow us on
|
38 |
+
<a href="https://www.facebook.com/apptrian" target="_blank">Facebook</a>,
|
39 |
+
<a href="https://plus.google.com/+ApptrianCom" target="_blank">Google+</a>,
|
40 |
+
<a href="http://www.pinterest.com/apptrian" target="_blank">Pinterest</a>, and
|
41 |
+
<a href="http://twitter.com/apptrian" target="_blank">Twitter</a>.<br />
|
42 |
+
If you have any questions send email at
|
43 |
+
<a href="mailto:service@apptrian.com">service@apptrian.com</a>.
|
44 |
+
</p>
|
45 |
+
</div>
|
46 |
+
HTML;
|
47 |
+
return $html;
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Apptrian/Minify/Block/Adminhtml/Button/Minify.php
CHANGED
@@ -1,41 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category
|
4 |
-
* @package
|
5 |
-
* @author
|
6 |
-
* @copyright
|
7 |
-
* @license
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Block_Adminhtml_Button_Minify
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
*
|
14 |
-
*
|
15 |
-
* @
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
+
*/
|
9 |
+
class Apptrian_Minify_Block_Adminhtml_Button_Minify
|
10 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Retrieve element HTML markup
|
14 |
+
*
|
15 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
protected function _getElementHtml(
|
19 |
+
Varien_Data_Form_Element_Abstract $element
|
20 |
+
)
|
21 |
+
{
|
22 |
+
|
23 |
+
$elementOriginalData = $element->getOriginalData();
|
24 |
+
|
25 |
+
if (isset($elementOriginalData['label'])) {
|
26 |
+
$buttonLabel = $elementOriginalData['label'];
|
27 |
+
} else {
|
28 |
+
return '<div>Button label was not specified</div>';
|
29 |
+
}
|
30 |
+
|
31 |
+
$url = Mage::helper('adminhtml')->getUrl(
|
32 |
+
'adminhtml/apptrian_minify/process'
|
33 |
+
);
|
34 |
+
|
35 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
36 |
+
->setType('button')
|
37 |
+
->setClass('apptrian-minify-admin-button-minify')
|
38 |
+
->setLabel($buttonLabel)
|
39 |
+
->setOnClick("setLocation('$url')")
|
40 |
+
->toHtml();
|
41 |
+
|
42 |
+
return $html;
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Apptrian/Minify/Block/Adminhtml/Info.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
+
*/
|
9 |
+
class Apptrian_Minify_Block_Adminhtml_Info
|
10 |
+
extends Mage_Adminhtml_Block_Abstract
|
11 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Render fieldset html
|
16 |
+
*
|
17 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
21 |
+
{
|
22 |
+
$element = null;
|
23 |
+
$logopath = 'http://www.apptrian.com/media/apptrian.gif';
|
24 |
+
$html = <<<HTML
|
25 |
+
<div style="background:url('$logopath') no-repeat scroll 15px 15px #e7efef;
|
26 |
+
border:1px solid #ccc; min-height:100px; margin:5px 0;
|
27 |
+
padding:15px 15px 15px 140px;">
|
28 |
+
<p>
|
29 |
+
<strong>Magento Online Stores & Extensions</strong><br />
|
30 |
+
<a href="http://www.apptrian.com" target="_blank">Apptrian</a> offers a wide
|
31 |
+
choice of products and services for your online business.
|
32 |
+
</p>
|
33 |
+
<p>
|
34 |
+
Website: <a href="http://www.apptrian.com" target="_blank">www.apptrian.com</a>
|
35 |
+
<br />
|
36 |
+
Like, share and follow us on
|
37 |
+
<a href="https://www.facebook.com/apptrian" target="_blank">Facebook</a>,
|
38 |
+
<a href="https://plus.google.com/+ApptrianCom" target="_blank">Google+</a>,
|
39 |
+
<a href="http://www.pinterest.com/apptrian" target="_blank">Pinterest</a>, and
|
40 |
+
<a href="http://twitter.com/apptrian" target="_blank">Twitter</a>.<br />
|
41 |
+
If you have any questions send email at
|
42 |
+
<a href="mailto:service@apptrian.com">service@apptrian.com</a>.
|
43 |
+
</p>
|
44 |
+
</div>
|
45 |
+
<div>
|
46 |
+
<p><strong>Products and services you might be interested in:</strong></p>
|
47 |
+
<a href="http://www.apptrian.com/facebook-pixel-for-magento"
|
48 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
49 |
+
<img src="http://www.apptrian.com/media/facebook-pixel.jpg"
|
50 |
+
alt="Facebook Pixel" style="border:1px solid #ccc;" />
|
51 |
+
</a>
|
52 |
+
<a href="http://www.apptrian.com/image-optimizer-for-magento"
|
53 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
54 |
+
<img src="http://www.apptrian.com/media/image-optimizer.jpg"
|
55 |
+
alt="Image Optimizer" style="border:1px solid #ccc;" />
|
56 |
+
</a>
|
57 |
+
<a href="http://www.apptrian.com/minify-html-css-js-for-magento"
|
58 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
59 |
+
<img src="http://www.apptrian.com/media/minify-html-css-js.jpg"
|
60 |
+
alt="Minify HTML CSS JS" style="border:1px solid #ccc;" />
|
61 |
+
</a>
|
62 |
+
<a href="http://www.apptrian.com/professional-magento-installation"
|
63 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
64 |
+
<img src="http://www.apptrian.com/media/professional-magento-installation.jpg"
|
65 |
+
alt="Professional Magento Installation" style="border:1px solid #ccc;" />
|
66 |
+
</a>
|
67 |
+
<a href="http://www.apptrian.com/quick-search-for-magento"
|
68 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
69 |
+
<img src="http://www.apptrian.com/media/quick-search.jpg"
|
70 |
+
alt="Quick Search" style="border:1px solid #ccc;" />
|
71 |
+
</a>
|
72 |
+
<a href="http://www.apptrian.com/responsive-product-slider-for-magento"
|
73 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
74 |
+
<img src="http://www.apptrian.com/media/responsive-product-slider.jpg"
|
75 |
+
alt="Responsive Product Slider" style="border:1px solid #ccc;" />
|
76 |
+
</a>
|
77 |
+
<a href="http://www.apptrian.com/schema-org-microdata-for-magento"
|
78 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
79 |
+
<img src="http://www.apptrian.com/media/schema-org-microdata-for-magento.jpg"
|
80 |
+
alt="Schema.org Microdata for Magento" style="border:1px solid #ccc;" />
|
81 |
+
</a>
|
82 |
+
<a href="http://www.apptrian.com/snippets-generator-for-magento"
|
83 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
84 |
+
<img src="http://www.apptrian.com/media/snippets-generator.jpg"
|
85 |
+
alt="Snippets Generator" style="border:1px solid #ccc;" />
|
86 |
+
</a>
|
87 |
+
<a href="http://www.apptrian.com/social-integrator-for-magento"
|
88 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
89 |
+
<img src="http://www.apptrian.com/media/social-integrator.jpg"
|
90 |
+
alt="Social Integrator" style="border:1px solid #ccc;" />
|
91 |
+
</a>
|
92 |
+
<a href="http://www.apptrian.com/subcategories-grid-list-for-magento"
|
93 |
+
target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
94 |
+
<img src="http://www.apptrian.com/media/subcategories-grid-list.jpg"
|
95 |
+
alt="Subcategories Grid/List" style="border:1px solid #ccc;" />
|
96 |
+
</a>
|
97 |
+
</div>
|
98 |
+
HTML;
|
99 |
+
return $html;
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Apptrian/Minify/Block/Info.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category Apptrian
|
4 |
-
* @package Apptrian_Minify
|
5 |
-
* @author Apptrian
|
6 |
-
* @copyright Copyright (c) 2015 Apptrian (http://www.apptrian.com)
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Block_Info
|
10 |
-
extends Mage_Adminhtml_Block_Abstract
|
11 |
-
implements Varien_Data_Form_Element_Renderer_Interface
|
12 |
-
{
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Render fieldset html
|
16 |
-
*
|
17 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
21 |
-
{
|
22 |
-
|
23 |
-
$logopath = 'http://www.apptrian.com/media/apptrian.gif';
|
24 |
-
$html = <<<HTML
|
25 |
-
<div style="background:url('$logopath') no-repeat scroll 15px 15px #e7efef; border:1px solid #ccc; min-height:100px; margin:5px 0; padding:15px 15px 15px 140px;">
|
26 |
-
<p>
|
27 |
-
<strong>Magento Online Stores & Extensions</strong><br />
|
28 |
-
<a href="http://www.apptrian.com" target="_blank">Apptrian</a> offers a wide choice of products and services for your online business.
|
29 |
-
</p>
|
30 |
-
<p>
|
31 |
-
Website: <a href="http://www.apptrian.com" target="_blank">www.apptrian.com</a><br />
|
32 |
-
Like, share and follow us on
|
33 |
-
<a href="https://www.facebook.com/apptrian" target="_blank">Facebook</a>,
|
34 |
-
<a href="https://plus.google.com/+ApptrianCom" target="_blank">Google+</a>,
|
35 |
-
<a href="http://www.pinterest.com/apptrian" target="_blank">Pinterest</a>, and
|
36 |
-
<a href="http://twitter.com/apptrian" target="_blank">Twitter</a>.<br />
|
37 |
-
If you have any questions send email at <a href="mailto:service@apptrian.com">service@apptrian.com</a>.
|
38 |
-
</p>
|
39 |
-
</div>
|
40 |
-
<div>
|
41 |
-
<p><strong>Products and services you might be interested in:</strong></p>
|
42 |
-
<a href="http://www.apptrian.com/products-and-services/magento/image-optimizer-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
43 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/image-optimizer-for-magento.jpg" alt="Image Optimizer for Magento" style="border:1px solid #ccc;" />
|
44 |
-
</a>
|
45 |
-
<a href="http://www.apptrian.com/products-and-services/magento/minify-html-css-js-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
46 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/minify-html-css-js-for-magento.jpg" alt="Minify HTML CSS JS for Magento" style="border:1px solid #ccc;" />
|
47 |
-
</a>
|
48 |
-
<a href="http://www.apptrian.com/products-and-services/magento/professional-magento-installation" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
49 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/professional-magento-installation.jpg" alt="Professional Magento Installation" style="border:1px solid #ccc;" />
|
50 |
-
</a>
|
51 |
-
<a href="http://www.apptrian.com/products-and-services/magento/quick-search-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
52 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/quick-search-for-magento.jpg" alt="Quick Search for Magento" style="border:1px solid #ccc;" />
|
53 |
-
</a>
|
54 |
-
<a href="http://www.apptrian.com/products-and-services/magento/responsive-product-slider-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
55 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/responsive-product-slider-for-magento.jpg" alt="Responsive Product Slider for Magento" style="border:1px solid #ccc;" />
|
56 |
-
</a>
|
57 |
-
<a href="http://www.apptrian.com/products-and-services/magento/schema-org-microdata-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
58 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/schema-org-microdata-for-magento.jpg" alt="Schema.org Microdata for Magento" style="border:1px solid #ccc;" />
|
59 |
-
</a>
|
60 |
-
<a href="http://www.apptrian.com/products-and-services/magento/social-integrator-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
61 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/social-integrator-for-magento.jpg" alt="Social Integrator" style="border:1px solid #ccc;" />
|
62 |
-
</a>
|
63 |
-
<a href="http://www.apptrian.com/products-and-services/magento/subcategories-grid-list-for-magento" target="_blank" style="margin: 0 15px 15px 0; display: inline-block;">
|
64 |
-
<img src="http://www.apptrian.com/media/apptrian-promotional/subcategories-grid-list-for-magento.jpg" alt="Subcategories Grid/List" style="border:1px solid #ccc;" />
|
65 |
-
</a>
|
66 |
-
</div>
|
67 |
-
HTML;
|
68 |
-
return $html;
|
69 |
-
}
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Apptrian/Minify/Helper/Data.php
CHANGED
@@ -1,135 +1,168 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category
|
4 |
-
* @package
|
5 |
-
* @author
|
6 |
-
* @copyright
|
7 |
-
* @license
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
-
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
+
*/
|
9 |
+
class Apptrian_Minify_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Array of paths that will be scaned for css and js files.
|
13 |
+
*
|
14 |
+
* @var array
|
15 |
+
*/
|
16 |
+
protected $_paths = null;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns extension version.
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getExtensionVersion()
|
24 |
+
{
|
25 |
+
return (string) Mage::getConfig()
|
26 |
+
->getNode()->modules->Apptrian_Minify->version;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Returns array of paths that will be scaned for css and js files.
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
public function getPaths()
|
35 |
+
{
|
36 |
+
if ($this->_paths === null) {
|
37 |
+
|
38 |
+
$list = array();
|
39 |
+
$baseDirMedia = Mage::getBaseDir('media');
|
40 |
+
$css = $baseDirMedia . DS . 'css';
|
41 |
+
$cssSecure = $baseDirMedia . DS . 'css_secure';
|
42 |
+
$js = $baseDirMedia . DS . 'js';
|
43 |
+
|
44 |
+
if (file_exists($css)) {
|
45 |
+
$list[] = $css;
|
46 |
+
}
|
47 |
+
|
48 |
+
if (file_exists($cssSecure)) {
|
49 |
+
$list[] = $cssSecure;
|
50 |
+
}
|
51 |
+
|
52 |
+
if (file_exists($js)) {
|
53 |
+
$list[] = $js;
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->_paths = $list;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
return $this->_paths;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Minifies CSS and JS files.
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public function process()
|
68 |
+
{
|
69 |
+
// Get remove important comments option
|
70 |
+
$removeComments = (int) Mage::getConfig()->getNode(
|
71 |
+
'apptrian_minify/minify_css_js/remove_comments', 'default'
|
72 |
+
);
|
73 |
+
|
74 |
+
foreach ($this->getPaths() as $path) {
|
75 |
+
|
76 |
+
$iterator = new RecursiveIteratorIterator(
|
77 |
+
new RecursiveDirectoryIterator(
|
78 |
+
$path, RecursiveDirectoryIterator::FOLLOW_SYMLINKS
|
79 |
+
)
|
80 |
+
);
|
81 |
+
|
82 |
+
foreach ($iterator as $filename => $file) {
|
83 |
+
|
84 |
+
if ($file->isFile()
|
85 |
+
&& preg_match('/^.+\.(css|js)$/i', $file->getFilename())
|
86 |
+
) {
|
87 |
+
|
88 |
+
$filePath = $file->getRealPath();
|
89 |
+
if (!is_writable($filePath)) {
|
90 |
+
Mage::log(
|
91 |
+
'Minification failed for '
|
92 |
+
. $filePath . ' File is not writable.'
|
93 |
+
);
|
94 |
+
continue;
|
95 |
+
}
|
96 |
+
|
97 |
+
//This is available from php v5.3.6
|
98 |
+
//$ext = $file->getExtension();
|
99 |
+
// Using this for compatibility
|
100 |
+
$ext = strtolower(
|
101 |
+
pathinfo($filePath, PATHINFO_EXTENSION)
|
102 |
+
);
|
103 |
+
$optimized = '';
|
104 |
+
$unoptimized = file_get_contents($filePath);
|
105 |
+
|
106 |
+
// If it is 0 byte file or cannot be read
|
107 |
+
if (!$unoptimized) {
|
108 |
+
Mage::log('File ' . $filePath . ' cannot be read.');
|
109 |
+
continue;
|
110 |
+
}
|
111 |
+
|
112 |
+
// CSS files
|
113 |
+
if ($ext == 'css') {
|
114 |
+
|
115 |
+
if ($removeComments == 1) {
|
116 |
+
|
117 |
+
$optimized = Minify_CSS::minify(
|
118 |
+
$unoptimized, array('preserveComments' => false)
|
119 |
+
);
|
120 |
+
|
121 |
+
} else {
|
122 |
+
|
123 |
+
$optimized = Minify_CSS::minify($unoptimized);
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
// JS files
|
128 |
+
} else {
|
129 |
+
|
130 |
+
|
131 |
+
if ($removeComments == 1) {
|
132 |
+
|
133 |
+
$optimized = JSMinMax::minify($unoptimized);
|
134 |
+
|
135 |
+
} else {
|
136 |
+
|
137 |
+
$optimized = JSMin::minify($unoptimized);
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
// If optimization failed
|
146 |
+
if (!$optimized) {
|
147 |
+
Mage::log('File ' . $filePath . ' was not minified.');
|
148 |
+
continue;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
if (file_put_contents(
|
153 |
+
$filePath, $optimized, LOCK_EX
|
154 |
+
) === false) {
|
155 |
+
|
156 |
+
Mage::log('Minification failed for ' . $filePath);
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
}
|
app/code/community/Apptrian/Minify/Model/Cron.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category Apptrian
|
4 |
-
* @package Apptrian_Minify
|
5 |
-
* @author Apptrian
|
6 |
-
* @copyright Copyright (c) 2015 Apptrian (http://www.apptrian.com)
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Model_Cron
|
10 |
-
{
|
11 |
-
|
12 |
-
public function check()
|
13 |
-
{
|
14 |
-
|
15 |
-
$module = "apptrian_minify";
|
16 |
-
$version = Mage::helper('apptrian_minify')->getExtensionVersion();
|
17 |
-
$active = "active";
|
18 |
-
$data = "Stores: \r\n";
|
19 |
-
$firstUrl = "";
|
20 |
-
$firstEm = "";
|
21 |
-
$firstNm = "";
|
22 |
-
|
23 |
-
$stores = Mage::app()->getStores();
|
24 |
-
|
25 |
-
foreach ($stores as $store) {
|
26 |
-
|
27 |
-
$id = $store->getId();
|
28 |
-
$isActive = $store->getIsActive();
|
29 |
-
|
30 |
-
if (!$isActive) {
|
31 |
-
$active = "not active";
|
32 |
-
}
|
33 |
-
|
34 |
-
$url = Mage::app()->getStore($id)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
35 |
-
$em = Mage::getStoreConfig('trans_email/ident_general/email', $id);
|
36 |
-
$nm = Mage::getStoreConfig('trans_email/ident_general/name', $id);
|
37 |
-
|
38 |
-
if ($firstUrl == "" && $isActive) {
|
39 |
-
$firstUrl = $url;
|
40 |
-
$firstEm = $em;
|
41 |
-
$firstNm = $nm;
|
42 |
-
}
|
43 |
-
|
44 |
-
$data .= $url . " \r\n" . $active . " \r\n" . $nm . " \r\n" . $em . " \r\n";
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
$text = "Site " . $firstUrl . " \r\n" . $data . $module . " v" . $version;
|
49 |
-
|
50 |
-
$m = Mage::getModel('core/email');
|
51 |
-
$m->setToName(base64_decode('QXBwdHJpYW4='));
|
52 |
-
$m->setToEmail(base64_decode('Y2hlY2tAYXBwdHJpYW4uY29t'));
|
53 |
-
$m->setBody($text);
|
54 |
-
$m->setSubject(base64_decode('Q2hlY2sgZnJvbSA=') . $firstUrl . " module " . $module . " v" . $version);
|
55 |
-
$m->setFromEmail($firstEm);
|
56 |
-
$m->setFromName($firstNm);
|
57 |
-
$m->setType('text');
|
58 |
-
|
59 |
-
try {
|
60 |
-
$m->send();
|
61 |
-
} catch (Exception $e) {
|
62 |
-
// Do nothing
|
63 |
-
}
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Apptrian/Minify/Model/Observer.php
CHANGED
@@ -1,157 +1,177 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @category
|
4 |
-
* @package
|
5 |
-
* @author
|
6 |
-
* @copyright
|
7 |
-
* @license
|
8 |
-
*/
|
9 |
-
class Apptrian_Minify_Model_Observer
|
10 |
-
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
+
*/
|
9 |
+
class Apptrian_Minify_Model_Observer
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Flag used to determine if block HTML minification is set in config.
|
14 |
+
*
|
15 |
+
* @var null|bool
|
16 |
+
*/
|
17 |
+
protected $_blockMinifyFlag = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Flag used to determine if maximum HTML minification is set in config.
|
21 |
+
*
|
22 |
+
* @var null|bool
|
23 |
+
*/
|
24 |
+
protected $_maxMinifyFlag = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Minify options array.
|
28 |
+
*
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
protected $_minifyOptions = array(
|
32 |
+
'cssMinifier' => array('Minify_CSS', 'minify'),
|
33 |
+
'jsMinifier' => array('JSMin', 'minify')
|
34 |
+
);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Method returns status of block minification.
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
public function getBlockMinifyStatus()
|
42 |
+
{
|
43 |
+
|
44 |
+
if ($this->_blockMinifyFlag === null) {
|
45 |
+
|
46 |
+
if (Mage::getStoreConfigFlag('apptrian_minify/minify_html/enabled')
|
47 |
+
&& Mage::getStoreConfigFlag(
|
48 |
+
'apptrian_minify/minify_html/compatibility'
|
49 |
+
)
|
50 |
+
) {
|
51 |
+
|
52 |
+
$this->_blockMinifyFlag = true;
|
53 |
+
|
54 |
+
} else {
|
55 |
+
|
56 |
+
$this->_blockMinifyFlag = false;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
return $this->_blockMinifyFlag;
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Method returns status of maximum HTML minification.
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function getMaxMinifyStatus()
|
72 |
+
{
|
73 |
+
|
74 |
+
if ($this->_maxMinifyFlag === null) {
|
75 |
+
|
76 |
+
$this->_maxMinifyFlag = Mage::getStoreConfigFlag(
|
77 |
+
'apptrian_minify/minify_html/max_minification'
|
78 |
+
);
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
return $this->_maxMinifyFlag;
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* This method is minifying HTML of every block.
|
88 |
+
* Multiple calls per page but they are cached.
|
89 |
+
*
|
90 |
+
* @param Varien_Event_Observer $observer
|
91 |
+
*/
|
92 |
+
public function minifyBlockHtml(Varien_Event_Observer $observer)
|
93 |
+
{
|
94 |
+
|
95 |
+
if ($this->getBlockMinifyStatus()) {
|
96 |
+
|
97 |
+
$block = $observer->getBlock();
|
98 |
+
$transport = $observer->getTransport();
|
99 |
+
$html = $transport->getHtml();
|
100 |
+
|
101 |
+
if ($this->getMaxMinifyStatus()) {
|
102 |
+
$transport->setHtml(
|
103 |
+
Minify_HTMLMaxComp::minify($html, $this->_minifyOptions)
|
104 |
+
);
|
105 |
+
} else {
|
106 |
+
$transport->setHtml(
|
107 |
+
Minify_HTMLComp::minify($html, $this->_minifyOptions)
|
108 |
+
);
|
109 |
+
}
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* This method is minifying HTML of entire page.
|
117 |
+
* One call per entire page.
|
118 |
+
*
|
119 |
+
* @param Varien_Event_Observer $observer
|
120 |
+
*/
|
121 |
+
public function minifyPageHtml(Varien_Event_Observer $observer)
|
122 |
+
{
|
123 |
+
|
124 |
+
if (Mage::getStoreConfigFlag('apptrian_minify/minify_html/enabled')
|
125 |
+
&& !Mage::getStoreConfigFlag(
|
126 |
+
'apptrian_minify/minify_html/compatibility'
|
127 |
+
)
|
128 |
+
) {
|
129 |
+
|
130 |
+
$response = $observer->getEvent()->getControllerAction()
|
131 |
+
->getResponse();
|
132 |
+
$html = $response->getBody();
|
133 |
+
|
134 |
+
if (stripos($html, '<!DOCTYPE html') !== false) {
|
135 |
+
|
136 |
+
$type = false;
|
137 |
+
|
138 |
+
foreach ($response->getHeaders() as $header) {
|
139 |
+
|
140 |
+
if (stripos($header['name'], 'Content-Type') !== false) {
|
141 |
+
|
142 |
+
if (stripos($header['value'], 'text/html') !== false) {
|
143 |
+
|
144 |
+
$type = true;
|
145 |
+
|
146 |
+
break;
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
if ($type) {
|
155 |
+
|
156 |
+
if (Mage::getStoreConfigFlag(
|
157 |
+
'apptrian_minify/minify_html/max_minification'
|
158 |
+
)
|
159 |
+
) {
|
160 |
+
$response->setBody(
|
161 |
+
Minify_HTMLMax::minify($html, $this->_minifyOptions)
|
162 |
+
);
|
163 |
+
} else {
|
164 |
+
$response->setBody(
|
165 |
+
Minify_HTML::minify($html, $this->_minifyOptions)
|
166 |
+
);
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
app/code/community/Apptrian/Minify/controllers/Adminhtml/Apptrian/MinifyController.php
CHANGED
@@ -1,37 +1,59 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* @category
|
4 |
-
* @package
|
5 |
-
* @author
|
6 |
-
* @copyright
|
7 |
-
* @license
|
8 |
*/
|
9 |
-
class Apptrian_Minify_Adminhtml_Apptrian_MinifyController
|
|
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @category Apptrian
|
4 |
+
* @package Apptrian_Minify
|
5 |
+
* @author Apptrian
|
6 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
8 |
*/
|
9 |
+
class Apptrian_Minify_Adminhtml_Apptrian_MinifyController
|
10 |
+
extends Mage_Adminhtml_Controller_Action
|
11 |
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Check is allowed access to action
|
15 |
+
*
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
protected function _isAllowed()
|
19 |
+
{
|
20 |
+
return Mage::getSingleton('admin/session')
|
21 |
+
->isAllowed('system/config/apptrian_minify');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Process action minifies CSS and JS files.
|
26 |
+
*/
|
27 |
+
public function processAction()
|
28 |
+
{
|
29 |
+
|
30 |
+
set_time_limit(18000);
|
31 |
+
|
32 |
+
$helper = Mage::helper('apptrian_minify');
|
33 |
+
|
34 |
+
try {
|
35 |
+
|
36 |
+
$helper->process();
|
37 |
+
|
38 |
+
$message = $this->__(
|
39 |
+
'Minification operations completed successfully.'
|
40 |
+
);
|
41 |
+
|
42 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
43 |
+
|
44 |
+
} catch (Exception $e) {
|
45 |
+
|
46 |
+
$message = $this->__('Minification failed.');
|
47 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
$url = Mage::helper('adminhtml')
|
53 |
+
->getUrl('adminhtml/system_config/edit/section/apptrian_minify');
|
54 |
+
|
55 |
+
Mage::app()->getResponse()->setRedirect($url);
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/community/Apptrian/Minify/etc/config.xml
CHANGED
@@ -1,132 +1,120 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* @category
|
5 |
-
* @package
|
6 |
-
* @author
|
7 |
-
* @copyright
|
8 |
-
* @license
|
9 |
-
*/
|
10 |
-
-->
|
11 |
-
<config>
|
12 |
-
<modules>
|
13 |
-
<Apptrian_Minify>
|
14 |
-
<version>1.5.
|
15 |
-
</Apptrian_Minify>
|
16 |
-
</modules>
|
17 |
-
<global>
|
18 |
-
<helpers>
|
19 |
-
<apptrian_minify>
|
20 |
-
<class>Apptrian_Minify_Helper</class>
|
21 |
-
</apptrian_minify>
|
22 |
-
</helpers>
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
<resources>
|
34 |
-
<apptrian_minify_setup>
|
35 |
-
<setup>
|
36 |
-
<module>Apptrian_Minify</module>
|
37 |
-
</setup>
|
38 |
-
<connection>
|
39 |
-
<use>core_setup</use>
|
40 |
-
</connection>
|
41 |
-
</apptrian_minify_setup>
|
42 |
-
</resources>
|
43 |
-
</global>
|
44 |
-
|
45 |
-
<apptrian_minify>
|
46 |
-
<minify_html>
|
47 |
-
<enabled>0</enabled>
|
48 |
-
<max_minification>0</max_minification>
|
49 |
-
<compatibility>0</compatibility>
|
50 |
-
</minify_html>
|
51 |
-
<minify_css_js>
|
52 |
-
<remove_comments>0</remove_comments>
|
53 |
-
</minify_css_js>
|
54 |
-
</apptrian_minify>
|
55 |
-
</default>
|
56 |
-
<frontend>
|
57 |
-
<events>
|
58 |
-
<core_block_abstract_to_html_after>
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
</core_block_abstract_to_html_after>
|
66 |
-
<controller_action_postdispatch>
|
67 |
-
<observers>
|
68 |
-
<apptrian_minify_controller_action_postdispatch>
|
69 |
-
<class>apptrian_minify/observer</class>
|
70 |
-
<method>minifyPageHtml</method>
|
71 |
-
</apptrian_minify_controller_action_postdispatch>
|
72 |
-
</observers>
|
73 |
-
</controller_action_postdispatch>
|
74 |
-
</events>
|
75 |
-
</frontend>
|
76 |
-
<admin>
|
77 |
-
<routers>
|
78 |
-
<adminhtml>
|
79 |
-
<args>
|
80 |
-
<modules>
|
81 |
-
<apptrian_minify after="Mage_Adminhtml">Apptrian_Minify_Adminhtml</apptrian_minify>
|
82 |
-
</modules>
|
83 |
-
</args>
|
84 |
-
</adminhtml>
|
85 |
-
</routers>
|
86 |
-
</admin>
|
87 |
-
<adminhtml>
|
88 |
-
<acl>
|
89 |
-
<resources>
|
90 |
-
<admin>
|
91 |
-
<children>
|
92 |
-
<system>
|
93 |
-
<children>
|
94 |
-
<config>
|
95 |
-
<children>
|
96 |
-
<apptrian_info>
|
97 |
-
<title>Info</title>
|
98 |
-
</apptrian_info>
|
99 |
-
<apptrian_minify>
|
100 |
-
<title>Minify HTML CSS JS</title>
|
101 |
-
</apptrian_minify>
|
102 |
-
</children>
|
103 |
-
</config>
|
104 |
-
</children>
|
105 |
-
</system>
|
106 |
-
</children>
|
107 |
-
</admin>
|
108 |
-
</resources>
|
109 |
-
</acl>
|
110 |
-
<translate>
|
111 |
-
<modules>
|
112 |
-
<Apptrian_Minify>
|
113 |
-
<files>
|
114 |
-
<default>Apptrian_Minify.csv</default>
|
115 |
-
</files>
|
116 |
-
</Apptrian_Minify>
|
117 |
-
</modules>
|
118 |
-
</translate>
|
119 |
-
</adminhtml>
|
120 |
-
|
121 |
-
<jobs>
|
122 |
-
<apptrian_minify_check>
|
123 |
-
<schedule>
|
124 |
-
<cron_expr>55 5 */15 * *</cron_expr>
|
125 |
-
</schedule>
|
126 |
-
<run>
|
127 |
-
<model>apptrian_minify/cron::check</model>
|
128 |
-
</run>
|
129 |
-
</apptrian_minify_check>
|
130 |
-
</jobs>
|
131 |
-
</crontab>
|
132 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Apptrian
|
5 |
+
* @package Apptrian_Minify
|
6 |
+
* @author Apptrian
|
7 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Apptrian_Minify>
|
14 |
+
<version>1.5.1</version>
|
15 |
+
</Apptrian_Minify>
|
16 |
+
</modules>
|
17 |
+
<global>
|
18 |
+
<helpers>
|
19 |
+
<apptrian_minify>
|
20 |
+
<class>Apptrian_Minify_Helper</class>
|
21 |
+
</apptrian_minify>
|
22 |
+
</helpers>
|
23 |
+
<models>
|
24 |
+
<apptrian_minify>
|
25 |
+
<class>Apptrian_Minify_Model</class>
|
26 |
+
</apptrian_minify>
|
27 |
+
</models>
|
28 |
+
<blocks>
|
29 |
+
<apptrian_minify>
|
30 |
+
<class>Apptrian_Minify_Block</class>
|
31 |
+
</apptrian_minify>
|
32 |
+
</blocks>
|
33 |
+
<resources>
|
34 |
+
<apptrian_minify_setup>
|
35 |
+
<setup>
|
36 |
+
<module>Apptrian_Minify</module>
|
37 |
+
</setup>
|
38 |
+
<connection>
|
39 |
+
<use>core_setup</use>
|
40 |
+
</connection>
|
41 |
+
</apptrian_minify_setup>
|
42 |
+
</resources>
|
43 |
+
</global>
|
44 |
+
<default>
|
45 |
+
<apptrian_minify>
|
46 |
+
<minify_html>
|
47 |
+
<enabled>0</enabled>
|
48 |
+
<max_minification>0</max_minification>
|
49 |
+
<compatibility>0</compatibility>
|
50 |
+
</minify_html>
|
51 |
+
<minify_css_js>
|
52 |
+
<remove_comments>0</remove_comments>
|
53 |
+
</minify_css_js>
|
54 |
+
</apptrian_minify>
|
55 |
+
</default>
|
56 |
+
<frontend>
|
57 |
+
<events>
|
58 |
+
<core_block_abstract_to_html_after>
|
59 |
+
<observers>
|
60 |
+
<apptrian_minify_core_block_abstract_to_html_after>
|
61 |
+
<class>apptrian_minify/observer</class>
|
62 |
+
<method>minifyBlockHtml</method>
|
63 |
+
</apptrian_minify_core_block_abstract_to_html_after>
|
64 |
+
</observers>
|
65 |
+
</core_block_abstract_to_html_after>
|
66 |
+
<controller_action_postdispatch>
|
67 |
+
<observers>
|
68 |
+
<apptrian_minify_controller_action_postdispatch>
|
69 |
+
<class>apptrian_minify/observer</class>
|
70 |
+
<method>minifyPageHtml</method>
|
71 |
+
</apptrian_minify_controller_action_postdispatch>
|
72 |
+
</observers>
|
73 |
+
</controller_action_postdispatch>
|
74 |
+
</events>
|
75 |
+
</frontend>
|
76 |
+
<admin>
|
77 |
+
<routers>
|
78 |
+
<adminhtml>
|
79 |
+
<args>
|
80 |
+
<modules>
|
81 |
+
<apptrian_minify after="Mage_Adminhtml">Apptrian_Minify_Adminhtml</apptrian_minify>
|
82 |
+
</modules>
|
83 |
+
</args>
|
84 |
+
</adminhtml>
|
85 |
+
</routers>
|
86 |
+
</admin>
|
87 |
+
<adminhtml>
|
88 |
+
<acl>
|
89 |
+
<resources>
|
90 |
+
<admin>
|
91 |
+
<children>
|
92 |
+
<system>
|
93 |
+
<children>
|
94 |
+
<config>
|
95 |
+
<children>
|
96 |
+
<apptrian_info>
|
97 |
+
<title>Info</title>
|
98 |
+
</apptrian_info>
|
99 |
+
<apptrian_minify>
|
100 |
+
<title>Minify HTML CSS JS</title>
|
101 |
+
</apptrian_minify>
|
102 |
+
</children>
|
103 |
+
</config>
|
104 |
+
</children>
|
105 |
+
</system>
|
106 |
+
</children>
|
107 |
+
</admin>
|
108 |
+
</resources>
|
109 |
+
</acl>
|
110 |
+
<translate>
|
111 |
+
<modules>
|
112 |
+
<Apptrian_Minify>
|
113 |
+
<files>
|
114 |
+
<default>Apptrian_Minify.csv</default>
|
115 |
+
</files>
|
116 |
+
</Apptrian_Minify>
|
117 |
+
</modules>
|
118 |
+
</translate>
|
119 |
+
</adminhtml>
|
120 |
+
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Apptrian/Minify/etc/system.xml
CHANGED
@@ -1,154 +1,144 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* @category
|
5 |
-
* @package
|
6 |
-
* @author
|
7 |
-
* @copyright
|
8 |
-
* @license
|
9 |
-
*/
|
10 |
-
-->
|
11 |
-
<config>
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
<sections>
|
19 |
-
<apptrian_info translate="label">
|
20 |
-
<label>Info</label>
|
21 |
-
<tab>apptrian_extensions</tab>
|
22 |
-
<frontend_type>text</frontend_type>
|
23 |
-
<sort_order>1000000</sort_order>
|
24 |
-
<show_in_default>1</show_in_default>
|
25 |
-
<show_in_website>1</show_in_website>
|
26 |
-
<show_in_store>1</show_in_store>
|
27 |
-
<groups>
|
28 |
-
<info>
|
29 |
-
<frontend_model>apptrian_minify/
|
30 |
-
<sort_order>1</sort_order>
|
31 |
-
<show_in_default>1</show_in_default>
|
32 |
-
<show_in_website>1</show_in_website>
|
33 |
-
<show_in_store>1</show_in_store>
|
34 |
-
</info>
|
35 |
-
</groups>
|
36 |
-
</apptrian_info>
|
37 |
-
<apptrian_minify translate="label" >
|
38 |
-
<label>Minify HTML CSS JS</label>
|
39 |
-
<tab>apptrian_extensions</tab>
|
40 |
-
<frontend_type>text</frontend_type>
|
41 |
-
<sort_order>1</sort_order>
|
42 |
-
<show_in_default>1</show_in_default>
|
43 |
-
<show_in_website>1</show_in_website>
|
44 |
-
<show_in_store>1</show_in_store>
|
45 |
-
<groups>
|
46 |
-
|
47 |
-
|
48 |
-
<
|
49 |
-
<
|
50 |
-
<
|
51 |
-
<
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
<
|
73 |
-
<label>
|
74 |
-
<frontend_type>select</frontend_type>
|
75 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
-
<sort_order>
|
77 |
-
<show_in_default>1</show_in_default>
|
78 |
-
<show_in_website>1</show_in_website>
|
79 |
-
<show_in_store>1</show_in_store>
|
80 |
-
<comment><![CDATA[Enables or disables HTML
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
<
|
88 |
-
<
|
89 |
-
<
|
90 |
-
<
|
91 |
-
<
|
92 |
-
<
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
<
|
123 |
-
<
|
124 |
-
<sort_order>
|
125 |
-
<show_in_default>1</show_in_default>
|
126 |
-
<show_in_website>0</show_in_website>
|
127 |
-
<show_in_store>0</show_in_store>
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
<
|
133 |
-
<
|
134 |
-
<
|
135 |
-
<
|
136 |
-
<
|
137 |
-
<
|
138 |
-
</
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
<show_in_website>0</show_in_website>
|
146 |
-
<show_in_store>0</show_in_store>
|
147 |
-
<comment><![CDATA[WARNING! Follow instructions on the top.]]></comment>
|
148 |
-
</minify_files>
|
149 |
-
</fields>
|
150 |
-
</minify_css_js>
|
151 |
-
</groups>
|
152 |
-
</apptrian_minify>
|
153 |
-
</sections>
|
154 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Apptrian
|
5 |
+
* @package Apptrian_Minify
|
6 |
+
* @author Apptrian
|
7 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<tabs>
|
13 |
+
<apptrian_extensions>
|
14 |
+
<label>Apptrian Extensions</label>
|
15 |
+
<sort_order>100</sort_order>
|
16 |
+
</apptrian_extensions>
|
17 |
+
</tabs>
|
18 |
+
<sections>
|
19 |
+
<apptrian_info translate="label">
|
20 |
+
<label>Info</label>
|
21 |
+
<tab>apptrian_extensions</tab>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1000000</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<groups>
|
28 |
+
<info>
|
29 |
+
<frontend_model>apptrian_minify/adminhtml_info</frontend_model>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</info>
|
35 |
+
</groups>
|
36 |
+
</apptrian_info>
|
37 |
+
<apptrian_minify translate="label" >
|
38 |
+
<label>Minify HTML CSS JS</label>
|
39 |
+
<tab>apptrian_extensions</tab>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>1</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<groups>
|
46 |
+
<about>
|
47 |
+
<frontend_model>apptrian_minify/adminhtml_about</frontend_model>
|
48 |
+
<sort_order>1</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</about>
|
53 |
+
<minify_html translate="label comment">
|
54 |
+
<label>Minify HTML</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>2</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<comment><![CDATA[<h4>WARNING! Use validator to check your pages code before using our extension. You must have error-free HTML code if you want minification to work.</h4>]]></comment>
|
61 |
+
<fields>
|
62 |
+
<enabled translate="label comment">
|
63 |
+
<label>Minify HTML</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>1</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
<comment><![CDATA[Enables or disables HTML minification.<br />WARNING! Before you enable this option you must have valid HTML code on all of the pages on your site. Use W3C Validator to check.]]></comment>
|
71 |
+
</enabled>
|
72 |
+
<max_minification translate="label comment tooltip">
|
73 |
+
<label>Enable Maximum Minification</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
+
<sort_order>2</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment><![CDATA[Enables or disables Maximum HTML Minification.<br />WARNING! Slower and unsafe. See tooltip for more information.]]></comment>
|
81 |
+
<tooltip>If you enable this option all multiple spaces will be eliminated and replaced with one space. All new line characters will be substituted with one space character. Your entire code will be on one line. This is not recommended, you should keep this option disabled.</tooltip>
|
82 |
+
<depends>
|
83 |
+
<enabled>1</enabled>
|
84 |
+
</depends>
|
85 |
+
</max_minification>
|
86 |
+
<compatibility translate="label comment">
|
87 |
+
<label>Enable Cache Compatibility Mode</label>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
90 |
+
<sort_order>3</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
<comment><![CDATA[Enables or disables Cache Compatibility Mode.<br />WARNING! You should enable this if you use third party FPC or Varnish cache extensions.]]></comment>
|
95 |
+
<depends>
|
96 |
+
<enabled>1</enabled>
|
97 |
+
</depends>
|
98 |
+
</compatibility>
|
99 |
+
</fields>
|
100 |
+
</minify_html>
|
101 |
+
<minify_css_js translate="label comment">
|
102 |
+
<label>Minify CSS and JavaScript</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<sort_order>3</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
<comment><![CDATA[<h4>WARNING! Use validators to check your pages code before using our extension. You must have error-free code in your CSS and JS files if you want minification to work.</h4><p>1. Enable <strong>System > Configuration > Developer > CSS Settings > Merge CSS Files</strong><br />2. Enable <strong>System > Configuration > Developer > JavaScript Settings > Merge JavaScript Files</strong><br />3. Flush and Refresh Magento cache <strong>System > Cache Management</strong><br />4. Visit several pages of your site on the frontend and wait for them to fully load. (Visit home page, one CMS page, one category page, one product page, cart page, and checkout page. This is done so Magento default merger can merge CSS and JS files, and some extensions add CSS and/or JS files only on specific pages not globally.)<br />5. Click <strong>Minify</strong> button and wait for CSS/JS files to be minified.<br />6. If you are using <strong>Expires</strong> header for CSS and JS files remember to empty your web browser's cache.<br />7. If you are using <strong>CDN</strong> make sure you flush/empty CDN cache.</p><p>(Our extension scans following directories:<br /><strong>/media/css/</strong><br /><strong>/media/css_secure/</strong><br /><strong>/media/js/</strong><br />for CSS and JS files and minifies them. If after minification your pages break or show any errors, just delete all files from above mentioned directories. This happens when there are errors in CSS and JS files. Use validators to check your CSS and JS code, find errors and fix them before you use our extension.)</p>]]></comment>
|
109 |
+
<fields>
|
110 |
+
<remove_comments translate="label comment tooltip">
|
111 |
+
<label>Remove Important Comments</label>
|
112 |
+
<frontend_type>select</frontend_type>
|
113 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
+
<sort_order>1</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>0</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
<comment><![CDATA[WARNING! See tooltip for more information.]]></comment>
|
119 |
+
<tooltip>If you enable this option important comments will be removed. Sometimes important comments hold copyright information and removing them is considered copyright infringement violation. If you are sure your CSS and JS files do not have important comments with copyright information you can enable this option.</tooltip>
|
120 |
+
</remove_comments>
|
121 |
+
<heading_minify_files translate="label">
|
122 |
+
<label>Minify CSS and JavaScript Files</label>
|
123 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
124 |
+
<sort_order>2</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>0</show_in_website>
|
127 |
+
<show_in_store>0</show_in_store>
|
128 |
+
</heading_minify_files>
|
129 |
+
<minify_files translate="label comment">
|
130 |
+
<label>Minify</label>
|
131 |
+
<frontend_type>button</frontend_type>
|
132 |
+
<frontend_model>apptrian_minify/adminhtml_button_minify</frontend_model>
|
133 |
+
<sort_order>3</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>0</show_in_website>
|
136 |
+
<show_in_store>0</show_in_store>
|
137 |
+
<comment><![CDATA[WARNING! Follow instructions on the top.]]></comment>
|
138 |
+
</minify_files>
|
139 |
+
</fields>
|
140 |
+
</minify_css_js>
|
141 |
+
</groups>
|
142 |
+
</apptrian_minify>
|
143 |
+
</sections>
|
144 |
+
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Apptrian_Minify.xml
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* @category
|
5 |
-
* @package
|
6 |
-
* @author
|
7 |
-
* @copyright
|
8 |
-
* @license
|
9 |
-
*/
|
10 |
-
-->
|
11 |
-
<config>
|
12 |
-
<modules>
|
13 |
-
<Apptrian_Minify>
|
14 |
-
<active>true</active>
|
15 |
-
<codePool>community</codePool>
|
16 |
-
<depends>
|
17 |
-
<Mage_Core />
|
18 |
-
<Mage_Page />
|
19 |
-
</depends>
|
20 |
-
</Apptrian_Minify>
|
21 |
-
</modules>
|
22 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Apptrian
|
5 |
+
* @package Apptrian_Minify
|
6 |
+
* @author Apptrian
|
7 |
+
* @copyright Copyright (c) 2016 Apptrian (http://www.apptrian.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Apptrian_Minify>
|
14 |
+
<active>true</active>
|
15 |
+
<codePool>community</codePool>
|
16 |
+
<depends>
|
17 |
+
<Mage_Core />
|
18 |
+
<Mage_Page />
|
19 |
+
</depends>
|
20 |
+
</Apptrian_Minify>
|
21 |
+
</modules>
|
22 |
+
</config>
|
package.xml
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Apptrian_Minify_HTML_CSS_JS</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Minify HTML CSS JS including inline CSS/JS and speed up your site. Works with default Magento CSS/JS merger.</summary>
|
10 |
<description>Apptrian Minify HTML CSS JS is a very small and efficient extension. It will minify HTML including inline CSS and JS code. Minification of CSS and JS files is compatible with default Magento CSS and JS file merger. There are no complex setups nor query strings on minified CSS and JS files. Extension is very easy to install and use. Compatible with FPC and Varnish cache extensions.</description>
|
11 |
-
<notes
|
12 |
-
*
|
13 |
<authors><author><name>Apptrian</name><user>apptrian</user><email>apptrian@yahoo.com</email></author></authors>
|
14 |
-
<date>
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Apptrian"><dir name="Minify"><dir name="Block"><file name="About.php" hash="
|
17 |
<compatible/>
|
18 |
-
<dependencies><required><php><min>5.1.0</min><max>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Apptrian_Minify_HTML_CSS_JS</name>
|
4 |
+
<version>1.5.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Minify HTML CSS JS including inline CSS/JS and speed up your site. Works with default Magento CSS/JS merger.</summary>
|
10 |
<description>Apptrian Minify HTML CSS JS is a very small and efficient extension. It will minify HTML including inline CSS and JS code. Minification of CSS and JS files is compatible with default Magento CSS and JS file merger. There are no complex setups nor query strings on minified CSS and JS files. Extension is very easy to install and use. Compatible with FPC and Varnish cache extensions.</description>
|
11 |
+
<notes>* Fixed few small issues with admin blocks
|
12 |
+
* Code standards improvements</notes>
|
13 |
<authors><author><name>Apptrian</name><user>apptrian</user><email>apptrian@yahoo.com</email></author></authors>
|
14 |
+
<date>2016-07-14</date>
|
15 |
+
<time>17:35:13</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Apptrian"><dir name="Minify"><dir name="Block"><dir name="Adminhtml"><file name="About.php" hash="8cd6fbcad4b309fd76b26a03e4a701d6"/><dir name="Button"><file name="Minify.php" hash="038c7a7de95baeb5b854622ae405b78b"/></dir><file name="Info.php" hash="9fda14526121a82265bf55dd60f70849"/></dir></dir><dir name="Helper"><file name="Data.php" hash="0a6fb118bc333bf44be76cd4146eb25c"/></dir><dir name="Model"><file name="Observer.php" hash="fd59c9d0fb80792e29389917b1ccc570"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Apptrian"><file name="MinifyController.php" hash="c40273a5d2949c12e2996246655c9166"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="75eb86af50c81c2e2f8003864c319dfa"/><file name="system.xml" hash="aa192a307897903db8715e185cde4260"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Apptrian_Minify.xml" hash="d51ecf2afc48da4417b9e9c5b2777df0"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Apptrian_Minify.csv" hash="694d5a244eeaaa7293520581b82ffcf7"/></dir></target><target name="magelib"><dir name="HTTP"><file name="ConditionalGet.php" hash="84d5f4e0b97e37228310a31a4bdc1240"/><file name="Encoder.php" hash="d697f04651d6363d1dd5dd8c2ce94cbd"/></dir><dir name="Minify"><file name="Build.php" hash="99800ab664e1fb0ff46a7133ab13bb1b"/><dir name="CSS"><file name="Compressor.php" hash="6f1d5d8c3f7ac47cabaca9d6ee923206"/><file name="UriRewriter.php" hash="d6c800c1b9b0603c3386f84074bc41a0"/></dir><file name="CSS.php" hash="c585f82e0a6f8af12da2d3337aa7e901"/><file name="CSSmin.php" hash="7e0549e63f49b99aac0f6688bfcf99ef"/><dir name="Cache"><file name="APC.php" hash="f83c096f1ea3eb712bf020371b7d3755"/><file name="File.php" hash="5550b7ad5d3cc20710a0835fdf20e3ec"/><file name="Memcache.php" hash="a572e300270f5cdb535de67eb1d9ce3b"/><file name="WinCache.php" hash="037003b972c8f648880b43b2c912afb7"/><file name="XCache.php" hash="a3239040e672955a8a520eef6e251d68"/><file name="ZendPlatform.php" hash="a20755bc554cfef6733ac64574c4f90e"/></dir><file name="ClosureCompiler.php" hash="0d04a74dae339bd8d2d0465503590819"/><file name="CommentPreserver.php" hash="f9fbae74aea3125d25f375942846d9c0"/><dir name="Controller"><file name="Base.php" hash="756cd27141da15f6bc0a9d34960e0338"/><file name="Files.php" hash="a0bc419aa48d256e19a64596dee53991"/><file name="Groups.php" hash="bf35ccd3d384c40033b978a402eaf917"/><file name="MinApp.php" hash="0910bc4af5280098b8411a8a23aa3e91"/><file name="Page.php" hash="c54a4b19474f9d0e9beb8ccb4e3678b3"/><file name="Version1.php" hash="0e4bce53a0b66c79aa6d15e52cf8ec50"/></dir><file name="DebugDetector.php" hash="d1bee7f6ab4dcf7be5d36dbcd1b81354"/><dir name="HTML"><file name="Helper.php" hash="af89e2e30f70dd935dd86d31649159e6"/></dir><file name="HTML.php" hash="35190e3378ff263774eb9cf975de22f0"/><file name="HTMLComp.php" hash="4435690b51daba79b367b57ffb930aa5"/><file name="HTMLMax.php" hash="355bd23860d3856bed6242c59b69fa19"/><file name="HTMLMaxComp.php" hash="2335b33c4014ae96046deb41ff1e17e2"/><file name="ImportProcessor.php" hash="075c561afa4825021fa44c3cac68ab94"/><dir name="JS"><file name="ClosureCompiler.php" hash="0d6d0017c3b9decdf0e1f647c0b53f17"/></dir><file name="Lines.php" hash="526499d43d682432dac9483da4509179"/><file name="Loader.php" hash="5e84b0e739587d8df742f47953f135d5"/><file name="Logger.php" hash="ee493543ebb47aa06f976f23a0f3d86a"/><file name="Packer.php" hash="e91f63a82c4fbd660c2341163e87dd4b"/><file name="Source.php" hash="f7055f963f00e5ae9f5b0005d5e4a5ec"/><dir name="YUI"><file name="CssCompressor.java" hash="cb15a586f2dcc4fead535bc982e3f91e"/><file name="CssCompressor.php" hash="12d5b4e38488c68bc84cc0efba6eb338"/></dir><file name="YUICompressor.php" hash="3ada081677d0cf118bba1f4b533b97cf"/></dir><dir name="."><file name="CSSmin.php" hash="b88ddd36d0ff681aa8a221467c0c71c1"/><file name="DooDigestAuth.php" hash="9d66abc8cfa37b5f593fc09c734f0269"/><file name="FirePHP.php" hash="f619b5a77fee4b21e4397e98d858fbf4"/><file name="JavaScriptPacker.php" hash="84900da372a375d3b2f117c5abe740a9"/><file name="JSMin.php" hash="63ada69cc753fe4136c67e1d3daabca3"/><file name="JSMinMax.php" hash="2fed0d2f38ae28220da56216ec2fe38f"/><file name="JSMinPlus.php" hash="13d47b54dd73ef825e5d86e6cc633e32"/><file name="Minify.php" hash="df50518e69c132b1354eb8ba73a8ed7c"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.1.0</min><max>8.0.0</max></php></required></dependencies>
|
19 |
</package>
|