Eggplant 301 Redirects - Version 1.1

Version Description

  • Minor CSS and usability fixes. Also checking out the SVN!
Download this release

Release Info

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

Version 1.1

Files changed (5) hide show
  1. css/eps_redirect.css +103 -0
  2. eps-301-redirects.php +459 -0
  3. icons/eggplant-64.png +0 -0
  4. js/scripts.js +41 -0
  5. readme.txt +90 -0
css/eps_redirect.css ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ *
4
+ *
5
+ *
6
+ *
7
+ */
8
+
9
+
10
+ /*----------------------------------------------------------*/
11
+ /*------------------------ Headings ------------------------*/
12
+ /*----------------------------------------------------------*/
13
+
14
+
15
+ h2.eps-title {
16
+ color: #68214d !important;
17
+ font-size: 32px !important;
18
+ padding-top: 24px;
19
+ }
20
+
21
+ #icon-eggplant {
22
+ background: url('../icons/eggplant-64.png') center center no-repeat;
23
+ width: 64px; height: 64px; float: left; margin-right: 12px; margin-top: 8px;
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
+ /*----------------------------------------------------------*/
36
+
37
+
38
+
39
+ .eps-notification-area {
40
+ -webkit-border-radius: 4px;
41
+ -moz-border-radius: 4px;
42
+ border-radius: 4px;
43
+ margin: 0px 4px; padding: 4px 8px;
44
+ text-shadow: 1px 1px 1px white; display: inline-block;
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;
62
+ padding: 4px 8px;
63
+ text-decoration: none;
64
+ background: #fefefe; /* Old browsers */
65
+ background: -moz-linear-gradient(top, #fefefe 0%, #eeeeee 10%, #f4f4f4 100%); /* FF3.6+ */
66
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(10%,#eeeeee), color-stop(100%,#f4f4f4)); /* Chrome,Safari4+ */
67
+ background: -webkit-linear-gradient(top, #fefefe 0%,#eeeeee 10%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */
68
+ background: -o-linear-gradient(top, #fefefe 0%,#eeeeee 10%,#f4f4f4 100%); /* Opera 11.10+ */
69
+ background: -ms-linear-gradient(top, #fefefe 0%,#eeeeee 10%,#f4f4f4 100%); /* IE10+ */
70
+ background: linear-gradient(to bottom, #fefefe 0%,#eeeeee 10%,#f4f4f4 100%); /* W3C */
71
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */
72
+
73
+ border: 1px solid #dddddd;
74
+ margin: 0px 4px;
75
+ text-shadow: 1px 1px 1px white;
76
+
77
+ -webkit-border-radius: 4px;
78
+ -moz-border-radius: 4px;
79
+ border-radius: 4px;
80
+ }
81
+ a.eps-text-link:hover { background: #fafafa; }
82
+
83
+ a.eps-text-link.remove {
84
+ color: #aa0000;
85
+ -webkit-border-radius: 12px;
86
+ -moz-border-radius: 12px;
87
+ border-radius: 12px;
88
+ }
89
+ a.eps-text-link.remove:hover { color: #fafafa; background: #aa0000;}
90
+
91
+ a.eps-text-link.new {
92
+ padding: 8px;
93
+ margin-top: 32px;
94
+ }
95
+
96
+
97
+
98
+ /*----------------------------------------------------------*/
99
+ /*-------------------------- misc ------------------------*/
100
+ /*----------------------------------------------------------*/
101
+
102
+ hr.eps-divider { border: none; margin: 16px 0px; }
103
+ .eps-grey-text { font-style: italic; color: #888888; }
eps-301-redirects.php ADDED
@@ -0,0 +1,459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * EPS 301 REDIRECTS
5
+ *
6
+ *
7
+ *
8
+ * This plugin creates a nice Wordpress settings page for creating 301 redirects on your Wordpress
9
+ * blog or website. Often used when migrating sites, or doing major redesigns, 301 redirects can
10
+ * sometimes be a pain - it's my hope that this plugin helps you seamlessly create these redirects
11
+ * in with this quick and efficient interface.
12
+ *
13
+ * PHP version 5
14
+ *
15
+ *
16
+ * @package EPS 301 Redirects
17
+ * @author Shawn Wernig ( shawn@eggplantstudios.ca )
18
+ * @version 1.1
19
+ */
20
+
21
+
22
+ /*
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.1
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
30
+ */
31
+ define ( 'EPS_REDIRECT_PATH', plugin_dir_path(__FILE__) );
32
+ define ( 'EPS_REDIRECT_URL', plugin_dir_url( __FILE__ ) );
33
+ define ( 'EPS_REDIRECT_VERSION', 1);
34
+
35
+ register_activation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_activation'));
36
+ register_deactivation_hook(__FILE__, array('EPS_Redirects', 'eps_redirect_deactivation'));
37
+
38
+
39
+ class EPS_Redirects {
40
+
41
+ static $option_slug = 'eps_redirects';
42
+ static $option_section_slug = 'eps_redirects_list';
43
+ static $page_slug = 'eps_redirects';
44
+ static $page_title = '301 Redirects';
45
+
46
+
47
+ public function __construct(){
48
+ if(is_admin()){
49
+ add_action('admin_menu', array($this, 'add_plugin_page'));
50
+ add_action('admin_init', array($this, '_save'));
51
+ add_action('wp_ajax_eps_redirect_get_new_entry', array($this, 'ajax_get_blank_entry') );
52
+ add_action('init', array($this, 'enqueue_resources'));
53
+ add_action('admin_footer_text', array($this, 'set_ajax_url'));
54
+ }
55
+ add_action('wp_footer', array($this, 'set_ajax_url'));
56
+ add_action('init', array($this,'do_redirect'), 1); // Priority 1 for redirects.
57
+ }
58
+
59
+ public static function eps_redirect_activation() {}
60
+ public static function eps_redirect_deactivation() {}
61
+
62
+ /**
63
+ *
64
+ * ENQUEUE_RESOURCES
65
+ *
66
+ * This function will queue up the javascript and CSS for the plugin.
67
+ *
68
+ * @return html string
69
+ * @author epstudios
70
+ *
71
+ */
72
+ public function enqueue_resources(){
73
+ wp_enqueue_script('jquery');
74
+ wp_enqueue_script('eps_redirect_script', EPS_REDIRECT_URL .'/js/scripts.js');
75
+
76
+ wp_enqueue_style('eps_redirect_styles', EPS_REDIRECT_URL .'css/eps_redirect.css');
77
+ }
78
+
79
+ /**
80
+ *
81
+ * ADD_PLUGIN_PAGE
82
+ *
83
+ * This function initialize the plugin page.
84
+ *
85
+ * @return html string
86
+ * @author epstudios
87
+ *
88
+ */
89
+ public function add_plugin_page(){
90
+ add_options_page('301 Redirects', 'EPS 301 Redirects', 'manage_options', self::$page_slug, array($this, 'do_admin_page'));
91
+ }
92
+
93
+ /**
94
+ *
95
+ * DO_REDIRECT
96
+ *
97
+ * This function will redirect the user if it can resolve that this url request has a redirect.
98
+ *
99
+ * @author epstudios
100
+ *
101
+ */
102
+ public function do_redirect() {
103
+ $redirects = get_option( self::$option_slug );
104
+ if (empty($redirects)) return false;
105
+
106
+ // Get current url
107
+ $url_request = self::get_url();
108
+
109
+ foreach ($redirects as $to => $from ) {
110
+
111
+ if( rtrim($url_request,'/') == self::format_from_url($from) ) {
112
+ // Match, this needs to be redirected
113
+ header ('HTTP/1.1 301 Moved Permanently');
114
+ header ('Location: ' . $to, true, 301);
115
+ exit();
116
+ }
117
+ }
118
+ }
119
+
120
+ private function format_from_url( $string ) {
121
+ $from = get_option('home') . '/' . $string;
122
+ return rtrim($from,'/');
123
+ }
124
+ /**
125
+ *
126
+ * GET_URL
127
+ *
128
+ * This function returns the current url.
129
+ *
130
+ * @return URL string
131
+ * @author epstudios
132
+ *
133
+ */
134
+ function get_url() {
135
+ $protocol = ( $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';
136
+ return urldecode( $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
137
+ }
138
+
139
+
140
+ /**
141
+ *
142
+ * DO_ADMIN_PAGE
143
+ *
144
+ * This function will create the admin page.
145
+ *
146
+ * @author epstudios
147
+ *
148
+ */
149
+ public function do_admin_page(){
150
+ ?>
151
+ <div class="wrap">
152
+ <header id="eps-header">
153
+ <div id="icon-eggplant">&nbsp;</div>
154
+ <h2 class="eps-title"><?php echo self::$page_title; ?></h2>
155
+ </header>
156
+
157
+ <form method="post" action="">
158
+ <table id="eps-redirect-entries">
159
+ <tr>
160
+ <td>
161
+ <h3>Request URL</h3>
162
+ </td>
163
+ <td>
164
+ <h3>Redirect to URL</h3>
165
+ </td>
166
+ </tr>
167
+ <?php
168
+ echo self::do_inputs();
169
+ echo self::get_blank_entry();
170
+ ?>
171
+ <tr><td colspan="2"><a class="eps-text-link new" href="#" id="eps-redirect-add">+ Add Empty</a></td></tr>
172
+ </table>
173
+ <hr class="eps-divider">
174
+ <p class="submit">
175
+ <?php wp_nonce_field('eps_redirect_nonce', 'eps_redirect_nonce_submit'); ?>
176
+ <input type="submit" name="eps_redirect_submit" id="submit" class="button button-primary" value="Save Changes"/>
177
+ </p>
178
+ </form>
179
+ </div>
180
+ <?php
181
+ }
182
+
183
+ /**
184
+ *
185
+ * _SAVE
186
+ *
187
+ * This function will list out all the current entries.
188
+ *
189
+ * @return html string
190
+ * @author epstudios
191
+ *
192
+ */
193
+ public function _save(){
194
+
195
+ // Check submitted values, and nonce.
196
+ if ( !isset( $_POST['eps_redirect_submit'] )
197
+ || !isset( $_POST[self::$option_slug] )
198
+ || !wp_verify_nonce( $_POST['eps_redirect_nonce_submit'], 'eps_redirect_nonce') ) return false;
199
+
200
+ $total_redirects = count( $_POST[self::$option_slug]['to'] );
201
+ $redirects = array();
202
+
203
+ for($i = 0; $i < $total_redirects; $i ++) {
204
+ $to = trim( $_POST[self::$option_slug]['to'][$i] );
205
+ $from = trim( $_POST[self::$option_slug]['from'][$i] );
206
+
207
+ $to = filter_var( $to, FILTER_SANITIZE_URL);
208
+ $from = filter_var( $from, FILTER_SANITIZE_URL);
209
+
210
+ // If this is a valid entry, add it to the save array.
211
+ if ( !empty($to) && !empty($from)) $redirects[$to] = $from;
212
+ }
213
+ // If we then have a valid array - save
214
+ if (!empty( $redirects) ) update_option( self::$option_slug, $redirects );
215
+
216
+ }
217
+
218
+ /**
219
+ *
220
+ * DO_INPUTS
221
+ *
222
+ * This function will list out all the current entries.
223
+ *
224
+ * @return html string
225
+ * @author epstudios
226
+ *
227
+ */
228
+ public function do_inputs(){
229
+ $redirects = get_option( self::$option_slug );
230
+ if (empty($redirects)) return false;
231
+
232
+ foreach ($redirects as $to => $from ) {
233
+ $response_code = self::get_response( self::format_from_url($from) );
234
+
235
+ $class = ( $response_code == 301 ) ? 'valid' : 'invalid';
236
+
237
+ $html .= '
238
+ <tr class="redirect-entry '.$class.'">
239
+ <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>
240
+
241
+ <td>
242
+ <input type="text" class="eps-redirect-url" name="'.self::$option_slug.'[to][]" value="'.esc_url( $to ).'" >
243
+ <span class="eps-text-link eps-notification-area">'.eps_prettify($response_code).'</span>
244
+ <a class="eps-text-link" href="'.$to.'" target="_blank">View</a>
245
+ <a class="eps-text-link remove" href="#" class="eps-redirect-remove">&times;</a>
246
+ </td>
247
+ </tr>';
248
+ }
249
+ return $html;
250
+ }
251
+
252
+ /**
253
+ *
254
+ * GET_BLANK_ENTRY
255
+ * AJAX_GET_BLANK_ENTRY
256
+ *
257
+ * This function will return a blank row ready for user input.
258
+ *
259
+ * @return html string
260
+ * @author epstudios
261
+ *
262
+ */
263
+ public static function get_blank_entry() {
264
+ return '<tr class="redirect-entry">
265
+ <td><span class="eps-grey-text">'.get_bloginfo('home').'/&nbsp;</span><input class="eps-request-url" type="text" name="'.self::$option_slug.'[from][]" value="" > &rarr;</td>
266
+ <td>'.self::get_type_select().'</td>
267
+ </tr>';
268
+ }
269
+ public static function ajax_get_blank_entry() {
270
+ echo self::get_blank_entry(); exit();
271
+ }
272
+
273
+
274
+ /**
275
+ *
276
+ * GET_TYPE_SELECT
277
+ *
278
+ * This function will initialze a series of html form elements so a user can narrow down their redirect destination.
279
+ *
280
+ * @return html string
281
+ * @author epstudios
282
+ *
283
+ */
284
+ private function get_type_select(){
285
+
286
+ // Get a list of primary destinations.
287
+ $post_types = get_post_types(array('public'=>true),'objects');
288
+ $html = '<select class="type-select">';
289
+ $html .= '<option value="eps-redirect-url" selected default>Custom</option>';
290
+ foreach ($post_types as $post_type ) {
291
+ $html .= '<option value="'.$post_type->name.'">'. $post_type->labels->singular_name. '</option>';
292
+ }
293
+ $html .= '<option value="term">Term Archive</option>';
294
+ $html .= '</select>';
295
+
296
+ // The default input, javascript will populate this input with the final URL for submission.
297
+ $html .= '<input class="eps-redirect-url" type="text" name="'.self::$option_slug.'[to][]" value="" placeholder="http://www.yoursite.com"/>';
298
+
299
+ // Get all the post type select boxes.
300
+ foreach ($post_types as $post_type )
301
+ $html .= self::get_post_type_select($post_type->name);
302
+
303
+ // Get the term select box.
304
+ $html .= self::get_term_archive_select();
305
+ return $html;
306
+ }
307
+
308
+ /**
309
+ *
310
+ * GET_POST_TYPE_SELECT
311
+ *
312
+ * This function will output a select box with all the posts in a given post_type.
313
+ * Post types with archives will have an All Posts link.
314
+ *
315
+ * @return html string
316
+ * @param $post_type = the post type slug.
317
+ * @author epstudios
318
+ *
319
+ */
320
+ private function get_post_type_select( $post_type ){
321
+ global $wpdb;
322
+ $entries = $wpdb->get_results("SELECT ID, post_title
323
+ FROM $wpdb->posts
324
+ WHERE post_status = 'publish'
325
+ AND post_type = '$post_type'");
326
+
327
+ if (!$entries) return false; //
328
+
329
+ // Start the select.
330
+ $html = '<select class="'.$post_type.' url-selector" style="display:none;">';
331
+ $html .= '<option value="" selected default>...</option>';
332
+
333
+ // Get the correct archive link
334
+ switch( $post_type ) {
335
+ case 'post': break; // no archive
336
+ case 'page': break; // no archive
337
+ case 'attachment': break; // no archive
338
+ default:
339
+ $html .= '<option value="'.get_post_type_archive_link($post_type).'">All '.eps_prettify($post_type).'s</option>';
340
+ }
341
+
342
+
343
+ // Get all entries and insert them as options.
344
+ foreach ($entries as $entry ) {
345
+ $html .= '<option value="'.get_permalink($entry->ID).'">'. $entry->post_title. '</option>';
346
+ }
347
+ $html .= '</select>';
348
+ return $html;
349
+ }
350
+
351
+
352
+ /**
353
+ *
354
+ * GET_TERM_ARCHIVE_SELECT
355
+ *
356
+ * This function will output a select box with all the taxonomies and terms.
357
+ *
358
+ * @return html string
359
+ * @author epstudios
360
+ *
361
+ */
362
+ private function get_term_archive_select(){
363
+ $taxonomies = get_taxonomies( '', 'objects' );
364
+
365
+ if (!$taxonomies) return false;
366
+
367
+ // Start the select.
368
+ $html = '<select class="term url-selector" style="display:none;">';
369
+ $html .= '<option value="" selected default>...</option>';
370
+
371
+ // Loop through all taxonomies.
372
+ foreach ($taxonomies as $tax ) {
373
+ $terms = get_terms( $tax->name, array('hide_empty' => false) ); // show empty terms.
374
+ $html .= '<option value="'.get_permalink($entry->ID).'" disabled>'. $tax->labels->singular_name. '</option>';
375
+
376
+ // Loop through all terms in this taxonomy and insert them as options.
377
+ foreach($terms as $term)
378
+ $html .= '<option value="'.get_term_link($term).'">&nbsp;&nbsp;- '. $term->name. '</option>';
379
+
380
+ }
381
+ $html .= '</select>';
382
+ return $html;
383
+ }
384
+
385
+ /**
386
+ *
387
+ * SET_AJAX_URL
388
+ *
389
+ * This function will output a variable containing the admin ajax url for use in javascript.
390
+ *
391
+ * @author epstudios
392
+ *
393
+ */
394
+ public static function set_ajax_url() {
395
+ echo '<script>var eps_redirect_ajax_url = "'. admin_url( 'admin-ajax.php' ) . '"</script>';
396
+ }
397
+
398
+
399
+ public static function filter_from( $string ) {
400
+ $string = esc_attr($string);
401
+ // If string does not start with a slash, add it
402
+ if( substr($string, 0, 1) != '/') $string = '/' . $string;
403
+
404
+ return $string;
405
+ }
406
+
407
+
408
+
409
+ public static function test_redirect( $url ) {
410
+ return ( self::get_response($url) == 301 ) ? true : false;
411
+ }
412
+
413
+ private static function get_response( $url ) {
414
+ // returns int responsecode, or false (if url does not exist or connection timeout occurs)
415
+ // 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))
416
+
417
+ if( !$url || !is_string($url)) return false;
418
+
419
+ $ch = @curl_init($url);
420
+
421
+ if($ch === false) return false;
422
+
423
+
424
+ @curl_setopt($ch, CURLOPT_HEADER ,true); // we want headers
425
+ @curl_setopt($ch, CURLOPT_NOBODY ,true); // dont need body
426
+ @curl_setopt($ch, CURLOPT_RETURNTRANSFER ,true); // catch output (do NOT print!)
427
+ @curl_exec($ch);
428
+
429
+ if( @curl_errno($ch) ) { // should be 0
430
+ @curl_close($ch);
431
+ return false;
432
+ } else {
433
+ $code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
434
+ @curl_close($ch);
435
+ return $code;
436
+ }
437
+
438
+ }
439
+ }
440
+
441
+
442
+
443
+ /**
444
+ * Outputs an object or array in a readable form.
445
+ *
446
+ * @return void
447
+ * @param $string = the object to prettify; Typically a string.
448
+ * @author epstudios
449
+ */
450
+ function eps_prettify( $string ) {
451
+ return ucwords( str_replace("_"," ",$string) );
452
+ }
453
+
454
+
455
+
456
+
457
+ // Run the plugin.
458
+ $EPS_Redirects = new EPS_Redirects();
459
+ ?>
icons/eggplant-64.png ADDED
Binary file
js/scripts.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Author:
2
+
3
+ */
4
+
5
+
6
+ jQuery(document).ready(function ($) {
7
+
8
+ $(document).on("change", 'select.type-select', function() {
9
+ var input_type = $(this).val();
10
+ $(this).siblings().hide();
11
+ $(this).siblings('.'+input_type).show();
12
+ });
13
+
14
+ $(document).on("change", 'select.url-selector', function() {
15
+ $(this).siblings('.eps-redirect-url').val( $(this).val() );
16
+ });
17
+
18
+
19
+
20
+ $('#eps-redirect-add').click( function(e){
21
+ e.preventDefault();
22
+ var request = $.post( eps_redirect_ajax_url, {
23
+ 'action' : 'eps_redirect_get_new_entry'
24
+ });
25
+ request.done(function( data ) {
26
+ $('#eps-redirect-entries tr:last-child').before( data );
27
+ });
28
+
29
+
30
+
31
+ });
32
+
33
+ $('.eps-text-link.remove').click( function(e){
34
+ e.preventDefault();
35
+ $(this).closest('tr.redirect-entry').remove();
36
+ });
37
+
38
+ });
39
+
40
+
41
+
readme.txt ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: shawneggplantstudiosca
3
+ Donate link: none
4
+ Tags: 301 redirects, redirects
5
+ Requires at least: 3.0.1
6
+ Tested up to: 3.4
7
+ Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Easily manage and create 301 redirects for your Wordpress website. A robust interface allows you create and validate redirecs.
12
+
13
+ == Description ==
14
+
15
+ **EPS 301 Redirects?** helps you manage and create 301 redirects for your Wordpress website. A robust interface allows you to select the *Destination URL* from drop down menus, and validates your redirects for troubleshooting.
16
+
17
+
18
+ **What is a 301 Redirect?**
19
+ A redirect is a simple way to re-route traffic coming to a *Requested URL* to different *Destination URL*.
20
+
21
+ A 301 redirect indicates that the page requested has been permanently moved to the *Destination URL*, and helps pass on the *Requested URLs* traffic in a search engine friendly manner. Creating a 301 redirect tells search engines that the *Requested URL* has moved permanently, and that the content can now be found on the *Destination URL*. An important feature is that search engines will pass along any clout the *Requested URL* used to have to the *Destination URL*.
22
+
23
+
24
+ **When Should I use EPS 301 Redirects?**
25
+ 1. Replacing an old site design with a new site design
26
+ 1. Overhauling or re-organizing your existing Wordpress content
27
+
28
+
29
+ **Features**
30
+ * Choose from Pages, Posts, Custom Post types, Archives, Term Archives,
31
+ * Overhauling or re-organizing your existing Wordpress content
32
+
33
+
34
+
35
+ Created by Shawn Wernig [Eggplant Studios](http://www.eggplantstudios.ca/ "Eggplant Studios")
36
+
37
+ *This release is compatible with all Wordpress versions since 3.0.1 (Tested. Plugin may not work as intended for older versions of Wordpress).*
38
+
39
+ *This plugin is English only; though it is somewhat language independent.*
40
+
41
+ == Installation ==
42
+
43
+
44
+
45
+ 1. Upload the `eps-301-redirects` folder to the `/wp-content/plugins/` directory
46
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
47
+ 1. Begin adding redirects in the Settings -> EPS 301 Redirects menu item.
48
+
49
+
50
+
51
+ == Frequently Asked Questions ==
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? =
64
+
65
+ Click the small X beside the redirect you wish to remove. Save changes.
66
+
67
+
68
+
69
+
70
+
71
+ == Screenshots ==
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.1 =
79
+ * Minor CSS and usability fixes. Also checking out the SVN!
80
+
81
+ = 1.0 =
82
+ * Release.
83
+
84
+ == Upgrade Notice ==
85
+
86
+ = 1.0 =
87
+ Cosmetic updates.
88
+
89
+ = 1.0 =
90
+ Released May, 2013.