Go Live Update URLS - Version 2.2

Version Description

  • Added Gravity Forms Support to Seralized Safe
  • Added a filter for additional seralized safe tables
Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Go Live Update URLS
Version 2.2
Comparing to
See all releases

Code changes from version 2.1 to 2.2

Files changed (3) hide show
  1. go-live-update-urls.php +1 -2
  2. lib/GoLiveUpdateUrls.php +32 -12
  3. readme.txt +8 -7
go-live-update-urls.php CHANGED
@@ -5,12 +5,11 @@ Plugin URI: http://lipeimagination.info/
5
  Description: This Plugin Updates all the URLs in the database to point to the new URL when making your site live or changing domains.
6
  Author: Mat Lipe
7
  Author URI: http://lipeimagination/
8
- Version: 2.1
9
  */
10
 
11
  define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
12
  define( 'GLUU_URL_VIEWS_DIR', plugins_url('go-live-update-urls').'/views/' );
13
- ;
14
 
15
  require('lib/GoLiveUpdateUrls.php');
16
 
5
  Description: This Plugin Updates all the URLs in the database to point to the new URL when making your site live or changing domains.
6
  Author: Mat Lipe
7
  Author URI: http://lipeimagination/
8
+ Version: 2.2
9
  */
10
 
11
  define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
12
  define( 'GLUU_URL_VIEWS_DIR', plugins_url('go-live-update-urls').'/views/' );
 
13
 
14
  require('lib/GoLiveUpdateUrls.php');
15
 
lib/GoLiveUpdateUrls.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Methods for the Go Live Update Urls Plugin
4
  * @author Mat Lipe
5
- * @since 2.1
6
  *
7
  * @TODO Cleanup the Names and formatting
8
  */
