Eggplant 301 Redirects - Version 1.3.4

Version Description

  • Fixed nonce validation problem which would prevent saving of new redirects. Special Thanks to Bruce Zlotowitz for all his testing!
Download this release

Release Info

Developer shawn@eggplantstudios.ca
Plugin Icon 128x128 Eggplant 301 Redirects
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

css/eps_redirect.css CHANGED
@@ -1,12 +1,3 @@
1
- /*
2
- *
3
- *
4
- *
5
- *
6
- *
7
- */
8
-
9
-
10
  /*----------------------------------------------------------*/
11
  /*------------------------ Headings ------------------------*/
12
  /*----------------------------------------------------------*/
@@ -24,12 +15,13 @@ h2.eps-title {
24
  }
25
 
26
 
27
- #eps-redirect-entries { margin-top: 32px; padding: 12px; border: 1px solid #d6d6d6; box-shadow: 1px 1px 6px #f4f4f4; min-width: 810px; }
28
  #eps-redirect-entries h3 { margin: 8px; font-size: 20px; font-weight: 100; border-bottom: 1px solid #eeeeee; padding-bottom: 12px; }
29
 
30
  tr.redirect-entry td, tr.redirect-entry th { padding: 6px 8px; }
31
  .eps-request-url { }
32
  .eps-redirect-url { width: 20em; }
 
33
  /*----------------------------------------------------------*/
34
  /*---------------------- notifications ---------------------*/
35
  /*----------------------------------------------------------*/
@@ -45,17 +37,18 @@ tr.redirect-entry td, tr.redirect-entry th { padding: 6px 8px; }
45
  zoom: 1;
46
  }
47
 
48
- tr.redirect-entry.valid .eps-notification-area {
49
  background: #cdf2d9; color: #195b2d; border: 1px solid #587b63;
50
  }
51
 
52
- tr.redirect-entry.invalid .eps-notification-area {
53
  background: #f2cdcd; color: #6a2222; border: 1px solid #935e5e;
54
  }
55
 
56
  /*----------------------------------------------------------*/
57
  /*-------------------------- Buttons -----------------------*/
58
  /*----------------------------------------------------------*/
 
59
  a.eps-text-link, a.eps-text-link:visited, a.eps-text-link:link {
60
  display: inline-block;
61
  zoom: 1;
@@ -93,6 +86,33 @@ a.eps-text-link.new {
93
  margin-top: 32px;
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
 
98
  /*----------------------------------------------------------*/
@@ -100,4 +120,5 @@ a.eps-text-link.new {
100
  /*----------------------------------------------------------*/
101
 
102
  hr.eps-divider { border: none; margin: 16px 0px; }
 
103
  .eps-grey-text { font-style: italic; color: #888888; }
 
 
 
 
 
 
 
 
 
1
  /*----------------------------------------------------------*/
2
  /*------------------------ Headings ------------------------*/
3
  /*----------------------------------------------------------*/
15
  }
16
 
17
 
18
+ /*#eps-redirect-entries { margin-top: 32px; padding: 12px; border: 1px solid #d6d6d6; box-shadow: 1px 1px 6px #f4f4f4; min-width: 810px; }*/
19
  #eps-redirect-entries h3 { margin: 8px; font-size: 20px; font-weight: 100; border-bottom: 1px solid #eeeeee; padding-bottom: 12px; }
20
 
21
  tr.redirect-entry td, tr.redirect-entry th { padding: 6px 8px; }
22
  .eps-request-url { }
23
  .eps-redirect-url { width: 20em; }
24
+
25
  /*----------------------------------------------------------*/
26
  /*---------------------- notifications ---------------------*/
27
  /*----------------------------------------------------------*/
37
  zoom: 1;
38
  }
39
 
40
+ .eps-notification-area.valid {
41
  background: #cdf2d9; color: #195b2d; border: 1px solid #587b63;
42
  }
43
 
44
+ .eps-notification-area.invalid {
45
  background: #f2cdcd; color: #6a2222; border: 1px solid #935e5e;
46
  }
47
 
48
  /*----------------------------------------------------------*/
49
  /*-------------------------- Buttons -----------------------*/
50
  /*----------------------------------------------------------*/
51
+
52
  a.eps-text-link, a.eps-text-link:visited, a.eps-text-link:link {
53
  display: inline-block;
54
  zoom: 1;
86
  margin-top: 32px;
87
  }
88
 
89
+ /*----------------------------------------------------------*/
90
+ /*--------------------------- tabs -------------------------*/
91
+ /*----------------------------------------------------------*/
92
+ #eps-tabs { padding: 12px 32px; border: 1px solid #d6d6d6; box-shadow: 1px 1px 6px #f4f4f4; }
93
+
94
+ #eps-tab-nav { margin-top: 32px; }
95
+ #eps-tab-nav a, #eps-tab-nav a:link, #eps-tab-nav a:visited {
96
+ display: inline-block;
97
+ border: 1px solid #d6d6d6;
98
+ padding: 16px 32px;
99
+ background: #fafafa;
100
+ text-decoration: none;
101
+ font-size: 16px; font-weight: bold;
102
+ position: relative; bottom: 0px;
103
+ -webkit-transition: all 100ms;
104
+ }
105
+
106
+ #eps-tab-nav a.active, #eps-tab-nav a:hover{
107
+ background: white;
108
+ position: relative;
109
+ bottom: -1px;
110
+ padding: 20px 32px;
111
+ background: white;
112
+ border-bottom: none;
113
+ }
114
+ #eps-tabs .eps-tab { display: none; }
115
+ #eps-tabs .eps-tab:first-child { display: block; }
116
 
