Version Description
Download this release
Release Info
Developer | shawn@eggplantstudios.ca |
Plugin | Eggplant 301 Redirects |
Version | 2.2.5 |
Comparing to | |
See all releases |
Code changes from version 2.2.4 to 2.2.5
- css/eps_redirect.css +0 -15
- eps-301-redirects.php +67 -16
- libs/eps-plugin-options.php +7 -55
- libs/eps-plugin.php +12 -12
- plugin.php +12 -22
- readme.txt +1 -10
- templates/admin-tab-404s.php +14 -26
- templates/admin-tab-error.php +0 -32
- templates/admin-tab-import-export.php +1 -0
- templates/admin-tab-redirects.php +2 -2
- templates/template.404-entry.php +26 -0
css/eps_redirect.css
CHANGED
@@ -261,21 +261,6 @@ select.eps-small-select { display: inline-block; }
|
|
261 |
|
262 |
.padding { padding: 16px; }
|
263 |
.padding-lots { padding: 32px; }
|
264 |
-
|
265 |
-
|
266 |
-
.eps-notice {
|
267 |
-
padding: 16px;
|
268 |
-
margin: 6px auto;
|
269 |
-
background: white;
|
270 |
-
box-shadow: 1px 1px 4px #dddddd;
|
271 |
-
border-left: 3px solid #888888;
|
272 |
-
font-weight: bold;
|
273 |
-
font-size: 14px;
|
274 |
-
}
|
275 |
-
.eps-notice.eps-warning {
|
276 |
-
border-left: 3px solid #940000;
|
277 |
-
color: #940000;
|
278 |
-
}
|
279 |
/*----------------------------------------------------------*/
|
280 |
/*-------------------- media queries ---------------------*/
|
281 |
/*----------------------------------------------------------*/
|
261 |
|
262 |
.padding { padding: 16px; }
|
263 |
.padding-lots { padding: 32px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
/*----------------------------------------------------------*/
|
265 |
/*-------------------- media queries ---------------------*/
|
266 |
/*----------------------------------------------------------*/
|
eps-301-redirects.php
CHANGED
@@ -13,19 +13,19 @@
|
|
13 |
* PHP version 5
|
14 |
*
|
15 |
*
|
16 |
-
* @package EPS 301 Redirects
|
17 |
* @author Shawn Wernig ( shawn@eggplantstudios.ca )
|
18 |
-
* @version 2.2.
|
19 |
*/
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
/*
|
25 |
-
Plugin Name: Eggplant 301 Redirects
|
26 |
Plugin URI: http://www.eggplantstudios.ca
|
27 |
Description: Create your own 301 redirects using this powerful plugin.
|
28 |
-
Version: 2.2.
|
29 |
Author: Shawn Wernig http://www.eggplantstudios.ca
|
30 |
License: GPLv2 or later
|
31 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -37,8 +37,8 @@ if( ! defined( 'EPS_REDIRECT_PRO' ) )
|
|
37 |
|
38 |
define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
|
39 |
define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
|
40 |
-
define ( 'EPS_REDIRECT_VERSION', '2.2.
|
41 |
-
define ( 'EPS_REDIRECT_PRO',
|
42 |
|
43 |
include(EPS_REDIRECT_PATH.'eps-form-elements.php');
|
44 |
include(EPS_REDIRECT_PATH.'class.drop-down-pages.php');
|
@@ -46,10 +46,9 @@ include(EPS_REDIRECT_PATH.'libs/eps-plugin.php');
|
|
46 |
include(EPS_REDIRECT_PATH.'libs/eps-plugin-options.php');
|
47 |
include(EPS_REDIRECT_PATH.'plugin.php');
|
48 |
|
49 |
-
register_activation_hook( __FILE__, array('EPS_Redirects_Plugin', '_activation'));
|
50 |
-
register_deactivation_hook( __FILE__, array('EPS_Redirects_Plugin', '_deactivation'));
|
51 |
|
52 |
-
|
|
|
53 |
|
54 |
/**
|
55 |
*
|
@@ -152,10 +151,6 @@ class EPS_Redirects {
|
|
152 |
*
|
153 |
*/
|
154 |
private function format_from_url( $string ) {
|
155 |
-
//$from = home_url() . '/' . $string;
|
156 |
-
//return strtolower( rtrim( $from,'/') );
|
157 |
-
|
158 |
-
|
159 |
$complete = home_url() . '/' . $string;
|
160 |
list($uprotocol,$uempty,$uhost,$from) = explode( '/', $complete, 4);
|
161 |
$from = '/' . $from;
|
@@ -526,11 +521,67 @@ class EPS_Redirects {
|
|
526 |
file_put_contents(EPS_REDIRECT_PATH. '/error_activation.html', ob_get_contents());
|
527 |
}
|
528 |
|
529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
public static function check_404()
|
531 |
{
|
|
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
|
535 |
}
|
536 |
|
@@ -563,12 +614,12 @@ function eps_view( $object ) {
|
|
563 |
|
564 |
|
565 |
// Run the plugin.
|
566 |
-
$EPS_Redirects = new
|
567 |
|
568 |
}
|
569 |
else
|
570 |
{
|
571 |
-
if( EPS_REDIRECT_PRO ===
|
572 |
{
|
573 |
add_action( 'admin_notices', 'eps_redirects_pro_conflict' );
|
574 |
function eps_redirects_pro_conflict()
|
13 |
* PHP version 5
|
14 |
*
|
15 |
*
|
16 |
+
* @package EPS 301 Redirects Pro
|
17 |
* @author Shawn Wernig ( shawn@eggplantstudios.ca )
|
18 |
+
* @version 2.2.2
|
19 |
*/
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
/*
|
25 |
+
Plugin Name: Eggplant 301 Redirects Pro
|
26 |
Plugin URI: http://www.eggplantstudios.ca
|
27 |
Description: Create your own 301 redirects using this powerful plugin.
|
28 |
+
Version: 2.2.2
|
29 |
Author: Shawn Wernig http://www.eggplantstudios.ca
|
30 |
License: GPLv2 or later
|
31 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
37 |
|
38 |
define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
|
39 |
define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
|
40 |
+
define ( 'EPS_REDIRECT_VERSION', '2.2.2');
|
41 |
+
define ( 'EPS_REDIRECT_PRO', true);
|
42 |
|
43 |
include(EPS_REDIRECT_PATH.'eps-form-elements.php');
|
44 |
include(EPS_REDIRECT_PATH.'class.drop-down-pages.php');
|
46 |
include(EPS_REDIRECT_PATH.'libs/eps-plugin-options.php');
|
47 |
include(EPS_REDIRECT_PATH.'plugin.php');
|
48 |
|
|
|
|
|
49 |
|
50 |
+
|
51 |
+
class EPS_Redirects_Pro {
|
52 |
|
53 |
/**
|
54 |
*
|
151 |
*
|
152 |
*/
|
153 |
private function format_from_url( $string ) {
|
|
|
|
|
|
|
|
|
154 |
$complete = home_url() . '/' . $string;
|
155 |
list($uprotocol,$uempty,$uhost,$from) = explode( '/', $complete, 4);
|
156 |
$from = '/' . $from;
|
521 |
file_put_contents(EPS_REDIRECT_PATH. '/error_activation.html', ob_get_contents());
|
522 |
}
|
523 |
|
524 |
+
|
525 |
+
/**
|
526 |
+
*
|
527 |
+
* 404 Stuff!
|
528 |
+
*
|
529 |
+
* This function will output a variable containing the admin ajax url for use in javascript.
|
530 |
+
*
|
531 |
+
* @author epstudios
|
532 |
+
*
|
533 |
+
*/
|
534 |
+
|
535 |
+
public static function get_404s() {
|
536 |
+
global $wpdb;
|
537 |
+
$table_name = $wpdb->prefix . "redirects";
|
538 |
+
|
539 |
+
$results = $wpdb->get_results(
|
540 |
+
"SELECT * FROM $table_name WHERE status = 404 ORDER BY id DESC"
|
541 |
+
);
|
542 |
+
|
543 |
+
return $results;
|
544 |
+
}
|
545 |
public static function check_404()
|
546 |
{
|
547 |
+
global $wp_query;
|
548 |
|
549 |
+
if ( $wp_query->is_404() )
|
550 |
+
{
|
551 |
+
$entries = array(
|
552 |
+
array(
|
553 |
+
'url_from' => ltrim( self::get_url(), '/' ),
|
554 |
+
'url_to' => '',
|
555 |
+
'type' => '',
|
556 |
+
'status' => 404,
|
557 |
+
'count' => 1
|
558 |
+
)
|
559 |
+
);
|
560 |
+
|
561 |
+
if( $entry = self::redirect_exists( $entries[0] ) )
|
562 |
+
{
|
563 |
+
self::increment_field($entry->id, 'count');
|
564 |
+
}
|
565 |
+
else
|
566 |
+
{
|
567 |
+
self::_save_redirects( $entries );
|
568 |
+
}
|
569 |
+
}
|
570 |
}
|
571 |
+
public static function list_404s(){
|
572 |
+
$redirects = self::get_404s( );
|
573 |
+
$html = '';
|
574 |
+
if (empty($redirects)) return false;
|
575 |
+
ob_start();
|
576 |
+
foreach ($redirects as $redirect ) {
|
577 |
+
$dfrom = urldecode($redirect->url_from);
|
578 |
+
include( EPS_REDIRECT_PATH . 'templates/template.404-entry.php');
|
579 |
+
}
|
580 |
+
$html = ob_get_contents();
|
581 |
+
ob_end_clean();
|
582 |
+
return $html;
|
583 |
+
}
|
584 |
+
|
585 |
|
586 |
}
|
587 |
|
614 |
|
615 |
|
616 |
// Run the plugin.
|
617 |
+
$EPS_Redirects = new EPS_Redirects_Pro();
|
618 |
|
619 |
}
|
620 |
else
|
621 |
{
|
622 |
+
if( EPS_REDIRECT_PRO === false )
|
623 |
{
|
624 |
add_action( 'admin_notices', 'eps_redirects_pro_conflict' );
|
625 |
function eps_redirects_pro_conflict()
|
libs/eps-plugin-options.php
CHANGED
@@ -51,63 +51,16 @@ class EPS_Plugin_Options {
|
|
51 |
*
|
52 |
*/
|
53 |
private function build_settings() {
|
54 |
-
$this->settings = $this->
|
55 |
}
|
56 |
|
57 |
-
private function
|
58 |
{
|
59 |
-
|
60 |
-
|
61 |
-
if ( is_readable( $uri ) )
|
62 |
-
{
|
63 |
-
$data = $this->read_json_from_file($uri);
|
64 |
-
}
|
65 |
-
else
|
66 |
-
{
|
67 |
-
chmod($uri, 0644);
|
68 |
-
$data = $this->read_json_from_file($uri);
|
69 |
-
if( $data )
|
70 |
-
{
|
71 |
-
$data = array(
|
72 |
-
'error' => array(
|
73 |
-
"title" => "Oops!",
|
74 |
-
"description" => "An essential file (options.json) could not be read. Please check your folder permissions.",
|
75 |
-
"callback" => "error",
|
76 |
-
"fields" => ''
|
77 |
-
)
|
78 |
-
);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
}
|
82 |
-
else
|
83 |
-
{
|
84 |
-
$data = array(
|
85 |
-
'error' => array(
|
86 |
-
"title" => "Oops!",
|
87 |
-
"description" => "An essential file (options.json) could not be found. Please re-install the plugin.",
|
88 |
-
"callback" => "error",
|
89 |
-
"fields" => ''
|
90 |
-
)
|
91 |
-
);
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
return $data;
|
96 |
}
|
97 |
|
98 |
-
private function read_json_from_file($uri)
|
99 |
-
{
|
100 |
-
try
|
101 |
-
{
|
102 |
-
$json = file_get_contents( $uri );
|
103 |
-
return json_decode($json,true);
|
104 |
-
}
|
105 |
-
catch( Exception $e )
|
106 |
-
{
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
/**
|
112 |
*
|
113 |
* Build the setting slug based on section.
|
@@ -194,8 +147,6 @@ class EPS_Plugin_Options {
|
|
194 |
|
195 |
}
|
196 |
|
197 |
-
|
198 |
-
|
199 |
/**
|
200 |
*
|
201 |
* Outputs the Sections intro HTML. A callback.
|
@@ -205,7 +156,7 @@ class EPS_Plugin_Options {
|
|
205 |
* @param $args
|
206 |
*
|
207 |
*/
|
208 |
-
function section_callback( $args ) {
|
209 |
if( isset( $_GET['tab'] ) )
|
210 |
{
|
211 |
$tab = $_GET['tab'];
|
@@ -215,6 +166,7 @@ class EPS_Plugin_Options {
|
|
215 |
$sections = array_keys( $this->settings );
|
216 |
$tab = $sections[0];
|
217 |
}
|
|
|
218 |
echo $this->settings[$tab]['description'];
|
219 |
}
|
220 |
|
@@ -319,7 +271,7 @@ class EPS_Plugin_Options {
|
|
319 |
if ( $this->tab_exists( $tab ) ) {
|
320 |
|
321 |
|
322 |
-
if(
|
323 |
{
|
324 |
do_action( $tab.'_admin_tab', $this->settings[$tab] );
|
325 |
}
|
51 |
*
|
52 |
*/
|
53 |
private function build_settings() {
|
54 |
+
$this->settings = $this->parse_json_from_url( $this->plugin->config('path') . 'options.json' );
|
55 |
}
|
56 |
|
57 |
+
private function parse_json_from_url( $uri )
|
58 |
{
|
59 |
+
$json = file_get_contents( $uri );
|
60 |
+
$data = json_decode($json,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
return $data;
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
/**
|
65 |
*
|
66 |
* Build the setting slug based on section.
|
147 |
|
148 |
}
|
149 |
|
|
|
|
|
150 |
/**
|
151 |
*
|
152 |
* Outputs the Sections intro HTML. A callback.
|
156 |
* @param $args
|
157 |
*
|
158 |
*/
|
159 |
+
function section_callback( $args ) {
|
160 |
if( isset( $_GET['tab'] ) )
|
161 |
{
|
162 |
$tab = $_GET['tab'];
|
166 |
$sections = array_keys( $this->settings );
|
167 |
$tab = $sections[0];
|
168 |
}
|
169 |
+
|
170 |
echo $this->settings[$tab]['description'];
|
171 |
}
|
172 |
|
271 |
if ( $this->tab_exists( $tab ) ) {
|
272 |
|
273 |
|
274 |
+
if(has_action( $tab.'_admin_tab'))
|
275 |
{
|
276 |
do_action( $tab.'_admin_tab', $this->settings[$tab] );
|
277 |
}
|
libs/eps-plugin.php
CHANGED
@@ -8,6 +8,8 @@
|
|
8 |
* @package EPS Boilerplate
|
9 |
*/
|
10 |
|
|
|
|
|
11 |
if( ! class_exists('EPS_Plugin') )
|
12 |
{
|
13 |
class EPS_Plugin {
|
@@ -50,12 +52,10 @@ if( ! class_exists('EPS_Plugin') )
|
|
50 |
public function __construct(){
|
51 |
$this->config['url'] = plugins_url() . $this->config['directory'] . '/';
|
52 |
$this->config['path'] = ABSPATH . 'wp-content/plugins/' . $this->config['directory'] . '/';
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
register_activation_hook( __FILE__, array($this, '_activation'));
|
58 |
-
register_deactivation_hook( __FILE__, array($this, '_deactivation'));
|
59 |
if ( !self::is_current_version() ) self::update_self();
|
60 |
add_action('init', array($this, 'plugin_resources'));
|
61 |
}
|
@@ -103,23 +103,23 @@ if( ! class_exists('EPS_Plugin') )
|
|
103 |
file_put_contents($this->config('path'). '/error_activation.html', ob_get_contents());
|
104 |
}
|
105 |
|
106 |
-
public
|
107 |
if ( !self::is_current_version() ) self::update_self();
|
108 |
}
|
109 |
|
110 |
public function _deactivation() {}
|
111 |
|
112 |
-
public
|
113 |
{
|
114 |
-
return version_compare(
|
115 |
}
|
116 |
-
public
|
117 |
{
|
118 |
-
return get_option( '
|
119 |
}
|
120 |
-
public
|
121 |
{
|
122 |
-
update_option( '
|
123 |
}
|
124 |
/**
|
125 |
*
|
8 |
* @package EPS Boilerplate
|
9 |
*/
|
10 |
|
11 |
+
require_once('eps-plugin-options.php');
|
12 |
+
|
13 |
if( ! class_exists('EPS_Plugin') )
|
14 |
{
|
15 |
class EPS_Plugin {
|
52 |
public function __construct(){
|
53 |
$this->config['url'] = plugins_url() . $this->config['directory'] . '/';
|
54 |
$this->config['path'] = ABSPATH . 'wp-content/plugins/' . $this->config['directory'] . '/';
|
55 |
+
$this->settings = new EPS_Plugin_Options( $this );
|
56 |
|
57 |
+
register_activation_hook( __FILE__, array($this->name, '_activation'));
|
58 |
+
register_deactivation_hook( __FILE__, array($this->name, '_deactivation'));
|
|
|
|
|
|
|
59 |
if ( !self::is_current_version() ) self::update_self();
|
60 |
add_action('init', array($this, 'plugin_resources'));
|
61 |
}
|
103 |
file_put_contents($this->config('path'). '/error_activation.html', ob_get_contents());
|
104 |
}
|
105 |
|
106 |
+
public function _activation() {
|
107 |
if ( !self::is_current_version() ) self::update_self();
|
108 |
}
|
109 |
|
110 |
public function _deactivation() {}
|
111 |
|
112 |
+
public function is_current_version()
|
113 |
{
|
114 |
+
return version_compare( $this->current_version(), $this->config['version'], '=') ? true : false;
|
115 |
}
|
116 |
+
public function current_version()
|
117 |
{
|
118 |
+
return get_option( $this->config['option_slug'] . '_version' );
|
119 |
}
|
120 |
+
public function set_current_version( $version )
|
121 |
{
|
122 |
+
update_option( $this->config['option_slug'] . '_version', $version );
|
123 |
}
|
124 |
/**
|
125 |
*
|
plugin.php
CHANGED
@@ -33,24 +33,16 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
33 |
// Template Hooks
|
34 |
add_action( 'redirects_admin_tab', array($this, 'admin_tab_redirects'), 10, 1 );
|
35 |
add_action( '404s_admin_tab', array($this, 'admin_tab_404s'), 10, 1 );
|
36 |
-
add_action( 'error_admin_tab', array($this, 'admin_tab_error'), 10, 1 );
|
37 |
add_action( 'import-export_admin_tab', array($this, 'admin_tab_import_export'), 10, 1 );
|
38 |
add_action( 'eps_redirects_panels_left', array($this, 'admin_panel_cache'));
|
39 |
add_action( 'eps_redirects_panels_right', array($this, 'admin_panel_donate'));
|
40 |
-
add_action(
|
41 |
|
42 |
// Actions
|
43 |
-
add_action(
|
44 |
-
|
45 |
-
|
46 |
|
47 |
}
|
48 |
|
49 |
-
public static function _activation()
|
50 |
-
{
|
51 |
-
self::_create_redirect_table(); // Maybe create the tables
|
52 |
-
if ( !self::is_current_version() ) self::update_self();
|
53 |
-
}
|
54 |
/**
|
55 |
*
|
56 |
* update_self
|
@@ -63,7 +55,9 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
63 |
*/
|
64 |
public function update_self()
|
65 |
{
|
|
|
66 |
$version = get_option( 'eps_redirects_version' );
|
|
|
67 |
|
68 |
if( version_compare($version, '2.0.0', '<')) {
|
69 |
// migrate old format to new format.
|
@@ -100,7 +94,7 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
100 |
);
|
101 |
}
|
102 |
|
103 |
-
|
104 |
}
|
105 |
|
106 |
/**
|
@@ -113,7 +107,7 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
113 |
* @author epstudios
|
114 |
*
|
115 |
*/
|
116 |
-
public
|
117 |
{
|
118 |
global $wpdb;
|
119 |
|
@@ -191,7 +185,7 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
191 |
|
192 |
// Save Redirects
|
193 |
if ( isset( $_POST['eps_redirect_submit'] ) && wp_verify_nonce( $_POST['eps_redirect_nonce_submit'], 'eps_redirect_nonce') ) {
|
194 |
-
self::_save_redirects(
|
195 |
}
|
196 |
}
|
197 |
}
|
@@ -207,7 +201,7 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
207 |
*/
|
208 |
public static function export_csv()
|
209 |
{
|
210 |
-
$entries =
|
211 |
$filename = sprintf("%s-redirects.csv",
|
212 |
date('Y-m-d')
|
213 |
);
|
@@ -316,19 +310,19 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
316 |
switch( strtolower( $_POST['eps_redirect_upload_method'] ) )
|
317 |
{
|
318 |
case 'skip':
|
319 |
-
if( !
|
320 |
{
|
321 |
$save_redirects[] = $redirect;
|
322 |
}
|
323 |
break;
|
324 |
case 'update':
|
325 |
-
if( $entry =
|
326 |
{
|
327 |
$redirect['id'] = $entry->id;
|
328 |
}
|
329 |
$save_redirects[] = $redirect;
|
330 |
break;
|
331 |
-
|
332 |
$save_redirects[] = $redirect;
|
333 |
break;
|
334 |
}
|
@@ -336,7 +330,7 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
336 |
|
337 |
if( ! empty( $save_redirects ) )
|
338 |
{
|
339 |
-
|
340 |
add_action( 'admin_notices', array($this, 'admin_notice_upload_success') );
|
341 |
}
|
342 |
else
|
@@ -382,10 +376,6 @@ class EPS_Redirects_Plugin extends EPS_Plugin {
|
|
382 |
{
|
383 |
include ( EPS_REDIRECT_PATH . 'templates/admin-tab-import-export.php' );
|
384 |
}
|
385 |
-
public static function admin_tab_error( $options )
|
386 |
-
{
|
387 |
-
include ( EPS_REDIRECT_PATH . 'templates/admin-tab-error.php' );
|
388 |
-
}
|
389 |
|
390 |
public static function admin_header_notices()
|
391 |
{
|
33 |
// Template Hooks
|
34 |
add_action( 'redirects_admin_tab', array($this, 'admin_tab_redirects'), 10, 1 );
|
35 |
add_action( '404s_admin_tab', array($this, 'admin_tab_404s'), 10, 1 );
|
|
|
36 |
add_action( 'import-export_admin_tab', array($this, 'admin_tab_import_export'), 10, 1 );
|
37 |
add_action( 'eps_redirects_panels_left', array($this, 'admin_panel_cache'));
|
38 |
add_action( 'eps_redirects_panels_right', array($this, 'admin_panel_donate'));
|
39 |
+
add_action('eps_redirects_admin_head', array($this, 'admin_header_notices'));
|
40 |
|
41 |
// Actions
|
42 |
+
add_action('admin_init', array($this, 'check_plugin_actions'));
|
|
|
|
|
43 |
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
*
|
48 |
* update_self
|
55 |
*/
|
56 |
public function update_self()
|
57 |
{
|
58 |
+
|
59 |
$version = get_option( 'eps_redirects_version' );
|
60 |
+
$this->_create_tables(); // Maybe create the tables
|
61 |
|
62 |
if( version_compare($version, '2.0.0', '<')) {
|
63 |
// migrate old format to new format.
|
94 |
);
|
95 |
}
|
96 |
|
97 |
+
EPS_Redirects_Pro::_save_redirects( $new_redirects );
|
98 |
}
|
99 |
|
100 |
/**
|
107 |
* @author epstudios
|
108 |
*
|
109 |
*/
|
110 |
+
public function _create_tables()
|
111 |
{
|
112 |
global $wpdb;
|
113 |
|
185 |
|
186 |
// Save Redirects
|
187 |
if ( isset( $_POST['eps_redirect_submit'] ) && wp_verify_nonce( $_POST['eps_redirect_nonce_submit'], 'eps_redirect_nonce') ) {
|
188 |
+
self::_save_redirects( EPS_Redirects_Pro::_parse_serial_array($_POST['redirect']) );
|
189 |
}
|
190 |
}
|
191 |
}
|
201 |
*/
|
202 |
public static function export_csv()
|
203 |
{
|
204 |
+
$entries = EPS_Redirects_Pro::get_all();
|
205 |
$filename = sprintf("%s-redirects.csv",
|
206 |
date('Y-m-d')
|
207 |
);
|
310 |
switch( strtolower( $_POST['eps_redirect_upload_method'] ) )
|
311 |
{
|
312 |
case 'skip':
|
313 |
+
if( ! EPS_Redirects_Pro::redirect_exists( $redirect ) )
|
314 |
{
|
315 |
$save_redirects[] = $redirect;
|
316 |
}
|
317 |
break;
|
318 |
case 'update':
|
319 |
+
if( $entry = EPS_Redirects_Pro::redirect_exists( $redirect ) )
|
320 |
{
|
321 |
$redirect['id'] = $entry->id;
|
322 |
}
|
323 |
$save_redirects[] = $redirect;
|
324 |
break;
|
325 |
+
case 'ignore':
|
326 |
$save_redirects[] = $redirect;
|
327 |
break;
|
328 |
}
|
330 |
|
331 |
if( ! empty( $save_redirects ) )
|
332 |
{
|
333 |
+
EPS_Redirects_Pro::_save_redirects( $save_redirects );
|
334 |
add_action( 'admin_notices', array($this, 'admin_notice_upload_success') );
|
335 |
}
|
336 |
else
|
376 |
{
|
377 |
include ( EPS_REDIRECT_PATH . 'templates/admin-tab-import-export.php' );
|
378 |
}
|
|
|
|
|
|
|
|
|
379 |
|
380 |
public static function admin_header_notices()
|
381 |
{
|
readme.txt
CHANGED
@@ -10,7 +10,7 @@ Requires at least: 3.0.1
|
|
10 |
|
11 |
Tested up to: 4.2.1
|
12 |
|
13 |
-
Stable tag: 2.2.
|
14 |
|
15 |
License: GPLv2 or later
|
16 |
|
@@ -116,12 +116,6 @@ By default, any URL with a query string is considered unique, and will redirect
|
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
-
= 2.2.4 =
|
120 |
-
Support for older versions of PHP.
|
121 |
-
|
122 |
-
= 2.2.3 =
|
123 |
-
Fixed an issue where the redirect database tables were not being created, causing 'Invalid Destination URL' errors.
|
124 |
-
|
125 |
= 2.2.0 =
|
126 |
Minor bug fixes. Greatly improved import feature. Redirects include query strings. Export feature added. Http/Https agnostic. Pro version added with 404 management.
|
127 |
|
@@ -170,9 +164,6 @@ Overhauled the entire plugin. Redirects are stored in their own table. Gracefull
|
|
170 |
|
171 |
== Upgrade Notice ==
|
172 |
|
173 |
-
= 2.2.4 =
|
174 |
-
Support for older versions of PHP.
|
175 |
-
|
176 |
= 2.2.0 =
|
177 |
Minor bug fixes. Greatly improved import feature, added Export feature plus many other updates. A Pro Version is now available with 404 Management!
|
178 |
|
10 |
|
11 |
Tested up to: 4.2.1
|
12 |
|
13 |
+
Stable tag: 2.2.5
|
14 |
|
15 |
License: GPLv2 or later
|
16 |
|
116 |
|
117 |
== Changelog ==
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
= 2.2.0 =
|
120 |
Minor bug fixes. Greatly improved import feature. Redirects include query strings. Export feature added. Http/Https agnostic. Pro version added with 404 management.
|
121 |
|
164 |
|
165 |
== Upgrade Notice ==
|
166 |
|
|
|
|
|
|
|
167 |
= 2.2.0 =
|
168 |
Minor bug fixes. Greatly improved import feature, added Export feature plus many other updates. A Pro Version is now available with 404 Management!
|
169 |
|
templates/admin-tab-404s.php
CHANGED
@@ -13,28 +13,16 @@
|
|
13 |
<div class="wrap">
|
14 |
<?php do_action('eps_redirects_admin_head'); ?>
|
15 |
|
16 |
-
<
|
17 |
-
<
|
18 |
-
<
|
19 |
-
<
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
<div class="eps-redirects-50 group">
|
29 |
-
<div class="padding-lots">
|
30 |
-
<a href="http://www.eggplantstudios.ca/cart/?add_to_cart=2974" target="_blank">
|
31 |
-
<img class="eps-redirects-fit" src="<?php echo EPS_REDIRECT_URL; ?>/images/icon-eps-redirects.jpg" title="Upgrade EPS 301 Redirects">
|
32 |
-
</a>
|
33 |
-
<a class="eps-redirects-big-button" href="http://www.eggplantstudios.ca/cart/?add_to_cart=2974" target="_blank">BUY NOW • ONLY $15.00</a>
|
34 |
-
|
35 |
-
</div>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
|
39 |
|
40 |
<div class="right">
|
@@ -44,7 +32,7 @@
|
|
44 |
<?php do_action('eps_redirects_panels_left'); ?>
|
45 |
</div>
|
46 |
</div>
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
13 |
<div class="wrap">
|
14 |
<?php do_action('eps_redirects_admin_head'); ?>
|
15 |
|
16 |
+
<table id="eps-redirect-entries" class="eps-table eps-table-striped">
|
17 |
+
<tr>
|
18 |
+
<th colspan="2">Request URL</th>
|
19 |
+
<th class="redirect-hits">Hits</th>
|
20 |
+
<th class="redirect-actions">Actions</th>
|
21 |
+
</tr>
|
22 |
+
<?php
|
23 |
+
echo EPS_Redirects_Pro::list_404s();
|
24 |
+
?>
|
25 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
<div class="right">
|
32 |
<?php do_action('eps_redirects_panels_left'); ?>
|
33 |
</div>
|
34 |
</div>
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
templates/admin-tab-error.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* The Redirects Tab.
|
5 |
-
*
|
6 |
-
* The main admin area for the redirects tab.
|
7 |
-
*
|
8 |
-
* @package EPS 301 Redirects
|
9 |
-
* @author Shawn Wernig ( shawn@eggplantstudios.ca )
|
10 |
-
*/
|
11 |
-
?>
|
12 |
-
|
13 |
-
|
14 |
-
<div class="wrap">
|
15 |
-
<?php do_action('eps_redirects_admin_head'); ?>
|
16 |
-
|
17 |
-
<div class="eps-notice eps-warning">
|
18 |
-
<?php echo $options['description']; ?>
|
19 |
-
</div>
|
20 |
-
|
21 |
-
|
22 |
-
<div class="right">
|
23 |
-
<?php do_action('eps_redirects_panels_right'); ?>
|
24 |
-
</div>
|
25 |
-
<div class="left">
|
26 |
-
<?php do_action('eps_redirects_panels_left'); ?>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/admin-tab-import-export.php
CHANGED
@@ -23,6 +23,7 @@
|
|
23 |
<p>
|
24 |
<input type="radio" name="eps_redirect_upload_method" value="skip" checked="checked"> Skip Duplicates
|
25 |
<input type="radio" name="eps_redirect_upload_method" value="update"> Update Duplicates
|
|
|
26 |
</p>
|
27 |
|
28 |
<br><small class="eps-grey-text">Supply Columns: <strong>Status</strong> (301,302,inactive), <strong>Request URL</strong>, <strong>Redirect To</strong> (ID or URL). <a href="<?php echo EPS_REDIRECT_URL . 'example.csv'?>" target="_blank">Download Example CSV</a></small>
|
23 |
<p>
|
24 |
<input type="radio" name="eps_redirect_upload_method" value="skip" checked="checked"> Skip Duplicates
|
25 |
<input type="radio" name="eps_redirect_upload_method" value="update"> Update Duplicates
|
26 |
+
<input type="radio" name="eps_redirect_upload_method" value="ignore"> Ignore Duplicates
|
27 |
</p>
|
28 |
|
29 |
<br><small class="eps-grey-text">Supply Columns: <strong>Status</strong> (301,302,inactive), <strong>Request URL</strong>, <strong>Redirect To</strong> (ID or URL). <a href="<?php echo EPS_REDIRECT_URL . 'example.csv'?>" target="_blank">Download Example CSV</a></small>
|
templates/admin-tab-redirects.php
CHANGED
@@ -25,8 +25,8 @@
|
|
25 |
<tr id="eps-redirect-add" style="display:none"><td colspan="4"><a href="#" id="eps-redirect-new"><span>+</span></a></td></tr>
|
26 |
|
27 |
<?php
|
28 |
-
echo
|
29 |
-
echo
|
30 |
?>
|
31 |
</table>
|
32 |
|
25 |
<tr id="eps-redirect-add" style="display:none"><td colspan="4"><a href="#" id="eps-redirect-new"><span>+</span></a></td></tr>
|
26 |
|
27 |
<?php
|
28 |
+
echo EPS_Redirects_Pro::get_inline_edit_entry();
|
29 |
+
echo EPS_Redirects_Pro::list_redirects();
|
30 |
?>
|
31 |
</table>
|
32 |
|
templates/template.404-entry.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* The 404 List Entry Template.
|
5 |
+
*
|
6 |
+
*
|
7 |
+
* @package EPS 301 Redirects
|
8 |
+
* @author Shawn Wernig ( shawn@eggplantstudios.ca )
|
9 |
+
*/
|
10 |
+
|
11 |
+
global $EPS_Redirects_Plugin;
|
12 |
+
$query_args = array( 'page' => $EPS_Redirects_Plugin->config('page_slug'), 'delete_redirect' => esc_attr( $redirect->id ) );
|
13 |
+
|
14 |
+
?>
|
15 |
+
<tr class="redirect-entry <?php echo esc_attr( $redirect->status ); ?> id-<?php echo esc_attr( $redirect->id ); ?>" data-id="<?php echo esc_attr( $redirect->id ); ?>" data-status="<?php echo esc_attr( $redirect->status ); ?>">
|
16 |
+
<td colspan="2">
|
17 |
+
<a target="_blank" class="eps-url" href="<?php bloginfo('url'); ?>/<?php echo esc_attr($dfrom); ?>" title="<?php bloginfo('url'); ?>/<?php echo esc_attr($dfrom); ?>">
|
18 |
+
<span class="eps-url-root eps-url-startcap"><?php echo ($redirect->status == 'inactive' ) ? 'OFF': esc_attr($redirect->status); ?></span><span class="eps-url-root"><?php bloginfo('url'); ?>/</span><span class="eps-url-fragment eps-url-endcap"><?php echo esc_attr($dfrom); ?></span>
|
19 |
+
</a>
|
20 |
+
</td>
|
21 |
+
<td class="redirect-hits"><strong><?php echo esc_attr( $redirect->count ); ?></strong></td>
|
22 |
+
<td class="redirect-actions">
|
23 |
+
<a class="button eps-redirect-edit" href="#eps-redirect-edit" data-id="<?php echo esc_attr( $redirect->id ); ?>">Redirect</a>
|
24 |
+
<a class="button eps-redirect-remove" href="<?php echo add_query_arg( $query_args, admin_url( '/options-general.php' ) ); ?>" data-id="<?php echo esc_attr( $redirect->id ); ?>">×</a>
|
25 |
+
</td>
|
26 |
+
</tr>
|