super-cache-hint - Version 1.0.0.1

Version Notes

Initial release.

Download this release

Release Info

Developer ESSE SOLUTIONS srl
Extension super-cache-hint
Version 1.0.0.1
Comparing to
See all releases


Version 1.0.0.1

app/code/community/Essesolutions/Supercachehint/Helper/Data.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ESSE SOLUTIONS srl
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@essesolutions.it so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Essesolutions
22
+ * @package Essesolutions_Supercachehint
23
+ * @copyright Copyright (c) 2011-2013 ESSE SOLUTIONS srl (http://www.essesolutions.it)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Marco Chinchio <marco.chinchio@essesolutions.it>
26
+ */
27
+
28
+ class Essesolutions_Supercachehint_Helper_Data extends Mage_Core_Helper_Abstract{}
app/code/community/Essesolutions/Supercachehint/Model/Observer.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ESSE SOLUTIONS srl
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@essesolutions.it so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Essesolutions
22
+ * @package Essesolutions_Supercachehint
23
+ * @copyright Copyright (c) 2011-2013 ESSE SOLUTIONS srl (http://www.essesolutions.it)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Marco Chinchio <marco.chinchio@essesolutions.it>
26
+ */
27
+
28
+ /**
29
+ * Block After Render Observer
30
+ *
31
+ * @category Essesolutions
32
+ * @package Essesolutions_Supercachehint
33
+ * @author Marco Chinchio <marco.chinchio@essesolutions.it>
34
+ */
35
+ class Essesolutions_Supercachehint_Model_Observer extends Mage_Core_Block_Template {
36
+
37
+ const XML_PATH_DEBUG_CACHE_HINTS = 'supercachehints/debug/template_hints';
38
+
39
+ protected static $_showCacheHints;
40
+
41
+ /**
42
+ * Event core_block_abstract_to_html_after
43
+ *
44
+ * @param Varien_Event_Observer $params
45
+ * @return void
46
+ * @author Fabrizio Branca
47
+ * @since 2011-01-24
48
+ */
49
+ public function core_block_abstract_to_html_after(Varien_Event_Observer $params) {
50
+
51
+ if (!$this->getShowCacheHints()) {
52
+ return;
53
+ }
54
+
55
+ $block = $params->getBlock();
56
+ $transport = $params->getTransport();
57
+
58
+ $wrappedHtml = $transport->getHtml();
59
+
60
+ $cacheLifeTime = $block->getCacheLifetime();
61
+
62
+ $info['cache-status'] = 'notcached';
63
+ if (!is_null($cacheLifeTime)) {
64
+ $info['cache-lifetime'] = (intval($cacheLifeTime) == 0) ? 'forever' : intval($cacheLifeTime) . ' sec';
65
+ $info['cache-key'] = $block->getCacheKey();
66
+ $info['tags'] = implode(',', $block->getCacheTags());
67
+ $info['cache-status'] = 'cached';
68
+ } elseif ($this->isWithinCachedBlock($block)) {
69
+ $info['cache-status'] = 'implicitly cached';
70
+ }
71
+
72
+ $wrappedHtml = '<div style="position:relative; border:1px dotted green; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
73
+ <div style="position:absolute; left:0; top:0; padding:2px 5px; background:green; color:white; font:normal 11px Arial;
74
+ text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'"
75
+ onmouseout="this.style.zIndex=\'998\'" title="'.$info['cache-status'].'">status = '.$info['cache-status'].($info['cache-status'] == 'cached' ? ' lifetime = ' . $info['cache-lifetime'] . ' key = ' . $info['cache-key'] . ' tags = ' .$info['tags'] : '').'</div>' . $wrappedHtml . '</div>';
76
+
77
+ $transport->setHtml($wrappedHtml);
78
+ }
79
+
80
+ protected function isWithinCachedBlock(Mage_Core_Block_Abstract $block) {
81
+ $step = $block;
82
+ while ($step instanceof Mage_Core_Block_Abstract) {
83
+ if (!is_null($step->getCacheLifetime())) {
84
+ return true;
85
+ }
86
+ $step = $step->getParentBlock();
87
+ }
88
+ return false;
89
+ }
90
+
91
+ protected function getShowCacheHints() {
92
+ if (is_null(self::$_showCacheHints)) {
93
+ self::$_showCacheHints = Mage::getStoreConfig(self::XML_PATH_DEBUG_CACHE_HINTS) && Mage::helper('core')->isDevAllowed();
94
+ }
95
+ return self::$_showCacheHints;
96
+ }
97
+
98
+ }
app/code/community/Essesolutions/Supercachehint/etc/config.xml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ESSE SOLUTIONS srl
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@essesolutions.it so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Essesolutions
22
+ * @package Essesolutions_Supercachehint
23
+ * @copyright Copyright (c) 2011-2013 ESSE SOLUTIONS srl (http://www.essesolutions.it)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Marco Chinchio <marco.chinchio@essesolutions.it>
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Essesolutions_Supercachehint>
31
+ <version>1.0.0.1</version>
32
+ </Essesolutions_Supercachehint>
33
+ </modules>
34
+ <global>
35
+ <models>
36
+ <supercachehints>
37
+ <class>Essesolutions_Supercachehint_Model</class>
38
+ </supercachehints>
39
+ </models>
40
+ <helpers>
41
+ <supercachehints>
42
+ <class>Essesolutions_Supercachehint_Helper</class>
43
+ </supercachehints>
44
+ </helpers>
45
+ <events>
46
+ <core_block_abstract_to_html_after>
47
+ <observers>
48
+ <core_block_abstract_to_html_after>
49
+ <type>singleton</type>
50
+ <class>Essesolutions_Supercachehint_Model_Observer</class>
51
+ <method>core_block_abstract_to_html_after</method>
52
+ </core_block_abstract_to_html_after>
53
+ </observers>
54
+ </core_block_abstract_to_html_after>
55
+ </events>
56
+ </global>
57
+ <adminhtml>
58
+ <acl>
59
+ <resources>
60
+ <admin>
61
+ <children>
62
+ <system>
63
+ <children>
64
+ <config>
65
+ <children>
66
+ <supercachehints>
67
+ <title>Template Cache Hints</title>
68
+ </supercachehints>
69
+ </children>
70
+ </config>
71
+ </children>
72
+ </system>
73
+ </children>
74
+ </admin>
75
+ </resources>
76
+ </acl>
77
+ </adminhtml>
78
+ </config>
app/code/community/Essesolutions/Supercachehint/etc/system.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * ESSE SOLUTIONS srl
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@essesolutions.it so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade this module to newer
19
+ * versions in the future.
20
+ *
21
+ * @category Essesolutions
22
+ * @package Essesolutions_Supercachehint
23
+ * @copyright Copyright (c) 2011-2013 ESSE SOLUTIONS srl (http://www.essesolutions.it)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @author Marco Chinchio <marco.chinchio@essesolutions.it>
26
+ */
27
+ -->
28
+ <config>
29
+ <tabs>
30
+ <essesolutions>
31
+ <label>ESSE SOLUTIONS</label>
32
+ <sort_order>320</sort_order>
33
+ </essesolutions>
34
+ </tabs>
35
+ <sections>
36
+ <supercachehints translate="label" module="supercachehints">
37
+ <label>Developer</label>
38
+ <tab>essesolutions</tab>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>30</sort_order>
41
+ <show_in_default>0</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <groups>
45
+ <debug>
46
+ <label>Cache Hints Settings</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>1</sort_order>
49
+ <show_in_default>0</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <fields>
53
+ <template_hints translate="label">
54
+ <label>Template Cache Hints</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <sort_order>10</sort_order>
58
+ <show_in_default>0</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </template_hints>
62
+ </fields>
63
+ </debug>
64
+ </groups>
65
+ </supercachehints>
66
+ </sections>
67
+ </config>
app/etc/modules/Essesolutions_Supercachehint.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Essesolutions_Supercachehint>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Essesolutions_Supercachehint>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>super-cache-hint</name>
4
+ <version>1.0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Super Cache Hint allows you to identify blocks within cache, find out where they are used and how long.</summary>
10
+ <description>Super Cache Hint is a free extension tha allows you to identify blocks within cache, find out where they are used and how long.&#xD;
11
+ &#xD;
12
+ Features:&#xD;
13
+ - Highlights block types.&#xD;
14
+ - Displays cache memory status and lifetime.&#xD;
15
+ - Doesn't need Magento core alterations.&#xD;
16
+ - Extends Magento functionalities.&#xD;
17
+ &#xD;
18
+ Super Cache Hint is a Esse Solutions (http://www.essesolutions.it) extension.</description>
19
+ <notes>Initial release.</notes>
20
+ <authors><author><name>ESSE SOLUTIONS srl</name><user>esse_solutions</user><email>magento@essesolutions.it</email></author></authors>
21
+ <date>2013-11-21</date>
22
+ <time>14:00:55</time>
23
+ <contents><target name="magecommunity"><dir name="Essesolutions"><dir name="Supercachehint"><dir name="Helper"><file name="Data.php" hash="29ba6657328794fad1cd3778f7ac2d23"/><file name="Data.php" hash="29ba6657328794fad1cd3778f7ac2d23"/><file name="Data.php" hash="29ba6657328794fad1cd3778f7ac2d23"/><file name="Data.php" hash="29ba6657328794fad1cd3778f7ac2d23"/></dir><dir name="Model"><file name="Observer.php" hash="e18cf755ce36fbf0b8e269fd85153706"/><file name="Observer.php" hash="e18cf755ce36fbf0b8e269fd85153706"/><file name="Observer.php" hash="e18cf755ce36fbf0b8e269fd85153706"/><file name="Observer.php" hash="e18cf755ce36fbf0b8e269fd85153706"/></dir><dir name="etc"><file name="config.xml" hash="e7c2797ab2e2fe2d077f0f49a7e80538"/><file name="system.xml" hash="ba73637dd1e7a7525703c968f76fb5d5"/><file name="config.xml" hash="e7c2797ab2e2fe2d077f0f49a7e80538"/><file name="system.xml" hash="ba73637dd1e7a7525703c968f76fb5d5"/><file name="config.xml" hash="e7c2797ab2e2fe2d077f0f49a7e80538"/><file name="system.xml" hash="ba73637dd1e7a7525703c968f76fb5d5"/><file name="config.xml" hash="e7c2797ab2e2fe2d077f0f49a7e80538"/><file name="system.xml" hash="ba73637dd1e7a7525703c968f76fb5d5"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Essesolutions_Supercachehint.xml" hash="ccc899d4d4bcf531a528f2b1a53d5116"/></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.8</max></package></required></dependencies>
26
+ </package>