Version Description
(16/03/2019) = ** New**
- Added option to disable URL guessing.
- Added review notice.
Download this release
Release Info
| Developer | joelcj91 |
| Plugin | |
| Version | 3.0.4 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.3 to 3.0.4
- 404-to-301.php +9 -8
- includes/admin/class-jj4t3-admin.php +118 -11
- includes/admin/views/settings.php +7 -0
- includes/class-jj4t3-activator-deactivator-uninstaller.php +5 -0
- includes/public/class-jj4t3-404-actions.php +20 -0
- languages/404-to-301.mo +0 -0
- languages/404-to-301.pot +49 -15
- readme.txt +11 -4
404-to-301.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: 404 to 301
|
| 4 |
* Plugin URI: https://duckdev.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: 3.0.
|
| 7 |
* Author: Joel James
|
| 8 |
* Author URI: https://duckdev.com/
|
| 9 |
* Donate link: https://paypal.me/JoelCJ
|
|
@@ -63,7 +63,7 @@ if ( ! class_exists( 'JJ_404_to_301' ) ) :
|
|
| 63 |
'JJ4T3_DIR' => plugin_dir_path( __FILE__ ),
|
| 64 |
'JJ4T3_URL' => plugin_dir_url( __FILE__ ),
|
| 65 |
'JJ4T3_BASE_FILE' => __FILE__,
|
| 66 |
-
'JJ4T3_VERSION' => '3.0.
|
| 67 |
'JJ4T3_DB_VERSION' => '11.0',
|
| 68 |
'JJ4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
|
| 69 |
// Set who all can access plugin settings.
|
|
@@ -127,6 +127,7 @@ if ( ! class_exists( 'JJ_404_to_301' ) ) :
|
|
| 127 |
'is_premium' => false,
|
| 128 |
'has_addons' => true,
|
| 129 |
'has_paid_plans' => false,
|
|
|
|
| 130 |
'menu' => array(
|
| 131 |
'slug' => 'jj4t3-logs',
|
| 132 |
'account' => false,
|
|
@@ -143,18 +144,18 @@ if ( ! class_exists( 'JJ_404_to_301' ) ) :
|
|
| 143 |
jj4t3_set_constants();
|
| 144 |
|
| 145 |
// Init Freemius.
|
| 146 |
-
|
| 147 |
|
| 148 |
// Init 404 to 301.
|
| 149 |
JJ_404_to_301();
|
| 150 |
|
| 151 |
// Uninstaller for 404 to 301.
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
|
| 157 |
// Signal that SDK was initiated.
|
| 158 |
do_action( 'jj4t3_fs_loaded' );
|
| 159 |
|
| 160 |
-
endif; // End if class_exists check.
|
| 3 |
* Plugin Name: 404 to 301
|
| 4 |
* Plugin URI: https://duckdev.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: 3.0.4
|
| 7 |
* Author: Joel James
|
| 8 |
* Author URI: https://duckdev.com/
|
| 9 |
* Donate link: https://paypal.me/JoelCJ
|
| 63 |
'JJ4T3_DIR' => plugin_dir_path( __FILE__ ),
|
| 64 |
'JJ4T3_URL' => plugin_dir_url( __FILE__ ),
|
| 65 |
'JJ4T3_BASE_FILE' => __FILE__,
|
| 66 |
+
'JJ4T3_VERSION' => '3.0.4',
|
| 67 |
'JJ4T3_DB_VERSION' => '11.0',
|
| 68 |
'JJ4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
|
| 69 |
// Set who all can access plugin settings.
|
| 127 |
'is_premium' => false,
|
| 128 |
'has_addons' => true,
|
| 129 |
'has_paid_plans' => false,
|
| 130 |
+
'anonymous_mode' => true, // Temporary fix.
|
| 131 |
'menu' => array(
|
| 132 |
'slug' => 'jj4t3-logs',
|
| 133 |
'account' => false,
|
| 144 |
jj4t3_set_constants();
|
| 145 |
|
| 146 |
// Init Freemius.
|
| 147 |
+
jj4t3_freemius();
|
| 148 |
|
| 149 |
// Init 404 to 301.
|
| 150 |
JJ_404_to_301();
|
| 151 |
|
| 152 |
// Uninstaller for 404 to 301.
|
| 153 |
+
jj4t3_freemius()->add_action( 'after_uninstall', array(
|
| 154 |
+
'JJ4T3_Activator_Deactivator_Uninstaller',
|
| 155 |
+
'uninstall'
|
| 156 |
+
) );
|
| 157 |
|
| 158 |
// Signal that SDK was initiated.
|
| 159 |
do_action( 'jj4t3_fs_loaded' );
|
| 160 |
|
| 161 |
+
endif; // End if class_exists check.
|
includes/admin/class-jj4t3-admin.php
CHANGED
|
@@ -48,6 +48,10 @@ class JJ4T3_Admin {
|
|
| 48 |
add_action( 'admin_footer', array( 'JJ4T3_Log_Listing', 'get_redirect_content' ), 100 );
|
| 49 |
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 5 );
|
| 50 |
add_action( 'plugins_loaded', array( $this, 'upgrade' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
/**
|
|
@@ -59,7 +63,7 @@ class JJ4T3_Admin {
|
|
| 59 |
* @since 2.1.4
|
| 60 |
* @access public
|
| 61 |
*
|
| 62 |
-
* @uses
|
| 63 |
*
|
| 64 |
* @return void
|
| 65 |
*/
|
|
@@ -89,7 +93,11 @@ class JJ4T3_Admin {
|
|
| 89 |
// Use minified assets if SCRIPT_DEBUG is turned off.
|
| 90 |
$file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/css/admin.css' : 'assets/css/admin.min.css';
|
| 91 |
|
| 92 |
-
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
wp_enqueue_style( JJ4T3_NAME, JJ4T3_URL . $file, array(), JJ4T3_VERSION, 'all' );
|
| 95 |
}
|
|
@@ -105,8 +113,8 @@ class JJ4T3_Admin {
|
|
| 105 |
* @since 2.0.0
|
| 106 |
* @access public
|
| 107 |
*
|
| 108 |
-
* @uses
|
| 109 |
-
* @uses
|
| 110 |
*
|
| 111 |
* @global string $pagenow Current page.
|
| 112 |
*
|
|
@@ -119,7 +127,11 @@ class JJ4T3_Admin {
|
|
| 119 |
// Use minified scripts if SCRIPT_DEBUG is turned off.
|
| 120 |
$file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/js/admin.js' : 'assets/js/admin.min.js';
|
| 121 |
|
| 122 |
-
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
wp_enqueue_script( JJ4T3_NAME, JJ4T3_URL . $file, array( 'jquery' ), JJ4T3_VERSION, false );
|
| 125 |
|
|
@@ -141,20 +153,26 @@ class JJ4T3_Admin {
|
|
| 141 |
* @since 2.0.0
|
| 142 |
* @access public
|
| 143 |
*
|
| 144 |
-
* @uses
|
| 145 |
*
|
| 146 |
* @return void
|
| 147 |
*/
|
| 148 |
public function admin_menu() {
|
| 149 |
|
| 150 |
// Main menu for error logs list.
|
| 151 |
-
$hook = add_menu_page( __( '404 Error Logs', '404-to-301' ), __( '404 Errors', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-logs', array(
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
// Render screen options on listing table.
|
| 154 |
add_action( "load-$hook", array( $this, 'screen_option' ) );
|
| 155 |
|
| 156 |
// 404 to 301 settings menu.
|
| 157 |
-
add_submenu_page( 'jj4t3-logs', __( '404 to 301 Settings', '404-to-301' ), __( '404 Settings', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-settings', array(
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
/**
|
| 160 |
* Action hook to register new submenu item.
|
|
@@ -183,9 +201,9 @@ class JJ4T3_Admin {
|
|
| 183 |
public function screen_option() {
|
| 184 |
|
| 185 |
$args = array(
|
| 186 |
-
'label'
|
| 187 |
'default' => 20,
|
| 188 |
-
'option'
|
| 189 |
);
|
| 190 |
|
| 191 |
add_screen_option( 'per_page', $args );
|
|
@@ -327,7 +345,7 @@ class JJ4T3_Admin {
|
|
| 327 |
* from the plugins listing page.
|
| 328 |
*
|
| 329 |
* @param array $links Links array.
|
| 330 |
-
* @param array $file
|
| 331 |
*
|
| 332 |
* @return array
|
| 333 |
*/
|
|
@@ -373,4 +391,93 @@ class JJ4T3_Admin {
|
|
| 373 |
update_option( 'i4t3_version_no', JJ4T3_VERSION );
|
| 374 |
}
|
| 375 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
}
|
| 48 |
add_action( 'admin_footer', array( 'JJ4T3_Log_Listing', 'get_redirect_content' ), 100 );
|
| 49 |
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 5 );
|
| 50 |
add_action( 'plugins_loaded', array( $this, 'upgrade' ) );
|
| 51 |
+
|
| 52 |
+
// Show review request.
|
| 53 |
+
add_action( 'admin_notices', array( $this, 'review_notice' ) );
|
| 54 |
+
add_action( 'admin_init', array( $this, 'review_action' ) );
|
| 55 |
}
|
| 56 |
|
| 57 |
/**
|
| 63 |
* @since 2.1.4
|
| 64 |
* @access public
|
| 65 |
*
|
| 66 |
+
* @uses ob_start() To load buffer.
|
| 67 |
*
|
| 68 |
* @return void
|
| 69 |
*/
|
| 93 |
// Use minified assets if SCRIPT_DEBUG is turned off.
|
| 94 |
$file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/css/admin.css' : 'assets/css/admin.min.css';
|
| 95 |
|
| 96 |
+
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
|
| 97 |
+
'jj4t3-settings',
|
| 98 |
+
'jj4t3-logs',
|
| 99 |
+
) )
|
| 100 |
+
) {
|
| 101 |
|
| 102 |
wp_enqueue_style( JJ4T3_NAME, JJ4T3_URL . $file, array(), JJ4T3_VERSION, 'all' );
|
| 103 |
}
|
| 113 |
* @since 2.0.0
|
| 114 |
* @access public
|
| 115 |
*
|
| 116 |
+
* @uses wp_enqueue_script To register script.
|
| 117 |
+
* @uses wp_localize_script To translate strings in js.
|
| 118 |
*
|
| 119 |
* @global string $pagenow Current page.
|
| 120 |
*
|
| 127 |
// Use minified scripts if SCRIPT_DEBUG is turned off.
|
| 128 |
$file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/js/admin.js' : 'assets/js/admin.min.js';
|
| 129 |
|
| 130 |
+
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
|
| 131 |
+
'jj4t3-settings',
|
| 132 |
+
'jj4t3-logs',
|
| 133 |
+
) )
|
| 134 |
+
) {
|
| 135 |
|
| 136 |
wp_enqueue_script( JJ4T3_NAME, JJ4T3_URL . $file, array( 'jquery' ), JJ4T3_VERSION, false );
|
| 137 |
|
| 153 |
* @since 2.0.0
|
| 154 |
* @access public
|
| 155 |
*
|
| 156 |
+
* @uses add_submenu_page() Action hook to add new admin menu sub page.
|
| 157 |
*
|
| 158 |
* @return void
|
| 159 |
*/
|
| 160 |
public function admin_menu() {
|
| 161 |
|
| 162 |
// Main menu for error logs list.
|
| 163 |
+
$hook = add_menu_page( __( '404 Error Logs', '404-to-301' ), __( '404 Errors', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-logs', array(
|
| 164 |
+
$this,
|
| 165 |
+
'error_list',
|
| 166 |
+
), 'dashicons-redo', 90 );
|
| 167 |
|
| 168 |
// Render screen options on listing table.
|
| 169 |
add_action( "load-$hook", array( $this, 'screen_option' ) );
|
| 170 |
|
| 171 |
// 404 to 301 settings menu.
|
| 172 |
+
add_submenu_page( 'jj4t3-logs', __( '404 to 301 Settings', '404-to-301' ), __( '404 Settings', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-settings', array(
|
| 173 |
+
$this,
|
| 174 |
+
'admin_page',
|
| 175 |
+
) );
|
| 176 |
|
| 177 |
/**
|
| 178 |
* Action hook to register new submenu item.
|
| 201 |
public function screen_option() {
|
| 202 |
|
| 203 |
$args = array(
|
| 204 |
+
'label' => __( 'Error Logs', '404-to-301' ),
|
| 205 |
'default' => 20,
|
| 206 |
+
'option' => 'logs_per_page',
|
| 207 |
);
|
| 208 |
|
| 209 |
add_screen_option( 'per_page', $args );
|
| 345 |
* from the plugins listing page.
|
| 346 |
*
|
| 347 |
* @param array $links Links array.
|
| 348 |
+
* @param array $file File name.
|
| 349 |
*
|
| 350 |
* @return array
|
| 351 |
*/
|
| 391 |
update_option( 'i4t3_version_no', JJ4T3_VERSION );
|
| 392 |
}
|
| 393 |
}
|
| 394 |
+
|
| 395 |
+
/**
|
| 396 |
+
* Show admin to ask for review in wp.org.
|
| 397 |
+
*
|
| 398 |
+
* Show admin notice only inside our plugin's settings page.
|
| 399 |
+
* Hide the notice permanently if user dismissed it.
|
| 400 |
+
*
|
| 401 |
+
* @since 3.0.4
|
| 402 |
+
*
|
| 403 |
+
* @return void|bool
|
| 404 |
+
*/
|
| 405 |
+
public function review_notice() {
|
| 406 |
+
global $pagenow;
|
| 407 |
+
|
| 408 |
+
// Only on our page.
|
| 409 |
+
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
|
| 410 |
+
'jj4t3-settings',
|
| 411 |
+
'jj4t3-logs',
|
| 412 |
+
'jj4t3-logs-addons',
|
| 413 |
+
) )
|
| 414 |
+
) {
|
| 415 |
+
// Only for admins.
|
| 416 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
| 417 |
+
return false;
|
| 418 |
+
}
|
| 419 |
+
// Get the notice time.
|
| 420 |
+
$notice_time = get_option( 'i4t3_review_notice' );
|
| 421 |
+
// If not set, set now and bail.
|
| 422 |
+
if ( ! $notice_time ) {
|
| 423 |
+
// Set to next week.
|
| 424 |
+
return add_option( 'i4t3_review_notice', time() + 604800 );
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
// Current logged in user.
|
| 428 |
+
$current_user = wp_get_current_user();
|
| 429 |
+
// Did the current user already dismiss?.
|
| 430 |
+
$dismissed = get_user_meta( $current_user->ID, 'i4t3_review_notice_dismissed', true );
|
| 431 |
+
// Continue only when allowed.
|
| 432 |
+
if ( (int) $notice_time <= time() && ! $dismissed ) {
|
| 433 |
+
?>
|
| 434 |
+
<div class="notice notice-success">
|
| 435 |
+
<p><?php printf( __( 'Hey %1$s, I noticed you\'ve been using %2$s404 to 301%3$s for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.', '404-to-301' ),
|
| 436 |
+
empty( $current_user->display_name ) ? __( 'there', '404-to-301' ) : ucwords( $current_user->display_name ),
|
| 437 |
+
'<strong>',
|
| 438 |
+
'</strong>'
|
| 439 |
+
); ?>
|
| 440 |
+
</p>
|
| 441 |
+
<p>
|
| 442 |
+
<a href="https://wordpress.org/support/plugin/404-to-301/reviews/#new-post" target="_blank"><?php esc_html_e( 'Ok, you deserve it', '404-to-301' ); ?></a>
|
| 443 |
+
</p>
|
| 444 |
+
<p>
|
| 445 |
+
<a href="<?php echo add_query_arg( 'jj4t3_rating', 'later' ); // later. ?>"><?php esc_html_e( 'Nope, maybe later', '404-to-301' ); ?></a>
|
| 446 |
+
</p>
|
| 447 |
+
<p>
|
| 448 |
+
<a href="<?php echo add_query_arg( 'jj4t3_rating', 'dismiss' ); // dismiss link. ?>"><?php esc_html_e( 'I already did', '404-to-301' ); ?></a>
|
| 449 |
+
</p>
|
| 450 |
+
</div>
|
| 451 |
+
<?php
|
| 452 |
+
}
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
/**
|
| 457 |
+
* Handle review notice actions.
|
| 458 |
+
*
|
| 459 |
+
* If dismissed set a user meta for the current
|
| 460 |
+
* user and do not show again.
|
| 461 |
+
* If agreed to review later, update the review
|
| 462 |
+
* timestamp to after 2 weeks.
|
| 463 |
+
*
|
| 464 |
+
* @since 3.0.4
|
| 465 |
+
*
|
| 466 |
+
* @return void
|
| 467 |
+
*/
|
| 468 |
+
public function review_action() {
|
| 469 |
+
// Get the current review action.
|
| 470 |
+
$action = jj4t3_from_request( 'jj4t3_rating' );
|
| 471 |
+
|
| 472 |
+
switch ( $action ) {
|
| 473 |
+
case 'later':
|
| 474 |
+
// Let's show after another 2 weeks.
|
| 475 |
+
update_option( 'i4t3_review_notice', time() + 1209600 );
|
| 476 |
+
break;
|
| 477 |
+
case 'dismiss':
|
| 478 |
+
// Do not show again to this user.
|
| 479 |
+
update_user_meta( get_current_user_id(), 'i4t3_review_notice_dismissed', 1 );
|
| 480 |
+
break;
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
}
|
includes/admin/views/settings.php
CHANGED
|
@@ -69,6 +69,13 @@ defined( 'ABSPATH' ) or exit; ?>
|
|
| 69 |
<p class="description jj4t3-p-desc"><?php _e( 'If you check this, an email will be sent on every 404 log on the admin email account.', '404-to-301' ); ?></p>
|
| 70 |
</td>
|
| 71 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
<tr>
|
| 73 |
<th><?php _e( 'Email address', '404-to-301' ); ?></th>
|
| 74 |
<td>
|
| 69 |
<p class="description jj4t3-p-desc"><?php _e( 'If you check this, an email will be sent on every 404 log on the admin email account.', '404-to-301' ); ?></p>
|
| 70 |
</td>
|
| 71 |
</tr>
|
| 72 |
+
<tr>
|
| 73 |
+
<th><?php _e( 'Disable URL guessing', '404-to-301' ); ?></th>
|
| 74 |
+
<td>
|
| 75 |
+
<input type="checkbox" name="i4t3_gnrl_options[disable_guessing]" value="1" <?php checked( jj4t3_get_option( 'disable_guessing' ), 0 ); ?> />
|
| 76 |
+
<p class="description jj4t3-p-desc"><?php printf( __( 'If you disable URL guessing, it will stop WordPress from autocorrecting incorrect URLs. %1$sLearn more%2$s about canonical redirect.', '404-to-301' ), '<a href="https://developer.wordpress.org/reference/functions/redirect_canonical/" target="_blank">', '</a>' ); ?></p>
|
| 77 |
+
</td>
|
| 78 |
+
</tr>
|
| 79 |
<tr>
|
| 80 |
<th><?php _e( 'Email address', '404-to-301' ); ?></th>
|
| 81 |
<td>
|
includes/class-jj4t3-activator-deactivator-uninstaller.php
CHANGED
|
@@ -39,6 +39,7 @@ class JJ4T3_Activator_Deactivator_Uninstaller {
|
|
| 39 |
'redirect_to' => 'link',
|
| 40 |
'redirect_page' => '',
|
| 41 |
'email_notify' => 0,
|
|
|
|
| 42 |
'email_notify_address' => get_option( 'admin_email' ),
|
| 43 |
'exclude_paths' => '/wp-content',
|
| 44 |
);
|
|
@@ -58,6 +59,9 @@ class JJ4T3_Activator_Deactivator_Uninstaller {
|
|
| 58 |
// We are using older prefix for our option names.
|
| 59 |
update_option( 'i4t3_gnrl_options', $options );
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
// Manage error log table.
|
| 62 |
self::log_table();
|
| 63 |
}
|
|
@@ -130,6 +134,7 @@ class JJ4T3_Activator_Deactivator_Uninstaller {
|
|
| 130 |
'i4t3_activated_time',
|
| 131 |
'i4t3_db_version',
|
| 132 |
'i4t3_version_no',
|
|
|
|
| 133 |
);
|
| 134 |
|
| 135 |
// Loop through each options.
|
| 39 |
'redirect_to' => 'link',
|
| 40 |
'redirect_page' => '',
|
| 41 |
'email_notify' => 0,
|
| 42 |
+
'disable_guessing' => 0,
|
| 43 |
'email_notify_address' => get_option( 'admin_email' ),
|
| 44 |
'exclude_paths' => '/wp-content',
|
| 45 |
);
|
| 59 |
// We are using older prefix for our option names.
|
| 60 |
update_option( 'i4t3_gnrl_options', $options );
|
| 61 |
|
| 62 |
+
// Set review notice time for 1 week.
|
| 63 |
+
add_option( 'i4t3_review_notice', time() + 604800 );
|
| 64 |
+
|
| 65 |
// Manage error log table.
|
| 66 |
self::log_table();
|
| 67 |
}
|
| 134 |
'i4t3_activated_time',
|
| 135 |
'i4t3_db_version',
|
| 136 |
'i4t3_version_no',
|
| 137 |
+
'i4t3_review_notice',
|
| 138 |
);
|
| 139 |
|
| 140 |
// Loop through each options.
|
includes/public/class-jj4t3-404-actions.php
CHANGED
|
@@ -91,6 +91,7 @@ class JJ4T3_404_Actions extends JJ4T3_404_Data {
|
|
| 91 |
|
| 92 |
// Main filter that handles 404.
|
| 93 |
add_action( 'template_redirect', array( $this, 'handle_404' ) );
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
/**
|
|
@@ -443,4 +444,23 @@ class JJ4T3_404_Actions extends JJ4T3_404_Data {
|
|
| 443 |
}
|
| 444 |
}
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
}
|
| 91 |
|
| 92 |
// Main filter that handles 404.
|
| 93 |
add_action( 'template_redirect', array( $this, 'handle_404' ) );
|
| 94 |
+
add_filter( 'redirect_canonical', array( $this, 'url_guessing' ) );
|
| 95 |
}
|
| 96 |
|
| 97 |
/**
|
| 444 |
}
|
| 445 |
}
|
| 446 |
|
| 447 |
+
/**
|
| 448 |
+
* Disable URL guessing if enabled.
|
| 449 |
+
*
|
| 450 |
+
* @param bool $guess Current status.
|
| 451 |
+
*
|
| 452 |
+
* @since 3.0.4
|
| 453 |
+
*
|
| 454 |
+
* @return bool
|
| 455 |
+
*/
|
| 456 |
+
public function url_guessing( $guess ) {
|
| 457 |
+
// Check if guessing is disabled.
|
| 458 |
+
$disable_guessing = jj4t3_get_option( 'disable_guessing' );
|
| 459 |
+
// Disable only on 404.
|
| 460 |
+
if ( $disable_guessing && is_404() && ! isset( $_GET['p'] ) ) {
|
| 461 |
+
$guess = false;
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
return $guess;
|
| 465 |
+
}
|
| 466 |
}
|
languages/404-to-301.mo
CHANGED
|
Binary file
|
languages/404-to-301.pot
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
# This file is distributed under the GPL-2.0+.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: 404 to 301 3.0.
|
| 6 |
"Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
|
| 7 |
-
"POT-Creation-Date: 2019-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -24,29 +24,29 @@ msgstr ""
|
|
| 24 |
"X-Textdomain-Support: yes\n"
|
| 25 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
| 26 |
|
| 27 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 28 |
msgid "Custom Redirect"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 32 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 33 |
#: includes/admin/class-jj4t3-log-listing.php:47
|
| 34 |
msgid "404 Error Logs"
|
| 35 |
msgstr ""
|
| 36 |
|
| 37 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 38 |
msgid "404 Errors"
|
| 39 |
msgstr ""
|
| 40 |
|
| 41 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 42 |
msgid "404 to 301 Settings"
|
| 43 |
msgstr ""
|
| 44 |
|
| 45 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 46 |
msgid "404 Settings"
|
| 47 |
msgstr ""
|
| 48 |
|
| 49 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 50 |
msgid "Error Logs"
|
| 51 |
msgstr ""
|
| 52 |
|
|
@@ -54,14 +54,38 @@ msgstr ""
|
|
| 54 |
msgid "404 to 301"
|
| 55 |
msgstr ""
|
| 56 |
|
| 57 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 58 |
msgid "Settings"
|
| 59 |
msgstr ""
|
| 60 |
|
| 61 |
-
#: includes/admin/class-jj4t3-admin.php:
|
| 62 |
msgid "Logs"
|
| 63 |
msgstr ""
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
#: includes/admin/class-jj4t3-log-listing.php:46
|
| 66 |
msgid "404 Error Log"
|
| 67 |
msgstr ""
|
|
@@ -270,22 +294,32 @@ msgid ""
|
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
#: includes/admin/views/settings.php:73
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
msgid "Email address"
|
| 274 |
msgstr ""
|
| 275 |
|
| 276 |
-
#: includes/admin/views/settings.php:
|
| 277 |
msgid "Change the recipient email address for error log notifications."
|
| 278 |
msgstr ""
|
| 279 |
|
| 280 |
-
#: includes/admin/views/settings.php:
|
| 281 |
msgid "Exclude paths"
|
| 282 |
msgstr ""
|
| 283 |
|
| 284 |
-
#: includes/admin/views/settings.php:
|
| 285 |
msgid "If you want to exclude few paths from error logs, enter here. One per line."
|
| 286 |
msgstr ""
|
| 287 |
|
| 288 |
-
#: includes/admin/views/settings.php:
|
| 289 |
msgid "Save settings"
|
| 290 |
msgstr ""
|
| 291 |
|
| 2 |
# This file is distributed under the GPL-2.0+.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: 404 to 301 3.0.4\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
|
| 7 |
+
"POT-Creation-Date: 2019-03-16 10:39:38+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 24 |
"X-Textdomain-Support: yes\n"
|
| 25 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
| 26 |
|
| 27 |
+
#: includes/admin/class-jj4t3-admin.php:139
|
| 28 |
msgid "Custom Redirect"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
+
#: includes/admin/class-jj4t3-admin.php:163
|
| 32 |
+
#: includes/admin/class-jj4t3-admin.php:230
|
| 33 |
#: includes/admin/class-jj4t3-log-listing.php:47
|
| 34 |
msgid "404 Error Logs"
|
| 35 |
msgstr ""
|
| 36 |
|
| 37 |
+
#: includes/admin/class-jj4t3-admin.php:163
|
| 38 |
msgid "404 Errors"
|
| 39 |
msgstr ""
|
| 40 |
|
| 41 |
+
#: includes/admin/class-jj4t3-admin.php:172
|
| 42 |
msgid "404 to 301 Settings"
|
| 43 |
msgstr ""
|
| 44 |
|
| 45 |
+
#: includes/admin/class-jj4t3-admin.php:172
|
| 46 |
msgid "404 Settings"
|
| 47 |
msgstr ""
|
| 48 |
|
| 49 |
+
#: includes/admin/class-jj4t3-admin.php:204
|
| 50 |
msgid "Error Logs"
|
| 51 |
msgstr ""
|
| 52 |
|
| 54 |
msgid "404 to 301"
|
| 55 |
msgstr ""
|
| 56 |
|
| 57 |
+
#: includes/admin/class-jj4t3-admin.php:357 includes/admin/views/admin.php:27
|
| 58 |
msgid "Settings"
|
| 59 |
msgstr ""
|
| 60 |
|
| 61 |
+
#: includes/admin/class-jj4t3-admin.php:358
|
| 62 |
msgid "Logs"
|
| 63 |
msgstr ""
|
| 64 |
|
| 65 |
+
#: includes/admin/class-jj4t3-admin.php:435
|
| 66 |
+
msgid ""
|
| 67 |
+
"Hey %1$s, I noticed you've been using %2$s404 to 301%3$s for more than 1 "
|
| 68 |
+
"week – that’s awesome! Could you please do me a BIG favor and give it a "
|
| 69 |
+
"5-star rating on WordPress? Just to help us spread the word and boost our "
|
| 70 |
+
"motivation."
|
| 71 |
+
msgstr ""
|
| 72 |
+
|
| 73 |
+
#: includes/admin/class-jj4t3-admin.php:436
|
| 74 |
+
msgid "there"
|
| 75 |
+
msgstr ""
|
| 76 |
+
|
| 77 |
+
#: includes/admin/class-jj4t3-admin.php:442
|
| 78 |
+
msgid "Ok, you deserve it"
|
| 79 |
+
msgstr ""
|
| 80 |
+
|
| 81 |
+
#: includes/admin/class-jj4t3-admin.php:445
|
| 82 |
+
msgid "Nope, maybe later"
|
| 83 |
+
msgstr ""
|
| 84 |
+
|
| 85 |
+
#: includes/admin/class-jj4t3-admin.php:448
|
| 86 |
+
msgid "I already did"
|
| 87 |
+
msgstr ""
|
| 88 |
+
|
| 89 |
#: includes/admin/class-jj4t3-log-listing.php:46
|
| 90 |
msgid "404 Error Log"
|
| 91 |
msgstr ""
|
| 294 |
msgstr ""
|
| 295 |
|
| 296 |
#: includes/admin/views/settings.php:73
|
| 297 |
+
msgid "Disable URL guessing"
|
| 298 |
+
msgstr ""
|
| 299 |
+
|
| 300 |
+
#: includes/admin/views/settings.php:76
|
| 301 |
+
msgid ""
|
| 302 |
+
"If you disable URL guessing, it will stop WordPress from autocorrecting "
|
| 303 |
+
"incorrect URLs. %1$sLearn more%2$s about canonical redirect."
|
| 304 |
+
msgstr ""
|
| 305 |
+
|
| 306 |
+
#: includes/admin/views/settings.php:80
|
| 307 |
msgid "Email address"
|
| 308 |
msgstr ""
|
| 309 |
|
| 310 |
+
#: includes/admin/views/settings.php:84
|
| 311 |
msgid "Change the recipient email address for error log notifications."
|
| 312 |
msgstr ""
|
| 313 |
|
| 314 |
+
#: includes/admin/views/settings.php:88
|
| 315 |
msgid "Exclude paths"
|
| 316 |
msgstr ""
|
| 317 |
|
| 318 |
+
#: includes/admin/views/settings.php:91
|
| 319 |
msgid "If you want to exclude few paths from error logs, enter here. One per line."
|
| 320 |
msgstr ""
|
| 321 |
|
| 322 |
+
#: includes/admin/views/settings.php:96
|
| 323 |
msgid "Save settings"
|
| 324 |
msgstr ""
|
| 325 |
|
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.me/JoelCJ
|
| 5 |
Requires at least: 3.5
|
| 6 |
Tested up to: 5.1
|
| 7 |
-
Stable tag: 3.0.
|
| 8 |
Requires PHP: 5.6
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
@@ -128,6 +128,12 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
|
|
| 128 |
|
| 129 |
== Changelog ==
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
= 3.0.3 (15/03/2019) =
|
| 132 |
**🐛 Bug Fixes**
|
| 133 |
|
|
@@ -402,7 +408,8 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
|
|
| 402 |
|
| 403 |
== Upgrade Notice ==
|
| 404 |
|
| 405 |
-
= 3.0.
|
| 406 |
-
|
| 407 |
|
| 408 |
-
*
|
|
|
| 4 |
Donate link: https://www.paypal.me/JoelCJ
|
| 5 |
Requires at least: 3.5
|
| 6 |
Tested up to: 5.1
|
| 7 |
+
Stable tag: 3.0.4
|
| 8 |
Requires PHP: 5.6
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 128 |
|
| 129 |
== Changelog ==
|
| 130 |
|
| 131 |
+
= 3.0.4 (16/03/2019) =
|
| 132 |
+
**📦 New**
|
| 133 |
+
|
| 134 |
+
* Added option to disable URL guessing.
|
| 135 |
+
* Added review notice.
|
| 136 |
+
|
| 137 |
= 3.0.3 (15/03/2019) =
|
| 138 |
**🐛 Bug Fixes**
|
| 139 |
|
| 408 |
|
| 409 |
== Upgrade Notice ==
|
| 410 |
|
| 411 |
+
= 3.0.4 (16/03/2019) =
|
| 412 |
+
**📦 New**
|
| 413 |
|
| 414 |
+
* Added option to disable URL guessing.
|
| 415 |
+
* Added review notice.
|
