RazvanMocanu_Devtools - Version 0.0.2

Version Notes

Display block data:
- block name
- block template
- block data

Easy inspect block parte/children.

Download this release

Release Info

Developer Razvan Mocanu
Extension RazvanMocanu_Devtools
Version 0.0.2
Comparing to
See all releases


Code changes from version 0.0.1 to 0.0.2

app/code/community/RazvanMocanu/Devtools/Helper/Data.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- class RazvanMocanu_Devtools_Helper_Data extends Mage_Core_Helper_Abstract {
4
-
5
- public function isEnabled() {
6
- return Mage::getStoreConfig('weltpixel_newsletter/general/enable');
7
- }
8
-
9
- /**
10
- * 1 - All Pages
11
- * 0 - Just on Home Page
12
- */
13
- public function getDisplayMode() {
14
- return Mage::getStoreConfig('weltpixel_newsletter/general/display_options');
15
- }
16
-
17
- public function getDisplayBlock() {
18
- return Mage::getStoreConfig('weltpixel_newsletter/general/display_block');
19
- }
20
-
21
- public function getLifeTime() {
22
- return Mage::getStoreConfig('weltpixel_newsletter/general/popup_cookie_lifetime');
23
- }
24
-
25
- public function isAnalyticsTrackingEnabled() {
26
- return Mage::getStoreConfig('weltpixel_newsletter/general/google_analytics_tracking');
27
- }
28
-
29
- public function geNewsletterSignupSuccess() {
30
- return Mage::getStoreConfig('weltpixel_newsletter/general/newsletter_signup_success');
31
- }
32
-
33
- public function getCookieName() {
34
- return 'weltpixel_newsletter';
35
- }
36
-
37
- public function canShowPopup() {
38
- $NisAjax = !Mage::app()->getRequest()->isAjax();
39
- $enabled = $this->isEnabled();
40
- $dOption = $this->getDisplayMode();
41
- //check if you are on home page
42
- $weAreOnHomePage = (Mage::getUrl('') == Mage::getUrl('*/*/*', array('_current' => true, '_use_rewrite' => true))) ? 1 : 0;
43
-
44
- if ($dOption == 1) {
45
- return ( $enabled && $NisAjax );
46
- } else {
47
- //check if you are on home page
48
- return ( $enabled && $NisAjax && $weAreOnHomePage );
49
- }
50
- }
51
-
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/Model/Booleanselect.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- class RazvanMocanu_Devtools_Model_Booleanselect
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- array('value' => true, 'label' => Mage::helper('devtools')->__('Enabled')),
9
- array('value' => false, 'label' => Mage::helper('devtools')->__('Disabled')),
10
- );
11
- }
12
-
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/Model/Observer.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
- class RazvanMocanu_Devtools_Model_Observer extends Varien_Event_Observer
3
- {
4
- public function __construct()
5
- {
6
- }
7
- public function highlightBlocks($observer)
8
- {
9
-
10
- if((Mage::getDesign()->getArea() == 'frontend') && (Mage::getStoreConfig('devtools_options/block_info_settings/block_info_enabled'))) {
11
-
12
- $argBefore = $observer->getBlock()->getYourCustomParam();
13
-
14
- $_currentBlock = $observer->getBlock();
15
- $_blockName = $_currentBlock->getNameInLayout();
16
- $_blockTemplate = $_currentBlock->getTemplate();
17
-
18
- // get config for encapsulating tag
19
- $_wrapperTag = Mage::getStoreConfig('devtools_options/block_info_settings/tag_select');
20
- if($_wrapperTag == null) {
21
- $_wrapperTag = 'comment';
22
- }
23
-
24
- if(($_blockName == 'root') || ($_blockName == 'head') || (($_currentBlock->getParentBlock() != null) && ($_currentBlock->getParentBlock()->getNameInLayout() == 'head'))) {
25
- $_wrapperTag = 'comment';
26
- }
27
-
28
- // get config for show_block_name
29
- $_showBlockName = Mage::getStoreConfig('devtools_options/block_info_settings/show_block_name');
30
- // prepare content for block name
31
- $_blockNameContent = '';
32
- if($_showBlockName) {
33
- $_blockNameContent = ' BlockName="'.$_blockName.'"';
34
- }
35
-
36
- // get config for show_block_template
37
- $_showTemplate = Mage::getStoreConfig('devtools_options/block_info_settings/show_block_template');
38
- // prepare content for block name
39
- $_blockTemplateContent = '';
40
- if($_showTemplate) {
41
- $_blockTemplateContent = ' BlockTemplate="'.$_blockTemplate.'"';
42
- }
43
-
44
- // get config for show_block_data
45
- $_showData = Mage::getStoreConfig('devtools_options/block_info_settings/show_block_data');
46
- // prepare content for block data
47
- $_blockDataContent = '';
48
- if($_showData) {
49
-
50
- $_currentData = '';
51
-
52
- //get first level of data in array
53
- //if the value is array it will not be parsed
54
- foreach($_currentBlock->debug() as $key=>$value){
55
- if($key != "text") {$_currentData .= $key . ':' . $value .'; ';}
56
- }
57
-
58
- $_blockDataContent = ' Data="'.$_currentData.'"';
59
- }
60
-
61
- $normalOutput = $observer->getTransport()->getHtml();
62
-
63
- if($_wrapperTag == 'comment') {
64
- $normalOutput = '<!-- Begin'.$_blockNameContent.$_blockTemplateContent.$_blockDataContent.' -->'."\n".$normalOutput."\n".'<!-- End'.$_blockNameContent.' -->';
65
- }
66
-
67
- if($_wrapperTag == 'section') {
68
- $normalOutput = '<section'.$_blockNameContent.$_blockTemplateContent.$_blockDataContent.'>'."\n".$normalOutput."\n".'</section>';
69
- }
70
-
71
- if($_wrapperTag == 'div') {
72
- $normalOutput = '<div'.$_blockNameContent.$_blockTemplateContent.$_blockDataContent.'>'."\n".$normalOutput."\n".'</div>';
73
- }
74
-
75
- $observer->getTransport()->setHtml( $argBefore . $normalOutput );
76
-
77
- }
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/Model/Tagselect.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
-
3
- class RazvanMocanu_Devtools_Model_Tagselect
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- array('value' => 'comment', 'label' => Mage::helper('devtools')->__('Comment block')),
9
- array('value' => 'section', 'label' => Mage::helper('devtools')->__('Section')),
10
- array('value' => 'div', 'label' => Mage::helper('devtools')->__('Div')),
11
- );
12
- }
13
-
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/RazvanMocanu_Devtools.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <RazvanMocanu_Devtools>
5
- <active>active</active>
6
- <codePool>community</codePool>
7
- </RazvanMocanu_Devtools>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/etc/config.xml DELETED
@@ -1,52 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <RazvanMocanu_Devtools>
5
- <version>0.0.1</version>
6
- </RazvanMocanu_Devtools>
7
- </modules>
8
- <global>
9
- <models>
10
- <razvanMocanu_devtools>
11
- <class>RazvanMocanu_Devtools_Model</class>
12
- </razvanMocanu_devtools>
13
- </models>
14
- <helpers>
15
- <devtools>
16
- <class>RazvanMocanu_Devtools_Helper</class>
17
- </devtools>
18
- </helpers>
19
- <events>
20
- <core_block_abstract_to_html_after>
21
- <observers>
22
- <RazvanMocanu_Devtools_Model_Observer>
23
- <type>singleton</type>
24
- <class>razvanMocanu_devtools/observer</class>
25
- <method>highlightBlocks</method>
26
- </RazvanMocanu_Devtools_Model_Observer>
27
- </observers>
28
- </core_block_abstract_to_html_after>
29
- </events>
30
- </global>
31
- <adminhtml>
32
- <acl>
33
- <resources>
34
- <admin>
35
- <children>
36
- <system>
37
- <children>
38
- <config>
39
- <children>
40
- <devtools_options>
41
- <title>Razvan Mocanu Devtools</title>
42
- </devtools_options>
43
- </children>
44
- </config>
45
- </children>
46
- </system>
47
- </children>
48
- </admin>
49
- </resources>
50
- </acl>
51
- </adminhtml>
52
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/RazvanMocanu/Devtools/etc/system.xml DELETED
@@ -1,82 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <razvanmocanu translate="label" module="devtools">
5
- <label>Razvan Mocanu Devtools</label>
6
- <sort_order>150</sort_order>
7
- </razvanmocanu>
8
- </tabs>
9
- <sections>
10
- <devtools_options translate="label" module="devtools">
11
- <label>Devtools Config Options</label>
12
- <tab>razvanmocanu</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>1000</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <block_info_settings translate="label">
20
- <label>Devtools Block Info</label>
21
- <frontend_type>text</frontend_type>
22
- <sort_order>1</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <fields>
27
- <block_info_enabled>
28
- <label>Enable Block Info</label>
29
- <frontend_type>select</frontend_type>
30
- <source_model>razvanMocanu_devtools/booleanselect</source_model>
31
- <comment>If enabled this will add information about each block in the HTML source. Below you can configure which information is added.</comment>
32
- <sort_order>1</sort_order>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>1</show_in_store>
36
- </block_info_enabled>
37
- <tag_select>
38
- <label>Tag to use</label>
39
- <frontend_type>select</frontend_type>
40
- <source_model>razvanMocanu_devtools/tagselect</source_model>
41
- <comment>This tag will encapsulate the block. The root block, head block and children of head block will be encapsulated in comments regardless of this selection.</comment>
42
- <sort_order>2</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- </tag_select>
47
- <show_block_name>
48
- <label>Show Block Name</label>
49
- <frontend_type>select</frontend_type>
50
- <source_model>razvanMocanu_devtools/booleanselect</source_model>
51
- <comment>If enabled the block name will be included as attribute in the encapsulating tag.</comment>
52
- <sort_order>3</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- </show_block_name>
57
- <show_block_template>
58
- <label>Show Block Template</label>
59
- <frontend_type>select</frontend_type>
60
- <source_model>razvanMocanu_devtools/booleanselect</source_model>
61
- <comment>If enabled the block template will be included as attribute in the encapsulating tag.</comment>
62
- <sort_order>4</sort_order>
63
- <show_in_default>1</show_in_default>
64
- <show_in_website>1</show_in_website>
65
- <show_in_store>1</show_in_store>
66
- </show_block_template>
67
- <show_block_data>
68
- <label>Show Block Template</label>
69
- <frontend_type>select</frontend_type>
70
- <source_model>razvanMocanu_devtools/booleanselect</source_model>
71
- <comment>If enabled the block data will be included as attribute in the encapsulating tag.</comment>
72
- <sort_order>5</sort_order>
73
- <show_in_default>1</show_in_default>
74
- <show_in_website>1</show_in_website>
75
- <show_in_store>1</show_in_store>
76
- </show_block_data>
77
- </fields>
78
- </block_info_settings>
79
- </groups>
80
- </devtools_options>
81
- </sections>
82
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/RazvanMocanu_Devtools.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <RazvanMocanu_Devtools>
5
- <active>active</active>
6
- <codePool>community</codePool>
7
- </RazvanMocanu_Devtools>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,23 +1,27 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RazvanMocanu_Devtools</name>
4
- <version>0.0.1</version>
5
  <stability>stable</stability>
