404 to 301 - Version 2.0.5

Version Description

(03/09/2015) =

Improvements - Added option to avoid search engine crawlers/bots from logging errors.

Bug Fixes - Fixed error log per page issue.

Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

404-to-301.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 404 to 301
4
  * Plugin URI: http://iscode.co/product/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.4
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
@@ -23,12 +23,12 @@
23
  * GNU General Public License for more details.
24
  *
25
  * You should have received a copy of the GNU General Public License
26
- * along with Easy Digital Downloads. If not, see <http://www.gnu.org/licenses/>.
27
  *
28
  * @package I4T3
29
  * @category Core
30
  * @author Joel James
31
- * @version 2.0.0
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.4' );
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/product/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.5
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
23
  * GNU General Public License for more details.
24
  *
25
  * You should have received a copy of the GNU General Public License
26
+ * along with 404 to 301. If not, see <http://www.gnu.org/licenses/>.
27
  *
28
  * @package I4T3
29
  * @category Core
30
  * @author Joel James
31
+ * @version 2.0.5
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.5' );
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-logs.php CHANGED
@@ -90,7 +90,7 @@ class _404_To_301_Logs extends WP_List_Table_404 {
90
  $wpdb->hide_errors();
91
 
92
  // Per page filter
93
- $per_page = apply_filters( 'i4t3_log_list_per_page', 2 );
94
 
95
  $current_page = $this->get_pagenum();
96
  $limit = ( $current_page-1 )* $per_page;
@@ -329,7 +329,7 @@ class _404_To_301_Logs extends WP_List_Table_404 {
329
  $current_page = $this->get_pagenum();
330
 
331
  // Per page filter
332
- $per_page = apply_filters( 'i4t3_log_list_per_page', 2 );
333
 
334
  $total = $wpdb->get_var( "SELECT count(id) as ID FROM $this->table" );
335
 
90
  $wpdb->hide_errors();
91
 
92
  // Per page filter
93
+ $per_page = apply_filters( 'i4t3_log_list_per_page', 10 );
94
 
95
  $current_page = $this->get_pagenum();
96
  $limit = ( $current_page-1 )* $per_page;
329
  $current_page = $this->get_pagenum();
330
 
331
  // Per page filter
332
+ $per_page = apply_filters( 'i4t3_log_list_per_page', 10 );
333
 
334
  $total = $wpdb->get_var( "SELECT count(id) as ID FROM $this->table" );
335
 
includes/class-404-to-301.php CHANGED
@@ -67,7 +67,7 @@ class _404_To_301 {
67
  public function __construct() {
68
 
69
  $this->plugin_name = '404-to-301';
70
- $this->version = '2.0.4';
71
  $this->table = $GLOBALS['wpdb']->prefix . '404_to_301';
72
  $this->load_dependencies();
73
  $this->define_admin_hooks();
67
  public function __construct() {
68
 
69
  $this->plugin_name = '404-to-301';
70
+ $this->version = '2.0.5';
71
  $this->table = $GLOBALS['wpdb']->prefix . '404_to_301';
72
  $this->load_dependencies();
73
  $this->define_admin_hooks();
public/class-404-to-301-public.php CHANGED
@@ -149,7 +149,7 @@ class _404_To_301_Public {
149
  }
150
 
151
  // Add log data to db if log is enabled by user
152
- if($logging_status == 1) {
153
 
154
  $wpdb->insert( $this->table, $data );
155
 
@@ -163,7 +163,7 @@ class _404_To_301_Public {
163
  }
164
 
165
  // Send email notification if enabled
166
- if ($is_email_send) {
167
  $this->i4t3_send_404_log_email($data);
168
  }
169
 
@@ -200,5 +200,34 @@ class _404_To_301_Public {
200
  do_action( 'i4t3_after_404_redirect' );
201
  }
202
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  }
149
  }
150
 
151
  // Add log data to db if log is enabled by user
152
+ if($logging_status == 1 && !$this->i4t3_is_bot()) {
153
 
154
  $wpdb->insert( $this->table, $data );
155
 
163
  }
164
 
165
  // Send email notification if enabled
166
+ if ($is_email_send && !$this->i4t3_is_bot()) {
167
  $this->i4t3_send_404_log_email($data);
168
  }
169
 
200
  do_action( 'i4t3_after_404_redirect' );
201
  }
202
  }
203
+
204
+
205
+ /**
206
+ * Check if Bot is visiting.
207
+ *
208
+ * This function is used to check if a bot is being viewed our site content.
209
+ *
210
+ * @reference http://stackoverflow.com/questions/677419/how-to-detect-search-engine-bots-with-php
211
+ * @since 2.0.5
212
+ * @author Joel James
213
+ */
214
+ public function i4t3_is_bot() {
215
+
216
+ $botlist = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
217
+ "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
218
+ "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
219
+ "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
220
+ "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
221
+ "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
222
+ "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
223
+ "Butterfly","Twitturls","Me.dium","Twiceler");
224
+
225
+ foreach($botlist as $bot){
226
+ if(strpos($_SERVER['HTTP_USER_AGENT'],$bot)!==false)
227
+ return true; // Is a bot
228
+ }
229
+
230
+ return false; // Not a bot
231
+ }
232
 
233
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect, seo
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.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -110,6 +110,14 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://iscode.co/s
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
 
 
 
113
  = 2.0.4 (26/08/2015) =
114
 
115
  **Bug Fixes**
@@ -171,5 +179,5 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://iscode.co/s
171
 
172
  == Upgrade Notice ==
173
 
174
- = 2.0.4 =
175
- * Fixed an issue where error log table is not being created.
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
110
 
111
  == Changelog ==
112
 
113
+ = 2.0.5 (03/09/2015) =
114
+
115
+ **Improvements**
116
+ - Added option to avoid search engine crawlers/bots from logging errors.
117
+
118
+ **Bug Fixes**
119
+ - Fixed error log per page issue.
120
+
121
  = 2.0.4 (26/08/2015) =
122
 
123
  **Bug Fixes**
179
 
180
  == Upgrade Notice ==
181
 
182
+ = 2.0.5 =
183
+ * - Added option to avoid search engine crawlers/bots from logging errors.