Version Description
- Fix log cleanup options
- More space when editing redirects
- Better detection of regex when importing
- Restore export options
- Fix unncessary protected
Download this release
Release Info
Developer | johnny5 |
Plugin | Redirection |
Version | 2.3.11 |
Comparing to | |
See all releases |
Code changes from version 2.3.10 to 2.3.11
- README.md +2 -0
- admin.css +4 -0
- fileio/csv.php +5 -13
- models/pager.php +23 -5
- readme.txt +8 -1
- redirection.php +21 -14
README.md
CHANGED
@@ -3,6 +3,8 @@ Redirection
|
|
3 |
|
4 |
Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.
|
5 |
|
|
|
|
|
6 |
Installation
|
7 |
============
|
8 |
Redirection can be installed by visiting the WordPress.org plugin page:
|
3 |
|
4 |
Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.
|
5 |
|
6 |
+
Note: this is the current 'trunk' version of Redirection. It may be newer than what is in the WordPress.org plugin repository, and should be considered experimental.
|
7 |
+
|
8 |
Installation
|
9 |
============
|
10 |
Redirection can be installed by visiting the WordPress.org plugin page:
|
admin.css
CHANGED
@@ -168,6 +168,10 @@ table.items .red-disabled {
|
|
168 |
text-decoration: line-through;
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
171 |
.red-added {
|
172 |
display: none;
|
173 |
}
|
168 |
text-decoration: line-through;
|
169 |
}
|
170 |
|
171 |
+
table.edit {
|
172 |
+
width: 100%;
|
173 |
+
}
|
174 |
+
|
175 |
.red-added {
|
176 |
display: none;
|
177 |
}
|
fileio/csv.php
CHANGED
@@ -53,20 +53,12 @@ class Red_Csv_File extends Red_FileIO {
|
|
53 |
return $count;
|
54 |
}
|
55 |
|
56 |
-
function is_regex
|
57 |
-
$regex
|
58 |
-
$escape = false;
|
59 |
|
60 |
-
|
|
|
61 |
|
62 |
-
|
63 |
-
$escape = true;
|
64 |
-
elseif ( strpos( $regex, $url{$x} ) !== false && !$escape )
|
65 |
-
return true;
|
66 |
-
else
|
67 |
-
$escape = false;
|
68 |
-
}
|
69 |
-
|
70 |
-
return false;
|
71 |
}
|
72 |
}
|
53 |
return $count;
|
54 |
}
|
55 |
|
56 |
+
function is_regex( $url ) {
|
57 |
+
$regex = '()[]$^*';
|
|
|
58 |
|
59 |
+
if ( strpbrk( $url, $regex ) === false )
|
60 |
+
return false;
|
61 |
|
62 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
}
|
models/pager.php
CHANGED
@@ -157,9 +157,14 @@ class Redirection_Table extends WP_List_Table {
|
|
157 |
global $wpdb, $current_user;
|
158 |
|
159 |
$screen = get_current_screen();
|
160 |
-
$per_page = get_user_meta( $current_user->ID, $screen->get_option( 'per_page', 'option' ), true );
|
161 |
|
162 |
-
$per_page =
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
$columns = $this->get_columns();
|
164 |
$sortable = $this->get_sortable_columns();
|
165 |
|
@@ -296,7 +301,7 @@ class Redirection_Group_Table extends WP_List_Table {
|
|
296 |
$item->delete();
|
297 |
}
|
298 |
|
299 |
-
|
300 |
if ( $which == 'bottom' )
|
301 |
return;
|
302 |
|
@@ -638,7 +643,11 @@ class Redirection_404_Table extends WP_List_Table {
|
|
638 |
}
|
639 |
|
640 |
class Redirection_Module_Table extends WP_List_Table {
|
641 |
-
|
|
|
|
|
|
|
|
|
642 |
//Set parent defaults
|
643 |
parent::__construct( array(
|
644 |
'singular' => 'item', //singular name of the listed records
|
@@ -671,7 +680,16 @@ class Redirection_Module_Table extends WP_List_Table {
|
|
671 |
}
|
672 |
|
673 |
function column_name( $item ) {
|
674 |
-
$actions['edit']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
|
676 |
return '<a href="#" data-action="%s" data-nonce="%s" data-id="%s">'.esc_html( $item->get_name() ).'</a>'.$this->row_actions( $actions );
|
677 |
}
|
157 |
global $wpdb, $current_user;
|
158 |
|
159 |
$screen = get_current_screen();
|
|
|
160 |
|
161 |
+
$per_page = 25;
|
162 |
+
if ( $screen->get_option( 'per_page', 'option' ) ) {
|
163 |
+
$per_page = intval( get_user_meta( $current_user->ID, $screen->get_option( 'per_page', 'option' ), true ) );
|
164 |
+
if ( $per_page === 0 )
|
165 |
+
$per_page = 25;
|
166 |
+
}
|
167 |
+
|
168 |
$columns = $this->get_columns();
|
169 |
$sortable = $this->get_sortable_columns();
|
170 |
|
301 |
$item->delete();
|
302 |
}
|
303 |
|
304 |
+
function extra_tablenav( $which ) {
|
305 |
if ( $which == 'bottom' )
|
306 |
return;
|
307 |
|
643 |
}
|
644 |
|
645 |
class Redirection_Module_Table extends WP_List_Table {
|
646 |
+
private $token = false;
|
647 |
+
|
648 |
+
function __construct( $token ) {
|
649 |
+
$this->token = $token;
|
650 |
+
|
651 |
//Set parent defaults
|
652 |
parent::__construct( array(
|
653 |
'singular' => 'item', //singular name of the listed records
|
680 |
}
|
681 |
|
682 |
function column_name( $item ) {
|
683 |
+
$actions['edit'] = sprintf( '<a href="#" class="red-ajax" data-action="%s" data-nonce="%s" data-id="%s">'.__( 'Edit', 'redirection' ).'</a>', 'red_module_edit', wp_create_nonce( 'red_edit-'.$item->get_id() ), $item->get_id() );
|
684 |
+
|
685 |
+
if ( $this->token ) {
|
686 |
+
if ( $item->get_type() === 'wp' ) {
|
687 |
+
$actions['rss'] = sprintf( '<a href="%s">RSS</a>', '?page=redirection.php&token='.$this->token.'&sub=rss&module='.intval( $item->get_id() ) );
|
688 |
+
}
|
689 |
+
|
690 |
+
$actions['htaccess'] = sprintf( '<a href="%s">.htaccess</a>', '?page=redirection.php&token='.$this->token.'&sub=apache&module='.intval( $item->get_id() ) );
|
691 |
+
$actions['csv'] = sprintf( '<a href="%s">CSV</a>', '?page=redirection.php&token='.$this->token.'&sub=csv&module='.intval( $item->get_id() ) );
|
692 |
+
}
|
693 |
|
694 |
return '<a href="#" data-action="%s" data-nonce="%s" data-id="%s">'.esc_html( $item->get_name() ).'</a>'.$this->row_actions( $actions );
|
695 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://urbangiraffe.com/about/
|
|
4 |
Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 2.3.
|
8 |
|
9 |
Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
|
10 |
|
@@ -90,6 +90,13 @@ The plugin works in a similar manner to how WordPress handles permalinks and sho
|
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
= 2.3.10 =
|
94 |
* Another compatability fix for PHP < 5.3
|
95 |
* Fix incorrect module ID used when creating a group
|
4 |
Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 2.3.11
|
8 |
|
9 |
Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
|
10 |
|
90 |
|
91 |
== Changelog ==
|
92 |
|
93 |
+
= 2.3.11 =
|
94 |
+
* Fix log cleanup options
|
95 |
+
* More space when editing redirects
|
96 |
+
* Better detection of regex when importing
|
97 |
+
* Restore export options
|
98 |
+
* Fix unncessary protected
|
99 |
+
|
100 |
= 2.3.10 =
|
101 |
* Another compatability fix for PHP < 5.3
|
102 |
* Fix incorrect module ID used when creating a group
|
redirection.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Redirection
|
4 |
Plugin URI: http://urbangiraffe.com/plugins/redirection/
|
5 |
Description: Manage all your 301 redirects and monitor 404 errors
|
6 |
-
Version: 2.3.
|
7 |
Author: John Godley
|
8 |
Author URI: http://urbangiraffe.com
|
9 |
============================================================================================================
|
@@ -45,7 +45,6 @@ class Redirection extends Redirection_Plugin {
|
|
45 |
$this->add_action( 'load-tools_page_redirection', 'redirection_head' );
|
46 |
|
47 |
add_filter( 'set-screen-option', array( $this, 'set_per_page' ), 10, 3 );
|
48 |
-
add_action( 'redirection_log_delete', array( $this, 'expire_logs' ) );
|
49 |
|
50 |
$this->register_plugin_settings( __FILE__ );
|
51 |
|
@@ -66,6 +65,8 @@ class Redirection extends Redirection_Plugin {
|
|
66 |
$this->wp->start();
|
67 |
}
|
68 |
|
|
|
|
|
69 |
$this->monitor = new Red_Monitor( $this->get_options() );
|
70 |
$this->add_action ('template_redirect' );
|
71 |
}
|
@@ -131,18 +132,18 @@ class Redirection extends Redirection_Plugin {
|
|
131 |
|
132 |
if ( $options['expire_redirect'] > 0 ) {
|
133 |
$cleanup = true;
|
134 |
-
$logs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_logs WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY)", $options['
|
135 |
-
|
136 |
if ( $logs > 0 )
|
137 |
-
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_logs WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY) LIMIT 1000", $options['
|
138 |
}
|
139 |
|
140 |
if ( $options['expire_404'] > 0 ) {
|
141 |
$cleanup = true;
|
142 |
-
|
|
|
143 |
|
144 |
if ( $l404 > 0 )
|
145 |
-
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_404 WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY) LIMIT 1000", $options['
|
146 |
}
|
147 |
|
148 |
if ( $cleanup ) {
|
@@ -183,10 +184,11 @@ class Redirection extends Redirection_Plugin {
|
|
183 |
}
|
184 |
|
185 |
function admin_screen_modules() {
|
186 |
-
$
|
|
|
187 |
$pager->prepare_items();
|
188 |
|
189 |
-
$this->render_admin( 'module_list', array( 'options' => $
|
190 |
}
|
191 |
|
192 |
function get_options() {
|
@@ -367,11 +369,15 @@ class Redirection extends Redirection_Plugin {
|
|
367 |
$group_id = Red_Group::get_first_id();
|
368 |
|
369 |
$group = Red_Group::get( $group_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
$this->render_admin( 'item_list', array( 'options' => $this->get_options(), 'group' => $group, 'table' => $table, 'date_format' => get_option( 'date_format' ) ) );
|
375 |
}
|
376 |
|
377 |
function setMatched( $match ) {
|
@@ -450,6 +456,7 @@ class Redirection extends Redirection_Plugin {
|
|
450 |
|
451 |
$hook_suffix = '';
|
452 |
$module_id = intval( $_POST['id'] );
|
|
|
453 |
|
454 |
$this->check_ajax_referer( 'red_module_save_'.$module_id );
|
455 |
|
@@ -458,7 +465,7 @@ class Redirection extends Redirection_Plugin {
|
|
458 |
if ( $module ) {
|
459 |
$module->update( $_POST );
|
460 |
|
461 |
-
$pager = new Redirection_Module_Table(
|
462 |
$json = array( 'html' => $pager->column_name( $module ) );
|
463 |
}
|
464 |
else
|
3 |
Plugin Name: Redirection
|
4 |
Plugin URI: http://urbangiraffe.com/plugins/redirection/
|
5 |
Description: Manage all your 301 redirects and monitor 404 errors
|
6 |
+
Version: 2.3.11
|
7 |
Author: John Godley
|
8 |
Author URI: http://urbangiraffe.com
|
9 |
============================================================================================================
|
45 |
$this->add_action( 'load-tools_page_redirection', 'redirection_head' );
|
46 |
|
47 |
add_filter( 'set-screen-option', array( $this, 'set_per_page' ), 10, 3 );
|
|
|
48 |
|
49 |
$this->register_plugin_settings( __FILE__ );
|
50 |
|
65 |
$this->wp->start();
|
66 |
}
|
67 |
|
68 |
+
add_action( 'redirection_log_delete', array( $this, 'expire_logs' ) );
|
69 |
+
|
70 |
$this->monitor = new Red_Monitor( $this->get_options() );
|
71 |
$this->add_action ('template_redirect' );
|
72 |
}
|
132 |
|
133 |
if ( $options['expire_redirect'] > 0 ) {
|
134 |
$cleanup = true;
|
135 |
+
$logs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_logs WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY)", $options['expire_redirect'] ) );
|
|
|
136 |
if ( $logs > 0 )
|
137 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_logs WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY) LIMIT 1000", $options['expire_redirect'] ) );
|
138 |
}
|
139 |
|
140 |
if ( $options['expire_404'] > 0 ) {
|
141 |
$cleanup = true;
|
142 |
+
echo $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_404 WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY)", $options['expire_404'] );
|
143 |
+
$l404 = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_404 WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY)", $options['expire_404'] ) );
|
144 |
|
145 |
if ( $l404 > 0 )
|
146 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_404 WHERE created < DATE_SUB(NOW(), INTERVAL %d DAY) LIMIT 1000", $options['expire_404'] ) );
|
147 |
}
|
148 |
|
149 |
if ( $cleanup ) {
|
184 |
}
|
185 |
|
186 |
function admin_screen_modules() {
|
187 |
+
$options = $this->get_options();
|
188 |
+
$pager = new Redirection_Module_Table( $options['token'] );
|
189 |
$pager->prepare_items();
|
190 |
|
191 |
+
$this->render_admin( 'module_list', array( 'options' => $options, 'table' => $pager ) );
|
192 |
}
|
193 |
|
194 |
function get_options() {
|
369 |
$group_id = Red_Group::get_first_id();
|
370 |
|
371 |
$group = Red_Group::get( $group_id );
|
372 |
+
if ( $group === false ) {
|
373 |
+
$this->render_error( __( 'Invalid group ID', 'redirection' ) );
|
374 |
+
}
|
375 |
+
else {
|
376 |
+
$table = new Redirection_Table( Red_Group::get_for_select(), $group );
|
377 |
+
$table->prepare_items();
|
378 |
|
379 |
+
$this->render_admin( 'item_list', array( 'options' => $this->get_options(), 'group' => $group, 'table' => $table, 'date_format' => get_option( 'date_format' ) ) );
|
380 |
+
}
|
|
|
|
|
381 |
}
|
382 |
|
383 |
function setMatched( $match ) {
|
456 |
|
457 |
$hook_suffix = '';
|
458 |
$module_id = intval( $_POST['id'] );
|
459 |
+
$options = $this->get_options();
|
460 |
|
461 |
$this->check_ajax_referer( 'red_module_save_'.$module_id );
|
462 |
|
465 |
if ( $module ) {
|
466 |
$module->update( $_POST );
|
467 |
|
468 |
+
$pager = new Redirection_Module_Table( $options['token'] );
|
469 |
$json = array( 'html' => $pager->column_name( $module ) );
|
470 |
}
|
471 |
else
|