Quick Page/Post Redirect Plugin - Version 1.4

Version Description

  • Add exit script command after header redirect function - needed on some servers and browsers. (8/19/2009)
Download this release

Release Info

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

Code changes from version 1.3 to 1.4

Files changed (2) hide show
  1. page_post_redirect_plugin.php +19 -14
  2. readme.txt +7 -6
page_post_redirect_plugin.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: Quick Page/Post Redirect
4
- Plugin URI: http://www.fischercreativemedia.com/?page_id=163
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. Location can be to another WordPress page/post or an external URL.
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
- Version: 1.3
9
 
10
  Version info:
 
11
  1.3 - Add Meta Re-fresh option (7/26/2009)
12
  1.2 - Add easy Post/Page Edit Box (7/25/2009)
13
  1.1 - Fix redirect for off site links (7/7/2009)
@@ -28,6 +29,7 @@ Version info:
28
  You should have received a copy of the GNU General Public License
29
  along with this program. If not, see <http://www.gnu.org/licenses/>.
30
  */
 
31
  // Actions
32
  //----------
33
  add_action('admin_menu', 'add_edit_box_ppr');
@@ -45,7 +47,6 @@ global $wp_query;
45
  }
46
  $page_post_redirect_meta = page_post_redirect_get_meta();
47
 
48
-
49
  // Functions
50
  //----------
51
  function ppr_get_ID_by_page_name($page_name){
@@ -96,41 +97,45 @@ global $wp_query;
96
  $thisidis_current = ppr_get_ID_by_page_name($page_post_redirect_after_base);
97
  }
98
  }
99
- if ($thisidis_current!='' || $page_post_redirect_after_base === $ppr_postname || $page_post_redirect_after_base === $ppr_id){
 
100
  if($ppr_type=='meta' && $thisidis_current === $ppr_id){
101
  //metaredirect
102
  echo '<meta http-equiv="refresh" content="0; URL='.get_bloginfo('url').$ppr_url.'">';
103
  exit; //stop loading page so meta can do it's job without rest of page loading.
104
-
105
- }elseif ($thisidis_current === $ppr_id){
106
  //check for http:// - as full url - then we can just redirect if it is //
107
  if( strpos($ppr_url, 'http://')=== 0 || strpos($ppr_url, 'https://')=== 0){
108
  $offsite=$ppr_url;
109
- header("Location: $offsite", true);
110
- //echo "(1)header(\"Location: ".$offsite."\", true, $ppr_type);";
 
111
  }elseif(strpos($ppr_url, 'www')=== 0){ // check if they have full url but did not put http://
112
  $offsite='http://'.$ppr_url;
 
113
  header("Location: $offsite", true, $ppr_type);
114
- //echo "(2)header(\"Location: ".$offsite."\", true, $ppr_type);";
115
  }elseif(is_numeric($ppr_url)){ // page/post number
116
  if($ppr_postpage=='page'){ //page
117
  $onsite=get_bloginfo('url').'/?page_id='.$ppr_url;
 
118
  header("Location: $onsite", true, $ppr_type);
119
- //echo "(3)header(\"Location: ".$onsite."\", true, $ppr_type);";
120
  }else{ //post
121
  $onsite=get_bloginfo('url').'/?p='.$ppr_url;
 
122
  header("Location: $onsite", true, $ppr_type);
123
- //echo "(4)header(\"Location: ".$onsite."\", true, $ppr_type);";
124
  }
125
 
126
  //check permalink or local page redirect
127
  }else{ // we assume they are using the permalink / page name??
128
  $onsite=get_bloginfo('url'). $ppr_url;
129
  header("Location: $onsite", true, $ppr_type);
130
- //echo "(5)header(\"Location: ".$onsite."\", true, $ppr_type);";
131
  }
132
  }else{
133
- //nothing - we don't redirect
134
  }
135
  }
136
  }
1
  <?php
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. Location can be to another WordPress page/post or an external URL. NOTE: Page or post must remain published for this to work correctly.
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
+ Version: 1.4
9
 
10
  Version info:
11
+ 1.4 - Add exit after header redirect function - needed on some servers and browsers. (8/19/2009)
12
  1.3 - Add Meta Re-fresh option (7/26/2009)
13
  1.2 - Add easy Post/Page Edit Box (7/25/2009)
14
  1.1 - Fix redirect for off site links (7/7/2009)
29
  You should have received a copy of the GNU General Public License
30
  along with this program. If not, see <http://www.gnu.org/licenses/>.
31
  */
32
+
33
  // Actions
34
  //----------
35
  add_action('admin_menu', 'add_edit_box_ppr');
47
  }
48
  $page_post_redirect_meta = page_post_redirect_get_meta();
49
 
 
50
  // Functions
51
  //----------
52
  function ppr_get_ID_by_page_name($page_name){
97
  $thisidis_current = ppr_get_ID_by_page_name($page_post_redirect_after_base);
98
  }
99
  }