6
- <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Inserts block information inside the HTML source.</summary>
10
  <description>This module wraps each block in comment tags and ads information about the block like name, template and data.&#xD;
11
  &#xD;
12
  This allows the developer to quickly identify blocks and find the associated templates.&#xD;
13
  &#xD;
14
  It doesn't work as the template hints. All the information is contained inside the HTLM which you can inspect with the browser.</description>
15
- <notes>This extension was made for my personal use.&#xD;
16
- If you find it useful or think it should contain other features, feel free to contact me.</notes>
 
 
 
 
17
  <authors><author><name>Razvan Mocanu</name><user>razvan_mocanu</user><email>razvan_mocanu@yahoo.com</email></author></authors>
18
- <date>2014-06-17</date>
19
- <time>14:07:45</time>
20
- <contents><target name="magecommunity"><dir name="RazvanMocanu"><dir name="Devtools"><dir name="Helper"><file name="Data.php" hash="78ed86e7cea80cfc913e8c9a35cc9a83"/></dir><dir name="Model"><file name="Booleanselect.php" hash="8e8c9f59d97b9fe67291b93c4e59da7c"/><file name="Observer.php" hash="912dbe981db1ccc8d397715a3f2f94e1"/><file name="Tagselect.php" hash="29c03ea79a9567aedd52652c7cd499ae"/></dir><file name="RazvanMocanu_Devtools.xml" hash="ddb82da5aa2c298e79a7cfff58985999"/><dir name="etc"><file name="config.xml" hash="1f2701a40483a5456a68643fedc14af7"/><file name="system.xml" hash="05c653ed0160d9da9d2de920e6bcc748"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RazvanMocanu_Devtools.xml" hash="ddb82da5aa2c298e79a7cfff58985999"/></dir></target></contents>
21
  <compatible/>
