404 to 301 - Version 2.0.7

Version Description

(25/09/2015) =

New Feature - New option to change error notification email address. - Now 100% Translation ready.

Improvements - Minor code improvements.

Download this release

Release Info

Developer joelcj91
Plugin Icon 128x128 404 to 301
Version 2.0.7
Comparing to
See all releases

Code changes from version 2.0.6 to 2.0.7

404-to-301.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 404 to 301
4
  * Plugin URI: http://iscode.co/products/404-to-301/
5
  * Description: Automatically redirect all <strong>404 errors</strong> to any page using <strong>301 redirect for SEO</strong>. You can <strong>redirect and log</strong> every 404 errors. No more 404 errors in Webmaster tool.
6
- * Version: 2.0.6
7
  * Author: Joel James
8
  * Author URI: http://iscode.co/
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
@@ -28,7 +28,7 @@
28
  * @package I4T3
29
  * @category Core
30
  * @author Joel James
31
- * @version 2.0.6
32
  */
33
 
34
  // If this file is called directly, abort.
@@ -52,7 +52,7 @@ if(!defined('I4T3_DB_VERSION')) {
52
  define( 'I4T3_DB_VERSION', '3' );
53
  }
54
  if(!defined('I4T3_VERSION')) {
55
- define( 'I4T3_VERSION', '2.0.6' );
56
  }
57
  // Set who all can access 404 settings. You can change this if you want to give others access.
58
  if(!defined('I4T3_ADMIN_PERMISSION')) {
3
  * Plugin Name: 404 to 301
4
  * Plugin URI: http://iscode.co/products/404-to-301/
5
  * Description: Automatically redirect all <strong>404 errors</strong> to any page using <strong>301 redirect for SEO</strong>. You can <strong>redirect and log</strong> every 404 errors. No more 404 errors in Webmaster tool.
6
+ * Version: 2.0.7
7
  * Author: Joel James
8
  * Author URI: http://iscode.co/
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
28
  * @package I4T3
29
  * @category Core
30
  * @author Joel James
31
+ * @version 2.0.7
32
  */
33
 
34
  // If this file is called directly, abort.
52
  define( 'I4T3_DB_VERSION', '3' );
53
  }
54
  if(!defined('I4T3_VERSION')) {
55
+ define( 'I4T3_VERSION', '2.0.7' );
56
  }
57
  // Set who all can access 404 settings. You can change this if you want to give others access.
58
  if(!defined('I4T3_ADMIN_PERMISSION')) {
admin/class-404-to-301-admin.php CHANGED
@@ -66,6 +66,7 @@ class _404_To_301_Admin {
66
  $this->plugin_name = $plugin_name;
67
  $this->version = $version;
68
  $this->table = $table;
 
69
  }
70
 
71
 
@@ -127,6 +128,26 @@ class _404_To_301_Admin {
127
  update_option('i4t3_version_no', I4T3_VERSION );
128
  }
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
 
132
  /**
@@ -244,7 +265,11 @@ class _404_To_301_Admin {
244
  if (( $pagenow == 'admin.php' ) && ( in_array ( $_GET['page'], array('i4t3-settings', 'i4t3-logs')))) {
245
 
246
  _e( 'Thank you for choosing 404 to 301 to improve your website', '404-to-301' );
247
- echo ' | Kindly give this plugin a <a href="https://wordpress.org/support/view/plugin-reviews/404-to-301?filter=5#postform">rating &#9733; &#9733;</a>';
 
 
 
 
248
  } else {
249
  return;
250
  }
@@ -264,8 +289,8 @@ class _404_To_301_Admin {
264
  public function i4t3_plugin_action_links( $links, $file ) {
265
  $plugin_file = basename('404-to-301.php');
266
  if (basename($file) == $plugin_file) {
267
- $settings_link = '<a href="admin.php?page=i4t3-settings">Settings</a>';
268
- $settings_link .= ' | <a href="admin.php?page=i4t3-logs">Logs</a>';
269
  array_unshift($links, $settings_link);
270
  }
271
  return $links;
@@ -278,6 +303,8 @@ class _404_To_301_Admin {
278
  * Function to output the debug data for the plugin. This will be useful
279
  * when asking for support. Just copy and paste these data to the email.
280
  *
 
 
281
  * @since 2.0.0
282
  * @var array $gnrl_options Array of plugin settings
283
  * @var array $active_plugins Array of active plugins path
66
  $this->plugin_name = $plugin_name;
67
  $this->version = $version;
68
  $this->table = $table;
69
+ $this->gnrl_options = get_option( 'i4t3_gnrl_options' );
70
  }
71
 
72
 
128
  update_option('i4t3_version_no', I4T3_VERSION );
129
  }
130
  }
131
+
132
+ /**
133
+ * Changing email notification recipient
134
+ *
135
+ * Using filter to change email notification recipient address from
136
+ * default admin email.
137
+ *
138
+ * @since 2.0.7
139
+ * @uses get_option() To get the email address option from db.
140
+ * @return $email Email address to be used for notification.
141
+ */
142
+ public function i4t3_change_notify_email( $email ) {
143
+ if( !empty( $this->gnrl_options['email_notify_address'] ) ) {
144
+ $email_option = $this->gnrl_options['email_notify_address'];
145
+ if( is_email( $email_option ) ) {
146
+ $email = $email_option;
147
+ }
148
+ }
149
+ return $email;
150
+ }
151
 
152
 
153
  /**
265
  if (( $pagenow == 'admin.php' ) && ( in_array ( $_GET['page'], array('i4t3-settings', 'i4t3-logs')))) {
266
 
267
  _e( 'Thank you for choosing 404 to 301 to improve your website', '404-to-301' );
268
+ echo ' | ';
269
+ _e( 'Kindly give this plugin a','404-to-301');
270
+ echo '<a href="https://wordpress.org/support/view/plugin-reviews/404-to-301?filter=5#postform">';
271
+ _e( 'rating','404-to-301');
272
+ echo ' &#9733; &#9733;</a>';
273
  } else {
274
  return;
275
  }
289
  public function i4t3_plugin_action_links( $links, $file ) {
290
  $plugin_file = basename('404-to-301.php');
291
  if (basename($file) == $plugin_file) {
292
+ $settings_link = '<a href="admin.php?page=i4t3-settings">'. __( 'Settings', '404-to-301' ) .'</a>';
293
+ $settings_link .= ' | <a href="admin.php?page=i4t3-logs">'. __( 'Logs', '404-to-301' ) .'</a>';
294
  array_unshift($links, $settings_link);
295
  }
296
  return $links;
303
  * Function to output the debug data for the plugin. This will be useful
304
  * when asking for support. Just copy and paste these data to the email.
305
  *
306
+ * Please DO NOT translate this part, as this need to be provided for debugging only.
307
+ *
308
  * @since 2.0.0
309
  * @var array $gnrl_options Array of plugin settings
310
  * @var array $active_plugins Array of active plugins path
admin/core/class-wp-list-table.php CHANGED
@@ -141,8 +141,8 @@ class WP_List_Table_404 {
141
 
142
  if ( empty( $this->modes ) ) {
143
  $this->modes = array(
144
- 'list' => __( 'List View' ),
145
- 'excerpt' => __( 'Excerpt View' )
146
  );
147
  }
148
  }
@@ -435,9 +435,9 @@ class WP_List_Table_404 {
435
  if ( empty( $this->_actions ) )
436
  return;
437
 
438
- echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
439
  echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
440
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
441
 
442
  foreach ( $this->_actions as $name => $title ) {
443
  $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
@@ -447,7 +447,7 @@ class WP_List_Table_404 {
447
 
448
  echo "</select>\n";
449
 
450
- submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
451
  echo "\n";
452
  }
453
 
@@ -562,7 +562,7 @@ class WP_List_Table_404 {
562
  selected( $m, $year . $month, false ),
563
  esc_attr( $arc_row->year . $month ),
564
  /* translators: 1: month name, 2: 4-digit year */
565
- sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
566
  );
