Quick Page/Post Redirect Plugin - Version 2.0

Version Description

  • Cosmetic code cleanup. (2/28/2010)
  • Remove warning and error messages created in 1.9 (2/28/2010)
Download this release

Release Info

Developer prophecy2040
Plugin Icon 128x128 Quick Page/Post Redirect Plugin
Version 2.0
Comparing to
See all releases

Code changes from version 1.9 to 2.0

Files changed (2) hide show
  1. page_post_redirect_plugin.php +11 -4
  2. readme.txt +6 -2
page_post_redirect_plugin.php CHANGED
@@ -2,12 +2,14 @@
2
  /*
3
  Plugin Name: Quick Page/Post Redirect
4
  Plugin URI: http://fischercreativemedia.com/wordpress-plugins/quick-pagepost-redirct-plugin/
5
- Description: Redirect Pages or Posts to another location quickly. Adds a redirect box to the page or post edit page where you can specify the redirect Location and type which can be to another WordPress page/post or an external URL. Additional 301 Redirects can also be added for non-existant posts or pages - helpful for sites converted to WordPress.
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
- Version: 1.9
9
 
10
  Version info:
 
 
11
  1.9 - Add 'Open in New Window' Feature. (2/20/2010)
12
  - Add 'rel=nofollow' option for links that will redirect. (2/20/2010)
13
  - Add 'rewrite url/permalink' option to hide the regular link and replace it with the new re-write link. (2/20/2010)
@@ -144,6 +146,7 @@ Version info:
144
 
145
  //utility function to get the full address of the current request - credit: http://www.phpro.org/examples/Get-Full-URL.html
146
  function getAddress(){
 
147
  $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http'; //check for https
148
  return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //return the full address
149
  }
@@ -223,9 +226,13 @@ Version info:
223
 
224
  function ppr_filter_pages ($link, $post) {
225
  $ppr_cache = ppr_linktometa();
226
- $id = ($post->ID) ? $post->ID : $post;
 
 
 
 
227
  $ppr_rewrite = get_post_meta($id,'_pprredirect_rewritelink',true);
228
- if ($ppr_cache[$id] ){
229
  if($ppr_rewrite==='1'){ //only change the link if they want - otherwise, we will redirect the old way.
230
  if(strpos($ppr_cache[$id],get_bloginfo('url'))>=0 || strpos($ppr_cache[$id],'www.')>=0 || strpos($ppr_cache[$id],'http://')>=0 || strpos($ppr_cache[$id],'https://')>=0){
231
  $link = esc_url( $ppr_cache[$id] );
2
  /*
3
  Plugin Name: Quick Page/Post Redirect
4
  Plugin URI: http://fischercreativemedia.com/wordpress-plugins/quick-pagepost-redirct-plugin/
5
+ Description: Redirect Pages or Posts to another location quickly. Adds a redirect box to the page or post edit page where you can specify the redirect Location and type which can be to another WordPress page/post or an external URL. Additional 301 Redirects can also be added for non-existant posts or pages - helpful for sites converted to WordPress. Version 1.9 and up allows for redirects to open in a new window as well as giving you the ability to add the rel=nofollow to redirected links.
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
+ Version: 2.0
9
 
10
  Version info:
11
+ 2.0 - Code Cleanup. (2/28/2010)
12
+ - Fix WARNING and NOTICE messages that some people may have been receiving about objects and undefined variables. (2/28/2010)
13
  1.9 - Add 'Open in New Window' Feature. (2/20/2010)
14
  - Add 'rel=nofollow' option for links that will redirect. (2/20/2010)
15
  - Add 'rewrite url/permalink' option to hide the regular link and replace it with the new re-write link. (2/20/2010)
146
 
147
  //utility function to get the full address of the current request - credit: http://www.phpro.org/examples/Get-Full-URL.html
148
  function getAddress(){
149
+ if(!isset($_SERVER['HTTPS'])){$_SERVER['HTTPS']='';}
150
  $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http'; //check for https
151
  return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //return the full address
152
  }
226
 
227
  function ppr_filter_pages ($link, $post) {
228
  $ppr_cache = ppr_linktometa();
229
+ if(isset($post->ID)){
230
+ $id = $post->ID;
231
+ }else{
232
+ $id = $post;
233
+ }
234
  $ppr_rewrite = get_post_meta($id,'_pprredirect_rewritelink',true);
235
+ if (isset($ppr_cache[$id]) ){
236
  if($ppr_rewrite==='1'){ //only change the link if they want - otherwise, we will redirect the old way.
237
  if(strpos($ppr_cache[$id],get_bloginfo('url'))>=0 || strpos($ppr_cache[$id],'www.')>=0 || strpos($ppr_cache[$id],'http://')>=0 || strpos($ppr_cache[$id],'https://')>=0){
238
  $link = esc_url( $ppr_cache[$id] );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Quick Page/Post Redirect ===
2
  Contributors: Don Fischer
3
  Donate link: http://fischercreativemedia.com/
4
- Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct, nofollow, wpmu, menu links, WordPress MU
5
  Requires at least: 2.5
6
  Tested up to: 2.9.2
7
- Stable tag: 1.9
8
 
9
  Redirect Pages/Posts to another page/post or external URL. Adds edit box to admin edit so user can specify the redirect Location and type.
10
 
@@ -12,6 +12,7 @@ Redirect Pages/Posts to another page/post or external URL. Adds edit box to admi
12
  Quick Page/Post Redirect Plugin redirects WordPress Pages or Posts to another location quickly.
13
  It adds an option box to the edit section where you can specify the redirect location and type of redirect that you want, temporary, permanent, or meta. See blow for additional features added in each new version.
14
 
 
15
  *NEW* - Version 1.9 adds 3 new features: 1. you can now open a redirect link in a new window, 2. You can add a *rel="nofollow"* attribute to the link of a redirect, and 3. You can completely re-write the URL for the redirct so it takes the place of the default page URL (rewrite the href link).
16
  *NEW* - Version 1.8 adds a new feature to allow you to add redirects without needing to create a Page or Post to do so. This is very useful for sites that were converted to WordPress and have old links that create 404 errors (see FAQs for more information).
17
 
@@ -99,6 +100,9 @@ Yes, you can, but you do not always need to. If you are redirecting to an extern
99
  3. Menu for the Quick 301 Redirects page - located in the settings menu.
100
 
101
  == Changelog ==
 
 
 
102
  = 1.9 =
103
  * Added 'Open in New Window' Feature. (2/20/2010)
104
  * Added 'rel="nofollow"' attribute option for links that will redirect. (2/20/2010)
1
  === Quick Page/Post Redirect ===
2
  Contributors: Don Fischer
3
  Donate link: http://fischercreativemedia.com/
4
+ Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct, nofollow, wpmu, menu links, WordPress MU, posts, pages, admin
5
  Requires at least: 2.5
6
  Tested up to: 2.9.2
7
+ Stable tag: 2.0
8
 
9
  Redirect Pages/Posts to another page/post or external URL. Adds edit box to admin edit so user can specify the redirect Location and type.
10
 
12
  Quick Page/Post Redirect Plugin redirects WordPress Pages or Posts to another location quickly.
13
  It adds an option box to the edit section where you can specify the redirect location and type of redirect that you want, temporary, permanent, or meta. See blow for additional features added in each new version.
14
 
15
+ *2.0 NOTE:* - Version 2.0 is just a code cleanup version. It removes the Warning and Notice messages that some people may receive - it does not add any new features. It is not necessary to upgrade to 2.0 unless you have been getting WARNING and NOTICE messages.
16
  *NEW* - Version 1.9 adds 3 new features: 1. you can now open a redirect link in a new window, 2. You can add a *rel="nofollow"* attribute to the link of a redirect, and 3. You can completely re-write the URL for the redirct so it takes the place of the default page URL (rewrite the href link).
17
  *NEW* - Version 1.8 adds a new feature to allow you to add redirects without needing to create a Page or Post to do so. This is very useful for sites that were converted to WordPress and have old links that create 404 errors (see FAQs for more information).
18
 
100
  3. Menu for the Quick 301 Redirects page - located in the settings menu.
101
 
102
  == Changelog ==
103
+ = 2.0 =
104
+ * Cosmetic code cleanup. (2/28/2010)
105
+ * Remove warning and error messages created in 1.9 (2/28/2010)
106
  = 1.9 =
107
  * Added 'Open in New Window' Feature. (2/20/2010)
108
  * Added 'rel="nofollow"' attribute option for links that will redirect. (2/20/2010)