Zero1_Seoredirects - Version 1.0.8

Version Notes

Fixed an issue with the table not being created when installing.

Download this release

Release Info

Developer Arron Moss
Extension Zero1_Seoredirects
Version 1.0.8
Comparing to
See all releases


Code changes from version 1.0.6 to 1.0.8

app/code/community/Zero1/Seoredirects/Model/Mysql4/Redirection.php CHANGED
@@ -1,8 +1,5 @@
1
  <?php
2
- class Zero1_Seoredirects_Model_Mysql4_Redirection extends Mage_Core_Model_Mysql4_Abstract
3
  {
4
- protected function _construct()
5
- {
6
- $this->_init('seoredirects/redirection', 'entity_id');
7
- }
8
  }
1
  <?php
2
+ class Zero1_Seoredirects_Model_Mysql4_Redirection extends Zero1_Seoredirects_Model_Resource_Redirection
3
  {
4
+
 
 
 
5
  }
app/code/community/Zero1/Seoredirects/Model/Mysql4/Redirection/Collection.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
- class Zero1_Seoredirects_Model_Mysql4_Redirection_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
 
3
  {
4
- protected function _construct()
5
- {
6
- $this->_init('seoredirects/redirection');
7
- }
8
  }
1
  <?php
2
+ class Zero1_Seoredirects_Model_Mysql4_Redirection_Collection
3
+ extends Zero1_Seoredirects_Model_Resource_Redirection_Collection
4
  {
5
+
 
 
 
6
  }
app/code/community/Zero1/Seoredirects/Model/Mysql4/Setup.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Zero1_Seoredirects_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
3
  {
4
  }
5
 
1
  <?php
2
+ class Zero1_Seoredirects_Model_Mysql4_Setup extends Zero1_Seoredirects_Model_Resource_Setup
3
  {
4
  }
5
 
app/code/community/Zero1/Seoredirects/Model/Observer.php CHANGED
@@ -8,17 +8,15 @@ class Zero1_Seoredirects_Model_Observer
8
  $front = $observer->getFront();
9
  $request = $front->getRequest();
10
 
11
- if($request->getActionName() != 'noRoute')
12
- return; // There is a valid route, nothing to do
13
-
14
- $redirections = Mage::getModel('seoredirects/redirection')->getCollection();
15
- $redirections->addFieldToFilter('store', Mage::app()->getStore()->getId());
16
- $redirections->addFieldToFilter('redirect_from', $request->getRequestUri());
17
-
18
  foreach($redirections as $redirection)
19
  {
20
  header('HTTP/1.1 301 Moved Permanently');
21
- header('Location: '.$redirection->getRedirectTo());
22
  die();
23
  }
24
 
8
  $front = $observer->getFront();
9
  $request = $front->getRequest();
10
 
11
+ $requestUri = preg_replace('/^'.preg_quote($request->getBasePath(), '/').'/', '', $request->getRequestUri());
12
+ $redirections = Mage::getModel('seoredirects/redirection')->getCollection();
13
+ $redirections->addFieldToFilter('store', Mage::app()->getStore()->getId());
14
+ $redirections->addFieldToFilter('redirect_from', $requestUri);
15
+
 
 
16
  foreach($redirections as $redirection)
17
  {
18
  header('HTTP/1.1 301 Moved Permanently');
19
+ header('Location: '.$request->getBasePath().$redirection->getRedirectTo());
20
  die();
21
  }
22
 
app/code/community/Zero1/Seoredirects/Model/Resource/Redirection.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Zero1_Seoredirects_Model_Resource_Redirection extends Mage_Core_Model_Resource_Db_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('seoredirects/redirection', 'entity_id');
7
+ }
8
+ }
app/code/community/Zero1/Seoredirects/Model/Resource/Redirection/Collection.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Zero1_Seoredirects_Model_Resource_Redirection_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('seoredirects/redirection');
7
+ }
8
+ }
app/code/community/Zero1/Seoredirects/Model/Resource/Setup.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Zero1_Seoredirects_Model_Resource_Setup extends Mage_Sales_Model_Resource_Setup
3
+ {
4
+
5
+ }
app/code/community/Zero1/Seoredirects/etc/config.xml CHANGED
@@ -1,33 +1,33 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
  <modules>
4
  <Zero1_Seoredirects>