117
 
118
  /*----------------------------------------------------------*/
120
  /*----------------------------------------------------------*/
121
 
122
  hr.eps-divider { border: none; margin: 16px 0px; }
123
+ .padding { padding: 12px; }
124
  .eps-grey-text { font-style: italic; color: #888888; }
eps-301-redirects.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @package EPS 301 Redirects
17
  * @author Shawn Wernig ( shawn@eggplantstudios.ca )
18
- * @version 1.3.4
19
  */
20
 
21
 
@@ -23,7 +23,7 @@
23
  Plugin Name: Eggplant 301 Redirects
24
  Plugin URI: http://www.eggplantstudios.ca
25
  Description: Create your own 301 redirects using this powerful plugin.
26
- Version: 1.3.4
27
  Author: Shawn Wernig http://www.eggplantstudios.ca
28
  License: GPLv2 or later
29
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -31,7 +31,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
 
32
  define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
33
  define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
34
- define ( 'EPS_REDIRECT_VERSION', '1.3.4');
35
 
36
  register_activation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_activation'));
37
  register_deactivation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_deactivation'));
@@ -60,7 +60,7 @@ class EPS_Redirects {
60
 
61
  public static function eps_redirect_activation() {}
62
  public static function eps_redirect_deactivation() {
63
- update_option( self::$option_slug, null );
64
  update_option( 'eps_redirects_version', null );
65
  }
66
 
@@ -147,9 +147,11 @@ class EPS_Redirects {
147
 
148
  // Get current url
149
  $url_request = self::get_url();
150
-
151
- foreach ($redirects as $from => $to ) {
152
 
 
 
 
 
153
  if( rtrim($url_request,'/') == self::format_from_url($from) ) {
154
  // Match, this needs to be redirected
155
  header ('HTTP/1.1 301 Moved Permanently');
@@ -158,7 +160,14 @@ class EPS_Redirects {
158
  }
159
  }
160
  }
161
-
 
 
 
 
 
 
 
162
  private function format_from_url( $string ) {
163
  $from = get_option('home') . '/' . $string;
164
  return rtrim($from,'/');
@@ -174,7 +183,7 @@ class EPS_Redirects {
174
  *
175
  */
176
  function get_url() {
177
- $protocol = ( $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';
178
  return urldecode( $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
179
  }
180
 
@@ -189,37 +198,7 @@ class EPS_Redirects {
189
  *
190
  */
191
  public function do_admin_page(){
192
- ?>
193
- <div class="wrap">
194
- <header id="eps-header">
195
- <div id="icon-eggplant">&nbsp;</div>
196
- <h2 class="eps-title"><?php echo self::$page_title; ?></h2>
197
- </header>
198
-
199
- <form method="post" action="">
200
- <table id="eps-redirect-entries">
201
- <tr>
202
- <td>
203
- <h3>Request URL</h3>
204
- </td>
205
- <td>
206
- <h3>Redirect to URL</h3>
207
- </td>
208
- </tr>
209
- <?php
210
- echo self::do_inputs();
211
- echo self::get_blank_entry();
212
- ?>
213
- <tr><td colspan="2"><a class="eps-text-link new" href="#" id="eps-redirect-add">+ Add Empty</a></td></tr>
214
- </table>
215
- <hr class="eps-divider">
216
- <p class="submit">
217
- <?php wp_nonce_field('eps_redirect_nonce', 'eps_redirect_nonce_submit'); ?>
218
- <input type="submit" name="eps_redirect_submit" id="submit" class="button button-primary" value="Save Changes"/>
219
- </p>
220
- </form>
221
- </div>
222
- <?php
223
  }
224
 
225
  /**
@@ -234,20 +213,29 @@ class EPS_Redirects {
234
  */
235
  public function _save(){
236
 
237
- // Check submitted values, and nonce.
238
- if ( !isset( $_POST['eps_redirect_submit'] )
239
- || !isset( $_POST[self::$option_slug] )
240
- || !wp_verify_nonce( $_POST['eps_redirect_nonce_submit'], 'eps_redirect_nonce') ) return false;
241
-
 
 
 
 
 
 
242
  $total_redirects = count( $_POST[self::$option_slug]['to'] );
243
  $redirects = array();
244
 
245
  for($i = 0; $i < $total_redirects; $i ++) {
246
- $to = trim( $_POST[self::$option_slug]['to'][$i] );
247
- $from = trim( $_POST[self::$option_slug]['from'][$i] );
248
-
249
  $to = filter_var( $to, FILTER_SANITIZE_URL);
 
 
 
250
  $from = filter_var( $from, FILTER_SANITIZE_URL);
 
251
 
252
  if( empty($to) ) $to = home_url() . '/'; // default
253
 
@@ -256,7 +244,6 @@ class EPS_Redirects {
256
  }
257
  // If we then have a valid array - save
258
  update_option( self::$option_slug, $redirects );
259
-
260
  }
261
 
262
  /**
@@ -271,27 +258,35 @@ class EPS_Redirects {
271
  */
272
  public function do_inputs(){
273
  $redirects = get_option( self::$option_slug );
 
274
  if (empty($redirects)) return false;
275
 
276
  foreach ($redirects as $from => $to ) {
277
- $response_code = self::get_response( self::format_from_url( $from ) );
278
- $class = ( $response_code == 301 ) ? 'valid' : 'invalid';
279
-
280
- $html .= '
281
- <tr class="redirect-entry '.$class.'">
282
- <td><span class="eps-grey-text">'.get_bloginfo('home').'/&nbsp;</span><input class="eps-request-url" type="text" name="'.self::$option_slug.'[from][]" value="'. $from .'" > &rarr;</td>
283
 
 
 
 
284
  <td>
285
- <input type="text" class="eps-redirect-url" name="'.self::$option_slug.'[to][]" value="'.esc_url( $to ).'" >
286
- <span class="eps-text-link eps-notification-area">'.eps_prettify($response_code).'</span>
287
- <a class="eps-text-link" href="'.$to.'" target="_blank">View</a>
 
 
288
  <a class="eps-text-link remove" href="#" class="eps-redirect-remove">&times;</a>
289
  </td>
290
  </tr>';
291
  }
292
  return $html;
293
  }
 
294
 
 
 
 
295
  /**
296
  *
297
  * GET_BLANK_ENTRY
@@ -337,7 +332,7 @@ class EPS_Redirects {
337
  $html .= '</select>';
338
 
339
  // The default input, javascript will populate this input with the final URL for submission.
340
- $html .= '<input class="eps-redirect-url" type="text" name="'.self::$option_slug.'[to][]" value="" placeholder="http://www.yoursite.com"/>';
341
 
342
  // Get all the post type select boxes.
343
  foreach ($post_types as $post_type )
@@ -525,27 +520,49 @@ class EPS_Redirects {
525
  }
526
 
527
 
528
-
529
- public static function test_redirect( $url ) {
530
- return ( self::get_response($url) == 301 ) ? true : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  }
532
-
 
 
 
 
 
533
  private static function get_response( $url ) {
534
  // returns int responsecode, or false (if url does not exist or connection timeout occurs)
535
  // NOTE: could potentially take up to 0-30 seconds , blocking further code execution (more or less depending on connection, target site, and local timeout settings))
536
-
537
  if( !$url || !is_string($url)) return false;
538
 
539
  $ch = @curl_init($url);
540
 
541
  if($ch === false) return false;
542
-
543
-
544
  @curl_setopt($ch, CURLOPT_HEADER ,true); // we want headers
545
  @curl_setopt($ch, CURLOPT_NOBODY ,true); // dont need body
546
  @curl_setopt($ch, CURLOPT_RETURNTRANSFER ,true); // catch output (do NOT print!)
547
  @curl_exec($ch);
548
-
549
  if( @curl_errno($ch) ) { // should be 0
550
  @curl_close($ch);
551
  return false;
@@ -574,6 +591,32 @@ function eps_prettify( $string ) {
574
 
575
 
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  // Run the plugin.
578
  $EPS_Redirects = new EPS_Redirects();
579
  ?>
15
  *
16
  * @package EPS 301 Redirects
17
  * @author Shawn Wernig ( shawn@eggplantstudios.ca )
18
+ * @version 1.4.0
19
  */
20
 
21
 
23
  Plugin Name: Eggplant 301 Redirects
24
  Plugin URI: http://www.eggplantstudios.ca
25
  Description: Create your own 301 redirects using this powerful plugin.
26
+ Version: 1.4.0
27
  Author: Shawn Wernig http://www.eggplantstudios.ca
28
  License: GPLv2 or later
29
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
 
32
  define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
33
  define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
34
+ define ( 'EPS_REDIRECT_VERSION', '1.4.0');
35
 
36
  register_activation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_activation'));
37
  register_deactivation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_deactivation'));
60
 
61
  public static function eps_redirect_activation() {}
62
  public static function eps_redirect_deactivation() {
63
+ //update_option( self::$option_slug, null );
64
  update_option( 'eps_redirects_version', null );
65
  }
66
 
147
 
148
  // Get current url
149
  $url_request = self::get_url();
 
 
150
 
151
+ foreach ($redirects as $from => $to ) {
152
+ $from = urldecode($from);
153
+ $to = urldecode($to);
154
+
155
  if( rtrim($url_request,'/') == self::format_from_url($from) ) {
156
  // Match, this needs to be redirected
157
  header ('HTTP/1.1 301 Moved Permanently');
160
  }
161
  }
162
  }
163
+ private function rawurlencode_parts( $uri ) {
164
+ $parts = explode('/', $uri);
165
+ for ($i = 0; $i < count($parts); $i++) {
166
+ $parts[$i] = rawurlencode($parts[$i]);
167
+ }
168
+ return implode('/', $parts);
169
+ }
170
+
171
  private function format_from_url( $string ) {
172
  $from = get_option('home') . '/' . $string;
173
  return rtrim($from,'/');
183
  *
184
  */
185
  function get_url() {
186
+ $protocol = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';
187
  return urldecode( $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
188
  }
189
 
198
  *
199
  */
200
  public function do_admin_page(){
201
+ include ( EPS_REDIRECT_PATH . 'templates/admin.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
 
204
  /**
213
  */
214
  public function _save(){
215
 
216
+ if ( isset( $_POST['eps_redirect_submit'] ) && wp_verify_nonce( $_POST['eps_redirect_nonce_submit'], 'eps_redirect_nonce') )
217
+ $this->_save_redirects();
218
+
219
+ if ( isset( $_POST['eps_redirect_settings_submit'] ) && wp_verify_nonce( $_POST['eps_redirect_setting_nonce_submit'], 'eps_redirect_setting_nonce') )
220
+ $this->_save_settings();
221
+ }
222
+
223
+ private function _save_settings() {
224
+ update_option( 'eps_redirect_settings', $_POST['eps_redirect_settings'] );
225
+ }
226
+ private function _save_redirects() {
227
  $total_redirects = count( $_POST[self::$option_slug]['to'] );
228
  $redirects = array();
229
 
230
  for($i = 0; $i < $total_redirects; $i ++) {
231
+ $to = trim( $_POST[self::$option_slug]['to'][$i] );
232
+ $to = self::rawurlencode_parts( $to );
 
233
  $to = filter_var( $to, FILTER_SANITIZE_URL);
234
+
235
+ $from = trim( $_POST[self::$option_slug]['from'][$i] );
236
+ $from = self::rawurlencode_parts( $from );
237
  $from = filter_var( $from, FILTER_SANITIZE_URL);
238
+ $from = ltrim($from, '/');
239
 
240
  if( empty($to) ) $to = home_url() . '/'; // default
241
 
244
  }
245
  // If we then have a valid array - save
246
  update_option( self::$option_slug, $redirects );
 
247
  }
248
 
249
  /**
258
  */
259
  public function do_inputs(){
260
  $redirects = get_option( self::$option_slug );
261
+
262
  if (empty($redirects)) return false;
263
 
264
  foreach ($redirects as $from => $to ) {
265
+ $dfrom = urldecode($from);
266
+ $dto = urldecode($to);
267
+
268
+
 
 
269
 
270
+ $html .= '
271
+ <tr class="redirect-entry">
272
+ <td><span class="eps-grey-text">'.get_bloginfo('home').'/&nbsp;</span><input class="eps-request-url" type="text" name="'.self::$option_slug.'[from][]" value="'. $dfrom .'" > &rarr;</td>
273
  <td>
274
+ <input type="text" class="eps-redirect-url" name="'.self::$option_slug.'[to][]" value="'.$dto.'" >';
275
+
276
+ $html .= $this->get_testing_results($from, $dto);
277
+
278
+ $html .='<a class="eps-text-link" href="'.self::format_from_url( $from ).'" target="_blank">Test</a>
279
  <a class="eps-text-link remove" href="#" class="eps-redirect-remove">&times;</a>
280
  </td>
281
  </tr>';
282
  }
283
  return $html;
284
  }
285
+
286
 
287
+ private static function url_esc_spaces( $url ) {
288
+ return str_replace(' ', '%20', $url);
289
+ }
290
  /**
291
  *
292
  * GET_BLANK_ENTRY
332
  $html .= '</select>';
333
 
334
  // The default input, javascript will populate this input with the final URL for submission.
335
+ $html .= '<input class="eps-redirect-url" type="text" name="'.self::$option_slug.'[to][]" value="" placeholder="'.get_bloginfo('home').'"/>';
336
 
337
  // Get all the post type select boxes.
338
  foreach ($post_types as $post_type )
520
  }
521
 
522
 
523
+ /**
524
+ *
525
+ *
526
+ *
527
+ * Get the testing results for this redirect.
528
+ *
529
+ */
530
+ private function get_testing_results($from, $to) {
531
+ $settings = get_option( 'eps_redirect_settings' );
532
+ $test_urls = $settings['test_urls'];
533
+ if( isset($test_urls) && $test_urls == 'on' ) {
534
+
535
+ $redirect_response_code = self::get_response( self::format_from_url( $from ) );
536
+ $redirect_class = ( $redirect_response_code == 301 ) ? 'valid' : 'invalid';
537
+
538
+ $destination_response_code = self::get_response( self::url_esc_spaces( $to ) );
539
+ $destination_class = ( $destination_response_code == 200 ) ? 'valid' : 'invalid';
540
+
541
+ return '<span class="eps-text-link eps-notification-area '.$redirect_class.'">'.eps_prettify($redirect_response_code).'</span> &rarr;
542
+ <span class="eps-text-link eps-notification-area '.$destination_class.'">'.eps_prettify($destination_response_code).'</span>';
543
+ }
544
  }
545
+ /**
546
+ *
547
+ *
548
+ * Gets the status code for this url.
549
+ *
550
+ */
551
  private static function get_response( $url ) {
552
  // returns int responsecode, or false (if url does not exist or connection timeout occurs)
553
  // NOTE: could potentially take up to 0-30 seconds , blocking further code execution (more or less depending on connection, target site, and local timeout settings))
554
+
555
  if( !$url || !is_string($url)) return false;
556
 
557
  $ch = @curl_init($url);
558
 
559
  if($ch === false) return false;
560
+
 
561
  @curl_setopt($ch, CURLOPT_HEADER ,true); // we want headers
562
  @curl_setopt($ch, CURLOPT_NOBODY ,true); // dont need body
563
  @curl_setopt($ch, CURLOPT_RETURNTRANSFER ,true); // catch output (do NOT print!)
564
  @curl_exec($ch);
565
+
566
  if( @curl_errno($ch) ) { // should be 0
567
  @curl_close($ch);
568
  return false;
591
 
592
 
593
 
594
+ // Run the plugin.
595
+ $EPS_Redirects = new EPS_Redirects();
596
+ ?>_HTTP_CODE);
597
+ @curl_close($ch);
598
+ return $code;
599
+ }
600
+
601
+ }
602
+ }
603
+
604
+
605
+
606
+ /**
607
+ * Outputs an object or array in a readable form.
608
+ *
609
+ * @return void
610
+ * @param $string = the object to prettify; Typically a string.
611
+ * @author epstudios
612
+ */
613
+ function eps_prettify( $string ) {
614
+ return ucwords( str_replace("_"," ",$string) );
615
+ }
616
+
617
+
618
+
619
+
620
  // Run the plugin.
621
  $EPS_Redirects = new EPS_Redirects();
622
  ?>
js/scripts.js CHANGED
@@ -35,6 +35,45 @@ jQuery(document).ready(function ($) {
35
  $(this).closest('tr.redirect-entry').remove();
36
  });
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  });
39
 
40
 
35
  $(this).closest('tr.redirect-entry').remove();
36
  });
37
 
38
+
39
+
40
+ /**
41
+ *
42
+ *
43
+ * Tabs
44
+ */
45
+ $('#eps-tab-nav .eps-tab-nav-item').click(function(e){
46
+ //e.preventDefault();
47
+ var target = $(this).attr('href');
48
+
49
+
50
+ $('#eps-tabs .eps-tab').hide();
51
+
52
+ $(target + '-pane').show().height( 'auto' );
53
+
54
+ $('#eps-tab-nav .eps-tab-nav-item').removeClass('active');
55
+ $(this).addClass('active');
56
+ //return false;
57
+ });
58
+
59
+
60
+
61
+ /**
62
+ *
63
+ *
64
+ * Open up the tab as per the current location
65
+ */
66
+ var hash = window.location.hash;
67
+
68
+ if( hash ) {
69
+ $('#eps-tabs .eps-tab').hide();
70
+ $(hash+'-pane').show();
71
+ $('#eps-tab-nav .eps-tab-nav-item').removeClass('active');
72
+ $('#eps-tab-nav .eps-tab-nav-item').eq( $(hash +'-pane').index() ).addClass('active');
73
+ } else {
74
+ $('#eps-tab-nav .eps-tab-nav-item').show();
75
+ }
76
+
77
  });
78
 
79
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: none
4
  Tags: 301 redirects, redirects
5
  Requires at least: 3.0.1
6
  Tested up to: 3.5
7
- Stable tag: 1.3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -52,12 +52,12 @@ Created by Shawn Wernig [Eggplant Studios](http://www.eggplantstudios.ca/ "Eggpl
52
 
53
  = My redirects aren't working =
54
 
55
- This could be caused by many things, but please ensure that you are supplying valid URLs. If you're sure everything should be working, check the status code for the failing redirect, is it the validated Green 301?
56
 
57
 
58
  = My redirects aren't getting the 301 status code =
59
 
60
- Your Request or Redirect URLS may be incorrect; please ensure that you are supplying valid URLs. Check slashes. Try Viewing the page by clicking the View button - does it load correctly?
61
 
62
 
63
  = How do I delete a redirect? =
@@ -72,9 +72,17 @@ Click the small X beside the redirect you wish to remove. Save changes.
72
 
73
  1. The administrative area, Wordpress 3.5.1
74
  2. Examples of some of the dropdown options.
 
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
 
78
  = 1.3.4 =
79
  * Fixed nonce validation problem which would prevent saving of new redirects. Special Thanks to Bruce Zlotowitz for all his testing!
80
 
@@ -100,6 +108,12 @@ Click the small X beside the redirect you wish to remove. Save changes.
100
 
101
  == Upgrade Notice ==
102
 
 
 
 
 
 
 
103
  = 1.3.4 =
104
  Fixed a bug when saving new redirects.
105
 
4
  Tags: 301 redirects, redirects
5
  Requires at least: 3.0.1
6
  Tested up to: 3.5
7
+ Stable tag: 1.4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
52
 
53
  = My redirects aren't working =
54
 
55
+ This could be caused by many things, but please ensure that you are supplying valid URLs. If you're sure everything should be working, check the status code for the failing redirects, are both statuses marked Green?
56
 
57
 
58
  = My redirects aren't getting the 301 status code =
59
 
60
+ Your Request or Redirect URLS may be incorrect; please ensure that you are supplying valid URLs. Check slashes. Try Viewing the page by clicking the TEST button - does it load correctly?
61
 
62
 
63
  = How do I delete a redirect? =
72
 
73
  1. The administrative area, Wordpress 3.5.1
74
  2. Examples of some of the dropdown options.
75
+ 3. The redirect testing feature.
76
 
77
  == Changelog ==
78
 
79
+ = 1.4.0 =
80
+ * Performance updates, added a new 'Settings' page.
81
+
82
+ = 1.3.5 =
83
+ * Fixed a bug with spaces in the url. Added ease of use visual aids.
84
+
85
+
86
  = 1.3.4 =
87
  * Fixed nonce validation problem which would prevent saving of new redirects. Special Thanks to Bruce Zlotowitz for all his testing!
88
 
108
 
109
  == Upgrade Notice ==
110
 
111
+ = 1.4.0 =
112
+ * Performance updates, added a new 'Settings' page.
113
+
114
+ = 1.3.5 =
115
+ Fixed a bug with spaces in urls. Also added a test for both the request and destination urls to verify that they're working as intended.
116
+
117
  = 1.3.4 =
118
  Fixed a bug when saving new redirects.
119
 
templates/admin.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * EPS OPENGRAPH
5
+ *
6
+ *
7
+ *
8
+ * This plugin creates opengrah data for pages, posts and custom post types.
9
+ *
10
+ * PHP version 5
11
+ *
12
+ *
13
+ * @package EPS 301 Redirects
14
+ * @author Shawn Wernig ( shawn@eggplantstudios.ca )
15
+ * @version 1.3.4
16
+ */
17
+ $settings = get_option( 'eps_redirect_settings' );
18
+ global $wp_rewrite;
19
+
20
+ ?>
21
+
22
+ <div class="wrap">
23
+ <header id="eps-header">
24
+ <div id="icon-eggplant">&nbsp;</div>
25
+ <h2 class="eps-title"><?php echo self::$page_title; ?></h2>
26
+ </header>
27
+
28
+ <?php
29
+ if( !isset($wp_rewrite->permalink_structure) || empty($wp_rewrite->permalink_structure) ) {
30
+ echo '<div class="error clear"><div class="padding">';
31
+ echo '<strong>WARNING:</strong> EPS 301 Redirects requires that a permalink structure is set. The Default Wordpress permalink structure is not compatible. Please update the <a href="options-permalink.php" title="Permalinks">Permalink Structure</a>.</div>';
32
+ echo '</div></div>';
33
+ }
34
+ ?>
35
+ <div id="eps-tabgroup">
36
+
37
+ <div id="eps-tab-nav">
38
+ <a href="#eps-redirect-redirects" class="active eps-tab-nav-item">Redirects</a>
39
+ <a href="#eps-redirect-settings" class="eps-tab-nav-item">Settings</a>
40
+ </div>
41
+
42
+ <div id="eps-tabs">
43
+ <?php include ( EPS_REDIRECT_PATH . 'templates/admin.redirects.php' ); ?>
44
+ <?php include ( EPS_REDIRECT_PATH . 'templates/admin.settings.php' ); ?>
45
+ </div>
46
+
47
+ </div>
48
+
49
+
50
+ </div>
51
+
52
+
53
+
54
+
templates/admin.redirects.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * EPS OPENGRAPH
5
+ *
6
+ *
7
+ *
8
+ * This plugin creates opengrah data for pages, posts and custom post types.
9
+ *
10
+ * PHP version 5
11
+ *
12
+ *
13
+ * @package EPS 301 Redirects
14
+ * @author Shawn Wernig ( shawn@eggplantstudios.ca )
15
+ * @version 1.3.4
16
+ */
17
+ ?>
18
+ <div id="eps-redirect-redirects-pane" class="eps-tab">
19
+
20
+ <form method="post" action="">
21
+ <table id="eps-redirect-entries">
22
+ <tr>
23
+ <td>
24
+ <h3>Request URL</h3>
25
+ </td>
26
+ <td>
27
+ <h3>Redirect to URL</h3>
28
+ </td>
29
+ </tr>
30
+ <?php
31
+ echo self::do_inputs();
32
+ echo self::get_blank_entry();
33
+ ?>
34
+ <tr><td colspan="2"><a class="eps-text-link new" href="#" id="eps-redirect-add">+ Add Empty</a></td></tr>
35
+ </table>
36
+ <hr class="eps-divider">
37
+ <p class="submit">
38
+ <?php wp_nonce_field('eps_redirect_nonce', 'eps_redirect_nonce_submit'); ?>
39
+ <input type="submit" name="eps_redirect_submit" id="submit" class="button button-primary" value="Save Changes"/>
40
+ </p>
41
+ </form>
42
+
43
+ </div>
templates/admin.settings.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * EPS redirects
5
+ *
6
+ *
7
+ *
8
+ * This plugin creates opengrah data for pages, posts and custom post types.
9
+ *
10
+ * PHP version 5
11
+ *
12
+ *
13
+ * @package EPS 301 Redirects
14
+ * @author Shawn Wernig ( shawn@eggplantstudios.ca )
15
+ * @version 1.3.4
16
+ */
17
+
18
+
19
+ ?>
20
+
21
+
22
+ <div id="eps-redirect-settings-pane" class="eps-tab">
23
+
24
+
25
+ <form method="post" action="">
26
+
27
+ <table class="eps-redirect-table">
28
+ <tr>
29
+ <td class="eps-redirect-section-spacer">&nbsp;</td>
30
+ <td>
31
+ <table class="eps-redirect-meta">
32
+ <tr><th>Test Urls?</th>
33
+ <td class="padding">
34
+
35
+ <label><input type="checkbox" name="eps_redirect_settings[test_urls]" <?php echo( isset($settings['test_urls']) && $settings['test_urls'] == 'on' ) ? 'checked="checked"': null; ?>> Turn URL testing ON </label>
36
+ <br>
37
+ <small>This will test your redirects on the Admin Panel to help debug. Warning, this can severly affect page load times, please consider not using this if you have more than 20 redirects.</small>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </td>
42
+ </tr>
43
+
44
+ </table>
45
+ <hr class="eps-divider">
46
+ <p class="submit">
47
+ <?php wp_nonce_field('eps_redirect_setting_nonce', 'eps_redirect_setting_nonce_submit'); ?>
48
+ <input type="submit" name="eps_redirect_settings_submit" id="submit" class="button button-primary" value="Save Changes"/>
49
+ </p>
50
+ </form>
51
+ </div>