567
  }
568
  ?>
@@ -609,7 +609,7 @@ class WP_List_Table_404 {
609
  * @param int $pending_comments Number of pending comments.
610
  */
611
  protected function comments_bubble( $post_id, $pending_comments ) {
612
- $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
613
 
614
  if ( $pending_comments )
615
  echo '<strong>';
@@ -707,14 +707,14 @@ class WP_List_Table_404 {
707
  }
708
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
709
  'first-page' . $disable_first,
710
- esc_attr__( 'Go to the first page' ),
711
  esc_url( remove_query_arg( 'paged', $current_url ) ),
712
  '&laquo;'
713
  );
714
 
715
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
716
  'prev-page' . $disable_first,
717
- esc_attr__( 'Go to the previous page' ),
718
  esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
719
  '&lsaquo;'
720
  );
@@ -723,8 +723,8 @@ class WP_List_Table_404 {
723
  $html_current_page = $current;
724
  } else {
725
  $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d' />",
726
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page' ) . '</label>',
727
- esc_attr__( 'Current page' ),
728
  $current,
729
  strlen( $total_pages )
730
  );
@@ -734,14 +734,14 @@ class WP_List_Table_404 {
734
 
735
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
736
  'next-page' . $disable_last,
737
- esc_attr__( 'Go to the next page' ),
738
  esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
739
  '&rsaquo;'
740
  );
741
 
742
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
743
  'last-page' . $disable_last,
744
- esc_attr__( 'Go to the last page' ),
745
  esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
746
  '&raquo;'
747
  );
@@ -878,7 +878,7 @@ class WP_List_Table_404 {
878
 
879
  if ( ! empty( $columns['cb'] ) ) {
880
  static $cb_counter = 1;
881
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
882
  . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
883
  $cb_counter++;
884
  }
141
 
142
  if ( empty( $this->modes ) ) {
143
  $this->modes = array(
144
+ 'list' => __( 'List View', '404-to-301' ),
145
+ 'excerpt' => __( 'Excerpt View', '404-to-301' )
146
  );
147
  }
148
  }
435
  if ( empty( $this->_actions ) )
436
  return;
437
 
438
+ echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action', '404-to-301' ) . "</label>";
439
  echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
440
+ echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions', '404-to-301' ) . "</option>\n";
441
 
442
  foreach ( $this->_actions as $name => $title ) {
443
  $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
447
 
448
  echo "</select>\n";
449
 
450
+ submit_button( __( 'Apply', '404-to-301' ), 'action', '', false, array( 'id' => "doaction$two" ) );
451
  echo "\n";
452
  }
453
 
562
  selected( $m, $year . $month, false ),
563
  esc_attr( $arc_row->year . $month ),
