Codewix_IpBasedDevMode - Version 0.1.0

Version Notes

Initial Release

Download this release

Release Info

Developer Cueblocks
Extension Codewix_IpBasedDevMode
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Codewix/IpbasedDevmode/Helper/Data.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Codewix_IPbasedDevmode
4
+ * @author Ravinder <codewix@gmail.com>
5
+ */
6
+ class Codewix_IpbasedDevmode_Helper_Data extends Mage_Core_Helper_Abstract {
7
+
8
+ public function getConfig($field) {
9
+ return Mage::getStoreConfig("devmode/general/$field");
10
+ }
11
+
12
+ }
app/code/community/Codewix/IpbasedDevmode/Model/Observer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Codewix_IPbasedDevmode
4
+ * @author Ravinder <codewix@gmail.com>
5
+ */
6
+
7
+ class Codewix_IpbasedDevmode_Model_Observer {
8
+
9
+ public function controller_action_predispatch($observer) {
10
+ $helper = Mage::helper('ipbaseddevmode');
11
+ if($helper->getConfig('enable')) {
12
+ if(!empty($helper->getConfig('ip'))) {
13
+ $ip = explode(',',$helper->getConfig('ip'));
14
+ $userIp = $_SERVER['REMOTE_ADDR'];
15
+ if(in_array($userIp,$ip)) {
16
+ Mage::setIsDeveloperMode(true);
17
+ }
18
+ } else {
19
+ Mage::setIsDeveloperMode(true);
20
+ }
21
+
22
+ }
23
+
24
+ }
25
+
26
+ }
app/code/community/Codewix/IpbasedDevmode/etc/config.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Codewix_IpbasedDevmode>
5
+ <version>0.1.0</version>
6
+ </Codewix_IpbasedDevmode>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <ipbaseddevmode>
11
+ <class>Codewix_IpbasedDevmode_Model</class>
12
+ </ipbaseddevmode>
13
+ </models>
14
+ <blocks>
15
+ <ipbaseddevmode>
16
+ <class>Codewix_IpbasedDevmode_Block</class>
17
+ </ipbaseddevmode>
18
+ </blocks>
19
+ <helpers>
20
+ <ipbaseddevmode>
21
+ <class>Codewix_IpbasedDevmode_Helper</class>
22
+ </ipbaseddevmode>
23
+ </helpers>
24
+ <!--events>
25
+ <controller_front_init_before>
26
+ <observers>
27
+ <ipbaseddevmode>
28
+ <class>ipbaseddevmode/observer</class>
29
+ <method>controller_front_init_before</method>
30
+ </ipbaseddevmode>
31
+ </observers>
32
+ </controller_front_init_before>
33
+ </events-->
34
+ </global>
35
+ <frontend>
36
+ <events>
37
+ <controller_action_predispatch>
38
+ <observers>
39
+ <ipbaseddevmode>
40
+ <class>ipbaseddevmode/observer</class>
41
+ <method>controller_action_predispatch</method>
42
+ </ipbaseddevmode>
43
+ </observers>
44
+ </controller_action_predispatch>
45
+ </events>
46
+ </frontend>
47
+ <adminhtml>
48
+ <acl>
49
+ <resources>
50
+ <admin>
51
+ <children>
52
+ <system>
53
+ <children>
54
+ <config>
55
+ <children>
56
+ <devmode>
57
+ <title>Codewix IP Based Dev Mode</title>
58
+ </devmode>
59
+ </children>
60
+ </config>
61
+ </children>
62
+ </system>
63
+ </children>
64
+ </admin>
65
+ </resources>
66
+ </acl>
67
+ </adminhtml>
68
+ </config>
app/code/community/Codewix/IpbasedDevmode/etc/system.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <codewix_tab translate="label" module="ipbaseddevmode">
4
+ <label>Codewix</label>
5
+ <sort_order>0</sort_order>
6
+ </codewix_tab>
7
+ </tabs>
8
+ <sections>
9
+ <devmode translate="label" module="ipbaseddevmode">
10
+ <label>Developer Mode</label>
11
+ <tab>codewix_tab</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <general translate="label">
19
+ <label>General Configuration</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enable>
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <comment>Choose Yes/No</comment>
31
+ <default>1</default>
32
+ <sort_order>0</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
+ </enable>
37
+ <ip>
38
+ <label>Allowed Ip Addresses</label>
39
+ <frontend_type>textarea</frontend_type>
40
+ <comment>
41
+ Separate by comma in case of multiple values and leave it empty if you want to
42
+ allow method for all ip addresses
43
+ </comment>
44
+ <default>1</default>
45
+ <sort_order>1</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </ip>
50
+ </fields>
51
+ </general>
52
+ </groups>
53
+ </devmode>
54
+ </sections>
55
+ </config>
app/etc/modules/Codewix_IpbasedDevmode.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Codewix_IpbasedDevmode>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Codewix_IpbasedDevmode>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Codewix_IpBasedDevMode</name>
4
+ <version>0.1.0</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>This extension will allow to enable printing of exception errors for specific IP address.</summary>
10
+ <description>This extension will be very useful for developers as it will will enable printing exception error only for specific IP address. So a developer can enable developer mode from admin and print errors on frontend only for his IP address.</description>
11
+ <notes>Initial Release</notes>
12
+ <authors><author><name>Codewix</name><user>Ravinder</user><email>codewix@gmail.com</email></author></authors>
13
+ <date>2014-06-15</date>
14
+ <time>01:44:15</time>
15
+ <contents><target name="magecommunity"><dir name="Codewix"><dir name="IpbasedDevmode"><dir name="Helper"><file name="Data.php" hash="cdf1832b44b33c9bb4df3af99c1af839"/></dir><dir name="Model"><file name="Observer.php" hash="e809f652743b7183e700345441cd5989"/></dir><dir name="etc"><file name="config.xml" hash="cafbcb1e0a7040045c6b21bc190adcd2"/><file name="system.xml" hash="3b77a5c75556276d453f6b85095190ec"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Codewix_IpbasedDevmode.xml" hash="9bd1d8f17e99f76186e6c15f66fe13e3"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.2</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>