Search & Replace - Version 2.7.1

Version Description

Download this release

Release Info

Developer Bueltge
Plugin Icon 128x128 Search & Replace
Version 2.7.1
Comparing to
See all releases

Code changes from version 2.7.0 to 2.7.1

Files changed (2) hide show
  1. readme.txt +7 -3
  2. search-and-replace.php +433 -316
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Bueltge, inpsyde
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RHWH8VG798CSC
4
  Tags: database, mysql, search, replace, admin, security
5
  Requires at least: 3.0
6
- Tested up to: 4.0
7
- Stable tag: trunk
8
  License: GPLv2+
9
 
10
  A simple search for find strings in your database and replace the string.
@@ -40,6 +40,10 @@ The plugin comes with various translations, please refer to the [WordPress Codex
40
 
41
 
42
  == Changelog ==
 
 
 
 
43
  = v2.7.0 (2014-09-14) =
44
  * Exclude serialized data from replace function (maybe we reduce the support)
45
  * Add hint, if is serialized data on the result table
@@ -69,7 +73,7 @@ The plugin comes with various translations, please refer to the [WordPress Codex
69
 
70
  = v2.6.1 (01/25/2011) =
71
  * Feature: Add Signups-Table for WP MU
72
- * Maintenance: check for tables, PHP Warning fix
73
 
74
  = v2.6.0 (01/03/2011) =
75
  * Feature: add an new search for find strings (maybe a new way for search strings)
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RHWH8VG798CSC
4
  Tags: database, mysql, search, replace, admin, security
5
  Requires at least: 3.0
6
+ Tested up to: 4.2.2
7
+ Stable tag: 2.7.1
8
  License: GPLv2+
9
 
10
  A simple search for find strings in your database and replace the string.
40
 
41
 
42
  == Changelog ==
43
+ = v2.7.1 (2015-05-28) =
44
+ * Fix for changes on database collate since WordPress version 4.2
45
+ * Fix to reduce backslashes in search and replace string
46
+
47
  = v2.7.0 (2014-09-14) =
48
  * Exclude serialized data from replace function (maybe we reduce the support)
49
  * Add hint, if is serialized data on the result table
73
 
74
  = v2.6.1 (01/25/2011) =
75
  * Feature: Add Signups-Table for WP MU
76
+ * Maintenance: check for tables, PHP Warning fix
77
 
78
  = v2.6.0 (01/03/2011) =
79
  * Feature: add an new search for find strings (maybe a new way for search strings)
search-and-replace.php CHANGED
@@ -7,7 +7,7 @@
7
  * Description: A simple search to find strings in your database and replace those strings.
8
  * Author: Frank Bültge
9
  * Author URI: http://bueltge.de
10
- * Version: 2.7.0
11
  * License: GPLv2+
12
  * Donate URI:
13
  *
@@ -61,7 +61,6 @@ function searchandreplace_textdomain() {
61
  load_plugin_textdomain( FB_SAR_TEXTDOMAIN, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
62
  }
63
 
64
-
65
  /**
66
  * Add action link(s) to plugins page
67
  *
@@ -89,7 +88,6 @@ function searchandreplace_filter_plugin_meta( $links, $file ) {
89
  return $links;
90
  }
91
 
92
-
93
  /**
94
  * Settings in plugin-admin-page
95
  *
@@ -101,7 +99,10 @@ function searchandreplace_add_settings_page() {
101
  return;
102
  }
103
 
104
- add_management_page( __( 'Search & Replace', FB_SAR_TEXTDOMAIN ), __( 'Search & Replace', FB_SAR_TEXTDOMAIN ), 'manage_options', FB_SAR_BASENAME, 'searchandreplace_page', '' );
 
 
 
105
  add_action( 'load-plugins.php', 'searchandreplace_on_load' );
106
  }
107
 
@@ -118,7 +119,6 @@ function searchandreplace_init() {
118
  add_action( 'admin_print_scripts', 'searchandreplace_add_js_head' );
119
  }
120
 
121
-
122
  /* this does the important stuff! */
123
  function searchandreplace_doit(
124
  $search_text,
@@ -149,12 +149,24 @@ function searchandreplace_doit(
149
  $search_slug = strtolower( $search_text );
150
  $replace_slug = strtolower( $replace_text );
151
 
152
- if ( ! $sall && ! $content && ! $id && ! $guid && ! $title && ! $excerpt && ! $meta_value &&
153
- ! $comment_content && ! $comment_author && ! $comment_author_email && ! $comment_author_url && ! $comment_count &&
154
- ! $cat_description && ! $tag && ! $user_id && ! $user_login &&
 
 
 
 
 
 
 
 
 
 
155
  ! $signups
156
  ) {
157
- return '<div class="error"><p><strong>' . __( 'Nothing (checkbox) selected to modify!', FB_SAR_TEXTDOMAIN ) . '</strong></p></div><br class="clear" />';
 
 
158
  }
159
 
160
  // search at all
@@ -229,7 +241,9 @@ function searchandreplace_doit(
229
 
230
  // post guid
231
  if ( $guid ) {
232
- $myecho .= "\n" . '<li>' . __( 'Searching <abbr title=\"Global Unique Identifier\">GUID</abbr>', FB_SAR_TEXTDOMAIN ) . ' ...';
 
 
233
 
234
  $myecho .= "\n" . '<ul>' . "\n";
235
  $myecho .= searchandreplace_results( 'guid', 'posts', $search_text );
@@ -485,7 +499,7 @@ function searchandreplace_results( $field, $table, $search_text ) {
485
 
486
  global $wpdb;
487
 
488
- $myecho = '';
489
 
490
  $myecho .= "\n" . '<li>';
491
  $results = "SELECT $field FROM " . $wpdb->$table . " WHERE $field LIKE \"%$search_text%\"";
@@ -514,37 +528,48 @@ function searchandreplace_results( $field, $table, $search_text ) {
514
  return $myecho;
515
  }
516
 
517
-
518
  function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
519
 
520
  global $wpdb;
521
 
 
 
 
 
 
 
 
 
522
  if ( empty( $wpdb->dbname ) ) {
523
  $wpdb->dbname = DB_NAME;
524
  }
525
 
526
  $search_text = esc_sql( $search_text ); # this appears to be escaped already
 
 
527
  if ( $replace_text ) {
528
  $replace_text = esc_sql( $replace_text );
529
  } # this appears to be escaped already
 
 
530
  $result_in_tables = 0;
531
 
532
  $myecho = '
533
  <script language="JavaScript">
534
  var table_id = new Array();
535
-
536
  function hide_all() {
537
  for(i=0;i<table_id.length;i++){
538
  document.getElementById(table_id[i]).style.display = \'none\';
539
  }
540
  }
541
-
542
  function show_all() {
543
  for(i=0;i<table_id.length;i++){
544
  document.getElementById(table_id[i]).style.display = \'block\';
545
  }
546
  }
547
-
548
  function toggle(id) {
549
  if (get_style(id,\'display\') == \'block\') {
550
  document.getElementById(id).style.display = \'none\';
@@ -552,7 +577,7 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
552
  document.getElementById(id).style.display = \'block\';
553
  }
554
  }
555
-
556
  function get_style(el,styleProp) {
557
  var x = document.getElementById(el);
558
  if (x.currentStyle)
@@ -565,14 +590,17 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
565
 
566
  $myecho .= '<p><a href="javascript:hide_all()">' . __( 'Collapse All', FB_SAR_TEXTDOMAIN ) . '</a>
567
  <a href="javascript:show_all()">' . __( 'Expand All', FB_SAR_TEXTDOMAIN ) . '</a></p>';
568
- $myecho .= '<p>' . __( 'Results for', FB_SAR_TEXTDOMAIN ) . ': <code>' . stripslashes( $search_text ) . '</code></p><p>' . __( 'Please note search text may appear (and be replaced) more than one time in each row.', FB_SAR_TEXTDOMAIN ) . '</p>';
 
 
 
 
569
 
570
  $sql = 'SHOW TABLES';
571
  $tables = $wpdb->get_results( $sql, ARRAY_A );
572
 
573
  $replace_sql = '';
574
 
575
-
576
  for ( $i = 0; $i < count( $tables ); $i ++ ) {
577
  //@abstract query building of each table
578
  if ( $wpdb->get_var( "SELECT COUNT(*) FROM " . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] ) > 0 ) {
@@ -599,11 +627,10 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
599
  }
600
 
601
  // COLLATE utf8_bin for search case sensitive
602
- $search_sql .= '`' . $column[ $j ][ 'Field' ] . '` like \'%' . $search_text . '%\' COLLATE utf8_bin ';
603
 
604
  if ( $replace_text ) {
605
 
606
-
607
  $search_result = $wpdb->get_results( $search_sql, ARRAY_A );
608
 
609
  // Loop about the result and check for serialized data
@@ -649,8 +676,12 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
649
  if ( count( $search_result ) ) {
650
  $result_in_tables ++;
651
 
652
- $myecho .= '<p><strong>' . __( 'Table:', FB_SAR_TEXTDOMAIN ) . ' </strong><code>' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '</code> ... ';
653
- $myecho .= __( 'Total rows for', FB_SAR_TEXTDOMAIN ) . ' <code>"' . stripslashes( $search_text ) . '"</code>: <strong>' . $wpdb->num_rows . '</strong></p>';
 
 
 
 
654
  $myecho .= '<p><a href="javascript:toggle(\'' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '_sql' . '\')">SQL</a></p>';
655
  $myecho .= '<script language="JavaScript">
656
  table_id.push("' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '_sql");
@@ -669,7 +700,7 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
669
 
670
  $myecho .= searchandreplace_table_arrange( $search_result );
671
  $myecho .= '</div>';
672
- }// @endof showing found search
673
 
674
  }
675
 
@@ -677,7 +708,8 @@ function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
677
  }
678
 
679
  if ( ! $result_in_tables ) {
680
- $myecho = '<p style="color:red;">' . __( 'Sorry,' ) . ' <code>' .
 
681
  stripslashes_deep( stripslashes_deep( htmlentities2( $search_text ) ) ) . '</code> ' .
682
  __( 'is not found in this database', FB_SAR_TEXTDOMAIN ) .
683
  '(<code>' . $wpdb->dbname . '</code>)!</p>';
@@ -703,7 +735,7 @@ function searchandreplace_table_arrange( $array ) {
703
  $search_text = $_POST[ "search_text" ];
704
 
705
  for ( $i = 0; $i < count( $array ); $i ++ ) {
706
- //@abstract table row
707
  $table_data .= '<tr class=' . ( ( $i & 1 ) ? '"alternate"' : '""' ) . ' >';
708
  $j = 0;
709
 
@@ -711,10 +743,15 @@ function searchandreplace_table_arrange( $array ) {
711
 
712
  $hint = '';
713
  if ( is_serialized( $data ) ) {
714
- $hint = '<div class="error below-h2 form-invalid">' . __( 'Serialized, no changes possible.', FB_SAR_TEXTDOMAIN ) . '</div>';
 
 
715
  }
716
 
717
- $data = preg_replace( "|($search_text)|U", "<code style=\"background:#ffc516;padding:0 4px;\"><b>$1</b></code>", htmlspecialchars( $data ) );
 
 
 
718
  $table_data .= '<td>' . $hint . $data . ' &nbsp;</td>';
719
  $j ++;
720
  }
@@ -752,7 +789,6 @@ function searchandreplace_table_arrange( $array ) {
752
  </div>';
753
  }
754
 
755
-
756
  /**
757
  * add js to the head that fires the 'new node' function
758
  */
@@ -761,20 +797,20 @@ function searchandreplace_add_js_head() {
761
  ?>
762
  <script type="text/javascript">
763
  /* <![CDATA[ */
764
- function selectcb(thisobj, var1) {
765
  var i = 0;
766
- var o = document.forms[thisobj].elements;
767
- if (o) {
768
- for (i = 0; i < o.length; i++) {
769
- if (o[i].type == 'checkbox') {
770
- o[i].checked = var1;
771
  }
772
  }
773
  }
774
  }
775
  /* ]]> */
776
  </script>
777
- <?php
778
  }
779
 
780
  function searchandreplace_action() {
@@ -783,7 +819,9 @@ function searchandreplace_action() {
783
  check_admin_referer( 'searchandreplace_nonce' );
784
  $myecho = '';
785
  if ( empty( $_POST[ 'search_text' ] ) ) {
786
- $myecho .= '<div class="error"><p><strong>&raquo; ' . __( 'You must specify some text to replace!', FB_SAR_TEXTDOMAIN ) . '</strong></p></div><br class="clear">';
 
 
787
  } else {
788
  $myecho .= '<div class="updated fade">';
789
  $myecho .= '<p><strong>&raquo; ' . __( 'Performing search', FB_SAR_TEXTDOMAIN );
@@ -794,9 +832,13 @@ function searchandreplace_action() {
794
  $myecho .= ' ' . __( 'and replacement', FB_SAR_TEXTDOMAIN );
795
  }
796
  $myecho .= ' ...</strong></p>';
797
- $myecho .= '<p>&raquo; ' . __( 'Searching for', FB_SAR_TEXTDOMAIN ) . ' <code>' . stripslashes( htmlentities2( $_POST[ 'search_text' ] ) ) . '</code>';
 
 
798
  if ( isset( $_POST[ 'replace_text' ] ) && $_POST[ 'sall' ] == 'srall' ) {
799
- $myecho .= __( 'and replacing with', FB_SAR_TEXTDOMAIN ) . ' <code>' . stripslashes( htmlentities2( $_POST[ 'replace_text' ] ) ) . '</code></p>';
 
 
800
  }
801
  $myecho .= '</div><br class="clear" />';
802
 
@@ -837,7 +879,6 @@ function searchandreplace_action() {
837
  }
838
  }
839
 
840
-
841
  function searchandreplace_page() {
842
 
843
  global $wpdb;
@@ -847,290 +888,366 @@ function searchandreplace_page() {
847
  }
848
  ?>
849
  <div class="wrap" id="top">
850
- <h2><?php _e( 'Search &amp; Replace', FB_SAR_TEXTDOMAIN ); ?></h2>
851
 
852
- <?php
853
- if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) {
854
- $capability = 'manage_options';
855
- } else {
856
- $capability = 'edit_plugins';
857
- }
858
-
859
- if ( current_user_can( $capability ) ) {
860
- searchandreplace_action();
861
- } else {
862
- wp_die( '<div class="error"><p>' . __( 'You do not have sufficient permissions to edit plugins for this installation of WordPress.', FB_SAR_TEXTDOMAIN ) . '</p></div>' );
863
- }
864
- ?>
865
 
866
- <div id="poststuff" class="dlm">
867
- <div class="postbox">
868
- <h3><?php _e( 'Global Search &amp; Replace', FB_SAR_TEXTDOMAIN ) ?></h3>
869
-
870
- <div class="inside">
871
- <p><?php _e( 'This plugin modifies your database directly!<br /><strong>WARNING: </strong>You <strong>cannot</strong> undo any changes made by this plugin. <strong>It is therefore recommended you backup your database before running this plugin.</strong> <a href="http://www.gnu.org/licenses/gpl-2.0.txt">There is no warranty for this plugin!</a> <strong>Activate</strong> the plugin <strong>only</strong> if you want to use it!', FB_SAR_TEXTDOMAIN ); ?></p>
872
-
873
- <p><?php _e( 'Text search is case sensitive and has no pattern matching capabilities. This replace function matches raw text so it can be used to replace HTML tags too.', FB_SAR_TEXTDOMAIN ); ?></p>
874
- <p><?php _e( 'But it will not replaced strings inside serialized data fields, like option values in the table options.', FB_SAR_TEXTDOMAIN ); ?></p>
875
-
876
- <p><?php _e( '<strong>Step One:</strong> Use the folllowing search (only) first, for a better understanding of what will happen when you do the replace. The SQL query and tables will be returned with the results. The search uses all fields in all tables! After verifying your results you can use the replace function.', FB_SAR_TEXTDOMAIN ); ?></p>
877
-
878
- <form name="search" action="" method="post">
879
- <?php wp_nonce_field( 'searchandreplace_nonce' ) ?>
880
- <table summary="config" class="widefat">
881
- <tr>
882
- <th>
883
- <label for="sall_label"><?php _e( 'All - search only!', FB_SAR_TEXTDOMAIN ); ?></label>
884
- </th>
885
- <td><input type='radio' name='sall' value='sall' id='sall_label' checked="checked" />
886
- <label for="sall_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
887
- <code>*</code> <?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
888
- <code>*</code></label>
889
- </td>
890
- </tr>
891
- <tr>
892
- <th><label for="search_text"><?php _e( 'Search for', FB_SAR_TEXTDOMAIN ); ?></label></th>
893
- <td><input class="code" type="text" id="search_text" name="search_text" value="" size="80" /></td>
894
- </tr>
895
- <tr class="alternate">
896
- <th>
897
- <label for="srall_label"><?php _e( 'All - search and replace!', FB_SAR_TEXTDOMAIN ); ?></label>
898
- </th>
899
- <td><input type='radio' name='sall' value='srall' id='srall_label' />
900
- <label for="srall_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
901
- <code>*</code> <?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
902
- <code>*</code></label>
903
- </td>
904
- </tr>
905
- <tr class="alternate">
906
- <th><label for="replace_text"><?php _e( 'Replace with', FB_SAR_TEXTDOMAIN ); ?></label></th>
907
- <td><input class="code" type="text" id="replace_text" name="replace_text" value="" size="80" /></td>
908
- </tr>
909
- </table>
910
- <p class="submit">
911
- <input class="button" type="submit" value="<?php _e( 'Go', FB_SAR_TEXTDOMAIN ); ?> &raquo;" />
912
- <input type="hidden" name="submitted" />
913
- </p>
914
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
915
  </div>
916
  </div>
917
- </div>
918
-
919
- <div id="poststuff" class="dlm">
920
- <div class="postbox">
921
- <h3><?php _e( 'Search in', FB_SAR_TEXTDOMAIN ) ?></h3>
922
-
923
- <div class="inside">
924
-
925
- <form name="replace" action="" method="post">
926
- <?php wp_nonce_field( 'searchandreplace_nonce' ) ?>
927
- <table summary="config" class="widefat">
928
- <tr class="alternate">
929
- <th><label for="content_label"><?php _e( 'Content', FB_SAR_TEXTDOMAIN ); ?></label></th>
930
- <td colspan="2" style="text-align: center;">
931
- <input type='checkbox' name='content' id='content_label' /></td>
932
- <td><label for="content_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
933
- <code>post_content</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
934
- <code>_posts</code></label></td>
935
- </tr>
936
- <tr>
937
- <th>
938
- <label for="guid_label"><?php _e( '<abbr title="Global Unique Identifier">GUID</abbr>', FB_SAR_TEXTDOMAIN ); ?></label>
939
- </th>
940
- <td colspan="2" style="text-align: center;">
941
- <input type='checkbox' name='guid' id='guid_label' /></td>
942
- <td><label for="guid_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
943
- <code>guid</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
944
- <code>_posts</code></label></td>
945
- </tr>
946
- <tr class="alternate">
947
- <th><label for="title_label"><?php _e( 'Titles', FB_SAR_TEXTDOMAIN ); ?></label></th>
948
- <td colspan="2" style="text-align: center;">
949
- <input type='checkbox' name='title' id='title_label' /></td>
950
- <td><label for="title_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
951
- <code>post_title</code>,
952
- <code>post_name</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
953
- <code>_posts</code></label></td>
954
- </tr>
955
- <tr>
956
- <th><label for="excerpt_label"><?php _e( 'Excerpts', FB_SAR_TEXTDOMAIN ); ?></label>
957
- </th>
958
- <td colspan="2" style="text-align: center;">
959
- <input type='checkbox' name='excerpt' id='excerpt_label' /></td>
960
- <td><label for="excerpt_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
961
- <code>post_excerpt</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
962
- <code>_posts</code></label></td>
963
- </tr>
964
- <tr class="alternate">
965
- <th><label for="meta_value_label"><?php _e( 'Metadata', FB_SAR_TEXTDOMAIN ); ?></label>
966
- </th>
967
- <td colspan="2" style="text-align: center;">
968
- <input type='checkbox' name='meta_value' id='meta_value_label' /></td>
969
- <td><label for="meta_value_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
970
- <code>meta_value</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
971
- <code>_postmeta</code></label></td>
972
- </tr>
973
- <tr>
974
- <th>
975
- <label for="comment_content_label"><?php _e( 'Comments content', FB_SAR_TEXTDOMAIN ); ?></label>
976
- </th>
977
- <td colspan="2" style="text-align: center;">
978
- <input type='checkbox' name='comment_content' id='comment_content_label' /></td>
979
- <td><label for="comment_content_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
980
- <code>comment_content</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
981
- <code>_comments</code></label></td>
982
- </tr>
983
- <tr class="alternate">
984
- <th>
985
- <label for="comment_author_label"><?php _e( 'Comments author', FB_SAR_TEXTDOMAIN ); ?></label>
986
- </th>
987
- <td colspan="2" style="text-align: center;">
988
- <input type='checkbox' name='comment_author' id='comment_author_label' /></td>
989
- <td><label for="comment_author_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
990
- <code>comment_author</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
991
- <code>_comments</code></label></td>
992
- </tr>
993
- <tr>
994
- <th>
995
- <label for="comment_author_email_label"><?php _e( 'Comments author e-mail', FB_SAR_TEXTDOMAIN ); ?></label>
996
- </th>
997
- <td colspan="2" style="text-align: center;">
998
- <input type='checkbox' name='comment_author_email' id='comment_author_email_label' />
999
- </td>
1000
- <td><label for="comment_author_email_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1001
- <code>comment_author_email</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1002
- <code>_comments</code></label></td>
1003
- </tr>
1004
- <tr class="alternate">
1005
- <th>
1006
- <label for="comment_author_url_label"><?php _e( 'Comments author URL', FB_SAR_TEXTDOMAIN ); ?></label>
1007
- </th>
1008
- <td colspan="2" style="text-align: center;">
1009
- <input type='checkbox' name='comment_author_url' id='comment_author_url_label' />
1010
- </td>
1011
- <td><label for="comment_author_url_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1012
- <code>comment_author_url</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1013
- <code>_comments</code></label></td>
1014
- </tr>
1015
- <tr>
1016
- <th>
1017
- <label for="comment_count_label"><?php _e( 'Comments counter', FB_SAR_TEXTDOMAIN ); ?></label>
1018
- </th>
1019
- <td colspan="2" style="text-align: center;">
1020
- <input type='checkbox' name='comment_count' id='comment_count_label' /></td>
1021
- <td><label for="comment_count_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1022
- <code>comment_count</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1023
- <code>_posts</code></label></td>
1024
- </tr>
1025
- <tr class="alternate">
1026
- <th>
1027
- <label for="cat_description_label"><?php _e( 'Category description', FB_SAR_TEXTDOMAIN ); ?></label>
1028
- </th>
1029
- <td colspan="2" style="text-align: center;">
1030
- <input type='checkbox' name='cat_description' id='cat_description_label' /></td>
1031
- <td><label for="cat_description_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1032
- <code>description</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1033
- <code>_term_taxonomy</code></label></td>
1034
- </tr>
1035
- <tr>
1036
- <th>
1037
- <label for="tag_label"><?php _e( 'Tags &amp; Categories', FB_SAR_TEXTDOMAIN ); ?></label>
1038
- </th>
1039
- <td colspan="2" style="text-align: center;">
1040
- <input type='checkbox' name='tag' id='tag_label' /></td>
1041
- <td><label for="tag_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1042
- <code>name</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1043
- <code>slug</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1044
- <code>_terms</code></label></td>
1045
- </tr>
1046
- <tr class="alternate">
1047
- <th><label for="user_id_label"><?php _e( 'User ID', FB_SAR_TEXTDOMAIN ); ?></label></th>
1048
- <td colspan="2" style="text-align: center;">
1049
- <input type='checkbox' name='user_id' id='user_id_label' /></td>
1050
- <td><label for="user_id_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1051
- <code>ID</code>, <code>user_id</code>, <code>post_author</code>,
1052
- <code>user_id</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1053
- <code>link_owner</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1054
- <code>_users</code>, <code>_usermeta</code>, <code>_posts</code>,
1055
- <code>_comments</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1056
- <code>_links</code></label></td>
1057
- </tr>
1058
- <tr>
1059
- <th>
1060
- <label for="user_login_label"><?php _e( 'User login', FB_SAR_TEXTDOMAIN ); ?></label>
1061
- </th>
1062
- <td colspan="2" style="text-align: center;">
1063
- <input type='checkbox' name='user_login' id='user_login_label' /></td>
1064
- <td><label for="user_login_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1065
- <code>user_login</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1066
- <code>user_nicename</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1067
- <code>_users</code></label></td>
1068
- </tr>
1069
- <?php if ( $wpdb && $wpdb->query( "SHOW TABLES LIKE '" . $wpdb->prefix . 'terms' . "'" ) == 1 ) { ?>
1070
- <tr class="alternate">
1071
- <th><label for="id_label"><?php _e( 'ID', FB_SAR_TEXTDOMAIN ); ?></label></th>
1072
- <td colspan="2" style="text-align: center;">
1073
- <input type='checkbox' name='id' id='id_label' /></td>
1074
- <td><label for="id_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1075
- <code>ID</code>, <code>post_parent</code>, <code>post_id</code>,
1076
- <code>object_id</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1077
- <code>comments</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1078
- <code>_posts</code>, <code>_postmeta</code>,
1079
- <code>_term_relationships</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1080
- <code>_comment_post_ID</code></label></td>
1081
- </tr>
1082
- <?php } ?>
1083
- <?php if ( $wpdb && $wpdb->query( "SHOW TABLES LIKE '" . $wpdb->prefix . 'signups' . "'" ) == 1 ) { ?>
1084
- <tr class="alternate">
1085
- <th><label for="signups_label"><?php _e( 'Signups', FB_SAR_TEXTDOMAIN ); ?></label>
1086
- </th>
1087
- <td colspan="2" style="text-align: center;">
1088
- <input type='checkbox' name='signups' id='signups_label' /></td>
1089
- <td><label for="signups_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1090
- <code>user_login</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1091
- <code>_signups</code></label></td>
1092
- </tr>
1093
- <?php } ?>
1094
- <tr>
1095
- <th>&nbsp;</th>
1096
- <td colspan="2" style="text-align: center;">&nbsp;&nbsp;
1097
- <a href="javascript:selectcb('replace', true);" title="<?php _e( 'Check all', FB_SAR_TEXTDOMAIN ); ?>"><?php _e( 'all', FB_SAR_TEXTDOMAIN ); ?></a> |
1098
- <a href="javascript:selectcb('replace', false);" title="<?php _e( 'Uncheck all', FB_SAR_TEXTDOMAIN ); ?>"><?php _e( 'none', FB_SAR_TEXTDOMAIN ); ?></a>
1099
- </td>
1100
- <td>&nbsp;</td>
1101
- </tr>
1102
- </table>
1103
-
1104
- <table summary="submit" class="form-table">
1105
- <tr>
1106
- <th><label for="search_text"><?php _e( 'Search for', FB_SAR_TEXTDOMAIN ); ?></label></th>
1107
- <td><input class="code" type="text" id="search_text" name="search_text" value="" size="80" /></td>
1108
- </tr>
1109
- <tr>
1110
- <th><label for="replace_text"><?php _e( 'Replace with', FB_SAR_TEXTDOMAIN ); ?></label></th>
1111
- <td><input class="code" type="text" id="replace_text" name="replace_text" value="" size="80" /></td>
1112
- </tr>
1113
- </table>
1114
- <p class="submit">
1115
- <input class="button" type="submit" value="<?php _e( 'Go', FB_SAR_TEXTDOMAIN ); ?> &raquo;" />
1116
- <input type="hidden" name="submitted" />
1117
- </p>
1118
- </form>
1119
-
1120
- </div>
1121
- </div>
1122
- </div>
1123
-
1124
- <div id="poststuff" class="dlm">
1125
- <div class="postbox">
1126
- <h3><?php _e( 'Information about this plugin', FB_SAR_TEXTDOMAIN ); ?></h3>
1127
 
1128
- <div class="inside">
1129
- <p><?php _e( "&quot;Search and Replace&quot; original plugin (en) created by <a href='http://thedeadone.net/'>Mark Cunningham</a> and provided (comments) by <a href='http://www.gonahkar.com'>Gonahkar</a>.<br />&quot;Search &amp; Replace&quot;, enhanced by <a href='http://bueltge.de'>Frank Bueltge</a> and current version is also maintained by Ron Guerin.", FB_SAR_TEXTDOMAIN ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
 
1131
- <p><?php _e( "For more information: Visit the <a href='http://wordpress.org/plugins/search-and-replace/'>plugin homepage</a> for further information or to grab the latest version of this plugin.", FB_SAR_TEXTDOMAIN ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1132
  </div>
1133
  </div>
1134
  </div>
1135
- </div>
1136
  <?php } ?>
7
  * Description: A simple search to find strings in your database and replace those strings.
8
  * Author: Frank Bültge
9
  * Author URI: http://bueltge.de
10
+ * Version: 2.7.1
11
  * License: GPLv2+
12
  * Donate URI:
13
  *
61
  load_plugin_textdomain( FB_SAR_TEXTDOMAIN, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
62
  }
63
 
 
64
  /**
65
  * Add action link(s) to plugins page
66
  *
88
  return $links;
89
  }
90
 
 
91
  /**
92
  * Settings in plugin-admin-page
93
  *
99
  return;
100
  }
101
 
102
+ add_management_page(
103
+ __( 'Search &amp; Replace', FB_SAR_TEXTDOMAIN ), __( 'Search &amp; Replace', FB_SAR_TEXTDOMAIN ),
104
+ 'manage_options', FB_SAR_BASENAME, 'searchandreplace_page', ''
105
+ );
106
  add_action( 'load-plugins.php', 'searchandreplace_on_load' );
107
  }
108
 
119
  add_action( 'admin_print_scripts', 'searchandreplace_add_js_head' );
120
  }
121
 
 
122
  /* this does the important stuff! */
123
  function searchandreplace_doit(
124
  $search_text,
149
  $search_slug = strtolower( $search_text );
150
  $replace_slug = strtolower( $replace_text );
151
 
152
+ if ( ! $sall && ! $content && ! $id && ! $guid && ! $title && ! $excerpt && ! $meta_value
153
+ &&
154
+ ! $comment_content
155
+ && ! $comment_author
156
+ && ! $comment_author_email
157
+ && ! $comment_author_url
158
+ && ! $comment_count
159
+ &&
160
+ ! $cat_description
161
+ && ! $tag
162
+ && ! $user_id
163
+ && ! $user_login
164
+ &&
165
  ! $signups
166
  ) {
167
+ return '<div class="error"><p><strong>' . __(
168
+ 'Nothing (checkbox) selected to modify!', FB_SAR_TEXTDOMAIN
169
+ ) . '</strong></p></div><br class="clear" />';
170
  }
171
 
172
  // search at all
241
 
242
  // post guid
243
  if ( $guid ) {
244
+ $myecho .= "\n" . '<li>' . __(
245
+ 'Searching <abbr title=\"Global Unique Identifier\">GUID</abbr>', FB_SAR_TEXTDOMAIN
246
+ ) . ' ...';
247
 
248
  $myecho .= "\n" . '<ul>' . "\n";
249
  $myecho .= searchandreplace_results( 'guid', 'posts', $search_text );
499
 
500
  global $wpdb;
501
 
502
+ $myecho = '';
503
 
504
  $myecho .= "\n" . '<li>';
505
  $results = "SELECT $field FROM " . $wpdb->$table . " WHERE $field LIKE \"%$search_text%\"";
528
  return $myecho;
529
  }
530
 
 
531
  function searchandreplace_sall( $search_text, $replace_text = FALSE ) {
532
 
533
  global $wpdb;
534
 
535
+ if ( ! defined( 'DB_COLLATE' ) || '' === DB_COLLATE ) {
536
+ $db_collate = 'utf8mb4_unicode_ci';
537
+ } elseif ( 'utf8' === DB_CHARSET ) {
538
+ $db_collate = 'utf8mb4_unicode_ci';
539
+ } else {
540
+ $db_collate = DB_COLLATE;
541
+ }
542
+
543
  if ( empty( $wpdb->dbname ) ) {
544
  $wpdb->dbname = DB_NAME;
545
  }
546
 
547
  $search_text = esc_sql( $search_text ); # this appears to be escaped already
548
+ $search_text = stripslashes_deep( $search_text );
549
+
550
  if ( $replace_text ) {
551
  $replace_text = esc_sql( $replace_text );
552
  } # this appears to be escaped already
553
+ $replace_text = stripslashes_deep( $replace_text );
554
+
555
  $result_in_tables = 0;
556
 
557
  $myecho = '
558
  <script language="JavaScript">
559
  var table_id = new Array();
560
+
561
  function hide_all() {
562
  for(i=0;i<table_id.length;i++){
563
  document.getElementById(table_id[i]).style.display = \'none\';
564
  }
565
  }
566
+
567
  function show_all() {
568
  for(i=0;i<table_id.length;i++){
569
  document.getElementById(table_id[i]).style.display = \'block\';
570
  }
571
  }
572
+
573
  function toggle(id) {
574
  if (get_style(id,\'display\') == \'block\') {
575
  document.getElementById(id).style.display = \'none\';
577
  document.getElementById(id).style.display = \'block\';
578
  }
579
  }
580
+
581
  function get_style(el,styleProp) {
582
  var x = document.getElementById(el);
583
  if (x.currentStyle)
590
 
591
  $myecho .= '<p><a href="javascript:hide_all()">' . __( 'Collapse All', FB_SAR_TEXTDOMAIN ) . '</a>
592
  <a href="javascript:show_all()">' . __( 'Expand All', FB_SAR_TEXTDOMAIN ) . '</a></p>';
593
+ $myecho .= '<p>' . __( 'Results for', FB_SAR_TEXTDOMAIN ) . ': <code>' . stripslashes(
594
+ $search_text
595
+ ) . '</code></p><p>' . __(
596
+ 'Please note search text may appear (and be replaced) more than one time in each row.', FB_SAR_TEXTDOMAIN
597
+ ) . '</p>';
598
 
599
  $sql = 'SHOW TABLES';
600
  $tables = $wpdb->get_results( $sql, ARRAY_A );
601
 
602
  $replace_sql = '';
603
 
 
604
  for ( $i = 0; $i < count( $tables ); $i ++ ) {
605
  //@abstract query building of each table
606
  if ( $wpdb->get_var( "SELECT COUNT(*) FROM " . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] ) > 0 ) {
627
  }
628
 
629
  // COLLATE utf8_bin for search case sensitive
630
+ $search_sql .= '`' . $column[ $j ][ 'Field' ] . '` like \'%' . $search_text . '%\' COLLATE ' . $db_collate . ' ';
631
 
632
  if ( $replace_text ) {
633
 
 
634
  $search_result = $wpdb->get_results( $search_sql, ARRAY_A );
635
 
636
  // Loop about the result and check for serialized data
676
  if ( count( $search_result ) ) {
677
  $result_in_tables ++;
678
 
679
+ $myecho .= '<p><strong>' . __(
680
+ 'Table:', FB_SAR_TEXTDOMAIN
681
+ ) . ' </strong><code>' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '</code> ... ';
682
+ $myecho .= __( 'Total rows for', FB_SAR_TEXTDOMAIN ) . ' <code>"' . stripslashes(
683
+ $search_text
684
+ ) . '"</code>: <strong>' . $wpdb->num_rows . '</strong></p>';
685
  $myecho .= '<p><a href="javascript:toggle(\'' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '_sql' . '\')">SQL</a></p>';
686
  $myecho .= '<script language="JavaScript">
687
  table_id.push("' . $tables[ $i ][ 'Tables_in_' . $wpdb->dbname ] . '_sql");
700
 
701
  $myecho .= searchandreplace_table_arrange( $search_result );
702
  $myecho .= '</div>';
703
+ }// @endof showing found search
704
 
705
  }
706
 
708
  }
709
 
710
  if ( ! $result_in_tables ) {
711
+ $myecho = '<p><code>' . esc_attr( $search_sql ) . '</code></p>';
712
+ $myecho .= '<p style="color:red;">' . __( 'Sorry,' ) . ' <code>' .
713
  stripslashes_deep( stripslashes_deep( htmlentities2( $search_text ) ) ) . '</code> ' .
714
  __( 'is not found in this database', FB_SAR_TEXTDOMAIN ) .
715
  '(<code>' . $wpdb->dbname . '</code>)!</p>';
735
  $search_text = $_POST[ "search_text" ];
736
 
737
  for ( $i = 0; $i < count( $array ); $i ++ ) {
738
+ //@abstract table row
739
  $table_data .= '<tr class=' . ( ( $i & 1 ) ? '"alternate"' : '""' ) . ' >';
740
  $j = 0;
741
 
743
 
744
  $hint = '';
745
  if ( is_serialized( $data ) ) {
746
+ $hint = '<div class="error below-h2 form-invalid">' . __(
747
+ 'Serialized, no changes possible.', FB_SAR_TEXTDOMAIN
748
+ ) . '</div>';
749
  }
750
 
751
+ $data = preg_replace(
752
+ "|($search_text)|U", "<code style=\"background:#ffc516;padding:0 4px;\"><b>$1</b></code>",
753
+ htmlspecialchars( $data )
754
+ );
755
  $table_data .= '<td>' . $hint . $data . ' &nbsp;</td>';
756
  $j ++;
757
  }
789
  </div>';
790
  }
791
 
 
792
  /**
793
  * add js to the head that fires the 'new node' function
794
  */
797
  ?>
798
  <script type="text/javascript">
799
  /* <![CDATA[ */
800
+ function selectcb( thisobj, var1 ) {
801
  var i = 0;
802
+ var o = document.forms[ thisobj ].elements;
803
+ if ( o ) {
804
+ for ( i = 0; i < o.length; i++ ) {
805
+ if ( o[ i ].type == 'checkbox' ) {
806
+ o[ i ].checked = var1;
807
  }
808
  }
809
  }
810
  }
811
  /* ]]> */
812
  </script>
813
+ <?php
814
  }
815
 
816
  function searchandreplace_action() {
819
  check_admin_referer( 'searchandreplace_nonce' );
820
  $myecho = '';
821
  if ( empty( $_POST[ 'search_text' ] ) ) {
822
+ $myecho .= '<div class="error"><p><strong>&raquo; ' . __(
823
+ 'You must specify some text to replace!', FB_SAR_TEXTDOMAIN
824
+ ) . '</strong></p></div><br class="clear">';
825
  } else {
826
  $myecho .= '<div class="updated fade">';
827
  $myecho .= '<p><strong>&raquo; ' . __( 'Performing search', FB_SAR_TEXTDOMAIN );
832
  $myecho .= ' ' . __( 'and replacement', FB_SAR_TEXTDOMAIN );
833
  }
834
  $myecho .= ' ...</strong></p>';
835
+ $myecho .= '<p>&raquo; ' . __( 'Searching for', FB_SAR_TEXTDOMAIN ) . ' <code>' . stripslashes(
836
+ htmlentities2( $_POST[ 'search_text' ] )
837
+ ) . '</code>';
838
  if ( isset( $_POST[ 'replace_text' ] ) && $_POST[ 'sall' ] == 'srall' ) {
839
+ $myecho .= __( 'and replacing with', FB_SAR_TEXTDOMAIN ) . ' <code>' . stripslashes(
840
+ htmlentities2( $_POST[ 'replace_text' ] )
841
+ ) . '</code></p>';
842
  }
843
  $myecho .= '</div><br class="clear" />';
844
 
879
  }
880
  }
881
 
 
882
  function searchandreplace_page() {
883
 
884
  global $wpdb;
888
  }
889
  ?>
890
  <div class="wrap" id="top">
891
+ <h2><?php _e( 'Search &amp; Replace', FB_SAR_TEXTDOMAIN ); ?></h2>
892
 
893
+ <?php
894
+ if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) {
895
+ $capability = 'manage_options';
896
+ } else {
897
+ $capability = 'edit_plugins';
898
+ }
 
 
 
 
 
 
 
899
 
900
+ if ( current_user_can( $capability ) ) {
901
+ searchandreplace_action();
902
+ } else {
903
+ wp_die(
904
+ '<div class="error"><p>' . __(
905
+ 'You do not have sufficient permissions to edit plugins for this installation of WordPress.',
906
+ FB_SAR_TEXTDOMAIN
907
+ ) . '</p></div>'
908
+ );
909
+ }
910
+ ?>
911
+
912
+ <div id="poststuff" class="dlm">
913
+ <div class="postbox">
914
+ <h3><?php _e( 'Global Search &amp; Replace', FB_SAR_TEXTDOMAIN ) ?></h3>
915
+
916
+ <div class="inside">
917
+ <p><?php _e(
918
+ 'This plugin modifies your database directly!<br /><strong>WARNING: </strong>You <strong>cannot</strong> undo any changes made by this plugin. <strong>It is therefore recommended you backup your database before running this plugin.</strong> <a href="http://www.gnu.org/licenses/gpl-2.0.txt">There is no warranty for this plugin!</a> <strong>Activate</strong> the plugin <strong>only</strong> if you want to use it!',
919
+ FB_SAR_TEXTDOMAIN
920
+ ); ?></p>
921
+
922
+ <p><?php _e(
923
+ 'Text search is case sensitive and has no pattern matching capabilities. This replace function matches raw text so it can be used to replace HTML tags too.',
924
+ FB_SAR_TEXTDOMAIN
925
+ ); ?></p>
926
+
927
+ <p><?php _e(
928
+ 'But it will not replaced strings inside serialized data fields, like option values in the table options.',
929
+ FB_SAR_TEXTDOMAIN
930
+ ); ?></p>
931
+
932
+ <p><?php _e(
933
+ '<strong>Step One:</strong> Use the folllowing search (only) first, for a better understanding of what will happen when you do the replace. The SQL query and tables will be returned with the results. The search uses all fields in all tables! After verifying your results you can use the replace function.',
934
+ FB_SAR_TEXTDOMAIN
935
+ ); ?></p>
936
+
937
+ <form name="search" action="" method="post">
938
+ <?php wp_nonce_field( 'searchandreplace_nonce' ) ?>
939
+ <table summary="config" class="widefat">
940
+ <tr>
941
+ <th>
942
+ <label for="sall_label"><?php _e(
943
+ 'All - search only!', FB_SAR_TEXTDOMAIN
944
+ ); ?></label>
945
+ </th>
946
+ <td><input type='radio' name='sall' value='sall' id='sall_label' checked="checked" />
947
+ <label for="sall_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
948
+ <code>*</code> <?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
949
+ <code>*</code></label>
950
+ </td>
951
+ </tr>
952
+ <tr>
953
+ <th><label for="search_text"><?php _e( 'Search for', FB_SAR_TEXTDOMAIN ); ?></label>
954
+ </th>
955
+ <td>
956
+ <input class="code" type="text" id="search_text" name="search_text" value="" size="80" />
957
+ </td>
958
+ </tr>
959
+ <tr class="alternate">
960
+ <th>
961
+ <label for="srall_label"><?php _e(
962
+ 'All - search and replace!', FB_SAR_TEXTDOMAIN
963
+ ); ?></label>
964
+ </th>
965
+ <td><input type='radio' name='sall' value='srall' id='srall_label' />
966
+ <label for="srall_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
967
+ <code>*</code> <?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
968
+ <code>*</code></label>
969
+ </td>
970
+ </tr>
971
+ <tr class="alternate">
972
+ <th><label for="replace_text"><?php _e( 'Replace with', FB_SAR_TEXTDOMAIN ); ?></label>
973
+ </th>
974
+ <td>
975
+ <input class="code" type="text" id="replace_text" name="replace_text" value="" size="80" />
976
+ </td>
977
+ </tr>
978
+ </table>
979
+ <p class="submit">
980
+ <input class="button" type="submit" value="<?php _e(
981
+ 'Go', FB_SAR_TEXTDOMAIN
982
+ ); ?> &raquo;" />
983
+ <input type="hidden" name="submitted" />
984
+ </p>
985
+ </form>
986
+ </div>
987
  </div>
988
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
 
990
+ <div id="poststuff" class="dlm">
991
+ <div class="postbox">
992
+ <h3><?php _e( 'Search in', FB_SAR_TEXTDOMAIN ) ?></h3>
993
+
994
+ <div class="inside">
995
+
996
+ <form name="replace" action="" method="post">
997
+ <?php wp_nonce_field( 'searchandreplace_nonce' ) ?>
998
+ <table summary="config" class="widefat">
999
+ <tr class="alternate">
1000
+ <th><label for="content_label"><?php _e( 'Content', FB_SAR_TEXTDOMAIN ); ?></label></th>
1001
+ <td colspan="2" style="text-align: center;">
1002
+ <input type='checkbox' name='content' id='content_label' /></td>
1003
+ <td><label for="content_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1004
+ <code>post_content</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1005
+ <code>_posts</code></label></td>
1006
+ </tr>
1007
+ <tr>
1008
+ <th>
1009
+ <label for="guid_label"><?php _e(
1010
+ '<abbr title="Global Unique Identifier">GUID</abbr>', FB_SAR_TEXTDOMAIN
1011
+ ); ?></label>
1012
+ </th>
1013
+ <td colspan="2" style="text-align: center;">
1014
+ <input type='checkbox' name='guid' id='guid_label' /></td>
1015
+ <td><label for="guid_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1016
+ <code>guid</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1017
+ <code>_posts</code></label></td>
1018
+ </tr>
1019
+ <tr class="alternate">
1020
+ <th><label for="title_label"><?php _e( 'Titles', FB_SAR_TEXTDOMAIN ); ?></label></th>
1021
+ <td colspan="2" style="text-align: center;">
1022
+ <input type='checkbox' name='title' id='title_label' /></td>
1023
+ <td><label for="title_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1024
+ <code>post_title</code>,
1025
+ <code>post_name</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1026
+ <code>_posts</code></label></td>
1027
+ </tr>
1028
+ <tr>
1029
+ <th><label for="excerpt_label"><?php _e( 'Excerpts', FB_SAR_TEXTDOMAIN ); ?></label>
1030
+ </th>
1031
+ <td colspan="2" style="text-align: center;">
1032
+ <input type='checkbox' name='excerpt' id='excerpt_label' /></td>
1033
+ <td><label for="excerpt_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1034
+ <code>post_excerpt</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1035
+ <code>_posts</code></label></td>
1036
+ </tr>
1037
+ <tr class="alternate">
1038
+ <th><label for="meta_value_label"><?php _e( 'Metadata', FB_SAR_TEXTDOMAIN ); ?></label>
1039
+ </th>
1040
+ <td colspan="2" style="text-align: center;">
1041
+ <input type='checkbox' name='meta_value' id='meta_value_label' /></td>
1042
+ <td><label for="meta_value_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1043
+ <code>meta_value</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1044
+ <code>_postmeta</code></label></td>
1045
+ </tr>
1046
+ <tr>
1047
+ <th>
1048
+ <label for="comment_content_label"><?php _e(
1049
+ 'Comments content', FB_SAR_TEXTDOMAIN
1050
+ ); ?></label>
1051
+ </th>
1052
+ <td colspan="2" style="text-align: center;">
1053
+ <input type='checkbox' name='comment_content' id='comment_content_label' /></td>
1054
+ <td><label for="comment_content_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1055
+ <code>comment_content</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1056
+ <code>_comments</code></label></td>
1057
+ </tr>
1058
+ <tr class="alternate">
1059
+ <th>
1060
+ <label for="comment_author_label"><?php _e(
1061
+ 'Comments author', FB_SAR_TEXTDOMAIN
1062
+ ); ?></label>
1063
+ </th>
1064
+ <td colspan="2" style="text-align: center;">
1065
+ <input type='checkbox' name='comment_author' id='comment_author_label' /></td>
1066
+ <td><label for="comment_author_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1067
+ <code>comment_author</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1068
+ <code>_comments</code></label></td>
1069
+ </tr>
1070
+ <tr>
1071
+ <th>
1072
+ <label for="comment_author_email_label"><?php _e(
1073
+ 'Comments author e-mail', FB_SAR_TEXTDOMAIN
1074
+ ); ?></label>
1075
+ </th>
1076
+ <td colspan="2" style="text-align: center;">
1077
+ <input type='checkbox' name='comment_author_email' id='comment_author_email_label' />
1078
+ </td>
1079
+ <td><label for="comment_author_email_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1080
+ <code>comment_author_email</code><br /><?php _e(
1081
+ 'Table:', FB_SAR_TEXTDOMAIN
1082
+ ); ?>
1083
+ <code>_comments</code></label></td>
1084
+ </tr>
1085
+ <tr class="alternate">
1086
+ <th>
1087
+ <label for="comment_author_url_label"><?php _e(
1088
+ 'Comments author URL', FB_SAR_TEXTDOMAIN
1089
+ ); ?></label>
1090
+ </th>
1091
+ <td colspan="2" style="text-align: center;">
1092
+ <input type='checkbox' name='comment_author_url' id='comment_author_url_label' />
1093
+ </td>
1094
+ <td><label for="comment_author_url_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1095
+ <code>comment_author_url</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1096
+ <code>_comments</code></label></td>
1097
+ </tr>
1098
+ <tr>
1099
+ <th>
1100
+ <label for="comment_count_label"><?php _e(
1101
+ 'Comments counter', FB_SAR_TEXTDOMAIN
1102
+ ); ?></label>
1103
+ </th>
1104
+ <td colspan="2" style="text-align: center;">
1105
+ <input type='checkbox' name='comment_count' id='comment_count_label' /></td>
1106
+ <td><label for="comment_count_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1107
+ <code>comment_count</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1108
+ <code>_posts</code></label></td>
1109
+ </tr>
1110
+ <tr class="alternate">
1111
+ <th>
1112
+ <label for="cat_description_label"><?php _e(
1113
+ 'Category description', FB_SAR_TEXTDOMAIN
1114
+ ); ?></label>
1115
+ </th>
1116
+ <td colspan="2" style="text-align: center;">
1117
+ <input type='checkbox' name='cat_description' id='cat_description_label' /></td>
1118
+ <td><label for="cat_description_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1119
+ <code>description</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1120
+ <code>_term_taxonomy</code></label></td>
1121
+ </tr>
1122
+ <tr>
1123
+ <th>
1124
+ <label for="tag_label"><?php _e(
1125
+ 'Tags &amp; Categories', FB_SAR_TEXTDOMAIN
1126
+ ); ?></label>
1127
+ </th>
1128
+ <td colspan="2" style="text-align: center;">
1129
+ <input type='checkbox' name='tag' id='tag_label' /></td>
1130
+ <td><label for="tag_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1131
+ <code>name</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1132
+ <code>slug</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1133
+ <code>_terms</code></label></td>
1134
+ </tr>
1135
+ <tr class="alternate">
1136
+ <th><label for="user_id_label"><?php _e( 'User ID', FB_SAR_TEXTDOMAIN ); ?></label></th>
1137
+ <td colspan="2" style="text-align: center;">
1138
+ <input type='checkbox' name='user_id' id='user_id_label' /></td>
1139
+ <td><label for="user_id_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1140
+ <code>ID</code>, <code>user_id</code>, <code>post_author</code>,
1141
+ <code>user_id</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1142
+ <code>link_owner</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1143
+ <code>_users</code>, <code>_usermeta</code>, <code>_posts</code>,
1144
+ <code>_comments</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1145
+ <code>_links</code></label></td>
1146
+ </tr>
1147
+ <tr>
1148
+ <th>
1149
+ <label for="user_login_label"><?php _e(
1150
+ 'User login', FB_SAR_TEXTDOMAIN
1151
+ ); ?></label>
1152
+ </th>
1153
+ <td colspan="2" style="text-align: center;">
1154
+ <input type='checkbox' name='user_login' id='user_login_label' /></td>
1155
+ <td><label for="user_login_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1156
+ <code>user_login</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1157
+ <code>user_nicename</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1158
+ <code>_users</code></label></td>
1159
+ </tr>
1160
+ <?php if ( $wpdb
1161
+ && $wpdb->query(
1162
+ "SHOW TABLES LIKE '" . $wpdb->prefix . 'terms' . "'"
1163
+ ) == 1
1164
+ ) { ?>
1165
+ <tr class="alternate">
1166
+ <th><label for="id_label"><?php _e( 'ID', FB_SAR_TEXTDOMAIN ); ?></label></th>
1167
+ <td colspan="2" style="text-align: center;">
1168
+ <input type='checkbox' name='id' id='id_label' /></td>
1169
+ <td><label for="id_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1170
+ <code>ID</code>, <code>post_parent</code>, <code>post_id</code>,
1171
+ <code>object_id</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1172
+ <code>comments</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1173
+ <code>_posts</code>, <code>_postmeta</code>,
1174
+ <code>_term_relationships</code> <?php _e( 'and', FB_SAR_TEXTDOMAIN ); ?>
1175
+ <code>_comment_post_ID</code></label></td>
1176
+ </tr>
1177
+ <?php } ?>
1178
+ <?php if ( $wpdb
1179
+ && $wpdb->query(
1180
+ "SHOW TABLES LIKE '" . $wpdb->prefix . 'signups' . "'"
1181
+ ) == 1
1182
+ ) { ?>
1183
+ <tr class="alternate">
1184
+ <th><label for="signups_label"><?php _e( 'Signups', FB_SAR_TEXTDOMAIN ); ?></label>
1185
+ </th>
1186
+ <td colspan="2" style="text-align: center;">
1187
+ <input type='checkbox' name='signups' id='signups_label' /></td>
1188
+ <td><label for="signups_label"><?php _e( 'Field:', FB_SAR_TEXTDOMAIN ); ?>
1189
+ <code>user_login</code><br /><?php _e( 'Table:', FB_SAR_TEXTDOMAIN ); ?>
1190
+ <code>_signups</code></label></td>
1191
+ </tr>
1192
+ <?php } ?>
1193
+ <tr>
1194
+ <th>&nbsp;</th>
1195
+ <td colspan="2" style="text-align: center;">&nbsp;&nbsp;
1196
+ <a href="javascript:selectcb('replace', true);" title="<?php _e(
1197
+ 'Check all', FB_SAR_TEXTDOMAIN
1198
+ ); ?>"><?php _e( 'all', FB_SAR_TEXTDOMAIN ); ?></a> |
1199
+ <a href="javascript:selectcb('replace', false);" title="<?php _e(
1200
+ 'Uncheck all', FB_SAR_TEXTDOMAIN
1201
+ ); ?>"><?php _e( 'none', FB_SAR_TEXTDOMAIN ); ?></a>
1202
+ </td>
1203
+ <td>&nbsp;</td>
1204
+ </tr>
1205
+ </table>
1206
+
1207
+ <table summary="submit" class="form-table">
1208
+ <tr>
1209
+ <th><label for="search_text"><?php _e( 'Search for', FB_SAR_TEXTDOMAIN ); ?></label>
1210
+ </th>
1211
+ <td>
1212
+ <input class="code" type="text" id="search_text" name="search_text" value="" size="80" />
1213
+ </td>
1214
+ </tr>
1215
+ <tr>
1216
+ <th><label for="replace_text"><?php _e( 'Replace with', FB_SAR_TEXTDOMAIN ); ?></label>
1217
+ </th>
1218
+ <td>
1219
+ <input class="code" type="text" id="replace_text" name="replace_text" value="" size="80" />
1220
+ </td>
1221
+ </tr>
1222
+ </table>
1223
+ <p class="submit">
1224
+ <input class="button" type="submit" value="<?php _e(
1225
+ 'Go', FB_SAR_TEXTDOMAIN
1226
+ ); ?> &raquo;" />
1227
+ <input type="hidden" name="submitted" />
1228
+ </p>
1229
+ </form>
1230
+
1231
+ </div>
1232
+ </div>
1233
+ </div>
1234
 
1235
+ <div id="poststuff" class="dlm">
1236
+ <div class="postbox">
1237
+ <h3><?php _e( 'Information about this plugin', FB_SAR_TEXTDOMAIN ); ?></h3>
1238
+
1239
+ <div class="inside">
1240
+ <p><?php _e(
1241
+ "&quot;Search and Replace&quot; original plugin (en) created by <a href='http://thedeadone.net/'>Mark Cunningham</a> and provided (comments) by <a href='http://www.gonahkar.com'>Gonahkar</a>.<br />&quot;Search &amp; Replace&quot;, enhanced by <a href='http://bueltge.de'>Frank Bueltge</a> and current version is also maintained by Ron Guerin.",
1242
+ FB_SAR_TEXTDOMAIN
1243
+ ); ?></p>
1244
+
1245
+ <p><?php _e(
1246
+ "For more information: Visit the <a href='http://wordpress.org/plugins/search-and-replace/'>plugin homepage</a> for further information or to grab the latest version of this plugin.",
1247
+ FB_SAR_TEXTDOMAIN
1248
+ ); ?></p>
1249
+ </div>
1250
  </div>
1251
  </div>
1252
  </div>
 
1253
  <?php } ?>