MageTitan_DevIdentifier - Version 1.1.0

Version Notes

Extension home page:
http://www.magetitan.com/magento-extensions/development-identifier.html
http://www.mojo-themes.com/item/magetitans-development-identifier/

Documentation:
http://www.magetitan.com/documentation/development-identifier.html

Uninstall Instructions:
If you delete the extension, please delete the following files:
app/code/local/MageTitan/DevIdentifier (entire folder and contents)
app/design/adminhtml/default/default/layout/devidentifer.xml
app/design/frontend/base/default/layout/devidentifier.xml
app/etc/modules/MageTitan_DevIdentifier.xml

Download this release

Release Info

Developer Magento Core Team
Extension MageTitan_DevIdentifier
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

app/code/local/MageTitan/DevIdentifier/Block/View.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Development Identifier
4
+ * For assistance please contact support@magetitan.com
5
+ *
6
+ * @category MageTitan
7
+ * @author Michael Potter (magetitan.com)
8
+ * @copyright Copyright (c) 2011 NetMediaGroup (www.netmediagroup.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ * @package MageTitan_DevIdentifier
11
+ */
12
+ class MageTitan_DevIdentifier_Block_View extends Mage_Core_Block_Template
13
+ {
14
+ protected $_enabled;
15
+ const XML_PATH_ENABLED = 'dev/devidentifier/enabled';
16
+
17
+ protected function _construct()
18
+ {
19
+ $this->_enabled = Mage::getStoreConfigFlag(self::XML_PATH_ENABLED);
20
+ $this->addData(array(
21
+ 'cache_lifetime'=> 2592000,
22
+ ));
23
+ }
24
+
25
+ /**
26
+ * Get Key pieces for caching block content
27
+ *
28
+ * @return array
29
+ */
30
+ public function getCacheKey()
31
+ {
32
+ $key = 'MAGETITAN_DEVIDENTIFIER'
33
+ . '_' . Mage::app()->getStore()->getId()
34
+ . '_' . Mage::getDesign()->getPackageName()
35
+ . '_' . Mage::getDesign()->getTheme('template')
36
+ . '_' . Mage::getSingleton('customer/session')->getCustomerGroupId();
37
+ $key = sha1($key);
38
+ return $key;
39
+ }
40
+
41
+ public function _toHtml()
42
+ {
43
+ if ( !$this->_enabled ) { return null; }
44
+ $serverType = Mage::helper('devidentifier')->getServerType();
45
+ if ( $serverType != 'production' ) {
46
+ $html = '<div id="devidentifier_banner" style="display: none;">' . $serverType . '</div>';
47
+ $html .= "<script type=\"text/javascript\">Event.observe(window, 'load', function () { $('devidentifier_banner').setStyle({ position: 'absolute', left: '0px', top: '0px', paddingTop: '4px', width: '125px', height: '25px', background: '#ff0033', color: '#ffffff', textAlign: 'center', zIndex: '1000', border: '1px solid black', cursor: 'pointer' }); $('devidentifier_banner').show(); Effect.Fade('devidentifier_banner', { duration: 1, from: 1, to: 0.3 }); }); $('devidentifier_banner').observe('click', function() { (this).hide(); });</script>";
48
+ } else {
49
+ $html = '';
50
+ }
51
+ return $html;
52
+ }
53
+
54
+ }
app/code/local/MageTitan/DevIdentifier/Helper/Data.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Development Identifier
4
+ * For assistance please contact support@magetitan.com
5
+ *
6
+ * @category MageTitan
7
+ * @author Michael Potter (magetitan.com)
8
+ * @copyright Copyright (c) 2011 NetMediaGroup (www.netmediagroup.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ * @package MageTitan_DevIdentifier
11
+ */
12
+ class MageTitan_DevIdentifier_Helper_Data extends Mage_Core_Helper_Abstract
13
+ {
14
+
15
+ const XML_PATH_METHOD = 'dev/devidentifier/method';
16
+ const XML_PATH_STATIC_VALUE = 'dev/devidentifier/static_value';
17
+ const METHOD_STATIC_VALUE = 0;
18
+ const METHOD_STAGED_CONFIG = 1;
19
+ const METHOD_VAR_FILE = 2;
20
+
21
+ public function getServerType()
22
+ {
23
+ $type = null;
24
+ switch ( Mage::getStoreConfig(self::XML_PATH_METHOD) ) {
25
+ case self::METHOD_VAR_FILE:
26
+ $type = $this->varFileMethod();
27
+ break;
28
+ case self::METHOD_STAGED_CONFIG:
29
+ $type = $this->versionControlledConfigMethod();
30
+ break;
31
+ case self::METHOD_STATIC_VALUE:
32
+ $type = Mage::getStoreConfig(self::XML_PATH_STATIC_VALUE);
33
+ break;
34
+ }
35
+ return $type;
36
+ }
37
+
38
+ protected function varFileMethod()
39
+ {
40
+ $_file = Mage::getBaseDir('var').'/devidentifier/identifier.txt';
41
+ if(file_exists($_file)){
42
+ $_fp = fopen($_file, 'r');
43
+ $_env = fgets($_fp, 64);
44
+ fclose($_fp);
45
+ return trim($_env);
46
+ }else{
47
+ return 'production';
48
+ }
49
+ }
50
+
51
+ protected function versionControlledConfigMethod()
52
+ {
53
+ $_path = Mage::getBaseDir('app').'/etc/';
54
+ $_config_files = glob("{$_path}/local.xml-*");
55
+ $_current_md5 = md5_file("{$_path}local.xml");
56
+ foreach($_config_files as $_file){
57
+ if($_current_md5 == md5_file($_file)){ return substr($_file, strpos($_file, 'local.xml-') + 10); }
58
+ }
59
+ return 'NEW LOCATION';
60
+ }
61
+
62
+ }
app/code/local/MageTitan/DevIdentifier/Model/System/Config/Source/Methods.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Development Identifier
4
+ * For assistance please contact support@magetitan.com
5
+ *
6
+ * @category MageTitan
7
+ * @author Michael Potter (magetitan.com)
8
+ * @copyright Copyright (c) 2011 NetMediaGroup (www.netmediagroup.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ * @package MageTitan_DevIdentifier
11
+ */
12
+ class MageTitan_DevIdentifier_Model_System_Config_Source_Methods
13
+ {
14
+ public function toOptionArray()
15
+ {
16
+ return array(
17
+ array('value'=>0, 'label'=>Mage::helper('devidentifier')->__('Static Value')),
18
+ array('value'=>1, 'label'=>Mage::helper('devidentifier')->__('Version Controlled Config File')),
19
+ array('value'=>2, 'label'=>Mage::helper('devidentifier')->__('TMP File (var/devidentifier/identifier.txt)')),
20
+ );
21
+ }
22
+ }
app/code/local/MageTitan/DevIdentifier/etc/config.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MageTitan_DevIdentifier>
5
+ <version>1.1.0</version>
6
+ </MageTitan_DevIdentifier>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <devidentifier>
11
+ <class>MageTitan_DevIdentifier_Block</class>
12
+ </devidentifier>
13
+ </blocks>
14
+ <models>
15
+ <devidentifier>
16
+ <class>MageTitan_DevIdentifier_Model</class>
17
+ </devidentifier>
18
+ </models>
19
+ <helpers>
20
+ <devidentifier>
21
+ <class>MageTitan_DevIdentifier_Helper</class>
22
+ </devidentifier>
23
+ </helpers>
24
+ </global>
25
+ <frontend>
26
+ <layout>
27
+ <updates>
28
+ <devidentifier>
29
+ <file>devidentifier.xml</file>
30
+ </devidentifier>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <adminhtml>
35
+ <layout>
36
+ <updates>
37
+ <devidentifier>
38
+ <file>devidentifier.xml</file>
39
+ </devidentifier>
40
+ </updates>
41
+ </layout>
42
+ </adminhtml>
43
+ <default>
44
+ <dev>
45
+ <devidentifier>
46
+ <enabled>1</enabled>
47
+ <method>0</method>
48
+ </devidentifier>
49
+ </dev>
50
+ </default>
51
+ </config>
app/code/local/MageTitan/DevIdentifier/etc/system.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <dev>
5
+ <groups>
6
+ <devidentifier translate="label">
7
+ <label>MageTitan Development Identifier</label>
8
+ <frontend_type>select</frontend_type>
9
+ <sort_order>1000</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <enabled translate="label">
15
+ <label>Enable Development Identifier</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>0</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </enabled>
23
+ <method translate="label">
24
+ <label>Identification Method</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>devidentifier/system_config_source_methods</source_model>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </method>
32
+ <static_value translate="label">
33
+ <label>Static Value</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>20</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <depends><method>0</method></depends>
40
+ </static_value>
41
+ </fields>
42
+ </devidentifier>
43
+ </groups>
44
+ </dev>
45
+ </sections>
46
+ </config>
package.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MageTitan_DevIdentifier</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>For the developer of Magento, this extension is a lifesaver! Placing a small development indicator at the top of your screen will help avoid those nasty "which server am I on" mistakes</summary>
10
+ <description>Avoid Development Mixups with MageTitan's DevIdentifier
11
+
12
+ Have you ever been testing your new skin or CMS page change and realized you've just finished making all the changes on your live server? MageTitan's DevIdentifier places a small indicator on the top of your screen when your developing to help identify which server your using.</description>
13
+ <notes>Extension home page:
14
+ http://www.magetitan.com/magento-extensions/development-identifier.html
15
+ http://www.mojo-themes.com/item/magetitans-development-identifier/
16
+
17
+ Documentation:
18
+ http://www.magetitan.com/documentation/development-identifier.html
19
+
20
+ Uninstall Instructions:
21
+ If you delete the extension, please delete the following files:
22
+ app/code/local/MageTitan/DevIdentifier (entire folder and contents)
23
+ app/design/adminhtml/default/default/layout/devidentifer.xml
24
+ app/design/frontend/base/default/layout/devidentifier.xml
25
+ app/etc/modules/MageTitan_DevIdentifier.xml</notes>
26
+ <authors><author><name>MageTotan</name><user>auto-converted</user><email>support@magetitan.com</email></author></authors>
27
+ <date>2011-11-09</date>
28
+ <time>18:43:00</time>
29
+ <contents><target name="magelocal"><dir name="MageTitan"><dir name="DevIdentifier"><dir name="Block"><file name="View.php" hash="3059b8f18ee8b0bf822fc709608bc820"/></dir><dir name="etc"><file name="config.xml" hash="cfcafa0eeceeea9e97d753317634c96e"/><file name="system.xml" hash="304440ff17367a9b2448c123599e48ad"/></dir><dir name="Helper"><file name="Data.php" hash="2afb3084e4d7d3d5e71b00867269f9d1"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Methods.php" hash="e45986cf18c87bfae9c64785db03629d"/></dir></dir></dir></dir></dir></dir></target></contents>
30
+ <compatible/>
31
+ <dependencies/>
32
+ </package>