C3_Environment_Banner - Version 1.1.3

Version Notes


  • New feature: Adds window border on frontend similar to admin - makes current environment more obvious, especially when scrolling down

  • Bug fix: Changed helper code that was not compatible with php5.3

Download this release

Release Info

Developer C3 Media
Extension C3_Environment_Banner
Version 1.1.3
Comparing to
See all releases


Code changes from version 1.1.1 to 1.1.3

app/code/local/C3/EnvironmentBanner/Helper/Data.php CHANGED
@@ -29,7 +29,8 @@ class C3_EnvironmentBanner_Helper_Data extends Mage_Core_Helper_Abstract
29
  }
30
 
31
  // Check that the given environment is recognised, else false
32
- if (!isset($this->getEnvironments()[$this->getEnvironment()])) {
 
33
  return false;
34
  }
35
 
@@ -55,7 +56,8 @@ class C3_EnvironmentBanner_Helper_Data extends Mage_Core_Helper_Abstract
55
  }
56
 
57
  // Check that the given environment is recognised, else false
58
- if (!isset($this->getEnvironments()[$this->getEnvironment()])) {
 
59
  return false;
60
  }
61
 
@@ -97,10 +99,11 @@ class C3_EnvironmentBanner_Helper_Data extends Mage_Core_Helper_Abstract
97
  {
98
  // Lazily load colours from environment data
99
  if ($this->_colours === null) {
100
- if (!isset($this->getEnvironments()[$this->getEnvironment()])) {
 
101
  return null;
102
  }
103
- $data = $this->getEnvironments()[$this->getEnvironment()];
104
  $this->_colours = Mage::getModel('c3_environmentbanner/colours')
105
  ->setData($data);
106
  }
29
  }
30
 
31
  // Check that the given environment is recognised, else false
32
+ $environments = $this->getEnvironments();
33
+ if (!isset($environments[$this->getEnvironment()])) {
34
  return false;
35
  }
36
 
56
  }
57
 
58
  // Check that the given environment is recognised, else false
59
+ $environments = $this->getEnvironments();
60
+ if (!isset($environments[$this->getEnvironment()])) {
61
  return false;
62
  }
63
 
99
  {
100
  // Lazily load colours from environment data
101
  if ($this->_colours === null) {
102
+ $environments = $this->getEnvironments();
103
+ if (!isset($environments[$this->getEnvironment()])) {
104
  return null;
105
  }
106
+ $data = $environments[$this->getEnvironment()];
107
  $this->_colours = Mage::getModel('c3_environmentbanner/colours')
108
  ->setData($data);
109
  }
app/design/frontend/base/default/template/c3_environmentbanner/banner.phtml CHANGED
@@ -51,7 +51,58 @@ if ($helper->isDisplayFrontendBanner()):
51
  background-image: -o-linear-gradient(top, <?php echo $cols->getFeLighterBgcolor() ?>, <?php echo $cols->getFeBgcolor() ?>);
52
  color: <?php echo $cols->getFeColor() ?>;
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  </style>
55
- <div class="ribbon-wrapper" onclick="document.getElementById('envbanner').style.display = 'none';" id="envbanner"><div class="ribbon-inner <?php echo $env ?>" title="click to hide"><?php echo ucfirst($env) ?></div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  <?php endif; ?>
51
  background-image: -o-linear-gradient(top, <?php echo $cols->getFeLighterBgcolor() ?>, <?php echo $cols->getFeBgcolor() ?>);
52
  color: <?php echo $cols->getFeColor() ?>;
53
  }
54
+
55
+
56
+
57
+
58
+
59
+ .ebborder {
60
+ position:fixed;
61
+ z-index: 10000;
62
+ }
63
+ #ebtop,#ebbottom {
64
+ left:0;
65
+ width:100%;
66
+ height:3px;
67
+ }
68
+ #ebtop {
69
+ top:0;
70
+ }
71
+ #ebbottom {
72
+ bottom:0;
73
+ }
74
+ #ebleft,#ebright {
75
+ top:0;
76
+ height:100%;
77
+ width:3px;
78
+ }
79
+ #ebleft {
80
+ left:0;
81
+ }
82
+ #ebright {
83
+ right:0;
84
+ }
85
+
86
+ .ebborder {
87
+ background-color: <?php echo $cols->getBeBorderColor() ?>;
88
+ }
89
+
90
+
91
  </style>
