Quick Page/Post Redirect Plugin - Version 5.0.6

Version Description

  • Fix to some users getting Warning messages for parse_url function.
  • Added nonce field checking for Quick Redirects form to help eliminate the possibility of form takeover on submission of quick redirect saves.
Download this release

Release Info

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

Code changes from version 5.0.5 to 5.0.6

Files changed (2) hide show
  1. page_post_redirect_plugin.php +89 -69
  2. readme.txt +20 -9
page_post_redirect_plugin.php CHANGED
@@ -6,60 +6,61 @@ Description: Redirect Pages, Posts or Custom Post Types to another location quic
6
Author: Don Fischer
7
Author URI: http://www.fischercreativemedia.com/
8
Donate link: http://www.fischercreativemedia.com/donations/
9
- Version: 5.0.5
10
11
- Version info:
12
- See change log in readme.txt file.
13
- Version 3.2.4 to 4.0.1 are testing versions only
14
-
15
- Copyright (C) 2009-2014 Donald J. Fischer
16
-
17
- This program is free software: you can redistribute it and/or modify
18
- it under the terms of the GNU General Public License as published by
19
- the Free Software Foundation, either version 3 of the License, or
20
- (at your option) any later version.
21
22
- This program is distributed in the hope that it will be useful,
23
- but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- GNU General Public License for more details.
26
27
- You should have received a copy of the GNU General Public License
28
- along with this program. If not, see <http://www.gnu.org/licenses/>.
29
30
- ==========
31
- //you can use the following action hooks with this plugin:
32
- // *** Quick Rediects function: use to take over redirect
33
- // add_action('qppr_redirect','some_callback_function',10,2);
34
- // arg 1. is Redirect URL
35
- // arg 2. is Redirect Type
36
- // *******************************
37
- // *** Page/Post Redirects function: use to take over redirect
38
- // add_action('qppr_do_redirect','some_callback_function2',10,2);
39
- // arg 1. is Redirect URL
40
- // arg 2. is Redirect Type
41
- // *******************************
42
- // *** Meta Redirect Action: Used for Meta Redirect Page Headers (so you can add meta tag)
43
- //add_action('ppr_meta_head_hook','some_callback',10,3);
44
- // arg 1. URL site
45
- // arg 2. Meta Redirect Time in Seconds
46
- // arg 3. Meta Message to display
47
- // Example:
48
- /***
49
add_action('ppr_meta_head_hook','override_ppr_metahead',10,3);
50
function override_ppr_metahead($refresh_url='',$refresh_secs=0,$messages=''){
51
echo '<meta http-equiv="refresh" content="'.$refresh_secs.'; URL='.$refresh_url.'" />'."\n";
52
echo '<div id="ppr_custom_message">'. $messages.'</div>'."\n";
53
return;
54
}
55
- **/
56
- // *******************************
57
- // *** Meta Redirect Filter: Used for Meta Redirect Page Headers (so you can add meta and message, etc.)
58
- //add_filter('ppr_meta_head_hook_filter','some_callback2',10,2);
59
- // arg 1. Meta Tag (fully generated)
60
- // arg 2. Page HTML Message (wrapped in a <div> tag)
61
- // Example:
62
- /*
63
add_filter('ppr_meta_head_hook_filter','override_ppr_metahead_new');
64
function override_ppr_metahead_new($meta_tag='',$meta_message=''){
65
$meta = $meta_tag;
@@ -69,15 +70,14 @@ Version 3.2.4 to 4.0.1 are testing versions only
69
add_filter('get_title',$function2,100,1);
70
return $meta;
71
}
72
- /*
73
- // ********************************/
74
- global $newqppr;
75
if (!function_exists('esc_attr')) { // For WordPress < 2.8 function compatibility
76
function esc_attr($attr){return attribute_escape( $attr );}
77
function esc_url($url){return clean_url( $url );}
78
}
79
- $newqppr = new quick_page_post_reds();
80
-
81
82
//=======================================
83
// Main Redirect Class.
@@ -114,7 +114,7 @@ class quick_page_post_reds {
114
public $pprptypes_ok;
115
116
function __construct() {
117
- $this->ppr_curr_version = '5.0.5';
118
$this->ppr_nofollow = array();
119
$this->ppr_newindow = array();
120
$this->ppr_url = array();
@@ -166,9 +166,16 @@ class quick_page_post_reds {
166
add_filter( 'post_type_link', array( $this, 'ppr_filter_page_links' ), 20, 2 );
167
add_filter( 'get_permalink', array( $this, 'ppr_filter_links' ), 20, 2 );
168
}
169
- if( isset( $_POST['submit_301'] ) ) {$this->quickppr_redirects = $this->save_redirects( $_POST['quickppr_redirects'] /* sanatized individually */ );$this->updatemsg ='Quick Redirects Updated.';} //if submitted, process the data
170
}
171
-
172
function ppr_add_menu(){
173
add_menu_page( 'Redirect Options', 'Redirect Options', 'administrator', 'redirect-options', array($this,'ppr_settings_page'),plugins_url( 'settings-16-icon.png' , __FILE__));
174
add_submenu_page( 'redirect-options', 'Quick Redirects', 'Quick Redirects', 'manage_options', 'redirect-updates', array($this,'ppr_options_page') );
@@ -178,8 +185,8 @@ class quick_page_post_reds {
178
}
179
function qppr_admin_scripts($hook){
180
if(in_array($hook, array('edit.php','post.php'))){
181
- wp_enqueue_script( 'qppr_admin_meta_script', plugins_url('/qppr_admin_script.js', __FILE__ ) , array('jquery'),'5.0.5');
182
- wp_enqueue_style( 'qppr_admin_meta_style', plugins_url('/qppr_admin_style.css', __FILE__ ) , null ,'5.0.5' );
183
}
184
return;
185
}
@@ -529,7 +536,7 @@ class quick_page_post_reds {
529
<td><label><span style="color:#FF0000;font-weight:bold;font-size:100%;margin-left:0px;">Hide</span> meta box for following Post Types:</label><?php echo $ptypeHTML;?></td>
530
</tr>
531
<!--tr valign="top">
532
- <td><label>Use with jQuery? <i><font size="2" color="#FF0000">(unavailable at this time)</font></i></label> <!--input type="checkbox" name="ppr_use-jquery" value="1"<?php if(get_option('ppr_use-jquery')=='1'){echo ' checked="checked" ';} ?>/--> <input type="checkbox" name="ppr_use-jquery" value="0" disabled /><span>disabled in current version<!--Increases effectiveness of plugin. If you have a jQuery conflict, try turning this off.--></span></td>
533
</tr-->
534
<tr valign="top">
535
<td><label>Meta Refresh Time (in seconds):</label> <input type="text" size="5" name="ppr_meta-seconds" value="<?php echo get_option('ppr_meta-seconds');?>" /> <span>Only needed for Meta Refresh. 0=default (instant)</span></td>
@@ -623,6 +630,7 @@ class quick_page_post_reds {
623
624
</ol>
625
<form method="post" action="admin.php?page=redirect-updates">
626
<table>
627
<tr>
628
<th align="left">Request</th>
@@ -959,7 +967,6 @@ class quick_page_post_reds {
959
exit;
960
} else {
961
$config_file = file_get_contents( $_FILES['qppr_file_add']['tmp_name'] );
962
- //------------
963
if ( strpos($config_file,'|') === false ) {
964
wp_die('This does not look like the file is in the correct format - it is possibly damaged or corrupt.<br/>be sure the redirects are 1 per line and the redirect and destination are seperated by a PIPE (|).<br/>Example:<br/><br/><code>redirect|destination</code>', 'ERROR - Not a valid File',array('response'=>'200','back_link'=>'1'));
965
exit;
@@ -1004,7 +1011,6 @@ class quick_page_post_reds {
1004
exit;
1005
endif;
1006
}
1007
- //-------------
1008
}
1009
} return;
1010
}
@@ -1097,11 +1103,10 @@ class quick_page_post_reds {
1097
// The actual fields for data entry
1098
$pprredirecttype = get_post_meta($post->ID, '_pprredirect_type', true) !='' ? get_post_meta($post->ID, '_pprredirect_type', true) : "";
1099
$pprredirecturl = get_post_meta($post->ID, '_pprredirect_url', true)!='' ? get_post_meta($post->ID, '_pprredirect_url', true) : "";
1100
- //echo $pprredirecttype.'|'.$pprredirecturl;
1101
echo '<label for="pprredirect_active" style="padding:2px 0;"><input type="checkbox" name="pprredirect_active" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_active',true),0).' />&nbsp;Make Redirect <b>Active</b>.<span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">Check to turn on or redirect will not work.</span></span></label><br />';
1102
echo '<label for="pprredirect_newwindow" style="padding:2px 0;"><input type="checkbox" name="pprredirect_newwindow" id="pprredirect_newwindow" value="_blank" '. checked('_blank',get_post_meta($post->ID,'_pprredirect_newwindow',true),0).'>&nbsp;Open redirect link in a <b>new window.</b><span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not work in all cases.</span></span></label><br />';
1103
echo '<label for="pprredirect_relnofollow" style="padding:2px 0;"><input type="checkbox" name="pprredirect_relnofollow" id="pprredirect_relnofollow" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_relnofollow',true),0).'>&nbsp;Add <b>rel="nofollow"</b> to redirect link.<span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not work in all cases.</span></span></label><br />';
1104
- echo '<label for="pprredirect_rewritelink" style="padding:2px 0;"><input type="checkbox" name="pprredirect_rewritelink" id="pprredirect_rewritelink" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_rewritelink',true),0).'>&nbsp;<b>Show</b> the Redirect URL instead of original URL. <span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not always work and will only show the link - <strong><em>NOT in the Address bar.</em></strong></span></span></label><br /><br />';
1105
//echo '<label for="pprredirect_casesensitive" style="padding:2px 0;"><input type="checkbox" name="pprredirect_casesensitive" id="pprredirect_casesensitive" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_casesensitive',true),0).'>&nbsp;Make the Redirect Case Insensitive.</label><br /><br />';
1106
echo '<label for="pprredirect_url"><b>Redirect URL:</b></label><br />';
1107
echo '<input type="text" style="width:75%;margin-top:2px;margin-bottom:2px;" name="pprredirect_url" value="'.$pprredirecturl.'" /><span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help"><br />(i.e., <strong>http://example.com</strong> or <strong>/somepage/</strong> or <strong>p=15</strong> or <strong>155</strong>. Use <b>FULL URL</b> <i>including</i> <strong>http://</strong> for all external <i>and</i> meta redirects.)</span></span><br /><br />';
@@ -1145,20 +1150,33 @@ class quick_page_post_reds {
1145
[query]
1146
[fragment]
1147
*/
1148
- if(substr($url,0,2) == 'p='){ // page or post id
1149
$url = network_site_url().'/?'.$url;
1150
}elseif(is_numeric($url)){ // page or post id
1151
$url = network_site_url().'/?'.$url;
1152
- }elseif($url[0] == "/" ){ // root
1153
$url = network_site_url().'/';
1154
- }elseif(strpos($url,"://") === false ){ // no protocol so add it
1155
- $url = "http://".$url;
1156
}
1157
- $info = parse_url($url);
1158
- $info['url'] = $url;
1159
- //echo $info['url'];
1160
return $info;
1161
}
1162
function isOne_none($val=''){ //true (1) or false =''
1163
if($val == '_blank'){
1164
return $val;
@@ -1192,8 +1210,9 @@ class quick_page_post_reds {
1192
$my_meta_data['_pprredirect_url'] = isset($_REQUEST['pprredirect_url']) ? sanitize_meta( '_pprredirect_url', ( $_REQUEST['pprredirect_url'] ), 'post' ) : '';
1193
1194
$info = $this->appip_parseURI($my_meta_data['_pprredirect_url']);
1195
-
1196
- $my_meta_data['_pprredirect_url'] = esc_url_raw($info['url']);
1197
if($my_meta_data['_pprredirect_url'] == 'http://' || $my_meta_data['_pprredirect_url'] == 'https://' || $my_meta_data['_pprredirect_url'] == ''){
1198
$my_meta_data['_pprredirect_url'] = ''; //reset to nothing
1199
$my_meta_data['_pprredirect_type'] = NULL; //clear Type if no URL is set.
@@ -1447,6 +1466,7 @@ class quick_page_post_reds {
1447
// END Main Redirect Class.
1448
//=======================================
1449
function start_ppr_class(){
1450
- $redirect_plugin = new quick_page_post_reds(); // call our class
1451
}
1452
?>
6
Author: Don Fischer
7
Author URI: http://www.fischercreativemedia.com/
8
Donate link: http://www.fischercreativemedia.com/donations/
9
+ Version: 5.0.6
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
13
+ * Copyright (C) 2009-2014 Donald J. Fischer <dfischer [at] fischercreativemedia [dot] com>
14
+ *
15
+ * This program is free software; you can redistribute it and/or
16
+ * modify it under the terms of the [GNU General Public License](http://wordpress.org/about/gpl/)
17
+ * as published by the Free Software Foundation; either version 2
18
+ * of the License, or (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * on an "AS IS", but WITHOUT ANY WARRANTY; without even the implied
22
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
+ * See the GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, see [GNU General Public Licenses](http://www.gnu.org/licenses/),
27
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
28
+ * Fifth Floor, Boston, MA 02110-1301, USA.
29
+
30
+ ==========
31
+ You can use the following action hooks with this plugin:
32
33
+ *** Quick Rediects function: use to take over redirect
34
+ add_action('qppr_redirect','some_callback_function',10,2);
35
+ arg 1. is Redirect URL
36
+ arg 2. is Redirect Type
37
+ *******************************
38
39
+ *** Page/Post Redirects function: use to take over redirect
40
+ add_action('qppr_do_redirect','some_callback_function2',10,2);
41
+ arg 1. is Redirect URL
42
+ arg 2. is Redirect Type
43
+ *******************************
44
45
+ *** Meta Redirect Action: Used for Meta Redirect Page Headers (so you can add meta tag)
46
+ add_action('ppr_meta_head_hook','some_callback',10,3);
47
+ arg 1. URL site
48
+ arg 2. Meta Redirect Time in Seconds
49
+ arg 3. Meta Message to display
50
+ Example:
51
add_action('ppr_meta_head_hook','override_ppr_metahead',10,3);
52
function override_ppr_metahead($refresh_url='',$refresh_secs=0,$messages=''){
53
echo '<meta http-equiv="refresh" content="'.$refresh_secs.'; URL='.$refresh_url.'" />'."\n";
54
echo '<div id="ppr_custom_message">'. $messages.'</div>'."\n";
55
return;
56
}
57
+ *******************************
58
+
59
+ *** Meta Redirect Filter: Used for Meta Redirect Page Headers (so you can add meta and message, etc.)
60
+ add_filter('ppr_meta_head_hook_filter','some_callback2',10,2);
61
+ arg 1. Meta Tag (fully generated)
62
+ arg 2. Page HTML Message (wrapped in a <div> tag)
63
+ Example:
64
add_filter('ppr_meta_head_hook_filter','override_ppr_metahead_new');
65
function override_ppr_metahead_new($meta_tag='',$meta_message=''){
66
$meta = $meta_tag;
70
add_filter('get_title',$function2,100,1);
71
return $meta;
72
}
73
+ *******************************
74
+ */
75
+ global $newqppr, $redirect_plugin;
76
+ start_ppr_class();
77
if (!function_exists('esc_attr')) { // For WordPress < 2.8 function compatibility
78
function esc_attr($attr){return attribute_escape( $attr );}
79
function esc_url($url){return clean_url( $url );}
80
}
81
82
//=======================================
83
// Main Redirect Class.
114
public $pprptypes_ok;
115
116
function __construct() {
117
+ $this->ppr_curr_version = '5.0.6';
118
$this->ppr_nofollow = array();
119
$this->ppr_newindow = array();
120
$this->ppr_url = array();
166
add_filter( 'post_type_link', array( $this, 'ppr_filter_page_links' ), 20, 2 );
167
add_filter( 'get_permalink', array( $this, 'ppr_filter_links' ), 20, 2 );
168
}
169
+ add_action('admin_init', array($this,'save_quick_redirects_fields'));
170
+ }
171
+ function save_quick_redirects_fields(){
172
+ if( isset( $_POST['submit_301'] ) ) {
173
+ if(check_admin_referer( 'add_qppr_redirects' )){
174
+ $this->quickppr_redirects = $this->save_redirects( $_POST['quickppr_redirects'] );
175
+ $this->updatemsg ='Quick Redirects Updated.';
176
+ }
177
+ } //if submitted and verified, process the data
178
}
179
function ppr_add_menu(){
180
add_menu_page( 'Redirect Options', 'Redirect Options', 'administrator', 'redirect-options', array($this,'ppr_settings_page'),plugins_url( 'settings-16-icon.png' , __FILE__));
181
add_submenu_page( 'redirect-options', 'Quick Redirects', 'Quick Redirects', 'manage_options', 'redirect-updates', array($this,'ppr_options_page') );
185
}
186
function qppr_admin_scripts($hook){
187
if(in_array($hook, array('edit.php','post.php'))){
188
+ wp_enqueue_script( 'qppr_admin_meta_script', plugins_url('/qppr_admin_script.js', __FILE__ ) , array('jquery'),'5.0.6');
189
+ wp_enqueue_style( 'qppr_admin_meta_style', plugins_url('/qppr_admin_style.css', __FILE__ ) , null ,'5.0.6' );
190
}
191
return;
192
}
536
<td><label><span style="color:#FF0000;font-weight:bold;font-size:100%;margin-left:0px;">Hide</span> meta box for following Post Types:</label><?php echo $ptypeHTML;?></td>
537
</tr>
538
<!--tr valign="top">
539
+ <td><label>Use with jQuery? <i><font size="2" color="#FF0000">(unavailable at this time)</font></i></label> <input type="checkbox" name="ppr_use-jquery" value="1"<?php if(get_option('ppr_use-jquery')=='1'){echo ' checked="checked" ';} ?>/> <input type="checkbox" name="ppr_use-jquery" value="0" disabled /><span>disabled in current version<!--Increases effectiveness of plugin. If you have a jQuery conflict, try turning this off.></span></td>
540
</tr-->
541
<tr valign="top">
542
<td><label>Meta Refresh Time (in seconds):</label> <input type="text" size="5" name="ppr_meta-seconds" value="<?php echo get_option('ppr_meta-seconds');?>" /> <span>Only needed for Meta Refresh. 0=default (instant)</span></td>
630
631
</ol>
632
<form method="post" action="admin.php?page=redirect-updates">
633
+ <?php wp_nonce_field( 'add_qppr_redirects' ); ?>
634
<table>
635
<tr>
636
<th align="left">Request</th>
967
exit;
968
} else {
969
$config_file = file_get_contents( $_FILES['qppr_file_add']['tmp_name'] );
970
if ( strpos($config_file,'|') === false ) {
971
wp_die('This does not look like the file is in the correct format - it is possibly damaged or corrupt.<br/>be sure the redirects are 1 per line and the redirect and destination are seperated by a PIPE (|).<br/>Example:<br/><br/><code>redirect|destination</code>', 'ERROR - Not a valid File',array('response'=>'200','back_link'=>'1'));
972
exit;
1011
exit;
1012
endif;
1013
}
1014
}
1015
} return;
1016
}
1103
// The actual fields for data entry
1104
$pprredirecttype = get_post_meta($post->ID, '_pprredirect_type', true) !='' ? get_post_meta($post->ID, '_pprredirect_type', true) : "";
1105
$pprredirecturl = get_post_meta($post->ID, '_pprredirect_url', true)!='' ? get_post_meta($post->ID, '_pprredirect_url', true) : "";
1106
echo '<label for="pprredirect_active" style="padding:2px 0;"><input type="checkbox" name="pprredirect_active" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_active',true),0).' />&nbsp;Make Redirect <b>Active</b>.<span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">Check to turn on or redirect will not work.</span></span></label><br />';
1107
echo '<label for="pprredirect_newwindow" style="padding:2px 0;"><input type="checkbox" name="pprredirect_newwindow" id="pprredirect_newwindow" value="_blank" '. checked('_blank',get_post_meta($post->ID,'_pprredirect_newwindow',true),0).'>&nbsp;Open redirect link in a <b>new window.</b><span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not work in all cases.</span></span></label><br />';
1108
echo '<label for="pprredirect_relnofollow" style="padding:2px 0;"><input type="checkbox" name="pprredirect_relnofollow" id="pprredirect_relnofollow" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_relnofollow',true),0).'>&nbsp;Add <b>rel="nofollow"</b> to redirect link.<span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not work in all cases.</span></span></label><br />';
1109
+ echo '<label for="pprredirect_rewritelink" style="padding:2px 0;"><input type="checkbox" name="pprredirect_rewritelink" id="pprredirect_rewritelink" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_rewritelink',true),0).'>&nbsp;<b>Show</b> the Redirect URL instead of original URL. <span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help">May not always work and will only show the link - <strong><em>but NOT in the Address bar, just the link itself.</em></strong></span></span></label><br /><br />';
1110
//echo '<label for="pprredirect_casesensitive" style="padding:2px 0;"><input type="checkbox" name="pprredirect_casesensitive" id="pprredirect_casesensitive" value="1" '. checked('1',get_post_meta($post->ID,'_pprredirect_casesensitive',true),0).'>&nbsp;Make the Redirect Case Insensitive.</label><br /><br />';
1111
echo '<label for="pprredirect_url"><b>Redirect URL:</b></label><br />';
1112
echo '<input type="text" style="width:75%;margin-top:2px;margin-bottom:2px;" name="pprredirect_url" value="'.$pprredirecturl.'" /><span class="qppr_meta_help_wrap"><span class="qppr_meta_help_icon">?</span><span class="qppr_meta_help"><br />(i.e., <strong>http://example.com</strong> or <strong>/somepage/</strong> or <strong>p=15</strong> or <strong>155</strong>. Use <b>FULL URL</b> <i>including</i> <strong>http://</strong> for all external <i>and</i> meta redirects.)</span></span><br /><br />';
1150
[query]
1151
[fragment]
1152
*/
1153
+ $strip_protocol = 0;
1154
+ $tostrip = '';
1155
+ //if($url == '' || $url == 'http://' || $url == 'https://' ){ return $url;}
1156
+
1157
+ if(substr($url,0,2) == 'p=' || substr($url,0,8) == 'page_id='){ // page or post id
1158
$url = network_site_url().'/?'.$url;
1159
}elseif(is_numeric($url)){ // page or post id
1160
$url = network_site_url().'/?'.$url;
1161
+ }elseif($url == "/" ){ // root
1162
$url = network_site_url().'/';
1163
+ }elseif(substr($url,0,1) == '/' ){ // relative to root
1164
+ $url = network_site_url().$url;
1165
+ $strip_protocol = 1;
1166
+ $tostrip = network_site_url();
1167
+ }elseif(substr($url,0,7) != 'http://' && substr($url,0,8) != 'https://' ){ // no protocol so add it
1168
+ //$url = "http://".$url;
1169
+ //desided not to add it automatically.
1170
+ }
1171
+ $info = @parse_url($url);
1172
+ if($strip_protocol == 1 && $tostrip != '' ){
1173
+ $info['url'] = str_replace($tostrip, '', $url);
1174
+ }else{
1175
+ $info['url'] = $url;
1176
}
1177
return $info;
1178
}
1179
+
1180
function isOne_none($val=''){ //true (1) or false =''
1181
if($val == '_blank'){
1182
return $val;
1210
$my_meta_data['_pprredirect_url'] = isset($_REQUEST['pprredirect_url']) ? sanitize_meta( '_pprredirect_url', ( $_REQUEST['pprredirect_url'] ), 'post' ) : '';
1211
1212
$info = $this->appip_parseURI($my_meta_data['_pprredirect_url']);
1213
+ //$my_meta_data['_pprredirect_url'] = esc_url_raw($info['url']);
1214
+ $my_meta_data['_pprredirect_url'] = $info['url'];
1215
+
1216
if($my_meta_data['_pprredirect_url'] == 'http://' || $my_meta_data['_pprredirect_url'] == 'https://' || $my_meta_data['_pprredirect_url'] == ''){
1217
$my_meta_data['_pprredirect_url'] = ''; //reset to nothing
1218
$my_meta_data['_pprredirect_type'] = NULL; //clear Type if no URL is set.
1466
// END Main Redirect Class.
1467
//=======================================
1468
function start_ppr_class(){
1469
+ global $newqppr, $redirect_plugin;
1470
+ $redirect_plugin = $newqppr = new quick_page_post_reds(); // call our class
1471
}
1472
?>
readme.txt CHANGED
@@ -2,20 +2,21 @@
2
Contributors: Don Fischer
3
Donate link: http://www.fischercreativemedia.com/donations/
4
Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct, nofollow, menu links, posts, pages, admin, 404, custom post types, nav menu, import, export, restore
5
- Requires at least: 3.1
6
- Tested up to: 3.8.2
7
Stable tag: trunk
8
9
Redirect Pages/Posts to another page/post or external URL. Has edit box as well as global options. Specify the redirect Location and type. For PHP5+
10
11
== Description ==
12
- Version 5.0.5.
13
This plugin adds 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 below for additional features added.
14
15
= Features: =
16
- * Works with new WordPress menus
17
- * Works with new WordPress Custom Post Types (set option on settings page)
18
- * Disabled in 5.0.3: [jQuery integration for more enhanced re-writes (set option on settings page)].
19
* You can set a redirect page or menu link to open in a new window (will not work on permalinks)
20
* You can add a *rel="nofollow"* attribute to the page or menu link of the redirect (will not work on permalinks)
21
* You can completely re-write the URL for the redirect so it takes the place of the default page URL (rewrite the href link)
@@ -28,7 +29,12 @@ This plugin adds adds an option box to the edit section where you can specify th
28
* Import/Export of redirects for backup, or to bulk add redirects.
29
* Built-in FAQs/Help that can be updated daily with relevant questions.
30
31
- This plugin is not compatible with WordPress versions less than 3.1. Requires PHP 5+.
32
33
*PLEASE NOTE:* A new page or post needs to be Published in order for Page/Post redirect to happen. It WILL work on a DRAFT Status Post/Page ONLY, and I mean ONLY, if the Post/Page has FIRST been Published and the re-saved as a Draft. This does not apply to Quick Redirects.
34
@@ -129,6 +135,10 @@ NO it isn't! Check the plugin FAQs/Help page for a more up to date list of Frequ
129
5. Summary of redirects plugin page.
130
131
== Changelog ==
132
= 5.0.5 =
133
* Fix to security flaw for logged in admin users.
134
* Fix to extra spaces that broke some callback functions in the redirect class in 5.0.4.
@@ -251,5 +261,6 @@ NO it isn't! Check the plugin FAQs/Help page for a more up to date list of Frequ
251
* Initial Plugin creation (7/1/2009)
252
253
== Upgrade Notice ==
254
- = 5.0.5 =
255
- Fix to security flaw for logged in admin users and extra spaces that broke some callback functions in the class in 5.0.4.
2
Contributors: Don Fischer
3
Donate link: http://www.fischercreativemedia.com/donations/
4
Tags: redirect, 301, 302, meta, post, plugin, page, forward, re-direct, nofollow, menu links, posts, pages, admin, 404, custom post types, nav menu, import, export, restore
5
+ Requires at least: 3.9
6
+ Tested up to: 4.2.2
7
Stable tag: trunk
8
9
Redirect Pages/Posts to another page/post or external URL. Has edit box as well as global options. Specify the redirect Location and type. For PHP5+
10
11
== Description ==
12
+ Version 5.0.6.
13
This plugin adds 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 below for additional features added.
14
15
+ This plugin works best when you have some form of Permalink Stucture set up. If you have other Redirect plugins installed, it is recommeded that you use only one redirect plugin or they may conflict or one may take over before the other can do its job.
16
+
17
= Features: =
18
+ * Works with WordPress Menus
19
+ * Works with WordPress Custom Post Types (set option on settings page)
20
* You can set a redirect page or menu link to open in a new window (will not work on permalinks)
21
* You can add a *rel="nofollow"* attribute to the page or menu link of the redirect (will not work on permalinks)
22
* You can completely re-write the URL for the redirect so it takes the place of the default page URL (rewrite the href link)
29
* Import/Export of redirects for backup, or to bulk add redirects.
30
* Built-in FAQs/Help that can be updated daily with relevant questions.
31
32
+ = What You CANNOT Do: =
33
+ * This plugin does not have wildcard redirect features
34
+ * You cannot redirect the Home (Posts) page - unless you set a page as the home page and redirect that.
35
+ * If your theme uses some form of custom layout or funcitonality, some features may not work.
36
+
37
+ This plugin is not compatible with WordPress versions less than 3.9. Requires PHP 5.2+.
38
39
*PLEASE NOTE:* A new page or post needs to be Published in order for Page/Post redirect to happen. It WILL work on a DRAFT Status Post/Page ONLY, and I mean ONLY, if the Post/Page has FIRST been Published and the re-saved as a Draft. This does not apply to Quick Redirects.
40
135
5. Summary of redirects plugin page.
136
137
== Changelog ==
138
+ = 5.0.6 =
139
+ * Fix to some users getting Warning messages for parse_url function.
140
+ * Added nonce field checking for Quick Redirects form to help eliminate the possibility of form takeover on submission of quick redirect saves.
141
+
142
= 5.0.5 =
143
* Fix to security flaw for logged in admin users.
144
* Fix to extra spaces that broke some callback functions in the redirect class in 5.0.4.
261
* Initial Plugin creation (7/1/2009)
262
263
== Upgrade Notice ==
264
+ = 5.0.6 =
265
+ * Fix Warning Message from parse_url function for some users.
266
+ * Added Nonce to form to prevent possible maliscious form takeover on saving Quick Redirects.