5
  <version>1.0.1</version>
6
  </Zero1_Seoredirects>
7
  </modules>
8
 
9
- <global>
10
  <models>
11
  <seoredirects>
12
  <class>Zero1_Seoredirects_Model</class>
13
- <resourceModel>seoredirects_mysql4</resourceModel>
14
  </seoredirects>
15
 
16
- <seoredirects_mysql4>
17
- <class>Zero1_Seoredirects_Model_Mysql4</class>
18
  <entities>
19
  <redirection>
20
  <table>zero1_seoredirects_redirection</table>
21
  </redirection>
22
  </entities>
23
- </seoredirects_mysql4>
24
  </models>
25
 
26
  <resources>
27
  <seoredirects_setup>
28
  <setup>
29
  <module>Zero1_Seoredirects</module>
30
- <class>Zero1_Seoredirects_Model_Mysql4_Setup</class>
31
  </setup>
32
  </seoredirects_setup>
33
  </resources>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
  <modules>
4
  <Zero1_Seoredirects>
5
  <version>1.0.1</version>
6
  </Zero1_Seoredirects>
7
  </modules>
8
 
9
+ <global>
10
  <models>
11
  <seoredirects>
12
  <class>Zero1_Seoredirects_Model</class>
13
+ <resourceModel>seoredirects_resource</resourceModel>
14
  </seoredirects>
15
 
16
+ <seoredirects_resource>
17
+ <class>Zero1_Seoredirects_Model_Resource</class>
18
  <entities>
19
  <redirection>
20
  <table>zero1_seoredirects_redirection</table>
21
  </redirection>
22
  </entities>
23
+ </seoredirects_resource>
24
  </models>
25
 
26
  <resources>
27
  <seoredirects_setup>
28
  <setup>
29
  <module>Zero1_Seoredirects</module>
30
+ <class>Zero1_Seoredirects_Model_Resource_Setup</class>
31
  </setup>
32
  </seoredirects_setup>
33
  </resources>