564
  /* translators: 1: month name, 2: 4-digit year */
565
+ sprintf( __( '%1$s %2$d', '404-to-301' ), $wp_locale->get_month( $month ), $year )
566
  );
567
  }
568
  ?>
609
  * @param int $pending_comments Number of pending comments.
610
  */
611
  protected function comments_bubble( $post_id, $pending_comments ) {
612
+ $pending_phrase = sprintf( __( '%s pending', '404-to-301' ), number_format( $pending_comments ) );
613
 
614
  if ( $pending_comments )
615
  echo '<strong>';
707
  }
708
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
709
  'first-page' . $disable_first,
710
+ esc_attr__( 'Go to the first page', '404-to-301' ),
711
  esc_url( remove_query_arg( 'paged', $current_url ) ),
712
  '&laquo;'
713
  );
714
 
715
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
716
  'prev-page' . $disable_first,
717
+ esc_attr__( 'Go to the previous page', '404-to-301' ),
718
  esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
719
  '&lsaquo;'
720
  );
723
  $html_current_page = $current;
724
  } else {
725
  $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d' />",
726
+ '<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page', '404-to-301' ) . '</label>',
727
+ esc_attr__( 'Current page', '404-to-301' ),
728
  $current,
729
  strlen( $total_pages )
730
  );
734
 
735
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
736
  'next-page' . $disable_last,
737
+ esc_attr__( 'Go to the next page', '404-to-301' ),
738
  esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
739
  '&rsaquo;'
740
  );
741
 
742
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
743
  'last-page' . $disable_last,
744
+ esc_attr__( 'Go to the last page', '404-to-301' ),
745
  esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
746
  '&raquo;'
747
  );
878
 
879
  if ( ! empty( $columns['cb'] ) ) {
880
  static $cb_counter = 1;
881
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', '404-to-301' ) . '</label>'
882
  . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
883
  $cb_counter++;
884
  }
admin/partials/404-to-301-admin-credits-tab.php CHANGED
@@ -20,14 +20,14 @@
20
  <hr/>
21
  </p>
22
  <p>
23
- So you installed this plugin and how is it doing? Feel free to <a href="http://iscode.co/support/" class="i4t3-author-link" target="_blank" title="<?php _e( 'Contact the developer', '404-to-301' ); ?>">get in touch with me</a> anytime for help. I am always happy to help.
24
  </p>
25
  </div>
26
  </div>
27
  </div>
28
  </div>
29
  <div class="postbox">
30
- <h3 class="hndle"><span>Debugging Data</span></h3>
31
  <div class="inside">
32
  <div class="c4p-clearfix">
33
  <div class="c4p-left" style="width: 70%">
@@ -40,48 +40,48 @@
40
  <div id="postbox-container-1" class="postbox-container">
41
 
42
  <div class="postbox">
43
- <h3 class="hndle ui-sortable-handle"><span class="dashicons dashicons-info"></span> Plugin Information</h3>
44
  <div class="inside">
45
  <div class="misc-pub-section">
46
- <label>Name : </label>
47
- <span><strong>404 to 301</strong></span>
48
  </div>
49
  <div class="misc-pub-section">
50
- <label>Version : v<?php echo $this->version; ?></label>
51
  <span></span>
52
  </div>
53
  <div class="misc-pub-section">
54
- <label>Author : <a href="http://iscode.co/" class="i4t3-author-link" target="_blank" title="Visit author website">is_code()</a></label>
55
  <span></span>
56
  </div>
57
  <div class="misc-pub-section">
58
- <label><a href="http://iscode.co/docs/category/404-to-301/" class="i4t3-author-link" target="_blank" title="Visit plugin website"><strong>Plugin documentation</strong></a></label>
59
  <span></span>
60
  </div>
61
  <div class="misc-pub-section">
62
- <label><a href="http://iscode.co/docs/category/404-to-301/" class="i4t3-author-link" target="_blank" title="Visit plugin website"><strong>More plugin details</strong></a></label>
63
  <span></span>
64
  </div>
65
  <div class="misc-pub-section">
66
- <label>Need help?</label>
67
- <span><strong><a href="http://iscode.co/support/">contact support</a></strong></span>
68
  </div>
69
  </div>
70
  </div>
71
  <div class="postbox">
72
- <h3 class="hndle ui-sortable-handle"><span class="dashicons dashicons-smiley"></span> Like the plugin?</h3>
73
  <div class="inside">
74
  <div class="misc-pub-section">
75
- <span class="dashicons dashicons-star-filled"></span> <label><strong><a href="https://wordpress.org/support/view/plugin-reviews/404-to-301?filter=5#postform" target="_blank" title="Rate now">Rate this on WordPress</a></strong></label>
76
  </div>
77
  <div class="misc-pub-section">
78
- <label><span class="dashicons dashicons-heart"></span> <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4" target="_blank" title="Donate now">Make a small donation</a></strong></label>
79
  </div>
80
  <div class="misc-pub-section">
81
- <label><span class="dashicons dashicons-admin-plugins"></span> <strong><a href="https://github.com/joel-james/404-to-301/" target="_blank" title="Contribute now">Contribute to the Plugin</a></strong></label>
82
  </div>
83
  <div class="misc-pub-section">