22
- <dependencies><required><php><min>5.2.0</min><max>5.5.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RazvanMocanu_Devtools</name>
4
+ <version>0.0.2</version>
5
  <stability>stable</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>See extended block information inside the HTML source.</summary>
10
  <description>This module wraps each block in comment tags and ads information about the block like name, template and data.&#xD;
11
  &#xD;
12
  This allows the developer to quickly identify blocks and find the associated templates.&#xD;
13
  &#xD;
14
  It doesn't work as the template hints. All the information is contained inside the HTLM which you can inspect with the browser.</description>
15
+ <notes>Display block data:&#xD;
16
+ - block name&#xD;
17
+ - block template&#xD;
18
+ - block data&#xD;
19
+ &#xD;
20
+ Easy inspect block parte/children.</notes>
21
  <authors><author><name>Razvan Mocanu</name><user>razvan_mocanu</user><email>razvan_mocanu@yahoo.com</email></author></authors>
22
+ <date>2014-06-20</date>
23
+ <time>20:39:30</time>
24
+ <contents><target name="mageetc"><dir name="."><dir name="app"><dir name="etc"><dir name="modules"><file name="RazvanMocanu_Devtools.xml" hash=""/></dir></dir></dir></dir></target></contents>
25
  <compatible/>
26
+ <dependencies><required><php><min>1.5.2</min><max>1.5.5</max></php></required></dependencies>
27
  </package>