Eggplant 301 Redirects - Version 1.3.1

Version Description

  • Added hierarchy to heirarchical post type selects.
Download this release

Release Info

Developer shawn@eggplantstudios.ca
Plugin Icon 128x128 Eggplant 301 Redirects
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.2 to 1.3.1

Files changed (2) hide show
  1. eps-301-redirects.php +46 -5
  2. readme.txt +8 -1
eps-301-redirects.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @package EPS 301 Redirects
17
  * @author Shawn Wernig ( shawn@eggplantstudios.ca )
18
- * @version 1.3.1
19
  */
20
 
21
 
@@ -23,7 +23,7 @@
23
  Plugin Name: Eggplant 301 Redirects
24
  Plugin URI: http://www.eggplantstudios.ca
25
  Description: Create your own 301 redirects using this powerful plugin.
26
- Version: 1.3.1
27
  Author: Shawn Wernig http://www.eggplantstudios.ca
28
  License: GPLv2 or later
29
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -31,7 +31,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
 
32
  define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
33
  define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
34
- define ( 'EPS_REDIRECT_VERSION', 1.2);
35
 
36
  register_activation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_activation'));
37
  register_deactivation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_deactivation'));
@@ -49,6 +49,7 @@ class EPS_Redirects {
49
  if(is_admin()){
50
  add_action('admin_menu', array($this, 'add_plugin_page'));
51
  add_action('admin_init', array($this, '_save'));
 
52
  add_action('wp_ajax_eps_redirect_get_new_entry', array($this, 'ajax_get_blank_entry') );
53
  add_action('init', array($this, 'enqueue_resources'));
54
  add_action('admin_footer_text', array($this, 'set_ajax_url'));
@@ -58,7 +59,48 @@ class EPS_Redirects {
58
  }
59
 
60
  public static function eps_redirect_activation() {}
61
- public static function eps_redirect_deactivation() {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  /**
64
  *
@@ -321,7 +363,6 @@ class EPS_Redirects {
321
  */
322
  function find_parent_index( $id, $entries ){
323
  foreach($entries as $k => $entry ) {
324
- //print_r($entry); echo '<br>';
325
  if ( $entry->ID == $id ) return( $k );
326
  }
327
  return false;
15
  *
16
  * @package EPS 301 Redirects
17
  * @author Shawn Wernig ( shawn@eggplantstudios.ca )
18
+ * @version 1.3.3
19
  */
20
 
21
 
23
  Plugin Name: Eggplant 301 Redirects
24
  Plugin URI: http://www.eggplantstudios.ca
25
  Description: Create your own 301 redirects using this powerful plugin.
26
+ Version: 1.3.3
27
  Author: Shawn Wernig http://www.eggplantstudios.ca
28
  License: GPLv2 or later
29
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
 
32
  define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
33
  define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
34
+ define ( 'EPS_REDIRECT_VERSION', '1.3.3');
35
 
36
  register_activation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_activation'));
37
  register_deactivation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_deactivation'));
49
  if(is_admin()){
50
  add_action('admin_menu', array($this, 'add_plugin_page'));
51
  add_action('admin_init', array($this, '_save'));
52
+ add_action('admin_init', array($this, 'check_version'));
53
  add_action('wp_ajax_eps_redirect_get_new_entry', array($this, 'ajax_get_blank_entry') );
54
  add_action('init', array($this, 'enqueue_resources'));
55
  add_action('admin_footer_text', array($this, 'set_ajax_url'));
59
  }
60
 
61
  public static function eps_redirect_activation() {}
62
+ public static function eps_redirect_deactivation() {
63
+ update_option( self::$option_slug, null );
64
+ update_option( 'eps_redirects_version', null );
65
+ }
66
+
67
+
68
+ /**
69
+ *
70
+ * CHECK VERSION
71
+ *
72
+ * This function will check the current version and do any fixes required
73
+ *
74
+ * @return html string
75
+ * @author epstudios
76
+ *
77
+ */
78
+ public function check_version() {
79
+ $version = get_option( 'eps_redirects_version' );
80
+
81
+ if ( !isset($version) || empty( $version ) ) {
82
+ // no version is set. versions started being stored at 1.3.1
83
+ // because in 1.3.1 we did a big database storage change, we need to fix old versions storage
84
+
85
+ $redirects = get_option( self::$option_slug );
86
+ if (empty($redirects)) return false; // no redirects anyways, so dont do anything.
87
+
88
+ foreach ($redirects as $to => $from ) {
89
+ $new_redirects[$from] = $to;
90
+ }
91
+ update_option( self::$option_slug, $new_redirects );
92
+ }
93
+
94
+ switch( $version ) {
95
+ case '1.3.2':
96
+ // do stuff
97
+ default:
98
+ break;
99
+ }
100
+ update_option( 'eps_redirects_version', EPS_REDIRECT_VERSION );
101
+ return EPS_REDIRECT_VERSION;
102
+ }
103
+
104
 
105
  /**
106
  *
363
  */
364
  function find_parent_index( $id, $entries ){
365
  foreach($entries as $k => $entry ) {
 
366
  if ( $entry->ID == $id ) return( $k );
367
  }
368
  return false;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: none
4
  Tags: 301 redirects, redirects
5
  Requires at least: 3.0.1
6
  Tested up to: 3.5
7
- Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,10 @@ Click the small X beside the redirect you wish to remove. Save changes.
75
 
76
  == Changelog ==
77
 
 
 
 
 
78
  = 1.3.1 =
79
  * Added hierarchy to heirarchical post type selects.
80
 
@@ -93,6 +97,9 @@ Click the small X beside the redirect you wish to remove. Save changes.
93
 
94
  == Upgrade Notice ==
95
 
 
 
 
96
  = 1.3.1 =
97
  Functionality update, Cosmetic.
98
 
4
  Tags: 301 redirects, redirects
5
  Requires at least: 3.0.1
6
  Tested up to: 3.5
7
+ Stable tag: 1.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.3.3 =
79
+ * Fixed major problem when switching from 1.2 to 1.3+
80
+
81
+
82
  = 1.3.1 =
83
  * Added hierarchy to heirarchical post type selects.
84
 
97
 
98
  == Upgrade Notice ==
99
 
100
+ = 1.3.3 =
101
+ Compatibility update for users upgrading from 1.2 to 1.3+ - Update ASAP.
102
+
103
  = 1.3.1 =
104
  Functionality update, Cosmetic.
105