84
- <label><span class="dashicons dashicons-twitter"></span> <strong><a href="https://twitter.com/home?status=I%20am%20using%20404%20to%20301%20plugin%20by%20%40Joel_James%20to%20handle%20all%20404%20errors%20in%20my%20%40WordPress%20site%20-%20it%20is%20awesome!%20%3E%20https://wordpress.org/plugins/404-to-301/" target="_blank" title="Tweet now">Tweet about the Plugin</a></strong></label>
85
  </div>
86
  </div>
87
  </div>
20
  <hr/>
21
  </p>
22
  <p>
23
+ <?php _e( 'So you installed this plugin and how is it doing? Feel free to', '404-to-301' ); ?> <a href="http://iscode.co/support/" class="i4t3-author-link" target="_blank" title="<?php _e( 'Contact the developer', '404-to-301' ); ?>"><?php _e( 'get in touch with me', '404-to-301' ); ?></a> <?php _e( 'anytime for help. I am always happy to help.', '404-to-301' ); ?>
24
  </p>
25
  </div>
26
  </div>
27
  </div>
28
  </div>
29
  <div class="postbox">
30
+ <h3 class="hndle"><span><?php _e( 'Debugging Data', '404-to-301' ); ?></span></h3>
31
  <div class="inside">
32
  <div class="c4p-clearfix">
33
  <div class="c4p-left" style="width: 70%">
40
  <div id="postbox-container-1" class="postbox-container">
41
 
42
  <div class="postbox">
43
+ <h3 class="hndle ui-sortable-handle"><span class="dashicons dashicons-info"></span> <?php _e( 'Plugin Information', '404-to-301' ); ?></h3>
44
  <div class="inside">
45
  <div class="misc-pub-section">
46
+ <label><?php _e( 'Name', '404-to-301' ); ?> : </label>
47
+ <span><strong><?php _e( '404 to 301', '404-to-301' ); ?></strong></span>
48
  </div>
49
  <div class="misc-pub-section">
50
+ <label><?php _e( 'Version', '404-to-301' ); ?> : v<?php echo $this->version; ?></label>
51
  <span></span>
52
  </div>
53
  <div class="misc-pub-section">
54
+ <label><?php _e( 'Author', '404-to-301' ); ?> : <a href="http://iscode.co/" class="i4t3-author-link" target="_blank" title="<?php _e( 'Visit author website', '404-to-301' ); ?>">is_code()</a></label>
55
  <span></span>
56
  </div>
57
  <div class="misc-pub-section">
58
+ <label><a href="http://iscode.co/docs/category/404-to-301/" class="i4t3-author-link" target="_blank" title="<?php _e( 'Visit plugin website','404-to-301' ); ?>"><strong><?php _e( 'Plugin documentation','404-to-301' ); ?></strong></a></label>
59
  <span></span>
60
  </div>
61
  <div class="misc-pub-section">
62
+ <label><a href="http://iscode.co/docs/category/404-to-301/" class="i4t3-author-link" target="_blank" title="<?php _e( 'Visit plugin website','404-to-301' ); ?>"><strong><?php _e( 'More plugin details','404-to-301' ); ?></strong></a></label>
63
  <span></span>
64
  </div>
65
  <div class="misc-pub-section">
66
+ <label><?php _e( 'Need help?','404-to-301' ); ?></label>
67
+ <span><strong><a href="http://iscode.co/support/"><?php _e( 'contact support','404-to-301' ); ?></a></strong></span>
68
  </div>
69
  </div>
70
  </div>
71
  <div class="postbox">
72
+ <h3 class="hndle ui-sortable-handle"><span class="dashicons dashicons-smiley"></span> <?php _e( 'Like the plugin','404-to-301' ); ?>?</h3>
73
  <div class="inside">
74
  <div class="misc-pub-section">
75
+ <span class="dashicons dashicons-star-filled"></span> <label><strong><a href="https://wordpress.org/support/view/plugin-reviews/404-to-301?filter=5#postform" target="_blank" title="<?php _e( 'Rate now','404-to-301' ); ?>"><?php _e( 'Rate this on WordPress','404-to-301' ); ?></a></strong></label>
76
  </div>
77
  <div class="misc-pub-section">
78
+ <label><span class="dashicons dashicons-heart"></span> <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4" target="_blank" title="<?php _e( 'Donate now','404-to-301' ); ?>"><?php _e( 'Make a small donation','404-to-301' ); ?></a></strong></label>
79
  </div>
80
  <div class="misc-pub-section">
81
+ <label><span class="dashicons dashicons-admin-plugins"></span> <strong><a href="https://github.com/joel-james/404-to-301/" target="_blank" title="<?php _e( 'Contribute now','404-to-301' ); ?>"><?php _e( 'Contribute to the Plugin','404-to-301' ); ?></a></strong></label>
82
  </div>
83
  <div class="misc-pub-section">
84
+ <label><span class="dashicons dashicons-twitter"></span> <strong><a href="https://twitter.com/home?status=I%20am%20using%20404%20to%20301%20plugin%20by%20%40Joel_James%20to%20handle%20all%20404%20errors%20in%20my%20%40WordPress%20site%20-%20it%20is%20awesome!%20%3E%20https://wordpress.org/plugins/404-to-301/" target="_blank" title="<?php _e( 'Tweet now','404-to-301' ); ?>"><?php _e( 'Tweet about the Plugin','404-to-301' ); ?></a></strong></label>
85
  </div>
86
  </div>
87
  </div>
