Simple 301 Redirects - Version 1.06

Version Description

  • Security Updates - Special thanks to Ryan Hellyer!
Download this release

Release Info

Developer scottnelle
Plugin Icon 128x128 Simple 301 Redirects
Version 1.06
Comparing to
See all releases

Code changes from version 1.05 to 1.06

Files changed (2) hide show
  1. readme.txt +6 -5
  2. wp-simple-301-redirects.php +9 -23
readme.txt CHANGED
@@ -2,8 +2,10 @@
2
  Contributors: scottnelle
3
  Tags: 301, redirect, url, seo
4
  Requires at least: 3.0
5
- Tested up to: 3.6.1
6
- Stable tag: 1.05
 
 
7
 
8
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web.
9
 
@@ -11,9 +13,6 @@ Simple 301 Redirects provides an easy method of redirecting requests to another
11
 
12
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web. It's especially handy when you migrate a site to WordPress and can't preserve your URL structure. By setting up 301 redirects from your old pages to your new pages, any incoming links will be seemlessly passed along, and their pagerank (or what-have-you) will be passed along with them.
13
 
14
- New for version 1.05: Wildcard redirect support.
15
-
16
-
17
  == Installation ==
18
 
19
  1. Upload Simple 301 Redirects to the `/wp-content/plugins/` directory
@@ -22,6 +21,8 @@ New for version 1.05: Wildcard redirect support.
22
 
23
 
24
  == Changelog ==
 
 
25
 
26
  = 1.05 =
27
  * Wildcard support
2
  Contributors: scottnelle
3
  Tags: 301, redirect, url, seo
4
  Requires at least: 3.0
5
+ Tested up to: 4.3
6
+ Stable tag: 1.06
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web.
11
 
13
 
14
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web. It's especially handy when you migrate a site to WordPress and can't preserve your URL structure. By setting up 301 redirects from your old pages to your new pages, any incoming links will be seemlessly passed along, and their pagerank (or what-have-you) will be passed along with them.
15
 
 
 
 
16
  == Installation ==
17
 
18
  1. Upload Simple 301 Redirects to the `/wp-content/plugins/` directory
21
 
22
 
23
  == Changelog ==
24
+ = 1.06 =
25
+ * Security Updates - Special thanks to Ryan Hellyer!
26
 
27
  = 1.05 =
28
  * Wildcard support
wp-simple-301-redirects.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple 301 Redirects
4
  Plugin URI: http://www.scottnelle.com/simple-301-redirects-plugin-for-wordpress/
5
  Description: Create a list of URLs that you would like to 301 redirect to another page or site. Now with wildcard support.
6
- Version: 1.05
7
  Author: Scott Nellé
8
  Author URI: http://www.scottnelle.com/
9
  */
@@ -80,6 +80,8 @@ if (!class_exists("Simple301redirects")) {
80
 
81
  <form method="post" id="simple_301_redirects_form" action="options-general.php?page=301options&savedata=true">
82
 
 
 
83
  <table class="widefat">
84
  <thead>
85
  <tr>
@@ -175,6 +177,11 @@ if (!class_exists("Simple301redirects")) {
175
  * @return void
176
  */
177
  function save_redirects($data) {
 
 
 
 
 
178
  $redirects = array();
179
 
180
  for($i = 0; $i < sizeof($data['request']); ++$i) {
@@ -195,27 +202,6 @@ if (!class_exists("Simple301redirects")) {
195
  }
196
  }
197
 
198
- /**
199
- * delete_redirect function
200
- * save the redirects from the options page to the database
201
- * @access public
202
- * @param int $redirect_position
203
- * @return boolean
204
- */
205
- function delete_redirect($redirect_position) {
206
- // use nonces and check for permission http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/
207
-
208
- // handle ajax or regular request
209
-
210
- // unserialize data
211
-
212
- // find the redirect in the position that you want to delete and remove it
213
-
214
- // serialize and save data
215
-
216
- // if the request came from ajax, return true for the callback
217
- // if it was traditional, redirect to the page with deleted=$redirect_position in url for save state
218
- }
219
  /**
220
  * redirect function
221
  * Read the list of redirects and if the current page
@@ -312,7 +298,7 @@ if (isset($redirect_plugin)) {
312
 
313
  // if submitted, process the data
314
  if (isset($_POST['301_redirects'])) {
315
- $redirect_plugin->save_redirects($_POST['301_redirects']);
316
  }
317
  }
318
 
3
  Plugin Name: Simple 301 Redirects
4
  Plugin URI: http://www.scottnelle.com/simple-301-redirects-plugin-for-wordpress/
5
  Description: Create a list of URLs that you would like to 301 redirect to another page or site. Now with wildcard support.
6
+ Version: 1.06
7
  Author: Scott Nellé
8
  Author URI: http://www.scottnelle.com/
9
  */
80
 
81
  <form method="post" id="simple_301_redirects_form" action="options-general.php?page=301options&savedata=true">
82
 
83
+ <?php wp_nonce_field( 'save_redirects', '_s301r_nonce' ); ?>
84
+
85
  <table class="widefat">
86
  <thead>
87
  <tr>
177
  * @return void
178
  */
179
  function save_redirects($data) {
180
+ if ( !current_user_can('manage_options') ) { wp_die( 'You do not have sufficient permissions to access this page.' ); }
181
+ check_admin_referer( 'save_redirects', '_s301r_nonce' );
182
+
183
+ $data = $_POST['301_redirects'];
184
+
185
  $redirects = array();
186
 
187
  for($i = 0; $i < sizeof($data['request']); ++$i) {
202
  }
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * redirect function
207
  * Read the list of redirects and if the current page
298
 
299
  // if submitted, process the data
300
  if (isset($_POST['301_redirects'])) {
301
+ add_action('admin_init', array($redirect_plugin,'save_redirects'));
302
  }
303
  }
304