Quick Page/Post Redirect Plugin - Version 5.0.2

Version Description

  • Bug fixes and jQuery now set to off until issues are resolved.
  • Set Case Sensetive to on by default - Some people having issues with infinite loops.
Download this release

Release Info

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

Code changes from version 5.0.1 to 5.0.2

Files changed (2) hide show
  1. page_post_redirect_plugin.php +34 -26
  2. readme.txt +6 -2
page_post_redirect_plugin.php CHANGED
@@ -6,7 +6,7 @@ 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.1
10
 
11
  Version info:
12
  See change log in readme.txt file.
@@ -113,7 +113,7 @@ class quick_page_post_reds {
113
  public $pprptypes_ok;
114
 
115
  function __construct() {
116
- $this->ppr_curr_version = '5.0';
117
  $this->ppr_nofollow = array();
118
  $this->ppr_newindow = array();
119
  $this->ppr_url = array();
@@ -234,20 +234,24 @@ jQuery(document).ready(function() {
234
  var tempdf = '';
235
  var jqvers = parseFloat(jQuery().jquery, 3);
236
  //this checks for jQuery version and serves correct script (i.e., prop vs attr)
 
237
  if(jqvers >= 1.6){
238
  jQuery('a').each(function (i) {
239
  var tempfga = jQuery(this).attr('href');
240
- if(tempfga != '' && typeof tempfga != 'undefined'){
 
 
241
  var tempfg = tempfga.replace(pprspoturl,'');
242
  var tempfg2 = tempfg.replace(/\//gi,'');
243
  var tempfg3 = tempfga.replace(/\//gi,'');
244
  var tempfh = jQuery(this).prop('rel');
245
  var tempfi = jQuery(this).prop('target');
246
  if(pprrewrite == '1'){
247
- pprnewurl = jQuery(this).attr('href',pprrewriteurl);
 
248
  }
249
  if(jQuery.inArray(tempfg2, pprNoFollArr) >= 0 || jQuery.inArray(tempfg3, pprNoFollArr) >= 0){
250
- if(tempfh =='' || tempfh =='undefined' ){
251
  jQuery(this).prop('rel','nofollow');
252
  }else{
253
  if(tempfh != 'nofollow' && tempfh.indexOf('nofollow') == -1){
@@ -258,24 +262,27 @@ jQuery(document).ready(function() {
258
  }
259
  if(jQuery.inArray(tempfg2,pprNewWinArr) >= 0 || jQuery.inArray(tempfg3, pprNewWinArr) >= 0){
260
  jQuery(this).addClass('qppr-nw');
261
- if(tempfi =='' || tempfi =='undefined'){jQuery(this).prop('target','_blank');}
262
  }
263
  }
264
  });
265
  }else{
266
  jQuery('a').each(function (i) {
267
  var tempfga = jQuery(this).attr('href');
268
- if(tempfga != '' && typeof tempfga != 'undefined'){
 
 
269
  var tempfg = tempfga.replace(pprspoturl,'');
270
  var tempfg2 = tempfg.replace(/\//gi,'');
271
  var tempfg3 = tempfga.replace(/\//gi,'');
272
  var tempfh = jQuery(this).attr('rel');
273
  var tempfi = jQuery(this).attr('target');
274
  if(pprrewrite == '1'){
275
- pprnewurl = jQuery(this).attr('href',pprrewriteurl);
 
276
  }
277
  if(jQuery.inArray(tempfg2, pprNoFollArr) >= 0 || jQuery.inArray(tempfg3, pprNoFollArr) >= 0){
278
- if(tempfh =='' || tempfh =='undefined' ){
279
  jQuery(this).attr('rel','nofollow');
280
  }else{
281
  if(tempfh != 'nofollow' && tempfh.indexOf('nofollow') == -1){
@@ -286,13 +293,15 @@ jQuery(document).ready(function() {
286
  }
287
  if(jQuery.inArray(tempfg2,pprNewWinArr) >= 0 || jQuery.inArray(tempfg3, pprNewWinArr) >= 0){
288
  jQuery(this).addClass('qppr-nw');
289
- if(tempfi =='' || tempfi =='undefined'){jQuery(this).attr('target','_blank');}
290
  }
291
  }
292
  });
293
  }
294
  });
295
  ";
 
 
296
  update_option('qppr_jQuery_cache',$theScript);
297
  $this->quickppr_jquerycache = get_option('qppr_jQuery_cache');
298
  }
@@ -646,7 +655,8 @@ jQuery(document).ready(function() {
646
  <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>
647
  </tr>
648
  <tr valign="top">
649
- <td><label>Use with jQuery?</label> <input type="checkbox" name="ppr_use-jquery" value="1"<?php if(get_option('ppr_use-jquery')=='1'){echo ' checked="checked" ';} ?>/>
 
650
  <span>Increases effectiveness of plugin. If you have a jQuery
651
  conflict, try turning this off.</span></td>
652
  </tr>
@@ -722,29 +732,24 @@ jQuery(document).ready(function() {
722
  <?php if($this->updatemsg!=''){?><div class="updated settings-error" id="setting-error-settings_updated"><p><strong><?php echo $this->updatemsg;?></strong></p></div><?php } ?>
723
  <?php $this->updatemsg ='';//reset message;?>
724
  <?php $isJQueryOn = get_option('ppr_use-jquery');$isJQueryMsgHidden = get_option('qppr_jQuery_hide_message');$isJQueryMsgHidden2 = get_option('qppr_jQuery_hide_message2');?>
 
725
  <?php if($isJQueryOn == '' && ($isJQueryMsgHidden =='' || $isJQueryMsgHidden =='0')){?>
726
- <div class="usejqpprmessage error below-h2" id="usejqpprmessage"><code>Use with jQuery</code> option is turned off in plugin settings.<br/>
727
- In order to use NW (open in a new window) or NF (add rel="nofollow") options for Quick Redirects, you must have it enabled.<br/>
728
  <div class="hidepprjqmessage" style=""><a href="javascript:void(0);" id="hidepprjqmessage">hide this message</a></div></div>
729
  <?php }elseif($isJQueryMsgHidden2 !='1'){ ?>
730
- <div class="usejqpprmessage info below-h2" id="usejqpprmessage2">The
731
- <b>NW </b>(open in a new window)<b> NF</b> (nofollow) options are new for this version.<br/>
732
- To use them, just click the appropriate option and update. Then, any link in the page that has the request URL will be updated with these options (as long as you have <code>use with jQuery</code> enabled in the plugin settings.
733
  <div class="hidepprjqmessage" style=""><a href="javascript:void(0);" id="hidepprjqmessage2">hide this message</a></div></div>
734
  <?php }else{ ?>
735
  <br/>
736
  <?php }?>
737
- This section is useful if you have links from an old site and need to have them redirect to a new location on the current site, or if you have an existing URL that you need to send some place else and you don't want to have a Page or Post created to use the other Page/Post Redirect option.
738
- To add these additional 301 redirects, put the URL you want to redirect into the Request field and the
739
- place it should redirect to in the Destination field. To delete a redirect, click the 'x' next to the Destination Field.
740
- If you want the redirect to open in a new window or to add rel=nofollow
741
- to the link, select the NW (new Window) or NF (no Follow) boxes next to
742
- the appropriate redirect (must enable 'use jQuery' in settings for this
743
- to work).
744
  <br/>
745
  <br/><b style="color:red;">IMPORTANT TROUBLE SHOOTING NOTES:</b>
746
  <ol>
747
- <li style="color:#214070;margin-left:25px;list-style-type:disc;">The
 
748
  <b>Request</b> field MUST be relative to the ROOT directory and contain the
749
  <code>/</code> at the beginning.</li>
750
  <li style="color:#214070;margin-left:25px;list-style-type:disc;">The
@@ -761,6 +766,7 @@ jQuery(document).ready(function() {
761
  there needs to be a link that they click on in your site so that
762
  the jQuery script can add the appropriate <code>target</code> and <code>rel</code> properties to the link to make it work.</li></ol>
763
  </li>
 
764
  </ol>
765
  <form method="post" action="admin.php?page=redirect-updates">
766
  <table>
@@ -1227,8 +1233,10 @@ jQuery(document).ready(function() {
1227
 
1228
  global $wpdb;
1229
  if($this->thepprversion != $this->ppr_curr_version){
1230
- update_option( 'ppr_use-jquery','1'); //default to on
1231
- $this->ppruse_jquery = '1';
 
 
1232
  update_option( 'ppr_version', $this->ppr_curr_version );
1233
  }
1234
  if($this->thepprmeta != '1'){
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
  Donate link: http://www.fischercreativemedia.com/donations/
9
+ Version: 5.0.2
10
 
11
  Version info:
12
  See change log in readme.txt file.
113
  public $pprptypes_ok;
114
 
115
  function __construct() {
116
+ $this->ppr_curr_version = '5.0.2';
117
  $this->ppr_nofollow = array();
118
  $this->ppr_newindow = array();
119
  $this->ppr_url = array();
234
  var tempdf = '';
235
  var jqvers = parseFloat(jQuery().jquery, 3);
236
  //this checks for jQuery version and serves correct script (i.e., prop vs attr)
237
+ //alert(jqvers);
238
  if(jqvers >= 1.6){
239
  jQuery('a').each(function (i) {
240
  var tempfga = jQuery(this).attr('href');
241
+ if(tempfga == '' || typeof tempfga == 'undefined' || tempfga === undefined ){
242
+ // do nothing
243
+ }else{
244
  var tempfg = tempfga.replace(pprspoturl,'');
245
  var tempfg2 = tempfg.replace(/\//gi,'');
246
  var tempfg3 = tempfga.replace(/\//gi,'');
247
  var tempfh = jQuery(this).prop('rel');
248
  var tempfi = jQuery(this).prop('target');
249
  if(pprrewrite == '1'){
250
+ //pprnewurl = jQuery(this).attr('href',pprrewriteurl);
251
+ // Temp Remove as it causes the all links to be redirected in 5.0.1
252
  }
253
  if(jQuery.inArray(tempfg2, pprNoFollArr) >= 0 || jQuery.inArray(tempfg3, pprNoFollArr) >= 0){
254
+ if(tempfh =='' || tempfh =='undefined' || tempfh === undefined || typeof tempfh == 'undefined' ){
255
  jQuery(this).prop('rel','nofollow');
256
  }else{
257
  if(tempfh != 'nofollow' && tempfh.indexOf('nofollow') == -1){
262
  }
263
  if(jQuery.inArray(tempfg2,pprNewWinArr) >= 0 || jQuery.inArray(tempfg3, pprNewWinArr) >= 0){
264
  jQuery(this).addClass('qppr-nw');
265
+ if(tempfi =='' || tempfi =='undefined' || tempfi === undefined || typeof tempfi == 'undefined'){jQuery(this).prop('target','_blank');}
266
  }
267
  }
268
  });
269
  }else{
270
  jQuery('a').each(function (i) {
271
  var tempfga = jQuery(this).attr('href');
272
+ if(tempfga == '' || typeof tempfga == 'undefined' || tempfga === undefined ){
273
+ // do nothing
274
+ }else{
275
  var tempfg = tempfga.replace(pprspoturl,'');
276
  var tempfg2 = tempfg.replace(/\//gi,'');
277
  var tempfg3 = tempfga.replace(/\//gi,'');
278
  var tempfh = jQuery(this).attr('rel');
279
  var tempfi = jQuery(this).attr('target');
280
  if(pprrewrite == '1'){
281
+ //pprnewurl = jQuery(this).attr('href',pprrewriteurl);
282
+ // Temp Remove as it causes the all links to be redirected in 5.0.1
283
  }
284
  if(jQuery.inArray(tempfg2, pprNoFollArr) >= 0 || jQuery.inArray(tempfg3, pprNoFollArr) >= 0){
285
+ if(tempfh =='' || tempfh =='undefined' || tempfh === undefined || typeof tempfh == 'undefined' ){
286
  jQuery(this).attr('rel','nofollow');
287
  }else{
288
  if(tempfh != 'nofollow' && tempfh.indexOf('nofollow') == -1){
293
  }
294
  if(jQuery.inArray(tempfg2,pprNewWinArr) >= 0 || jQuery.inArray(tempfg3, pprNewWinArr) >= 0){
295
  jQuery(this).addClass('qppr-nw');
296
+ if(tempfi =='' || tempfi =='undefined' || tempfi === undefined || typeof tempfi == 'undefined' ){jQuery(this).attr('target','_blank');}
297
  }
298
  }
299
  });
300
  }
301
  });
302
  ";
303
+ //temp fix until this is resolved:
304
+ $theScript = '';
305
  update_option('qppr_jQuery_cache',$theScript);
306
  $this->quickppr_jquerycache = get_option('qppr_jQuery_cache');
307
  }
655
  <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>
656
  </tr>
657
  <tr valign="top">
658
+ <td><label>Use with jQuery?</label> <!--input type="checkbox" name="ppr_use-jquery" value="1"<?php if(get_option('ppr_use-jquery')=='1'){echo ' checked="checked" ';} ?>/-->
659
+ <input type="checkbox" name="ppr_use-jquery" value="0" disabled />
660
  <span>Increases effectiveness of plugin. If you have a jQuery
661
  conflict, try turning this off.</span></td>
662
  </tr>
732
  <?php if($this->updatemsg!=''){?><div class="updated settings-error" id="setting-error-settings_updated"><p><strong><?php echo $this->updatemsg;?></strong></p></div><?php } ?>
733
  <?php $this->updatemsg ='';//reset message;?>
734
  <?php $isJQueryOn = get_option('ppr_use-jquery');$isJQueryMsgHidden = get_option('qppr_jQuery_hide_message');$isJQueryMsgHidden2 = get_option('qppr_jQuery_hide_message2');?>
735
+ <!--
736
  <?php if($isJQueryOn == '' && ($isJQueryMsgHidden =='' || $isJQueryMsgHidden =='0')){?>
737
+ <div class="usejqpprmessage error below-h2" id="usejqpprmessage"><code>Use with jQuery</code> option is turned off in plugin settings.<br/>In order to use NW (open in a new window) or NF (add rel="nofollow") options for Quick Redirects, you must have it enabled.<br/>
 
738
  <div class="hidepprjqmessage" style=""><a href="javascript:void(0);" id="hidepprjqmessage">hide this message</a></div></div>
739
  <?php }elseif($isJQueryMsgHidden2 !='1'){ ?>
740
+ <div class="usejqpprmessage info below-h2" id="usejqpprmessage2">The <b>NW </b>(open in a new window)<b> NF</b> (nofollow) options are new for this version.<br/>To use them, just click the appropriate option and update. Then, any link in the page that has the request URL will be updated with these options (as long as you have <code>use with jQuery</code> enabled in the plugin settings.
 
 
741
  <div class="hidepprjqmessage" style=""><a href="javascript:void(0);" id="hidepprjqmessage2">hide this message</a></div></div>
742
  <?php }else{ ?>
743
  <br/>
744
  <?php }?>
745
+ -->This section is useful if you have links from an old site and need to have them redirect to a new location on the current site, or if you have an existing URL that you need to send some place else and you don't want to have a Page or Post created to use the other Page/Post Redirect option.
746
+ To add these additional 301 redirects, put the URL you want to redirect into the Request field and the place it should redirect to in the Destination field. To delete a redirect, click the 'x' next to the Destination Field.
747
+ <!--If you want the redirect to open in a new window or to add rel=nofollow to the link, select the NW (new Window) or NF (no Follow) boxes next to the appropriate redirect (must enable 'use jQuery' in settings for this to work).-->
 
 
 
 
748
  <br/>
749
  <br/><b style="color:red;">IMPORTANT TROUBLE SHOOTING NOTES:</b>
750
  <ol>
751
+ <li>Until some jQuery issues are resolved, the New Window and No Follow features are not available for Quick Redirects.</li>
752
+ <!--<li style="color:#214070;margin-left:25px;list-style-type:disc;">The
753
  <b>Request</b> field MUST be relative to the ROOT directory and contain the
754
  <code>/</code> at the beginning.</li>
755
  <li style="color:#214070;margin-left:25px;list-style-type:disc;">The
766
  there needs to be a link that they click on in your site so that
767
  the jQuery script can add the appropriate <code>target</code> and <code>rel</code> properties to the link to make it work.</li></ol>
768
  </li>
769
+ -->
770
  </ol>
771
  <form method="post" action="admin.php?page=redirect-updates">
772
  <table>
1233
 
1234
  global $wpdb;
1235
  if($this->thepprversion != $this->ppr_curr_version){
1236
+ update_option( 'ppr_use-jquery','0'); //default to off
1237
+ update_option( 'ppr_override-casesensitive', '1' );
1238
+ $this->ppruse_jquery = '0';
1239
+ $this->pproverride_casesensitive = '1';
1240
  update_option( 'ppr_version', $this->ppr_curr_version );
1241
  }
1242
  if($this->thepprmeta != '1'){
readme.txt CHANGED
@@ -9,7 +9,7 @@ Stable tag: trunk
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.1.
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: =
@@ -129,6 +129,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.1 =
133
  * Fix to jQuery conflict issue.
134
 
@@ -232,4 +236,4 @@ NO it isn't! Check the plugin FAQs/Help page for a more up to date list of Frequ
232
 
233
  == Upgrade Notice ==
234
  = 5.0.1 =
235
- Fix to jQuery conlict in version 5.0 that caused some jQuery features to malfunction on frontend of site.
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.2.
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: =
129
  5. Summary of redirects plugin page.
130
 
131
  == Changelog ==
132
+ = 5.0.2 =
133
+ * Bug fixes and jQuery now set to off until issues are resolved.
134
+ * Set Case Sensetive to on by default - Some people having issues with infinite loops.
135
+
136
  = 5.0.1 =
137
  * Fix to jQuery conflict issue.
138
 
236
 
237
  == Upgrade Notice ==
238
  = 5.0.1 =
239
+ Fix to jQuery issue in versions 5.0 and 5.0.1 that caused some jQuery features to malfunction on frontend of site and updated default settingq for use with jQuery (default to off) and Case Seneitive (default to on).