admin/partials/404-to-301-admin-display.php CHANGED
@@ -24,15 +24,15 @@ if ( ! defined( 'WPINC' ) ) {
24
  ?>
25
 
26
  <div class="wrap">
27
- <h2>404 to 301 | Settings</h2><br>
28
  <?php if( isset($_GET['settings-updated']) ) { ?>
29
  <div class="updated">
30
- <p><strong>404 to 301 settings updated successfully</strong></p>
31
  </div>
32
  <?php } ?>
33
  <h2 class="nav-tab-wrapper">
34
- <a href="?page=i4t3-settings&tab=general" class="nav-tab <?php echo $general_class; ?>">General</a>
35
- <a href="?page=i4t3-settings&tab=credits" class="nav-tab <?php echo $credits_class ?>">Help & Info</a>
36
  </h2>
37
  </div>
38
 
24
  ?>
25
 
26
  <div class="wrap">
27
+ <h2>404 to 301 | <?php _e( 'Settings', '404-to-301' ); ?></h2><br>
28
  <?php if( isset($_GET['settings-updated']) ) { ?>
29
  <div class="updated">
30
+ <p><strong>404 to 301 <?php _e( 'settings updated successfully', '404-to-301' ); ?></strong></p>
31
  </div>
32
  <?php } ?>
33
  <h2 class="nav-tab-wrapper">
34
+ <a href="?page=i4t3-settings&tab=general" class="nav-tab <?php echo $general_class; ?>"><?php _e( 'General', '404-to-301' ); ?></a>
35
+ <a href="?page=i4t3-settings&tab=credits" class="nav-tab <?php echo $credits_class ?>"><?php _e( 'Help & Info', '404-to-301' ); ?></a>
36
  </h2>
37
  </div>
38
 
admin/partials/404-to-301-admin-general-tab.php CHANGED
@@ -24,68 +24,76 @@
24
  <tbody>
25
 
26
  <tr>
27
- <th>Redirect type</th>
28
  <td>
29
  <select name='i4t3_gnrl_options[redirect_type]'>
30
- <option value='301' <?php selected( $options['redirect_type'], '301' ); ?>>301 Redirect (SEO)</option>
31
- <option value='302' <?php selected( $options['redirect_type'], '302' ); ?>>302 Redirect</option>
32
- <option value='307' <?php selected( $options['redirect_type'], '307' ); ?>>307 Redirect</option>
33
  </select>
34
- <p class="description"><a target="_blank" href="https://moz.com/learn/seo/redirection"><strong>Learn more</strong></a> about these redirect types</p>
35
  </td>
36
  </tr>
37
  <tr>
38
- <th>Redirect to</th>
39
  <td>
40
  <select name='i4t3_gnrl_options[redirect_to]' id='i4t3_redirect_to'>
41
- <option value='page' <?php selected( $options['redirect_to'], 'page' ); ?>>Existing Page</option>
42
- <option value='link' <?php selected( $options['redirect_to'], 'link' ); ?>>Custom URL</option>
43
- <option value='none' <?php selected( $options['redirect_to'], 'none' ); ?>>No Redirect</option>
44
  </select>
45
- <p class="description"><strong>Existing Page:</strong> Select any WordPress page as a 404 page.</p>
46
- <p class="description"><strong>Custom URL:</strong> Redirect 404 requests to a specific URL.</p>
47
- <p class="description"><strong>No Redirect:</strong> To disable redirect.</p>
48
  </td>
49
  </tr>
50
  <tr id="custom_page" <?php echo $cp_style; ?>>
51
- <th>Select the page</th>
52
  <td>
53
  <select name='i4t3_gnrl_options[redirect_page]'>
54
  <?php foreach( $pages as $page ) { ?>
55
  <option value='<?php echo $page->ID; ?>' <?php selected( $options['redirect_page'], $page->ID ); ?>><?php echo $page->post_title; ?></option>
56
  <?php } ?>
57
  </select>
58
- <p class="description">The default 404 page will be replaced by the page you choose in this list.</p>
59
  </td>
60
  </tr>
61
  <tr id="custom_url"<?php echo $cl_style; ?>>
62
- <th>Custom URL</th>
63
  <td>
64
  <input type="text" placeholder="<?php echo home_url(); ?>" name="i4t3_gnrl_options[redirect_link]" value="<?php echo $options['redirect_link']; ?>">
65
- <p class="description">Enter any url (including http://)</p>
66
  </td>
67
  </tr>
68
  <tr>
69
- <th>Email notifications</th>
 
 
 
 
 
 
 
 
 
 
70
  <td>
71
  <?php $email_notify = 0; if( isset( $options['email_notify'] ) ) { $email_notify = $options['email_notify']; } ?>
72
  <input type="checkbox" name="i4t3_gnrl_options[email_notify]" value="1" <?php checked( $email_notify, 1 ); ?> />
73
- <p class="description">If you check this, an email will be sent on every 404 log on the admin's email account.</p>
74
  </td>
75
  </tr>
76
  <tr>
77
- <th>Log 404 Errors</th>
78
  <td>
79
- <select name='i4t3_gnrl_options[redirect_log]'>
80
- <option value='1' <?php selected( $options['redirect_log'], 1 ); ?>>Enable Error Logs</option>
81
- <option value='0' <?php selected( $options['redirect_log'], 0 ); ?>>Disable Error Logs</option>
82
- </select>
83
- <p class="description">Enable/Disable Logging</p>
84
  </td>
85
  </tr>
86
  </tbody>
87
  </table>
88
- <?php submit_button( 'Save All Changes' ); ?>
89
  </p>
90
  </form>
91
  </div>
24
  <tbody>
25
 
26
  <tr>
27
+ <th><?php _e( 'Redirect type', '404-to-301' ); ?></th>
28
  <td>
29
  <select name='i4t3_gnrl_options[redirect_type]'>
30
+ <option value='301' <?php selected( $options['redirect_type'], '301' ); ?>>301 <?php _e( 'Redirect (SEO)', '404-to-301' ); ?></option>
31
+ <option value='302' <?php selected( $options['redirect_type'], '302' ); ?>>302 <?php _e( 'Redirect', '404-to-301' ); ?></option>
32
+ <option value='307' <?php selected( $options['redirect_type'], '307' ); ?>>307 <?php _e( 'Redirect', '404-to-301' ); ?></option>
33
  </select>
34
+ <p class="description"><a target="_blank" href="https://moz.com/learn/seo/redirection"><strong><?php _e( 'Learn more', '404-to-301' ); ?></strong></a> <?php _e( 'about these redirect types', '404-to-301' ); ?></p>
35
  </td>
36
  </tr>
37
  <tr>
38
+ <th><?php _e( 'Redirect to', '404-to-301' ); ?></th>
39
  <td>
40
  <select name='i4t3_gnrl_options[redirect_to]' id='i4t3_redirect_to'>
41
+ <option value='page' <?php selected( $options['redirect_to'], 'page' ); ?>><?php _e( 'Existing Page', '404-to-301' ); ?></option>
42
+ <option value='link' <?php selected( $options['redirect_to'], 'link' ); ?>><?php _e( 'Custom URL', '404-to-301' ); ?></option>
43
+ <option value='none' <?php selected( $options['redirect_to'], 'none' ); ?>><?php _e( 'No Redirect', '404-to-301' ); ?></option>
44
  </select>
45
+ <p class="description"><strong><?php _e( 'Existing Page', '404-to-301' ); ?>:</strong> <?php _e( 'Select any WordPress page as a 404 page', '404-to-301' ); ?>.</p>
46
+ <p class="description"><strong><?php _e( 'Custom URL', '404-to-301' ); ?>:</strong> <?php _e( 'Redirect 404 requests to a specific URL', '404-to-301' ); ?>.</p>
47
+ <p class="description"><strong><?php _e( 'No Redirect', '404-to-301' ); ?>:</strong> <?php _e( 'To disable redirect', '404-to-301' ); ?>.</p>
48
  </td>
49
  </tr>
50
  <tr id="custom_page" <?php echo $cp_style; ?>>
51
+ <th><?php _e( 'Select the page', '404-to-301' ); ?></th>
52
  <td>
53
  <select name='i4t3_gnrl_options[redirect_page]'>
54
  <?php foreach( $pages as $page ) { ?>
55
  <option value='<?php echo $page->ID; ?>' <?php selected( $options['redirect_page'], $page->ID ); ?>><?php echo $page->post_title; ?></option>
56
  <?php } ?>
57
  </select>
58
+ <p class="description"><?php _e( 'The default 404 page will be replaced by the page you choose in this list', '404-to-301' ); ?>.</p>
59
  </td>
60
  </tr>
61
  <tr id="custom_url"<?php echo $cl_style; ?>>
62
+ <th><?php _e( 'Custom URL', '404-to-301' ); ?></th>
63
  <td>
64
  <input type="text" placeholder="<?php echo home_url(); ?>" name="i4t3_gnrl_options[redirect_link]" value="<?php echo $options['redirect_link']; ?>">
65
+ <p class="description"><?php _e( 'Enter any url', '404-to-301' ); ?> (<?php _e( 'including', '404-to-301' ); ?> http://)</p>
66
  </td>
67
  </tr>
68
  <tr>
69
+ <th><?php _e( 'Log 404 Errors', '404-to-301' ); ?></th>
70
+ <td>
71
+ <select name='i4t3_gnrl_options[redirect_log]'>
72
+ <option value='1' <?php selected( $options['redirect_log'], 1 ); ?>><?php _e( 'Enable Error Logs', '404-to-301' ); ?></option>
73
+ <option value='0' <?php selected( $options['redirect_log'], 0 ); ?>><?php _e( 'Disable Error Logs', '404-to-301' ); ?></option>
74
+ </select>
75
+ <p class="description"><?php _e( 'Enable/Disable Logging', '404-to-301' ); ?></p>
76
+ </td>
77
+ </tr>
78
+ <tr>
79
+ <th><?php _e( 'Email notifications', '404-to-301' ); ?></th>
80
  <td>
81
  <?php $email_notify = 0; if( isset( $options['email_notify'] ) ) { $email_notify = $options['email_notify']; } ?>
82
  <input type="checkbox" name="i4t3_gnrl_options[email_notify]" value="1" <?php checked( $email_notify, 1 ); ?> />
83
+ <p class="description"><?php _e( 'If you check this, an email will be sent on every 404 log on the admin email account', '404-to-301' ); ?>.</p>
84
  </td>
85
  </tr>
86
  <tr>
87
+ <th><?php _e( 'Email address', '404-to-301' ); ?></th>
88
  <td>
89
+ <?php $notify_address = ( isset( $options['email_notify_address'] ) ) ? $options['email_notify_address'] : get_option( 'admin_email' ); ?>
90
+ <input type="text" placeholder="<?php echo get_option( 'admin_email' ); ?>" name="i4t3_gnrl_options[email_notify_address]" value="<?php echo $notify_address; ?>">
91
+ <p class="description"><?php _e( 'Change the recipient email address for error log notifications', '404-to-301' ); ?>.</p>
 
 
92
  </td>
93
  </tr>
94
  </tbody>
95
  </table>
96
+ <?php submit_button( __( 'Save All Changes', '404-to-301' ) ); ?>
97
  </p>
98
  </form>
99
  </div>
includes/class-404-to-301-activator.php CHANGED
@@ -35,6 +35,7 @@ class _404_To_301_Activator {
35
  $i4t3_to = self::transfer( '', 'redirect_to', 'link' );
36
  $i4t3_page = self::transfer( '', 'redirect_page', '' );
37
  $i4t3_notify = self::transfer( '', 'email_notify', 1 );
 
38
 
39
  // New general settings array to be added
40
  $i4t3GnrlOptions = array(
@@ -43,7 +44,8 @@ class _404_To_301_Activator {
43
  'redirect_log' => $i4t3_enable,
44
  'redirect_to' => $i4t3_to,
45
  'redirect_page' => $i4t3_page,
46
- 'email_notify' => $i4t3_notify
 
47
  );
48
 
49
  /**
@@ -104,9 +106,9 @@ class _404_To_301_Activator {
104
  if( get_option( $option ) ) {
105
  $i4t3_option = get_option( $option );
106
  // If exists, then take that option value
107
- $fresh = $i4t3_option[$new];
108
  // Check if old value is available for the same option
109
- if(get_option( $old )) {
110
  // If available delete it, as we are moving to new settings
111
  delete_option( $old );
112
  }
35
  $i4t3_to = self::transfer( '', 'redirect_to', 'link' );
36
  $i4t3_page = self::transfer( '', 'redirect_page', '' );
37
  $i4t3_notify = self::transfer( '', 'email_notify', 1 );
38
+ $i4t3_notify_email = self::transfer( '', 'email_notify_address', get_option( 'admin_email' ) );
39
 
40
  // New general settings array to be added
41
  $i4t3GnrlOptions = array(
44
  'redirect_log' => $i4t3_enable,
45
  'redirect_to' => $i4t3_to,
46
  'redirect_page' => $i4t3_page,
47
+ 'email_notify' => $i4t3_notify,
48
+ 'email_notify_address' => $i4t3_notify_email
49
  );
50
 
51
  /**
106
  if( get_option( $option ) ) {
107
  $i4t3_option = get_option( $option );
108
  // If exists, then take that option value
109
+ $fresh = (!empty($i4t3_option[$new])) ? $i4t3_option[$new] : $fresh;
110
  // Check if old value is available for the same option
111
+ if( in_array( $old, array( 'type', 'link' ) ) && get_option( $old )) {
112
  // If available delete it, as we are moving to new settings
113
  delete_option( $old );
114
  }
includes/class-404-to-301-i18n.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Define the internationalization functionality
4
+ *
5
+ * Loads and defines the internationalization files for this plugin
6
+ * so that it is ready for translation.
7
+ *
8
+ * @link http://iscode.co/products/404-to-301/
9
+ * @since 2.0.7
10
+ * @package I4T3
11
+ * @subpackage I4T3/includes
12
+ * @author Joel James <me@joelsays.com>
13
+ */
14
+ class _404_To_301_i18n {
15
+ /**
16
+ * The domain specified for this plugin.
17
+ *
18
+ * @since 2.0.7
19
+ * @access private
20
+ * @var string $domain The domain identifier for this plugin.
21
+ */
22
+ private $domain;
23
+ /**
24
+ * Load the plugin text domain for translation.
25
+ *
26
+ * @since 2.0.7
27
+ */
28
+ public function load_plugin_textdomain() {
29
+ load_plugin_textdomain(
30
+ $this->domain,
31
+ false,
32
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
33
+ );
34
+ }
35
+ /**
36
+ * Set the domain equal to that of the specified domain.
37
+ *
38
+ * @since 2.0.7
39
+ * @param string $domain The domain that represents the locale of this plugin.
40
+ */
41
+ public function set_domain( $domain ) {
42
+ $this->domain = $domain;
43
+ }
44
+ }
includes/class-404-to-301.php CHANGED
@@ -67,9 +67,10 @@ class _404_To_301 {
67
  public function __construct() {
68
 
69
  $this->plugin_name = '404-to-301';
70
- $this->version = '2.0.6';
71
  $this->table = $GLOBALS['wpdb']->prefix . '404_to_301';
72
  $this->load_dependencies();
 
73
  $this->define_admin_hooks();
74
  $this->define_handler_hooks();
75
  }
@@ -93,12 +94,29 @@ class _404_To_301 {
93
  private function load_dependencies() {
94
 
95
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-404-to-301-loader.php';
 
96
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-404-to-301-admin.php';
97
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-404-to-301-logs.php';
98
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-404-to-301-public.php';
99
 
100
  $this->loader = new _404_To_301_Loader();
101
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
 
104
  /**
@@ -122,6 +140,7 @@ class _404_To_301 {
122
  $this->loader->add_filter( 'admin_footer_text', $plugin_admin, 'i4t3_dashboard_footer');
123
  $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'i4t3_plugin_action_links', 10, 5 );
124
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'i4t3_upgrade_if_new' );
 
125
  }
126
 
127
 
67
  public function __construct() {
68
 
69
  $this->plugin_name = '404-to-301';
70
+ $this->version = '2.0.7';
71
  $this->table = $GLOBALS['wpdb']->prefix . '404_to_301';
72
  $this->load_dependencies();
73
+ $this->set_locale();
74
  $this->define_admin_hooks();
75
  $this->define_handler_hooks();
76
  }
94
  private function load_dependencies() {
95
 
96
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-404-to-301-loader.php';
97
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-404-to-301-i18n.php';
98
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-404-to-301-admin.php';
99
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-404-to-301-logs.php';
100
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-404-to-301-public.php';
101
 
102
  $this->loader = new _404_To_301_Loader();
103
  }
104
+
105
+
106
+ /**
107
+ * Define the locale for this plugin for internationalization.
108
+ *
109
+ * Uses the Plugin_Name_i18n class in order to set the domain and to register the hook
110
+ * with WordPress.
111
+ *
112
+ * @since 1.0.0
113
+ * @access private
114
+ */
115
+ private function set_locale() {
116
+ $plugin_i18n = new _404_To_301_i18n();
117
+ $plugin_i18n->set_domain( $this->get_plugin_name() );
118
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
119
+ }
120
 
121
 
122
  /**
140
  $this->loader->add_filter( 'admin_footer_text', $plugin_admin, 'i4t3_dashboard_footer');
141
  $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'i4t3_plugin_action_links', 10, 5 );
142
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'i4t3_upgrade_if_new' );
143
+ $this->loader->add_filter( 'i4t3_notify_admin_email_address', $plugin_admin, 'i4t3_change_notify_email' );
144
  }
145
 
146
 
languages/404-to-301.pot ADDED
File without changes
public/class-404-to-301-public.php CHANGED
@@ -93,7 +93,6 @@ class _404_To_301_Public {
93
  $message .= '<td>' . $log_data['ua'] . '</td>';
94
  $message .= '</tr>';
95
  $message .= '</table>';
96
-
97
  $is_sent = wp_mail(
98
  $admin_email,
99
  __( 'Snap! One more 404 on ', '404-to-301' ) . $site_name,
93
  $message .= '<td>' . $log_data['ua'] . '</td>';
94
  $message .= '</tr>';
95
  $message .= '</table>';
 
96
  $is_sent = wp_mail(
97
  $admin_email,
98
  __( 'Snap! One more 404 on ', '404-to-301' ) . $site_name,
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: joelcj91,is_code
3
  Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect, seo redirect, error redirect, 404 seo, custom 404 page
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
5
  Requires at least: 3.0
6
- Tested up to: 4.3
7
- Stable tag: 2.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -26,6 +26,7 @@ You will not see any 404 error reports in your webmaster tool dashboard.
26
  >
27
  > - You can redirect errors to any existing page or custom link.<br />
28
  > - No more 404 errors in your website. Seriously!<br />
 
29
  > - You can optionally monitor/log all errors.<br />
30
  > - You can optionally enable email notification on all 404 errors.<br />
31
  > - You can choose which redirect method to be used (301,302,307).<br />
@@ -42,7 +43,7 @@ You will not see any 404 error reports in your webmaster tool dashboard.
42
 
43
  **Bug Reports**
44
 
45
- Bug reports for 404 to 301 are always welcome. [Report here](http://iscode.co/support/).
46
 
47
  **More information**
48
 
@@ -110,6 +111,15 @@ Bug reports for 404 to 301 are always welcome. [Report here](http://iscode.co/bu
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
 
 
 
 
113
  = 2.0.6 (13/09/2015) =
114
 
115
  **Improvements**
@@ -185,7 +195,7 @@ Bug reports for 404 to 301 are always welcome. [Report here](http://iscode.co/bu
185
 
186
  == Upgrade Notice ==
187
 
188
- = 2.0.6 =
189
  **Improvements**
190
- - Introduced new website for the plugin.
191
- - Fixed few dead link issues
3
  Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect, seo redirect, error redirect, 404 seo, custom 404 page
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
5
  Requires at least: 3.0
6
+ Tested up to: 4.3.1
7
+ Stable tag: 2.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
26
  >
27
  > - You can redirect errors to any existing page or custom link.<br />
28
  > - No more 404 errors in your website. Seriously!<br />
29
+ > - **Translation ready!**<br />
30
  > - You can optionally monitor/log all errors.<br />
31
  > - You can optionally enable email notification on all 404 errors.<br />
32
  > - You can choose which redirect method to be used (301,302,307).<br />
43
 
44
  **Bug Reports**
45
 
46
+ Bug reports for 404 to 301 are always welcome. [Report here](https://iscode.co/bug-report/).
47
 
48
  **More information**
49
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.0.7 (25/09/2015) =
115
+
116
+ **New Feature**
117
+ - New option to change error notification email address.
118
+ - Now **100% Translation ready**.
119
+
120
+ **Improvements**
121
+ - Minor code improvements.
122
+
123
  = 2.0.6 (13/09/2015) =
124
 
125
  **Improvements**
195
 
196
  == Upgrade Notice ==
197
 
198
+ = 2.0.7 =
199
  **Improvements**
200
+ - New option to change error notification email address.
201
+ - Now **100% Translation ready**.
screenshot-1.png CHANGED
Binary file