Codewix_IpBasedDevMode - Version 0.1.1

Version Notes

Added feature to enable dev mode by adding query string to current url.

Download this release

Release Info

Developer Cueblocks
Extension Codewix_IpBasedDevMode
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/community/Codewix/IpbasedDevmode/Model/Observer.php CHANGED
@@ -9,13 +9,28 @@ class Codewix_IpbasedDevmode_Model_Observer {
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
 
9
  public function controller_action_predispatch($observer) {
10
  $helper = Mage::helper('ipbaseddevmode');
11
  if($helper->getConfig('enable')) {
12
+ $enable = false;
13
+ $ip = $helper->getConfig('ip');
14
+ if(!empty($ip)) {
15
  $ip = explode(',',$helper->getConfig('ip'));
16
  $userIp = $_SERVER['REMOTE_ADDR'];
17
  if(in_array($userIp,$ip)) {
18
+ $enable=true;
19
  }
20
  } else {
21
+ $enable = true;
22
+ }
23
+ $useParam = $helper->getConfig('useparam');
24
+ if($useParam) {
25
+ $param = $helper->getConfig('param');
26
+ $value = Mage::app()->getRequest()->getParam($param);
27
+ if($value == 'true') {
28
+ $enable=true;;
29
+ } else{
30
+ $enable=false;
31
+ }
32
+ }
33
+ if($enable) {
34
  Mage::setIsDeveloperMode(true);
35
  }
36
 
app/code/community/Codewix/IpbasedDevmode/etc/system.xml CHANGED
@@ -47,6 +47,33 @@
47
  <show_in_website>1</show_in_website>
48
  <show_in_store>1</show_in_store>
49
  </ip>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </fields>
51
  </general>
52
  </groups>
47
  <show_in_website>1</show_in_website>
48
  <show_in_store>1</show_in_store>
49
  </ip>
50
+ <useparam>
51
+ <label>Use Url Param</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>adminhtml/system_config_source_yesno</source_model>
54
+ <comment>
55
+ If this is set to 'Yes' then Developer mode will not be enabled automatically, you have to
56
+ use value of next setting to trigger developer mode ON.
57
+ </comment>
58
+ <default>1</default>
59
+ <sort_order>2</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </useparam>
64
+ <param>
65
+ <label>Url Param</label>
66
+ <frontend_type>text</frontend_type>
67
+ <comment>
68
+ Url param to be used to enable dev mode on front.For example if you enter 'dev' here the on
69
+ frontend it should be used as '?dev=true' after current page url.
70
+ </comment>
71
+ <default>1</default>
72
+ <sort_order>3</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
+ </param>
77
  </fields>
78
  </general>
79
  </groups>
package.xml CHANGED
@@ -1,18 +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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Codewix_IpBasedDevMode</name>
4
+ <version>0.1.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>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>Added feature to enable dev mode by adding query string to current url.</notes>
12
  <authors><author><name>Codewix</name><user>Ravinder</user><email>codewix@gmail.com</email></author></authors>
13
+ <date>2014-06-29</date>
14
+ <time>14:29:51</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="67a11373f36d7a6562e3d4a784db6f6f"/></dir><dir name="etc"><file name="config.xml" hash="cafbcb1e0a7040045c6b21bc190adcd2"/><file name="system.xml" hash="46e55943cd6608ee8febb4fd69fba4bb"/></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>