92
+ <div class="ribbon-wrapper" onclick="document.getElementById('envbanner').style.display = 'none';
93
+ document.getElementById('ebtop').style.display = 'none';
94
+ document.getElementById('ebbottom').style.display = 'none';
95
+ document.getElementById('ebleft').style.display = 'none';
96
+ document.getElementById('ebright').style.display = 'none';
97
+ " id="envbanner"><div class="ribbon-inner <?php echo $env ?>" title="click to hide"><?php echo ucfirst($env) ?></div></div>
98
+
99
+
100
+
101
+ <div id="ebtop" class="ebborder"></div>
102
+ <div id="ebbottom" class="ebborder"></div>
103
+ <div id="ebleft" class="ebborder"></div>
104
+ <div id="ebright" class="ebborder"></div>
105
+
106
+
107
 
108
  <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>C3_Environment_Banner</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
@@ -11,7 +11,7 @@
11
  &#xD;
12
  &lt;p&gt;Have you ever performed an action - deleted a product or created a promotion live, only to realise that you've accidentally done it on the production site rather than a development copy? Be honest now.&lt;/p&gt;&#xD;
13
  &#xD;
14
- &lt;p&gt;If so, this extension is for you. It adds a discrete corner banner to the frontend of non-production websites (fail-safe - if it doesn't know what environment it is in then it assumes it is on a production server). It is more striking on the admin side, where the entire title bar is colour-coded, and a border added to the page so that no matter how long the page (I'm looking at you, system config), you'll always have a visual reminder of which environment you are in.&lt;/p&gt;&#xD;
15
  &#xD;
16
  &lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; The environment is picked up from the commonly used APPLICATION_ENV environment variable. This is set by the web-server, and for apache it just means adding in a single line to your .htaccess file. e.g.&#xD;
17
  SetEnv APPLICATION_ENV &amp;quot;staging&amp;quot;&lt;/p&gt;&#xD;
@@ -20,16 +20,18 @@ SetEnv APPLICATION_ENV &amp;quot;staging&amp;quot;&lt;/p&gt;&#xD;
20
  &lt;p&gt;You can set any set of environments and colours in the admin interface. As default these are: production, staging, preview and development&lt;/p&gt;&#xD;
21
  &lt;p&gt;The extension is &lt;a href="https://github.com/c3limited/magento-environment-banner"&gt;Open source on GitHub&lt;/a&gt;&lt;/p&gt;&#xD;
22
  &lt;p&gt;Include via composer or modman&lt;/p&gt;&#xD;
 
23
  &lt;p&gt;Oldest supported CE version is 1.6.0.0&lt;/p&gt;&#xD;
24
  &lt;p&gt;Tested in EE 1.13.0.0 to 1.14.0.1&lt;/p&gt;&#xD;
25
  &lt;p&gt;Developed by C3 Media, a full service &lt;a href="http://www.c3media.co.uk"&gt;Magento agency&lt;/a&gt;&lt;/p&gt;</description>
26
  <notes>&lt;ul&gt;&#xD;
27
- &lt;li&gt;Bug fix: Admin displays incorrectly if no env var or colour set&lt;/li&gt;&#xD;
 
28
  &lt;/ul&gt;</notes>
29
  <authors><author><name>C3 Media</name><user>c3media_ltd</user><email>hello@c3media.co.uk</email></author></authors>
30
- <date>2014-11-13</date>
31
- <time>09:40:58</time>
32
- <contents><target name="mageetc"><dir name="modules"><file name="C3_EnvironmentBanner.xml" hash="35dfc2771b04c92c1a007103db954e7b"/></dir></target><target name="magelocal"><dir name="C3"><dir name="EnvironmentBanner"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Header.php" hash="d0cb927ced912b84f9a495df946c0ac1"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Environment.php" hash="c5333c5851ba0c7b47520cdffa0ae53b"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="da3ab0b8d4cc90862249c94e27b5afc6"/></dir><dir name="Model"><file name="Colours.php" hash="36cf70a33c0e8ee3b5ff6cc8239e86e3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8f49b5c04cdcfb2ff975c8227d30d33c"/><file name="config.xml" hash="82b5c13bc79878a3b2407d9a05063879"/><file name="system.xml" hash="4d6dfff3681f6df651cf8208767968a5"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="c3_environmentbanner"><file name="header.phtml" hash="3888446b24c1c996b1333e068c486bbd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="c3_environmentbanner"><file name="banner.phtml" hash="1667bdc1fb1bf77c963280aba36c8c7e"/></dir></dir><dir name="layout"><file name="c3_environmentbanner.xml" hash="f080e3fefdd423257212a8ac9e6f1084"/></dir></dir></dir></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>Core</name><min/><max/></extension></required></dependencies>
35
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>C3_Environment_Banner</name>
4
+ <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
11
  &#xD;