100
+ if ($thisidis_current!='' || $page_post_redirect_after_base === $ppr_postname || $page_post_redirect_after_base == $ppr_id){
101
+ //echo $thisidis_current .'|'.$ppr_id.'<br />';
102
  if($ppr_type=='meta' && $thisidis_current === $ppr_id){
103
  //metaredirect
104
  echo '<meta http-equiv="refresh" content="0; URL='.get_bloginfo('url').$ppr_url.'">';
105
  exit; //stop loading page so meta can do it's job without rest of page loading.
106
+ }elseif ($thisidis_current == $ppr_id){
 
107
  //check for http:// - as full url - then we can just redirect if it is //
108
  if( strpos($ppr_url, 'http://')=== 0 || strpos($ppr_url, 'https://')=== 0){
109
  $offsite=$ppr_url;
110
+ header('Status: '.$ppr_type);
111
+ header('Location: '.$offsite, true, $ppr_type);
112
+ exit; //stop loading page
113
  }elseif(strpos($ppr_url, 'www')=== 0){ // check if they have full url but did not put http://
114
  $offsite='http://'.$ppr_url;
115
+ header("Status: $ppr_type");
116
  header("Location: $offsite", true, $ppr_type);
117
+ exit; //stop loading page
118
  }elseif(is_numeric($ppr_url)){ // page/post number
119
  if($ppr_postpage=='page'){ //page
120
  $onsite=get_bloginfo('url').'/?page_id='.$ppr_url;
121
+ header("Status: $ppr_type");
122
  header("Location: $onsite", true, $ppr_type);
123
+ exit; //stop loading page
124
  }else{ //post
125
  $onsite=get_bloginfo('url').'/?p='.$ppr_url;
126
+ header("Status: $ppr_type");
127
  header("Location: $onsite", true, $ppr_type);
128
+ exit; //stop loading page
129
  }
130
 
131
  //check permalink or local page redirect
132
  }else{ // we assume they are using the permalink / page name??
133
  $onsite=get_bloginfo('url'). $ppr_url;
134
  header("Location: $onsite", true, $ppr_type);
135
+ exit; //stop loading page
136
  }
137
  }else{
138
+ //echo "nothing - we don't redirect";
139
  }
140
  }
141
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Don Fischer
3
  Donate link: http://fischercreativemedia.com/
4
  Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct
5
  Requires at least: 2.5
6
- Tested up to: 2.8.2
7
- Stable tag: 1.3
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
 
@@ -15,16 +15,16 @@ It adds an option box to the edit section where you can specify the redirect loc
15
 
16
  The redirect Location can be to another WordPress page/post or any other website with an external URL. It allows the use of a full URL path, the post or page ID, permalink or page-name.
17
 
18
- PLEASE NOTE: At this time, the page or post needs to remain Published in order for the redirect to happen. This plugin is also not compatible with WordPress versions less than 2.5, and has not been tested with WordPress MU. If anyone using WPMU has tested this plugin and would like to let me know, I would love to know your know your results.
19
 
20
  == Installation ==
21
 
22
- If you downloaded this plugin:
23
  * Upload `quick_page_post_redirect` folder to the `/wp-content/plugins/` directory
24
  * Activate the plugin through the 'Plugins' menu in WordPress
25
  * Once Activated, you can add a redirect by entering the correct information in the `Quick Page/Post Redirect` box in the edit section of a page or post
26
 
27
- If you install this plugin through WordPress 2.8+ plugin search interface:
28
  * Click Install `Quick Page/Post Redirect Plugin`
29
  * Activate the plugin through the 'Plugins' menu in WordPress
30
  * Once Activated, you can add a redirect by entering the correct information in the `Quick Page/Post Redirect` box in the edit section of a page or post
@@ -66,7 +66,8 @@ Yes, you can, but you do not always need to. If you are redirecting to an extern
66
 
67
 
68
  == Changelog ==
69
-
 
70
  = 1.3 =
71
  * Add Meta Re-fresh option (7/26/2009)
72
  = 1.2 =
3
  Donate link: http://fischercreativemedia.com/
4
  Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct
5
  Requires at least: 2.5
6
+ Tested up to: 2.8.4
7
+ Stable tag: 1.4
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
 
15
 
16
  The redirect Location can be to another WordPress page/post or any other website with an external URL. It allows the use of a full URL path, the post or page ID, permalink or page-name.
17
 
18
+ PLEASE NOTE: At this time, the page or post needs to remain Published in order for the redirect to happen. This plugin is also not compatible with WordPress versions less than 2.5, and has not been tested with WordPress MU. If anyone using WPMU has tested this plugin and would like to let me know, I would love to know your results.
19
 
20
  == Installation ==
21
 
22
+ = If you downloaded this plugin: =
23
  * Upload `quick_page_post_redirect` folder to the `/wp-content/plugins/` directory
24
  * Activate the plugin through the 'Plugins' menu in WordPress
25
  * Once Activated, you can add a redirect by entering the correct information in the `Quick Page/Post Redirect` box in the edit section of a page or post
26
 
27
+ = If you install this plugin through WordPress 2.8+ plugin search interface: =
28
  * Click Install `Quick Page/Post Redirect Plugin`
29
  * Activate the plugin through the 'Plugins' menu in WordPress
30
  * Once Activated, you can add a redirect by entering the correct information in the `Quick Page/Post Redirect` box in the edit section of a page or post
66
 
67
 
68
  == Changelog ==
69
+ = 1.4 =
70
+ * Add exit script command after header redirect function - needed on some servers and browsers. (8/19/2009)
71
  = 1.3 =
72
  * Add Meta Re-fresh option (7/26/2009)
73
  = 1.2 =