Version Notes
The initial release.
Download this release
Release Info
Developer | Morten Munkholm |
Extension | Droppin_Theme_By_IP |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Droppin/ThemeByIp/Helper/Data.php +6 -0
- app/code/community/Droppin/ThemeByIp/Model/Observer.php +31 -0
- app/code/community/Droppin/ThemeByIp/controllers/Adminhtml/ThemeByIpController.php +8 -0
- app/code/community/Droppin/ThemeByIp/etc/config.xml +47 -0
- app/code/community/Droppin/ThemeByIp/etc/system.xml +51 -0
- app/etc/modules/Droppin_ThemeByIp.xml +9 -0
- package.xml +20 -0
app/code/community/Droppin/ThemeByIp/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Droppin_ThemeByIp_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
|
6 |
+
}
|
app/code/community/Droppin/ThemeByIp/Model/Observer.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Droppin_ThemeByIp_Model_Observer extends Varien_Event_Observer
|
3 |
+
{
|
4 |
+
|
5 |
+
public function preDispatchEvent($observer)
|
6 |
+
{
|
7 |
+
$controllerAction = $observer->getControllerAction();
|
8 |
+
if ($controllerAction->getLayout()->getArea() == Mage_Core_Model_App_Area::AREA_FRONTEND) {
|
9 |
+
$ipAddress = Mage::helper('core/http')->getRemoteAddr();
|
10 |
+
|
11 |
+
|
12 |
+
$ip_array = Mage::getStoreConfig('dev/themebyip_group1/ip_array', Mage::app()->getStore());
|
13 |
+
|
14 |
+
|
15 |
+
$ipAddresses = explode(',', $ip_array);
|
16 |
+
|
17 |
+
if (in_array($ipAddress, $ipAddresses)) {
|
18 |
+
|
19 |
+
|
20 |
+
$package = Mage::getStoreConfig('dev/themebyip_group1/theme_package', Mage::app()->getStore());
|
21 |
+
$template = Mage::getStoreConfig('dev/themebyip_group1/theme_template', Mage::app()->getStore());
|
22 |
+
|
23 |
+
Mage::getDesign()
|
24 |
+
->setPackageName($package)
|
25 |
+
->setTheme($template);
|
26 |
+
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
?>
|
app/code/community/Droppin/ThemeByIp/controllers/Adminhtml/ThemeByIpController.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Droppin_ThemeByIp_Adminhtml_DevThemeController extends Mage_Adminhtml_Controller_Action {
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/Droppin/ThemeByIp/etc/config.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Droppin_ThemeByIp>
|
5 |
+
<version>1.0</version>
|
6 |
+
</Droppin_ThemeByIp>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<themebyip>
|
12 |
+
<class>Droppin_ThemeByIp_Model</class>
|
13 |
+
</themebyip>
|
14 |
+
</models>
|
15 |
+
<helpers>
|
16 |
+
<themebyip>
|
17 |
+
<class>Droppin_ThemeByIp_Helper</class>
|
18 |
+
</themebyip>
|
19 |
+
</helpers>
|
20 |
+
|
21 |
+
<events>
|
22 |
+
<controller_action_predispatch>
|
23 |
+
<observers>
|
24 |
+
<dev_theme_changer>
|
25 |
+
<type>singleton</type>
|
26 |
+
<class>Droppin_ThemeByIp_Model_Observer</class>
|
27 |
+
<method>preDispatchEvent</method>
|
28 |
+
</dev_theme_changer>
|
29 |
+
</observers>
|
30 |
+
</controller_action_predispatch>
|
31 |
+
</events>
|
32 |
+
|
33 |
+
</global>
|
34 |
+
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<themebyip>
|
38 |
+
<use>admin</use>
|
39 |
+
<args>
|
40 |
+
<module>Droppin_ThemeByIp</module>
|
41 |
+
<frontName>themebyip</frontName>
|
42 |
+
</args>
|
43 |
+
</themebyip>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
|
47 |
+
</config>
|
app/code/community/Droppin/ThemeByIp/etc/system.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<dev>
|
5 |
+
|
6 |
+
<tab>advanced</tab>
|
7 |
+
|
8 |
+
<show_in_default>1</show_in_default>
|
9 |
+
<show_in_website>1</show_in_website>
|
10 |
+
<show_in_store>1</show_in_store>
|
11 |
+
<groups>
|
12 |
+
<themebyip_group1 translate="label">
|
13 |
+
<label>Developer Theme Settings</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>2000</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<ip_array translate="label">
|
21 |
+
<label>List of IP's to show different theme</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<comment>Comma separated</comment>
|
28 |
+
</ip_array>
|
29 |
+
<theme_package translate="label">
|
30 |
+
<label>Theme package name</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>2</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 |
+
</theme_package>
|
37 |
+
<theme_template translate="label">
|
38 |
+
<label>Theme template name</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>3</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
<comment>This also covers the skin folder</comment>
|
45 |
+
</theme_template>
|
46 |
+
</fields>
|
47 |
+
</themebyip_group1>
|
48 |
+
</groups>
|
49 |
+
</dev>
|
50 |
+
</sections>
|
51 |
+
</config>
|
app/etc/modules/Droppin_ThemeByIp.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Droppin_ThemeByIp>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Droppin_ThemeByIp>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Droppin_Theme_By_IP</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Show a diferent package and template for your developers. Defined by IP, so regular visitors will still see the original template.</summary>
|
10 |
+
<description>This extension allows you to show a custom theme to chosen IP's. This allows you to show a diferent package and template for your developers. The IP filter ensures that you can control who sees the new theme under development, and your regular visitors will still see the orginal live theme.
|
11 |
+

|
12 |
+
Simple but does a good job making development on a live server, easier.</description>
|
13 |
+
<notes>The initial release.</notes>
|
14 |
+
<authors><author><name>Morten Munkholm</name><user>droppinstudio</user><email>morten@droppinstudio.dk</email></author></authors>
|
15 |
+
<date>2014-02-28</date>
|
16 |
+
<time>21:18:36</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Droppin"><dir name="ThemeByIp"><dir name="Helper"><file name="Data.php" hash="e464b457e4a236839f240ad1893cc831"/></dir><dir name="Model"><file name="Observer.php" hash="e4429d35dae3e27017edcdc9577ab5eb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ThemeByIpController.php" hash="0ee4c66aa8574cd4be717dbef4f820b3"/></dir></dir><dir name="etc"><file name="config.xml" hash="9a7bf68d2474ae651c8b5fc8afe7579a"/><file name="system.xml" hash="9dc57fcabcbe279b2d292f28b3b747ba"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Droppin_ThemeByIp.xml" hash="782aeddae26b2441a6bfca2381b23f68"/></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|