@@ -11,15 +11,28 @@ class GoLiveUpdateUrls{
11
  var $newurl = false;
12
  var $double_subdomain = false; //keep track if going to a subdomain
13
 
 
 
 
 
14
  /**
15
- * @since 2.0
16
  */
17
  function __construct(){
 
 
18
  //Add the settings to the admin menu
19
  add_action('admin_menu', array( $this,'gluu_add_url_options') );
20
 
21
  //Add the CSS
22
  add_action( 'admin_head', array( $this,'css') );
 
 
 
 
 
 
 
23
  }
24
 
25
  /**
@@ -61,7 +74,7 @@ class GoLiveUpdateUrls{
61
  $this->oldurl = trim( strip_tags( $_POST['oldurl'] ) );
62
  $this->newurl = trim( strip_tags( $_POST['newurl'] ) );
63
 
64
- if( $this->gluu_make_the_updates() ){
65
  echo '<div id="message" class="updated fade"><p><strong>URLs have been updated.</p></strong></div>';
66
  } else {
67
  echo '<div class="error"><p><strong>You must fill out both boxes to make the update!</p></strong></div>';
@@ -92,14 +105,14 @@ class GoLiveUpdateUrls{
92
  /**
93
  * Creates a list of checkboxes for each table
94
  *
95
- * @since 2.0
96
  * @uses by the view admin-tools-page.php
97
  *
98
  * @filter 'gluu_table_checkboxes' with 2 param
99
  * * $output - the html formatted checkboxes
100
  * * $tables - the complete tables object
101
  *
102
- *
103
  */
104
  function makeCheckBoxes(){
105
  global $wpdb;
@@ -107,12 +120,15 @@ class GoLiveUpdateUrls{
107
  $tables = $wpdb->get_results($god_query);
108
 
109
  $output = '<ul id="gluu-checkboxes">';
 
 
 
110
  foreach($tables as $v){
111
- if($v->TABLE_NAME == $wpdb->options):
112
  $output .= sprintf('<li><input name="%s" type="checkbox" value="%s" checked /> %s - <strong><em>Seralized Safe</strong></em></li>',$v->TABLE_NAME,$v->TABLE_NAME,$v->TABLE_NAME);
113
- else:
114
  $output .= sprintf('<li><input name="%s" type="checkbox" value="%s" checked /> %s</li>',$v->TABLE_NAME,$v->TABLE_NAME,$v->TABLE_NAME);
115
- endif;
116
  }
117
 
118
  $output .= '</ul>';
@@ -126,9 +142,11 @@ class GoLiveUpdateUrls{
126
  * Updates the datbase
127
  *
128
  * @uses the oldurl and newurl set above
129
- * @since 2.27.13
 
 
130
  */
131
- function gluu_make_the_updates(){
132
  global $wpdb;
133
 
134
  $oldurl = $this->oldurl;
@@ -145,13 +163,15 @@ function gluu_make_the_updates(){
145
  $this->double_subdomain = $subdomain . '.' . $newurl; //Create a match to what the broken one will be
146
  }
147
 
 
 
148
 
149
  //Go throuch each table sent to be updated
150
  foreach($_POST as $v => $i){
151
 
152
  //Send the options table through the seralized safe Update
153
- if( $v == $wpdb->options ){
154
- $this->UpdateSeralizedTable($wpdb->options, 'option_value');
155
  }
156
 
157
  if($v != 'submit' && $v != 'oldurl' && $v != 'newurl'){
2
  /**
3
  * Methods for the Go Live Update Urls Plugin
4
  * @author Mat Lipe
5
+ * @since 2.2
6
  *
7
  * @TODO Cleanup the Names and formatting
8
  */
11
  var $newurl = false;
12
  var $double_subdomain = false; //keep track if going to a subdomain
13
 
14
+ //Keys are table names, values are table columns
15
+ public $seralized_tables = array();
16
+
17
+
18
  /**
19
+ * @since 2.2
20
  */
21
  function __construct(){
22
+ global $wpdb;
23
+ $pf = $wpdb->base_prefix;
24
  //Add the settings to the admin menu
25
  add_action('admin_menu', array( $this,'gluu_add_url_options') );
26
 
27
  //Add the CSS
28
  add_action( 'admin_head', array( $this,'css') );
29
+
30
+ //default tables with seralized issues
31
+ $this->seralized_tables = array(
32
+ $pf.'options' => 'option_value', //wordpres options
33
+ $pf.'rg_form_meta' => 'display_meta' //gravity forms
34
+ );
35
+
36
  }
37
 
38
  /**
74
  $this->oldurl = trim( strip_tags( $_POST['oldurl'] ) );
75
  $this->newurl = trim( strip_tags( $_POST['newurl'] ) );
76
 
77
+ if( $this->makeTheUpdates() ){
78
  echo '<div id="message" class="updated fade"><p><strong>URLs have been updated.</p></strong></div>';
79
  } else {
80
  echo '<div class="error"><p><strong>You must fill out both boxes to make the update!</p></strong></div>';
105
  /**
106
  * Creates a list of checkboxes for each table
107
  *
108
+ * @since 2.2
109
  * @uses by the view admin-tools-page.php
110
  *
111
  * @filter 'gluu_table_checkboxes' with 2 param
112
  * * $output - the html formatted checkboxes
113
  * * $tables - the complete tables object
114
  *
115
+ * @filter apply_filters( 'gluu-seralized-tables', $this->seralized_tables ); - effect teh make the updates as well
116
  */
117
  function makeCheckBoxes(){
118
  global $wpdb;
120
  $tables = $wpdb->get_results($god_query);
121
 
122
  $output = '<ul id="gluu-checkboxes">';
123
+
124
+ $seralized_tables = apply_filters( 'gluu-seralized-tables', $this->seralized_tables );
125
+
126
  foreach($tables as $v){
127
+ if(in_array( $v->TABLE_NAME, array_keys($seralized_tables)) ){
128
  $output .= sprintf('<li><input name="%s" type="checkbox" value="%s" checked /> %s - <strong><em>Seralized Safe</strong></em></li>',$v->TABLE_NAME,$v->TABLE_NAME,$v->TABLE_NAME);
129
+ } else {
130
  $output .= sprintf('<li><input name="%s" type="checkbox" value="%s" checked /> %s</li>',$v->TABLE_NAME,$v->TABLE_NAME,$v->TABLE_NAME);
131
+ }
132
  }
133
 
134
  $output .= '</ul>';
142
  * Updates the datbase
143
  *
144
  * @uses the oldurl and newurl set above
145
+ * @since 2.2
146
+ *
147
+ * @filters apply_filters( 'gluu-seralized-tables', $this->seralized_tables ); - effects makeCheckBoxes as well
148
  */
149
+ function makeTheUpdates(){
150
  global $wpdb;
151
 
152
  $oldurl = $this->oldurl;
163
  $this->double_subdomain = $subdomain . '.' . $newurl; //Create a match to what the broken one will be
164
  }
165
 
166
+ $seralized_tables = apply_filters( 'gluu-seralized-tables', $this->seralized_tables );
167
+
168
 
169
  //Go throuch each table sent to be updated
170
  foreach($_POST as $v => $i){
171
 
172
  //Send the options table through the seralized safe Update
173
+ if( in_array($v, array_keys($seralized_tables)) ){
174
+ $this->UpdateSeralizedTable($v, $seralized_tables[$v]);
175
  }
176
 
177
  if($v != 'submit' && $v != 'oldurl' && $v != 'newurl'){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
4
  Tags: Go Live, Urls, Domain Changes
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 2.1
8
 
9
  == Description ==
10
 
@@ -13,7 +13,7 @@ Goes through entire site and replaces all instances of and old url with a new on
13
  Some of the features this plugin offers:
14
 
15
  * Database table by table selection in case of issues
16
- * Supports seralized data in the options table
17
  * Very easy to use admin page - which may be found under Tools
18
 
19
  Updates Entire Site including:
@@ -29,7 +29,8 @@ Updates Entire Site including:
29
  * And much more
30
 
31
  The admin screen is extendable for developers familiar with using filters or template overrides.
32
-
 
33
 
34
 
35
  == Installation ==
@@ -58,16 +59,16 @@ Most tables will be just fine to update. You may make a backup of your database,
58
 
59
 
60
 
61
-
62
-
63
-
64
-
65
  == Screenshots ==
66
 
67
  1. Screenshot of a tyical settings page. The verbage will change slightly depending on your database structure
68
 
69
  == Changelog ==
70
 
 
 
 
 
71
  = 2.0 =
72
  * Made updating the options table seralized safe *
73
  * Add extending ability of views and css *
4
  Tags: Go Live, Urls, Domain Changes
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 2.2
8
 
9
  == Description ==
10
 
13
  Some of the features this plugin offers:
14
 
15
  * Database table by table selection in case of issues
16
+ * Supports seralized data in the options table
17
  * Very easy to use admin page - which may be found under Tools
18
 
19
  Updates Entire Site including:
29
  * And much more
30
 
31
  The admin screen is extendable for developers familiar with using filters or template overrides.
32
+
33
+ Additonal Seralized Safe tables may be adding using the 'gluu-seralized-tables' filter checkboxes to tap into this will be coming in a future release.
34
 
35
 
36
  == Installation ==
59
 
60
 
61
 
 
 
 
 
62
  == Screenshots ==
63
 
64
  1. Screenshot of a tyical settings page. The verbage will change slightly depending on your database structure
65
 
66
  == Changelog ==
67
 
68
+ = 2.2 =
69
+ * Added Gravity Forms Support to Seralized Safe
70
+ * Added a filter for additional seralized safe tables
71
+
72
  = 2.0 =
73
  * Made updating the options table seralized safe *
74
  * Add extending ability of views and css *