12
  &lt;p&gt;Have you ever performed an action - deleted a product or created a promotion live, only to realise that you've accidentally done it on the production site rather than a development copy? Be honest now.&lt;/p&gt;&#xD;
13
  &#xD;
14
+ &lt;p&gt;If so, this extension is for you. It adds a discrete corner banner and window border to the frontend of non-production websites (fail-safe - if it doesn't know what environment it is in then it assumes it is on a production server). It is more striking on the admin side, where the entire title bar is colour-coded, and a border added to the page so that no matter how long the page (I'm looking at you, system config), you'll always have a visual reminder of which environment you are in.&lt;/p&gt;&#xD;
15
  &#xD;
16
  &lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; The environment is picked up from the commonly used APPLICATION_ENV environment variable. This is set by the web-server, and for apache it just means adding in a single line to your .htaccess file. e.g.&#xD;
17
  SetEnv APPLICATION_ENV &amp;quot;staging&amp;quot;&lt;/p&gt;&#xD;
20
  &lt;p&gt;You can set any set of environments and colours in the admin interface. As default these are: production, staging, preview and development&lt;/p&gt;&#xD;
21
  &lt;p&gt;The extension is &lt;a href="https://github.com/c3limited/magento-environment-banner"&gt;Open source on GitHub&lt;/a&gt;&lt;/p&gt;&#xD;
22
  &lt;p&gt;Include via composer or modman&lt;/p&gt;&#xD;
23
+ &lt;p&gt;Tested with php 5.3 to 5.6&lt;/p&gt;&#xD;
24
  &lt;p&gt;Oldest supported CE version is 1.6.0.0&lt;/p&gt;&#xD;
25
  &lt;p&gt;Tested in EE 1.13.0.0 to 1.14.0.1&lt;/p&gt;&#xD;
26
  &lt;p&gt;Developed by C3 Media, a full service &lt;a href="http://www.c3media.co.uk"&gt;Magento agency&lt;/a&gt;&lt;/p&gt;</description>
27
  <notes>&lt;ul&gt;&#xD;
28
+ &lt;li&gt;New feature: Adds window border on frontend similar to admin - makes current environment more obvious, especially when scrolling down&lt;/li&gt;&#xD;
29
+ &lt;li&gt;Bug fix: Changed helper code that was not compatible with php5.3&lt;/li&gt;&#xD;
30
  &lt;/ul&gt;</notes>
31
  <authors><author><name>C3 Media</name><user>c3media_ltd</user><email>hello@c3media.co.uk</email></author></authors>
32
+ <date>2015-06-10</date>
33
+ <time>09:48:03</time>
34
+ <contents><target name="mageetc"><dir name="modules"><file name="C3_EnvironmentBanner.xml" hash="35dfc2771b04c92c1a007103db954e7b"/></dir></target><target name="magelocal"><dir name="C3"><dir name="EnvironmentBanner"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Header.php" hash="d0cb927ced912b84f9a495df946c0ac1"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Environment.php" hash="c5333c5851ba0c7b47520cdffa0ae53b"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b8182d6217948005f9569b7a7d3d1de5"/></dir><dir name="Model"><file name="Colours.php" hash="36cf70a33c0e8ee3b5ff6cc8239e86e3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8f49b5c04cdcfb2ff975c8227d30d33c"/><file name="config.xml" hash="82b5c13bc79878a3b2407d9a05063879"/><file name="system.xml" hash="4d6dfff3681f6df651cf8208767968a5"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="c3_environmentbanner"><file name="header.phtml" hash="3888446b24c1c996b1333e068c486bbd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="c3_environmentbanner"><file name="banner.phtml" hash="2feb2c78cc82db8edf2c12e4648a4c4a"/></dir></dir><dir name="layout"><file name="c3_environmentbanner.xml" hash="f080e3fefdd423257212a8ac9e6f1084"/></dir></dir></dir></dir></target></contents>
35
  <compatible/>
36
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>Core</name><min/><max/></extension></required></dependencies>
37
  </package>