app/code/community/Zero1/Seoredirects/sql/seoredirects_setup/install-1.0.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+
8
+ DROP TABLE IF EXISTS {$this->getTable('zero1_seoredirects_redirection')};
9
+ CREATE TABLE {$this->getTable('zero1_seoredirects_redirection')} (
10
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
11
+ `redirect_from` varchar(2047) NOT NULL,
12
+ `redirect_to` varchar(2047) NOT NULL,
13
+ `store` int(4) NOT NULL,
14
+ PRIMARY KEY (`entity_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
16
+
17
+ ");
18
+
19
+ $installer->endSetup();
app/code/community/Zero1/Seoredirects/sql/seoredirects_setup/install-1.0.1.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+
8
+ DROP TABLE IF EXISTS {$this->getTable('zero1_seoredirects_redirection')};
9
+ CREATE TABLE {$this->getTable('zero1_seoredirects_redirection')} (
10
+ `entity_id` int(11) unsigned NOT NULL auto_increment,
11
+ `redirect_from` varchar(2047) NOT NULL,
12
+ `redirect_to` varchar(2047) NOT NULL,
13
+ `store` int(4) NOT NULL,
14
+ PRIMARY KEY (`entity_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
16
+
17
+ ");
18
+
19
+ $installer->endSetup();
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Zero1_Seoredirects</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.zero1.co.uk/LICENSE.txt">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Manage you SEO redirects using a Google Doc</summary>
10
  <description>Manage you SEO redirects using a Google Doc</description>
11
- <notes>Changed getRequestString() to getRequestUri() to capture query strings.</notes>
12
  <authors><author><name>Arron Moss</name><user>zero1limited</user><email>arron.moss@zero1.co.uk</email></author></authors>
13
- <date>2012-09-05</date>
14
- <time>11:21:55</time>
15
- <contents><target name="magecommunity"><dir name="Zero1"><dir name="Seoredirects"><dir name="Block"><dir name="Manage"><file name="Grid.php" hash="b06399e81b30ef592805277595061b38"/></dir><file name="Manage.php" hash="1ed89ca5e60aeec11a5c225bcce8e124"/></dir><dir name="Helper"><file name="Data.php" hash="36474aca2c8e7dce3f30c398bd9c0ce0"/><file name="License.php" hash="479affaec1ba20aa6b916dec4e055b4b"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Redirection"><file name="Collection.php" hash="73bf6b8f2ddff49dac520a6f71f72502"/></dir><file name="Redirection.php" hash="21d829342e13727de44bd3c821054bd9"/><file name="Setup.php" hash="e97a5f05e8459f367c14e98e7a0b03c6"/></dir><file name="Observer.php" hash="3aca40cf7cb66d1a449fb9861fac0029"/><file name="Redirection.php" hash="8d26f395bf5b33679b032c160152e24a"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Seoredirects"><file name="ManageController.php" hash="bf497a1ce5f202abd024a5736a0e8a9a"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7e8d3a4c8dff9b4df9f380c284225393"/><file name="config.xml" hash="47fc4b68738ae8fc9e171ea8e1190fb8"/><file name="system.xml" hash="063dab03c71e04400c1f469b4f15ad61"/></dir><dir name="sql"><dir name="seoredirects_setup"><file name="mysql4-install-1.0.0.php" hash="918bc1dee6bb2388e78b7346929916c9"/><file name="mysql4-install-1.0.1.php" hash="918bc1dee6bb2388e78b7346929916c9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zero1_Seoredirects.xml" hash="dd176346dbb2abf0e20d8ea087abe2ce"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="seoredirects.xml" hash="84e2381a4d12eb22fa5e6b5b092ddef7"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Zero1_Seoredirects</name>
4
+ <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.zero1.co.uk/LICENSE.txt">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Manage you SEO redirects using a Google Doc</summary>
10
  <description>Manage you SEO redirects using a Google Doc</description>
11
+ <notes>Fixed an issue with the table not being created when installing.</notes>
12
  <authors><author><name>Arron Moss</name><user>zero1limited</user><email>arron.moss@zero1.co.uk</email></author></authors>
13
+ <date>2012-10-22</date>
14
+ <time>12:17:49</time>
15
+ <contents><target name="magecommunity"><dir name="Zero1"><dir name="Seoredirects"><dir name="Block"><dir name="Manage"><file name="Grid.php" hash="b06399e81b30ef592805277595061b38"/></dir><file name="Manage.php" hash="1ed89ca5e60aeec11a5c225bcce8e124"/></dir><dir name="Helper"><file name="Data.php" hash="36474aca2c8e7dce3f30c398bd9c0ce0"/><file name="License.php" hash="479affaec1ba20aa6b916dec4e055b4b"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Redirection"><file name="Collection.php" hash="a848d959fdca977b4470f46c93a27eb7"/></dir><file name="Redirection.php" hash="a357992dee4bb6cf526bb358dc4d1e0d"/><file name="Setup.php" hash="13c67d7925878d2076edcf92c375b9c1"/></dir><file name="Observer.php" hash="5cb45e14d9c45f2ec35ab1f1c4d2ab80"/><file name="Redirection.php" hash="8d26f395bf5b33679b032c160152e24a"/><dir name="Resource"><dir name="Redirection"><file name="Collection.php" hash="0b7bd678d49530782ba9198537ae5bc9"/></dir><file name="Redirection.php" hash="b2e5de0d116e2c17ecd3fb09472e4349"/><file name="Setup.php" hash="5d9dddc43a5bb75b68f1a2e4b98d36b6"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Seoredirects"><file name="ManageController.php" hash="bf497a1ce5f202abd024a5736a0e8a9a"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7e8d3a4c8dff9b4df9f380c284225393"/><file name="config.xml" hash="32ba23bb8f95679fa57126bdc880ffbc"/><file name="system.xml" hash="063dab03c71e04400c1f469b4f15ad61"/></dir><dir name="sql"><dir name="seoredirects_setup"><file name="install-1.0.0.php" hash="918bc1dee6bb2388e78b7346929916c9"/><file name="install-1.0.1.php" hash="918bc1dee6bb2388e78b7346929916c9"/><file name="mysql4-install-1.0.0.php" hash="918bc1dee6bb2388e78b7346929916c9"/><file name="mysql4-install-1.0.1.php" hash="918bc1dee6bb2388e78b7346929916c9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zero1_Seoredirects.xml" hash="dd176346dbb2abf0e20d8ea087abe2ce"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="seoredirects.xml" hash="84e2381a4d12eb22fa5e6b5b092ddef7"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>