Quick Page/Post Redirect Plugin - Version 5.0.3

Version Description

  • Minor bug cleanup update - (no new features added)
  • Bug fixes: Javascript ghost js file call fixed. Actions hooks not applying issue fixed. Querystring redirect issue addressed. Unset index errors addressed. Some Network/MU problems fixed.
  • Modified Import and Export scripts to export a more editable export file. Import can be either old encoded version or new readable PIPE version.
  • Typos and minor layout issues addressed.
Download this release

Release Info

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

Code changes from version 5.0.2 to 5.0.3

Files changed (2) hide show
  1. page_post_redirect_plugin.php +141 -105
  2. readme.txt +9 -3
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.2
10
 
11
  Version info:
12
  See change log in readme.txt file.
@@ -38,13 +38,13 @@ Version 3.2.4 to 4.0.1 are testing versions only
38
  //you can use the following action hooks with this plugin:
39
  // *** Quick Rediects function: use to take over redirect
40
  // add_action('qppr_redirect','some_callback_function',10,2);
41
- // value 1. is Redirect URL
42
- // value 2. is Redirect Type
43
  // *******************************
44
  // *** Page/Post Redirects function: use to take over redirect
45
  // add_action('qppr_do_redirect','some_callback_function2',10,2);
46
- // value 1. is Redirect URL
47
- // value 2. is Redirect Type
48
  // *******************************
49
  // *** Meta Redirect Action: Used for Meta Redirect Page Headers (so you can add meta tag)
50
  //add_action('ppr_meta_head_hook','some_callback',10,3);
@@ -63,8 +63,8 @@ Version 3.2.4 to 4.0.1 are testing versions only
63
  // *******************************
64
  // *** Meta Redirect Filter: Used for Meta Redirect Page Headers (so you can add meta and message, etc.)
65
  //add_filter('ppr_meta_head_hook_filter','some_callback2',10,2);
66
- // value 1. Meta Tag (fully generated)
67
- // value 2. Page HTML Message (wrapped in a <div> tag)
68
  // Example:
69
  add_filter('ppr_meta_head_hook_filter','override_ppr_metahead_new');
70
  function override_ppr_metahead_new($meta_tag='',$meta_message=''){
@@ -113,7 +113,7 @@ class quick_page_post_reds {
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();
@@ -134,10 +134,10 @@ class quick_page_post_reds {
134
  $this->pprmeta_message = get_option( 'ppr_meta-message' );
135
  $this->pprmeta_seconds = get_option( 'ppr_meta-seconds' );
136
  $this->pproverride_casesensitive = get_option( 'ppr_override-casesensitive' );
137
- $this->adminlink = get_bloginfo('url').'/wp-admin/';
138
  $this->fcmlink = 'http://www.fischercreativemedia.com/plugins';
139
  $this->ppr_metaurl = '';
140
- $this->quickppr_jquerycache = get_option( 'qppr_jQuery_cache' );
141
  $this->updatemsg = '';
142
  if($this->pprmeta_seconds==''){$this->pprmeta_seconds='0';}
143
 
@@ -146,7 +146,7 @@ class quick_page_post_reds {
146
  add_action( 'save_post', array($this,'ppr_save_metadata'),20,2 ); // save the custom fields
147
  add_action( 'wp',array($this,'ppr_parse_request') ); // parse query vars
148
  add_action( 'init',array($this,'ppr_parse_request_new') ); // parse query vars
149
- add_action( 'wp_enqueue_scripts',array($this,'ppr_do_jQuery'), 1, 2); // do the jQuery in site header
150
  add_action( 'admin_menu', array($this,'ppr_add_menu') ); // add the menu items needed
151
  add_action( 'admin_menu', array($this,'ppr_add_metabox') ); // add the metaboxes where needed
152
  add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this,'ppr_filter_plugin_actions') );
@@ -183,6 +183,7 @@ class quick_page_post_reds {
183
  }
184
 
185
  function build_jQueryCache(){
 
186
  $redirects = $this->quickppr_redirects;
187
  $redirectsmeta = $this->quickppr_redirectsmeta;
188
  $ppr_newWindowArray = array();
@@ -503,10 +504,12 @@ jQuery(document).ready(function() {
503
  }
504
 
505
  function ppr_settings_page() {
506
- if($_GET['update']=='3'){$this->updatemsg ='All Quick Redirects deleted from database.';}
507
- if($_GET['update']=='2'){$this->updatemsg ='All Regular Redirects deleted from database.';}
508
- if($_GET['update']=='4'){$this->updatemsg ='Quick Redirects Imported & Replaced.';}
509
- if($_GET['update']=='5'){$this->updatemsg ='Quick Redirects Importer & Added to Existing Redirects.';}
 
 
510
  ?>
511
  <div class="wrap" style="position:relative;">
512
  <style type="text/css">
@@ -563,7 +566,9 @@ jQuery(document).ready(function() {
563
  fname.value = '';
564
  }
565
  }
566
- function goOnConfirm(message, href) {if (confirm(message)) document.location.href = '/wp-admin/admin.php'+href;}
 
 
567
  </script>
568
  <div class="icon32" style="<?php echo 'background: url('.plugins_url( 'settings-icon.png' , __FILE__ ).') no-repeat transparent;';?>"><br></div>
569
  <h2>Quick Page Post Redirect Options & Settings</h2>
@@ -581,7 +586,7 @@ jQuery(document).ready(function() {
581
  <td><h2 style="font-size:20px;">Import/Export</h2></td>
582
  </tr>
583
  <tr valign="top">
584
- <td><label>Export Redirects </label><input class="button-secondary qppr_export_qr" type="button" name="qppr_export_qr" value="EXPORT all Quick Redirects" onclick="document.location='<?php echo wp_nonce_url( admin_url('admin.php?page=redirect-options').'&action=export_redirects_qppr', 'export-redirects-qppr'); ?>';" /></td>
585
  </tr>
586
  <tr valign="top">
587
  <td>
@@ -589,26 +594,20 @@ jQuery(document).ready(function() {
589
  <input class="button-secondary qppr_import_qr" type="button" id="qppr_import_qr_button" name="qppr_import_qr" value="RESTORE Saved Quick Redirects" /> OR <input class="button-secondary qppr_addto_qr" type="button" id="qppr_addto_qr_button" name="qppr_addto_qr" value="ADD TO Quick Redirects" />
590
  <div id="qppr_import_form" class="hide-if-js">
591
  <form action="<?php echo admin_url('admin.php?page=redirect-options'); ?>" method="post" enctype="multipart/form-data">
592
- <p style="margin:1em 0;">
593
- <label>Select Quick Redirects file to import:</label> <input type="file" name="qppr_file" onchange="check_file(this);" />
594
- </p>
595
- <p class="submit">
596
- <?php wp_nonce_field( 'import_redirects_qppr' ); ?>
597
- <input class="button-primary" type="submit" id="import_redirects_qppr" name="import_redirects_qppr" value="IMPORT & REPLACE Current Quick Redirects" />
598
- </p>
599
  </form>
600
  </div>
601
  <div id="qppr_addto_form" class="hide-if-js">
602
  <form action="<?php echo admin_url('admin.php?page=redirect-options'); ?>" method="post" enctype="multipart/form-data">
603
- <p style="margin:1em 0;">
 
 
 
604
  <label>Select Quick Redirects file to import:</label> <input type="file" name="qppr_file_add" onchange="check_file(this);" />
605
- <br/>file should be a text file with one rediect per line, PIPE separated, as <code>redirect|destination|newwindow|nofollow</code> - i.e.:<br/>
606
- <code>/old-location.htm|http://some.com/new-destination/|0|1</code><br/><code>/dontate/|http://example.com/destination/|1|1</code><br/>
607
- <strong>IMPORTANT:</strong> Make Sure any destinations that might have a PIPE in the querystring data are URL encoded!
608
  </p>
609
  <p class="submit">
610
- <?php wp_nonce_field( 'import_redirects_add_qppr' ); ?>
611
- <input class="button-primary" type="submit" id="import_redirects_add_qppr" name="import_redirects_add_qppr" value="ADD TO Current Quick Redirects" />
612
  </p>
613
  </form>
614
  </div>
@@ -655,33 +654,25 @@ jQuery(document).ready(function() {
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>
663
  <tr valign="top">
664
- <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');?>" />
665
- <span>Only needed for Meta Refresh. 0=default (instant)</span></td>
666
  </tr>
667
  <tr valign="top">
668
- <td><label>Meta Refresh Message:</label> <input type="text" size="25" name="ppr_meta-message" value="<?php echo get_option('ppr_meta-message');?>" />
669
- <span>Default is blank. Message to display while waiting for refresh.</span></td>
670
  </tr>
671
  <tr valign="top">
672
  <td><h2 style="font-size:20px;">Master Override Options</h2><b>NOTE: </b>These will override all individual settings.</td>
673
  </tr>
674
  <tr valign="top">
675
- <td><label>Turn OFF all Redirects? </label><input type="checkbox" name="ppr_override-active" value="1"<?php if(get_option('ppr_override-active')=='1'){echo ' checked="checked" ';} ?>/> <span>
676
- Includes Quick 301 Redirects when "use with jQuery" is also selected.</span></td>
677
  </tr>
678
  <tr valign="top">
679
- <td><label>Make ALL Redirects have <code>rel="nofollow"</code>? </label><input type="checkbox" name="ppr_override-nofollow" value="1"<?php if(get_option('ppr_override-nofollow')=='1'){echo ' checked="checked" ';} ?>/>
680
- <span>Includes Quick 301 Redirects when "use with jQuery" is also selected.</span></td>
681
  </tr>
682
  <tr valign="top">
683
- <td><label>Make ALL Redirects open in a New Window? </label><input type="checkbox" name="ppr_override-newwindow" value="1"<?php if(get_option('ppr_override-newwindow')=='1'){echo ' checked="checked" ';} ?>/>
684
- <span>Includes Quick 301 Redirects when "use with jQuery" is also selected.</span></td>
685
  </tr>
686
  <tr valign="top">
687
  <td><label>Make ALL Redirects this type: </label>
@@ -695,16 +686,13 @@ jQuery(document).ready(function() {
695
  <span> (Quick 301 Redirects will always be 301)</span></td>
696
  </tr>
697
  <tr valign="top">
698
- <td><label>Make ALL redirects Case Sensitive? </label><input type="checkbox" name="ppr_override-casesensitive" value="1"<?php if(get_option('ppr_override-casesensitive')=='1'){echo ' checked="checked" ';} ?>/>
699
- <span> Makes URLs CaSe SensiTivE - i.e., /somepage/ DOES NOT EQUAL /SoMEpaGe/</span></td>
700
  </tr>
701
  <tr valign="top">
702
- <td><label>Make ALL Redirects go to this URL: </label><input type="text" size="50" name="ppr_override-URL" value="<?php echo get_option('ppr_override-URL'); ?>"/>
703
- <span>Use full URL including <code>http://</code>.</span></td>
704
  </tr>
705
  <tr valign="top">
706
- <td><label>Rewrite ALL Redirects URLs to Show in LINK? </label><input type="checkbox" name="ppr_override-rewrite" value="1"<?php if(get_option('ppr_override-rewrite')=='1'){echo ' checked="checked" ';} ?>/> <span>
707
- Makes link show redirect URL instead of the original URL. ONLY includes Quick 301 Redirects when "use with jQuery" is also selected.</span></td>
708
  </tr>
709
  <tr valign="top">
710
  <td><h2 style="font-size:20px;">Plugin Clean Up</h2><b>NOTE: </b>This will DELETE all redirects - so be careful with this.</td>
@@ -713,20 +701,20 @@ jQuery(document).ready(function() {
713
  <td><label>Delete Redirects? </label><input class="button-secondary qppr_delete_reg" type="button" name="qppr_delete_reg" value="Delete all Page/Post Redirects" onclick="goOnConfirm('Are you sure you want to PERMANENTLY Delets ALL Regular Redirects?' , '?page=redirect-options&qppr_delete_reg=1');" /> <input class="button-secondary qppr_delete_qr" type="button" name="qppr_delete_qr" value="Delete all Quick Redirects" onclick="goOnConfirm('Are you sure you want to PERMANENTLY Delets ALL Quick Redirects?' , '?page=redirect-options&qppr_delete_qr=1');" /></td>
714
  </tr>
715
  </table>
716
- <p class="submit">
717
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
718
- </p>
719
  </form>
720
  </div>
721
  <?php }
722
 
723
  function ppr_options_page(){
724
  //generate the options page in the wordpress admin
725
- $tohash = $this->homelink.'/';
 
726
  ?>
727
  <div class="wrap">
728
  <div class="icon32" style="<?php echo 'background: url('.plugins_url( 'settings-icon.png' , __FILE__ ).') no-repeat transparent;';?>"><br></div>
729
- <script type="text/javascript">jQuery(document).ready(function() { var mainurl = '<?php echo get_bloginfo('url');?>'; jQuery(".delete-qppr").click(function(){ var thepprdel = jQuery(this).attr('id'); if(confirm('Are you sure you want to delete this redirect?')){ jQuery.ajax({ url: mainurl+"/",data : "pprd="+thepprdel+"&scid=<?php echo md5($tohash);?>", success: function(data){ jQuery('#row'+thepprdel).remove(); }, complete: function(){ jQuery(".pprnewwin").each(function (i) { jQuery(this).attr('name','quickppr_redirects[newwindow]['+jQuery(".pprnewwin").index(this)+']'); }); jQuery(".pprnofoll").each(function (i) { jQuery(this).attr('name','quickppr_redirects[nofollow]['+jQuery(".pprnofoll").index(this)+']'); }); } }); return false; }else{ return false; } }); jQuery("#hidepprjqmessage").click(function(){ jQuery.ajax({ url: mainurl+"/",data : "pprhidemessage=1", success: function(data){ jQuery('#usejqpprmessage').remove(); } }); return false; }); jQuery("#hidepprjqmessage2").click(function(){ jQuery.ajax({ url: mainurl+"/",data : "pprhidemessage=2", success: function(data){ jQuery('#usejqpprmessage2').remove(); } }); return false; }); });</script>
 
730
  <style type="text/css">div.info{background-color:#dceff8;border-color:#c00;margin: 5px 0 15px;padding: 5px;border:1px solid #2e92c1;border-radius: 3px;}div.info a{color:#2e92c1;}.usejqpprmessage{overflow:hidden;}.hidepprjqmessage{float:right;font-size:11px;}.delete-qppr{border: 1px solid #FFBBBB;display: inline-block;font-weight: bold;padding: 0 5px;text-decoration: none;text-transform: uppercase;}</style>
731
  <h2>Quick 301 Redirects</h2>
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 } ?>
@@ -747,26 +735,18 @@ jQuery(document).ready(function() {
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
756
- <b>Destination</b> field can be any valid URL or relative path (from root).</li>
757
- <li style="color:#214070;margin-left:25px;list-style-type:disc;">In
758
- order for NW (open in a new window) or NF (rel=&quot;nofollow&quot;) options
759
- to work with Quick Redirects, you need to have:
760
- <ol><li>&quot;Use with jQuery&quot; option selected in the settings page</li>
761
- <li>A link that uses the request url SOMEWHERE in your site page
762
- - i.e., in a menu, content, sidebar, etc. </li>
763
- <li>The open in a new window or nofollow settings will not
764
- happen if someone just types the old link in the URL or if that
765
- come from a bookmark or link outside your site - in essence,
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>
@@ -935,7 +915,7 @@ jQuery(document).ready(function() {
935
  foreach($thetemp as $key){
936
  // defaults
937
  if(!isset($theArray[$key->post_id]['_pprredirect_rewritelink'])){$theArray[$key->post_id]['_pprredirect_rewritelink'] = 0;}
938
- if(!isset($theArray[$key->post_id]['_pprredirect_url'])){$theArray[$key->post_id]['_pprredirect_url'] = 'http://www.example.com';}
939
  if(!isset($theArray[$key->post_id]['_pprredirect_type'] )){$theArray[$key->post_id]['_pprredirect_type'] = 302;}
940
  if(!isset($theArray[$key->post_id]['_pprredirect_relnofollow'])){$theArray[$key->post_id]['_pprredirect_relnofollow'] = 0;}
941
  if(!isset($theArray[$key->post_id]['_pprredirect_newwindow'] )) {$theArray[$key->post_id]['_pprredirect_newwindow'] = 0;}
@@ -1056,20 +1036,23 @@ jQuery(document).ready(function() {
1056
  $vars[] = 'pprhidemessage';
1057
  $vars[] = 'qppr_delete_reg';
1058
  $vars[] = 'qppr_delete_qr';
 
1059
  return $vars;
1060
  }
1061
  function ppr_parse_request_new($wp) {
1062
- global $wp;
1063
  if(is_admin() && (isset($_GET['qppr_delete_reg']) || isset($_GET['qppr_delete_qr']))){
1064
  if( $_GET['qppr_delete_reg'] =='1'){
1065
  global $wpdb;
1066
  $wpdb->query("DELETE FROM $wpdb->postmeta WHERE `meta_key` = '_pprredirect_active' OR `meta_key` = '_pprredirect_rewritelink' OR `meta_key` = '_pprredirect_newwindow' OR `meta_key` = '_pprredirect_relnofollow' OR `meta_key` = '_pprredirect_type' OR `meta_key` = '_pprredirect_url';");
1067
- wp_redirect('admin.php?page=redirect-options&update=2&settings-updated=true',200);
 
1068
  exit;
1069
  }elseif($_GET['qppr_delete_qr'] =='1'){
1070
  delete_option('quickppr_redirects');
1071
  delete_option('quickppr_redirects_meta');
1072
- wp_redirect('admin.php?page=redirect-options&update=3&settings-updated=true',200);
 
1073
  exit;
1074
  }elseif($_GET['qppr_export_qr'] =='1'){
1075
  wp_die('This option is not available at this time.','Quick Page/Post Redirect Plugin - Export',array('back_link'=>true));
@@ -1081,6 +1064,7 @@ jQuery(document).ready(function() {
1081
  }elseif ( isset($_GET['action']) && $_GET['action'] == 'export_redirects_qppr' ) {
1082
  $newQPPR_Array = array();
1083
  check_admin_referer('export-redirects-qppr');
 
1084
  header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
1085
  header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
1086
  header( 'Cache-Control: no-store, no-cache, must-revalidate' );
@@ -1092,7 +1076,26 @@ jQuery(document).ready(function() {
1092
  header("Content-Disposition: attachment; filename=qppr-quick-redirects-export-".date('U').".txt;");
1093
  $newQPPR_Array['quickppr_redirects'] = get_option('quickppr_redirects');
1094
  $newQPPR_Array['quickppr_redirects_meta'] = get_option('quickppr_redirects_meta');
1095
- die('QUICKPAGEPOSTREDIRECT'.base64_encode(serialize($newQPPR_Array)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1096
  exit;
1097
  } elseif( isset($_POST['import_redirects_qppr']) && isset($_FILES['qppr_file']) ) {
1098
  check_admin_referer( 'import_redirects_qppr' );
@@ -1102,8 +1105,30 @@ jQuery(document).ready(function() {
1102
  } else {
1103
  $config_file = file_get_contents( $_FILES['qppr_file']['tmp_name'] );
1104
  if ( substr($config_file, 0, strlen('QUICKPAGEPOSTREDIRECT')) !== 'QUICKPAGEPOSTREDIRECT' ) {
1105
- wp_die('This does not look like a Quick Page Post Redirect config file - it is possibly damaged or corrupt.', 'ERROR - Not a valid File',array('response'=>'200','back_link'=>'1'));
1106
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1107
  } else {
1108
  $config_file = unserialize(base64_decode(substr($config_file, strlen('QUICKPAGEPOSTREDIRECT'))));
1109
  if ( !is_array($config_file) ) {
@@ -1135,27 +1160,31 @@ jQuery(document).ready(function() {
1135
  $QR_Array = explode("\n",$config_file);
1136
  if(!empty($QR_Array) && is_array($QR_Array)):
1137
  foreach($QR_Array as $qrtoadd):
1138
- $item = explode('|',str_replace(array("\r","\n"), array('',''),$qrtoadd));
1139
- if(is_array($item) && !empty($item)){
1140
- $tempArr[$item[0]] = $item[1];
1141
- if(isset( $item[2]) || isset( $item[3])){
1142
- $newwin = (isset($item[2]) && ($item[2] != '' && $item[2] != '0')) ? 1 : '';
1143
- $nofoll = (isset($item[3]) && ($item[3] != '' && $item[3] != '0')) ? 1 : '';
1144
- $tempMArr[$item[0]]['newwindow'] = $newwin;
1145
- $tempMArr[$item[0]]['nofollow'] = $nofoll;
1146
- }else{
1147
- $tempMArr[$item[0]]['newwindow'] = '';
1148
- $tempMArr[$item[0]]['nofollow'] = '';
 
 
1149
  }
1150
  }
1151
  endforeach;
1152
  if(!empty($tempArr)){
1153
- $currQRs = get_option('quickppr_redirects');
 
1154
  $resultQR = array_merge($currQRs, $tempArr);
1155
  update_option('quickppr_redirects',$resultQR);
1156
  }
1157
  if(!empty($tempMArr)){
1158
- $currQRM = get_option('quickppr_redirects_meta');
 
1159
  $resultQRM = array_merge($currQRM, $tempMArr);
1160
  update_option('quickppr_redirects_meta',$resultQRM);
1161
  }
@@ -1254,7 +1283,7 @@ jQuery(document).ready(function() {
1254
  function ppr_filter_plugin_links($links, $file){
1255
  if ( $file == plugin_basename(__FILE__) ){
1256
  $links[] = '<a href="'.$this->adminlink.'admin.php?page=redirect-updates">Quick Redirects</a>';
1257
- $links[] = '<a target="_blank" href="'.$this->fcmlink.'/quick-page-post-redirect-plugin/">FAQ</a>';
1258
  $links[] = '<a target="_blank" href="'.$this->fcmlink.'/donations/">Donate</a>';
1259
  }
1260
  return $links;
@@ -1306,6 +1335,7 @@ jQuery(document).ready(function() {
1306
  }
1307
 
1308
  function ppr_save_metadata($post_id, $post) {
 
1309
  if($post->post_type == 'revision'){return;}
1310
  if(isset($_REQUEST['pprredirect_noncename']) && (isset($_POST['pprredirect_active']) || isset($_POST['pprredirect_url']) || isset($_POST['pprredirect_type']) || isset($_POST['pprredirect_newwindow']) || isset($_POST['pprredirect_relnofollow']))):
1311
  unset($my_meta_data);
@@ -1322,13 +1352,13 @@ jQuery(document).ready(function() {
1322
  }
1323
 
1324
  // find & save the form data & put it into an array
1325
- $my_meta_data['_pprredirect_active'] = $_REQUEST['pprredirect_active'];
1326
- $my_meta_data['_pprredirect_newwindow'] = $_REQUEST['pprredirect_newwindow'];
1327
- $my_meta_data['_pprredirect_relnofollow'] = $_REQUEST['pprredirect_relnofollow'];
1328
- $my_meta_data['_pprredirect_type'] = $_REQUEST['pprredirect_type'];
1329
- $my_meta_data['_pprredirect_rewritelink'] = $_REQUEST['pprredirect_rewritelink'];
1330
- $my_meta_data['_pprredirect_url'] = $_REQUEST['pprredirect_url'];
1331
- //$my_meta_data['_pprredirect_casesensitive'] = $_REQUEST['pprredirect_casesensitive'];
1332
 
1333
  if ( 0 === strpos($my_meta_data['_pprredirect_url'], 'www.'))
1334
  $my_meta_data['_pprredirect_url'] = 'http://' . $my_meta_data['_pprredirect_url'] ; // Starts with www., so add http://
@@ -1454,6 +1484,7 @@ jQuery(document).ready(function() {
1454
  }
1455
 
1456
  function redirect(){
 
1457
  // Read the list of redirects and if the current page is found in the list, send the visitor on her way
1458
  if (!empty($this->quickppr_redirects) && !is_admin()) {
1459
  $userrequest = str_replace(get_option('home'),'',$this->getAddress());
@@ -1462,7 +1493,8 @@ jQuery(document).ready(function() {
1462
  if(isset($_GET)){
1463
  $useURLQS = array();
1464
  if(count($_GET) >= 1){
1465
- foreach($_GET as $key => $value){$useURLQS[] = $key.'='.$value;}
 
1466
  $finalQS = '?'.implode('&',$useURLQS);
1467
  $userrequest = preg_replace('/\?.*/', '', $userrequest);
1468
  }
@@ -1482,12 +1514,15 @@ jQuery(document).ready(function() {
1482
  }else{
1483
  if(array_key_exists($needle.'/', $haystack)){
1484
  $index = $needle.'/';
 
 
 
1485
  }
1486
  }
1487
  if($index){
1488
  $val = $haystack[$index];
1489
  if($val) {
1490
- $useURL = $this->pproverride_URL!='' ? $this->pproverride_URL : $val;
1491
  $useURL .= $finalQS; //add QS back
1492
  do_action('qppr_redirect',$useURL,$this->pproverride_type);
1493
  if($this->pproverride_type == 'meta'){
@@ -1533,6 +1568,7 @@ jQuery(document).ready(function() {
1533
  $this->ppr_metaurl = $redrurl;
1534
  add_action('wp_head', array($this,'ppr_addmetatohead_theme'),1);
1535
  }else{
 
1536
  wp_redirect($urlsite,$redrtype);
1537
  exit();
1538
  }
6
  Author: Don Fischer
7
  Author URI: http://www.fischercreativemedia.com/
8
  Donate link: http://www.fischercreativemedia.com/donations/
9
+ Version: 5.0.3
10
 
11
  Version info:
12
  See change log in readme.txt file.
38
  //you can use the following action hooks with this plugin:
39
  // *** Quick Rediects function: use to take over redirect
40
  // add_action('qppr_redirect','some_callback_function',10,2);
41
+ // arg 1. is Redirect URL
42
+ // arg 2. is Redirect Type
43
  // *******************************
44
  // *** Page/Post Redirects function: use to take over redirect
45
  // add_action('qppr_do_redirect','some_callback_function2',10,2);
46
+ // arg 1. is Redirect URL
47
+ // arg 2. is Redirect Type
48
  // *******************************
49
  // *** Meta Redirect Action: Used for Meta Redirect Page Headers (so you can add meta tag)
50
  //add_action('ppr_meta_head_hook','some_callback',10,3);
63
  // *******************************
64
  // *** Meta Redirect Filter: Used for Meta Redirect Page Headers (so you can add meta and message, etc.)
65
  //add_filter('ppr_meta_head_hook_filter','some_callback2',10,2);
66
+ // arg 1. Meta Tag (fully generated)
67
+ // arg 2. Page HTML Message (wrapped in a <div> tag)
68
  // Example:
69
  add_filter('ppr_meta_head_hook_filter','override_ppr_metahead_new');
70
  function override_ppr_metahead_new($meta_tag='',$meta_message=''){
113
  public $pprptypes_ok;
114
 
115
  function __construct() {
116
+ $this->ppr_curr_version = '5.0.3';
117
  $this->ppr_nofollow = array();
118
  $this->ppr_newindow = array();
119
  $this->ppr_url = array();
134
  $this->pprmeta_message = get_option( 'ppr_meta-message' );
135
  $this->pprmeta_seconds = get_option( 'ppr_meta-seconds' );
136
  $this->pproverride_casesensitive = get_option( 'ppr_override-casesensitive' );
137
+ $this->adminlink = admin_url('/', 'admin');
138
  $this->fcmlink = 'http://www.fischercreativemedia.com/plugins';
139
  $this->ppr_metaurl = '';
140
+ $this->quickppr_jquerycache = ''; //get_option( 'qppr_jQuery_cache' );
141
  $this->updatemsg = '';
142
  if($this->pprmeta_seconds==''){$this->pprmeta_seconds='0';}
143
 
146
  add_action( 'save_post', array($this,'ppr_save_metadata'),20,2 ); // save the custom fields
147
  add_action( 'wp',array($this,'ppr_parse_request') ); // parse query vars
148
  add_action( 'init',array($this,'ppr_parse_request_new') ); // parse query vars
149
+ //add_action( 'wp_enqueue_scripts',array($this,'ppr_do_jQuery'), 1, 2); // do the jQuery in site header
150
  add_action( 'admin_menu', array($this,'ppr_add_menu') ); // add the menu items needed
151
  add_action( 'admin_menu', array($this,'ppr_add_metabox') ); // add the metaboxes where needed
152
  add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this,'ppr_filter_plugin_actions') );
183
  }
184
 
185
  function build_jQueryCache(){
186
+ return;
187
  $redirects = $this->quickppr_redirects;
188
  $redirectsmeta = $this->quickppr_redirectsmeta;
189
  $ppr_newWindowArray = array();
504
  }
505
 
506
  function ppr_settings_page() {
507
+ if(isset($_GET['update'])){
508
+ if($_GET['update']=='3'){$this->updatemsg ='All Quick Redirects deleted from database.';}
509
+ if($_GET['update']=='2'){$this->updatemsg ='All Regular Redirects deleted from database.';}
510
+ if($_GET['update']=='4'){$this->updatemsg ='Quick Redirects Imported & Replaced.';}
511
+ if($_GET['update']=='5'){$this->updatemsg ='Quick Redirects Imported & Added to Existing Redirects.';}
512
+ }
513
  ?>
514
  <div class="wrap" style="position:relative;">
515
  <style type="text/css">
566
  fname.value = '';
567
  }
568
  }
569
+ //function goOnConfirm(message, href) {if (confirm(message)) document.location.href = '/wp-admin/admin.php'+href;}
570
+ function goOnConfirm(message, href) {if (confirm(message)) document.location.href = '<?php echo admin_url("admin.php"); ?>'+href;}
571
+
572
  </script>
573
  <div class="icon32" style="<?php echo 'background: url('.plugins_url( 'settings-icon.png' , __FILE__ ).') no-repeat transparent;';?>"><br></div>
574
  <h2>Quick Page Post Redirect Options & Settings</h2>
586
  <td><h2 style="font-size:20px;">Import/Export</h2></td>
587
  </tr>
588
  <tr valign="top">
589
+ <td><label>Export Redirects </label><input class="button-secondary qppr_export_qr" type="button" name="qppr_export_qr" value="EXPORT all Quick Redirects (Encoded)" onclick="document.location='<?php echo wp_nonce_url( admin_url('admin.php?page=redirect-options&ftype=encoded').'&action=export_redirects_qppr', 'export-redirects-qppr'); ?>';" /> OR <input class="button-secondary qppr_export_qr" type="button" name="qppr_export_qr" value="EXPORT all Quick Redirects (PIPE Separated)" onclick="document.location='<?php echo wp_nonce_url( admin_url('admin.php?page=redirect-options').'&action=export_redirects_qppr&ftype=pipe', 'export-redirects-qppr'); ?>';" /></td>
590
  </tr>
591
  <tr valign="top">
592
  <td>
594
  <input class="button-secondary qppr_import_qr" type="button" id="qppr_import_qr_button" name="qppr_import_qr" value="RESTORE Saved Quick Redirects" /> OR <input class="button-secondary qppr_addto_qr" type="button" id="qppr_addto_qr_button" name="qppr_addto_qr" value="ADD TO Quick Redirects" />
595
  <div id="qppr_import_form" class="hide-if-js">
596
  <form action="<?php echo admin_url('admin.php?page=redirect-options'); ?>" method="post" enctype="multipart/form-data">
597
+ <p style="margin:1em 0;"><label>Select Quick Redirects file to import:</label> <input type="file" name="qppr_file" onchange="check_file(this);" /></p>
598
+ <p class="submit"><?php wp_nonce_field( 'import_redirects_qppr' ); ?><input class="button-primary" type="submit" id="import_redirects_qppr" name="import_redirects_qppr" value="IMPORT & REPLACE Current Quick Redirects" /></p>
 
 
 
 
 
599
  </form>
600
  </div>
601
  <div id="qppr_addto_form" class="hide-if-js">
602
  <form action="<?php echo admin_url('admin.php?page=redirect-options'); ?>" method="post" enctype="multipart/form-data">
603
+ <p style="margin:.5em 0 1em 1em;color:#444;">
604
+ The import file should be a text file with one rediect per line, PIPE separated, in this format:<br/><code>redirect|destination|newwindow|nofollow</code><br/>for Example:<br/>
605
+ <code>/old-location.htm|http://some.com/new-destination/|0|1<br/>/dontate/|http://example.com/destination/|1|1</code><br/><br/>
606
+ <strong>IMPORTANT:</strong> Make Sure any destinations that might have a PIPE in the querystring data are URL encoded!<br/><br/>
607
  <label>Select Quick Redirects file to import:</label> <input type="file" name="qppr_file_add" onchange="check_file(this);" />
 
 
 
608
  </p>
609
  <p class="submit">
610
+ <?php wp_nonce_field( 'import_redirects_add_qppr' ); ?><input class="button-primary" type="submit" id="import_redirects_add_qppr" name="import_redirects_add_qppr" value="ADD TO Current Quick Redirects" />
 
611
  </p>
612
  </form>
613
  </div>
654
  <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>
655
  </tr>
656
  <tr valign="top">
657
+ <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>
 
 
 
658
  </tr>
659
  <tr valign="top">
660
+ <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>
 
661
  </tr>
662
  <tr valign="top">
663
+ <td><label>Meta Refresh Message:</label> <input type="text" size="25" name="ppr_meta-message" value="<?php echo get_option('ppr_meta-message');?>" /> <span>Default is blank. Message to display while waiting for refresh.</span></td>
 
664
  </tr>
665
  <tr valign="top">
666
  <td><h2 style="font-size:20px;">Master Override Options</h2><b>NOTE: </b>These will override all individual settings.</td>
667
  </tr>
668
  <tr valign="top">
669
+ <td><label>Turn OFF all Redirects? </label><input type="checkbox" name="ppr_override-active" value="1"<?php if(get_option('ppr_override-active')=='1'){echo ' checked="checked" ';} ?>/> <span>Includes Quick 301 Redirects when "use with jQuery" is also selected.</span></td>
 
670
  </tr>
671
  <tr valign="top">
672
+ <td><label>Make ALL Redirects have <code>rel="nofollow"</code>? </label><input type="checkbox" name="ppr_override-nofollow" value="1"<?php if(get_option('ppr_override-nofollow')=='1'){echo ' checked="checked" ';} ?>/> <span>Will not work on Quick Redirects at this time.<!--Includes Quick 301 Redirects when "use with jQuery" is also selected.--></span></td>
 
673
  </tr>
674
  <tr valign="top">
675
+ <td><label>Make ALL Redirects open in a New Window? </label><input type="checkbox" name="ppr_override-newwindow" value="1"<?php if(get_option('ppr_override-newwindow')=='1'){echo ' checked="checked" ';} ?>/> <span>Will not work on Quick Redirects at this time.<!--Includes Quick 301 Redirects when "use with jQuery" is also selected.--></span></td>
 
676
  </tr>
677
  <tr valign="top">
678
  <td><label>Make ALL Redirects this type: </label>
686
  <span> (Quick 301 Redirects will always be 301)</span></td>
687
  </tr>
688
  <tr valign="top">
689
+ <td><label>Make ALL redirects Case Sensitive? </label><input type="checkbox" name="ppr_override-casesensitive" value="1"<?php if(get_option('ppr_override-casesensitive')=='1'){echo ' checked="checked" ';} ?>/> <span> Makes URLs CaSe SensiTivE - i.e., /somepage/ DOES NOT EQUAL /SoMEpaGe/</span></td>
 
690
  </tr>
691
  <tr valign="top">
692
+ <td><label>Make ALL Redirects go to this URL: </label><input type="text" size="50" name="ppr_override-URL" value="<?php echo get_option('ppr_override-URL'); ?>"/> <span>Use full URL including <code>http://</code>.</span></td>
 
693
  </tr>
694
  <tr valign="top">
695
+ <td><label>Rewrite ALL Redirects URLs to Show in LINK? </label><input type="checkbox" name="ppr_override-rewrite" value="1"<?php if(get_option('ppr_override-rewrite')=='1'){echo ' checked="checked" ';} ?>/> <span>Makes link show redirect URL instead of the original URL. Will not work on Quick Redirects at this time.<!--ONLY includes Quick 301 Redirects when "use with jQuery" is also selected.--></span></td>
 
696
  </tr>
697
  <tr valign="top">
698
  <td><h2 style="font-size:20px;">Plugin Clean Up</h2><b>NOTE: </b>This will DELETE all redirects - so be careful with this.</td>
701
  <td><label>Delete Redirects? </label><input class="button-secondary qppr_delete_reg" type="button" name="qppr_delete_reg" value="Delete all Page/Post Redirects" onclick="goOnConfirm('Are you sure you want to PERMANENTLY Delets ALL Regular Redirects?' , '?page=redirect-options&qppr_delete_reg=1');" /> <input class="button-secondary qppr_delete_qr" type="button" name="qppr_delete_qr" value="Delete all Quick Redirects" onclick="goOnConfirm('Are you sure you want to PERMANENTLY Delets ALL Quick Redirects?' , '?page=redirect-options&qppr_delete_qr=1');" /></td>
702
  </tr>
703
  </table>
704
+ <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
 
 
705
  </form>
706
  </div>
707
  <?php }
708
 
709
  function ppr_options_page(){
710
  //generate the options page in the wordpress admin
711
+ //$tohash = $this->homelink.'/';
712
+ $tohash = site_url('/', 'admin');
713
  ?>
714
  <div class="wrap">
715
  <div class="icon32" style="<?php echo 'background: url('.plugins_url( 'settings-icon.png' , __FILE__ ).') no-repeat transparent;';?>"><br></div>
716
+ <!--script type="text/javascript">jQuery(document).ready(function() { var mainurl = '<?php echo get_bloginfo('url');?>'; jQuery(".delete-qppr").click(function(){ var thepprdel = jQuery(this).attr('id'); if(confirm('Are you sure you want to delete this redirect?')){ jQuery.ajax({ url: mainurl+"/",data : "pprd="+thepprdel+"&scid=<?php echo md5($tohash);?>", success: function(data){ jQuery('#row'+thepprdel).remove(); }, complete: function(){ jQuery(".pprnewwin").each(function (i) { jQuery(this).attr('name','quickppr_redirects[newwindow]['+jQuery(".pprnewwin").index(this)+']'); }); jQuery(".pprnofoll").each(function (i) { jQuery(this).attr('name','quickppr_redirects[nofollow]['+jQuery(".pprnofoll").index(this)+']'); }); } }); return false; }else{ return false; } }); jQuery("#hidepprjqmessage").click(function(){ jQuery.ajax({ url: mainurl+"/",data : "pprhidemessage=1", success: function(data){ jQuery('#usejqpprmessage').remove(); } }); return false; }); jQuery("#hidepprjqmessage2").click(function(){ jQuery.ajax({ url: mainurl+"/",data : "pprhidemessage=2", success: function(data){ jQuery('#usejqpprmessage2').remove(); } }); return false; }); });</script-->
717
+ <script type="text/javascript">jQuery(document).ready(function() { var mainurl = '<?php echo site_url('/', 'admin') ;?>'; jQuery(".delete-qppr").click(function(){ var thepprdel = jQuery(this).attr('id'); if(confirm('Are you sure you want to delete this redirect?')){ jQuery.ajax({ url: mainurl,data : "pprd="+thepprdel+"&scid=<?php echo md5($tohash);?>", success: function(data, textStatus){ jQuery('#row'+thepprdel).remove(); }, complete: function(){ jQuery(".pprnewwin").each(function (i) { jQuery(this).attr('name','quickppr_redirects[newwindow]['+jQuery(".pprnewwin").index(this)+']'); }); jQuery(".pprnofoll").each(function (i) { jQuery(this).attr('name','quickppr_redirects[nofollow]['+jQuery(".pprnofoll").index(this)+']'); }); } }); return false; }else{ return false; } }); jQuery("#hidepprjqmessage").click(function(){ jQuery.ajax({ url: mainurl,data : "pprhidemessage=1", success: function(data){ jQuery('#usejqpprmessage').remove(); } }); return false; }); jQuery("#hidepprjqmessage2").click(function(){ jQuery.ajax({ url: mainurl,data : "pprhidemessage=2", success: function(data){ jQuery('#usejqpprmessage2').remove(); } }); return false; }); });</script>
718
  <style type="text/css">div.info{background-color:#dceff8;border-color:#c00;margin: 5px 0 15px;padding: 5px;border:1px solid #2e92c1;border-radius: 3px;}div.info a{color:#2e92c1;}.usejqpprmessage{overflow:hidden;}.hidepprjqmessage{float:right;font-size:11px;}.delete-qppr{border: 1px solid #FFBBBB;display: inline-block;font-weight: bold;padding: 0 5px;text-decoration: none;text-transform: uppercase;}</style>
719
  <h2>Quick 301 Redirects</h2>
720
  <?php if($this->updatemsg!=''){?><div class="updated settings-error" id="setting-error-settings_updated"><p><strong><?php echo $this->updatemsg;?></strong></p></div><?php } ?>
735
  <!--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).-->
736
  <br/>
737
  <br/><b style="color:red;">IMPORTANT TROUBLE SHOOTING NOTES:</b>
738
+ <ol style="margin-top:5px;">
739
+ <li style="color:#214070;margin-left:15px;list-style-type:disc;">Until some jQuery issues are resolved, the New Window and No Follow features will not work for Quick Redirects.</li>
740
+ <li style="color:#214070;margin-left:15px;list-style-type:disc;">The <b>Request</b> field should be relative to the ROOT directory and contain the <code>/</code> at the beginning.</li>
741
+ <li style="color:#214070;margin-left:15px;list-style-type:disc;">The <b>Destination</b> field can be any valid URL or relative path (from root).</li>
742
+ <!--li style="color:#214070;margin-left:25px;list-style-type:disc;">In order for NW (open in a new window) or NF (rel=&quot;nofollow&quot;) options to work with Quick Redirects, you need to have:
743
+ <ol>
744
+ <li>&quot;Use with jQuery&quot; option selected in the settings page</li>
745
+ <li>A link that uses the request url SOMEWHERE in your site page - i.e., in a menu, content, sidebar, etc. </li>
746
+ <li>The open in a new window or nofollow settings will not happen if someone just types the old link in the URL or if that come from a bookmark or link outside your site - in essence, there needs to be a link that they click on in your site so that the jQuery script can add the appropriate <code>target</code> and <code>rel</code> properties to the link to make it work.</li>
747
+ </ol>
748
+ </li-->
749
+
 
 
 
 
 
 
 
 
750
  </ol>
751
  <form method="post" action="admin.php?page=redirect-updates">
752
  <table>
915
  foreach($thetemp as $key){
916
  // defaults
917
  if(!isset($theArray[$key->post_id]['_pprredirect_rewritelink'])){$theArray[$key->post_id]['_pprredirect_rewritelink'] = 0;}
918
+ if(!isset($theArray[$key->post_id]['_pprredirect_url'])){$theArray[$key->post_id]['_pprredirect_url'] = '';}
919
  if(!isset($theArray[$key->post_id]['_pprredirect_type'] )){$theArray[$key->post_id]['_pprredirect_type'] = 302;}
920
  if(!isset($theArray[$key->post_id]['_pprredirect_relnofollow'])){$theArray[$key->post_id]['_pprredirect_relnofollow'] = 0;}
921
  if(!isset($theArray[$key->post_id]['_pprredirect_newwindow'] )) {$theArray[$key->post_id]['_pprredirect_newwindow'] = 0;}
1036
  $vars[] = 'pprhidemessage';
1037
  $vars[] = 'qppr_delete_reg';
1038
  $vars[] = 'qppr_delete_qr';
1039
+ $vars[] = 'ftype';
1040
  return $vars;
1041
  }
1042
  function ppr_parse_request_new($wp) {
1043
+ global $wp, $wpdb;
1044
  if(is_admin() && (isset($_GET['qppr_delete_reg']) || isset($_GET['qppr_delete_qr']))){
1045
  if( $_GET['qppr_delete_reg'] =='1'){
1046
  global $wpdb;
1047
  $wpdb->query("DELETE FROM $wpdb->postmeta WHERE `meta_key` = '_pprredirect_active' OR `meta_key` = '_pprredirect_rewritelink' OR `meta_key` = '_pprredirect_newwindow' OR `meta_key` = '_pprredirect_relnofollow' OR `meta_key` = '_pprredirect_type' OR `meta_key` = '_pprredirect_url';");
1048
+ //wp_redirect('admin.php?page=redirect-options&update=2&settings-updated=true',200);
1049
+ wp_redirect(admin_url('admin.php?page=redirect-options&update=2&settings-updated=true'));
1050
  exit;
1051
  }elseif($_GET['qppr_delete_qr'] =='1'){
1052
  delete_option('quickppr_redirects');
1053
  delete_option('quickppr_redirects_meta');
1054
+ //wp_redirect('admin.php?page=redirect-options&update=3&settings-updated=true',200);
1055
+ wp_redirect(admin_url('admin.php?page=redirect-options&update=3&settings-updated=true'));
1056
  exit;
1057
  }elseif($_GET['qppr_export_qr'] =='1'){
1058
  wp_die('This option is not available at this time.','Quick Page/Post Redirect Plugin - Export',array('back_link'=>true));
1064
  }elseif ( isset($_GET['action']) && $_GET['action'] == 'export_redirects_qppr' ) {
1065
  $newQPPR_Array = array();
1066
  check_admin_referer('export-redirects-qppr');
1067
+ $type = (isset($_GET['ftype']) && ($_GET['ftype']=='encoded' || $_GET['ftype'] =='pipe')) ? $wpdb->escape($_GET['ftype']) : 'pipe' ; // can be 'encoded' or 'pipe';
1068
  header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
1069
  header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
1070
  header( 'Cache-Control: no-store, no-cache, must-revalidate' );
1076
  header("Content-Disposition: attachment; filename=qppr-quick-redirects-export-".date('U').".txt;");
1077
  $newQPPR_Array['quickppr_redirects'] = get_option('quickppr_redirects');
1078
  $newQPPR_Array['quickppr_redirects_meta'] = get_option('quickppr_redirects_meta');
1079
+ if($type == 'encoded'){
1080
+ die('QUICKPAGEPOSTREDIRECT'.base64_encode(serialize($newQPPR_Array)));
1081
+ }else{
1082
+ if(is_array($newQPPR_Array)){
1083
+ $qpprs = $newQPPR_Array['quickppr_redirects'];
1084
+ $qpprm = $newQPPR_Array['quickppr_redirects_meta'];
1085
+ foreach($qpprs as $key=>$val){
1086
+ $nw = (isset($qpprm[$key]['newwindow']) && $qpprm[$key]['newwindow']=='1') ? $qpprm[$key]['newwindow'] : '0' ;
1087
+ $nf = (isset($qpprm[$key]['nofollow']) && $qpprm[$key]['nofollow'] == '1') ? $qpprm[$key]['nofollow'] : '0' ;
1088
+ $temps = str_replace('|','%7C',$key).'|'.str_replace('|','%7C',$val).'|'.$nw.'|'.$nf;
1089
+ if($temps!='|||'){
1090
+ $newline[] = $temps;
1091
+ }
1092
+ }
1093
+ $newfile = implode("\r\n",$newline);
1094
+ }else{
1095
+ $newfile = $newtext;
1096
+ }
1097
+ die($newfile);
1098
+ }
1099
  exit;
1100
  } elseif( isset($_POST['import_redirects_qppr']) && isset($_FILES['qppr_file']) ) {
1101
  check_admin_referer( 'import_redirects_qppr' );
1105
  } else {
1106
  $config_file = file_get_contents( $_FILES['qppr_file']['tmp_name'] );
1107
  if ( substr($config_file, 0, strlen('QUICKPAGEPOSTREDIRECT')) !== 'QUICKPAGEPOSTREDIRECT' ) {
1108
+ if(strpos($config_file,'|') !== false){
1109
+ $text = explode("\r\n",$config_file);
1110
+ $newfile1 = array();
1111
+ if(is_array($text)){
1112
+ foreach($text as $nl){
1113
+ if($nl!=''){
1114
+ $elem = explode('|',$nl);
1115
+ $newfile1['quickppr_redirects'][$elem[0]] = $elem[1];
1116
+ $nw = isset($elem[2]) && $elem[2] == '1' ? '1' : '';
1117
+ $nf = isset($elem[3]) && $elem[3] == '1' ? '1' : '';
1118
+ $newfile1['quickppr_redirects_meta'][$elem[0]]['newwindow'] = $nw;
1119
+ $newfile1['quickppr_redirects_meta'][$elem[0]]['newwindow'] = $nf;
1120
+ }
1121
+ }
1122
+ if(is_array($newfile1)){
1123
+ if(isset($newfile1['quickppr_redirects'])){update_option('quickppr_redirects', $newfile1['quickppr_redirects']);}
1124
+ if(isset($newfile1['quickppr_redirects_meta'])){update_option('quickppr_redirects_meta', $newfile1['quickppr_redirects_meta']);}
1125
+ }
1126
+ }
1127
+ wp_redirect(admin_url('admin.php?page=redirect-options&update=4'),302);
1128
+ }else{
1129
+ wp_die('This does not look like a Quick Page Post Redirect config file - it is possibly damaged or corrupt.', 'ERROR - Not a valid File',array('response'=>'200','back_link'=>'1'));
1130
+ exit;
1131
+ }
1132
  } else {
1133
  $config_file = unserialize(base64_decode(substr($config_file, strlen('QUICKPAGEPOSTREDIRECT'))));
1134
  if ( !is_array($config_file) ) {
1160
  $QR_Array = explode("\n",$config_file);
1161
  if(!empty($QR_Array) && is_array($QR_Array)):
1162
  foreach($QR_Array as $qrtoadd):
1163
+ if($qrtoadd != '' && strpos($qrtoadd,'|') !== false){
1164
+ $item = explode('|',str_replace(array("\r","\n"), array('',''),$qrtoadd));
1165
+ if(is_array($item) && !empty($item)){
1166
+ $tempArr[$item[0]] = $item[1];
1167
+ if(isset( $item[2]) || isset( $item[3])){
1168
+ $newwin = (isset($item[2]) && ($item[2] != '' && $item[2] != '0')) ? 1 : '';
1169
+ $nofoll = (isset($item[3]) && ($item[3] != '' && $item[3] != '0')) ? 1 : '';
1170
+ $tempMArr[$item[0]]['newwindow'] = $newwin;
1171
+ $tempMArr[$item[0]]['nofollow'] = $nofoll;
1172
+ }else{
1173
+ $tempMArr[$item[0]]['newwindow'] = '';
1174
+ $tempMArr[$item[0]]['nofollow'] = '';
1175
+ }
1176
  }
1177
  }
1178
  endforeach;
1179
  if(!empty($tempArr)){
1180
+ $temp = get_option('quickppr_redirects');
1181
+ $currQRs = ($temp !='' && is_array($temp)) ? $temp : array();
1182
  $resultQR = array_merge($currQRs, $tempArr);
1183
  update_option('quickppr_redirects',$resultQR);
1184
  }
1185
  if(!empty($tempMArr)){
1186
+ $temp = get_option('quickppr_redirects_meta');
1187
+ $currQRM = ($temp !='' && is_array($temp)) ? $temp : array();
1188
  $resultQRM = array_merge($currQRM, $tempMArr);
1189
  update_option('quickppr_redirects_meta',$resultQRM);
1190
  }
1283
  function ppr_filter_plugin_links($links, $file){
1284
  if ( $file == plugin_basename(__FILE__) ){
1285
  $links[] = '<a href="'.$this->adminlink.'admin.php?page=redirect-updates">Quick Redirects</a>';
1286
+ $links[] = '<a href="'.$this->adminlink.'admin.php?page=redirect-faqs">FAQ</a>';
1287
  $links[] = '<a target="_blank" href="'.$this->fcmlink.'/donations/">Donate</a>';
1288
  }
1289
  return $links;
1335
  }
1336
 
1337
  function ppr_save_metadata($post_id, $post) {
1338
+
1339
  if($post->post_type == 'revision'){return;}
1340
  if(isset($_REQUEST['pprredirect_noncename']) && (isset($_POST['pprredirect_active']) || isset($_POST['pprredirect_url']) || isset($_POST['pprredirect_type']) || isset($_POST['pprredirect_newwindow']) || isset($_POST['pprredirect_relnofollow']))):
1341
  unset($my_meta_data);
1352
  }
1353
 
1354
  // find & save the form data & put it into an array
1355
+ $my_meta_data['_pprredirect_active'] = isset($_REQUEST['pprredirect_active']) ? $_REQUEST['pprredirect_active'] : '';
1356
+ $my_meta_data['_pprredirect_newwindow'] = isset($_REQUEST['pprredirect_newwindow']) ? $_REQUEST['pprredirect_newwindow'] : '';
1357
+ $my_meta_data['_pprredirect_relnofollow'] = isset($_REQUEST['pprredirect_relnofollow']) ? $_REQUEST['pprredirect_relnofollow'] : '';
1358
+ $my_meta_data['_pprredirect_type'] = isset($_REQUEST['pprredirect_type']) ? $_REQUEST['pprredirect_type'] : '';
1359
+ $my_meta_data['_pprredirect_rewritelink'] = isset($_REQUEST['pprredirect_rewritelink']) ? $_REQUEST['pprredirect_rewritelink'] : '';
1360
+ $my_meta_data['_pprredirect_url'] = isset($_REQUEST['pprredirect_url']) ? $_REQUEST['pprredirect_url'] : '';
1361
+ //$my_meta_data['_pprredirect_casesensitive'] = isset($_REQUEST['pprredirect_casesensitive']) ? $_REQUEST['pprredirect_casesensitive']: '';
1362
 
1363
  if ( 0 === strpos($my_meta_data['_pprredirect_url'], 'www.'))
1364
  $my_meta_data['_pprredirect_url'] = 'http://' . $my_meta_data['_pprredirect_url'] ; // Starts with www., so add http://
1484
  }
1485
 
1486
  function redirect(){
1487
+
1488
  // Read the list of redirects and if the current page is found in the list, send the visitor on her way
1489
  if (!empty($this->quickppr_redirects) && !is_admin()) {
1490
  $userrequest = str_replace(get_option('home'),'',$this->getAddress());
1493
  if(isset($_GET)){
1494
  $useURLQS = array();
1495
  if(count($_GET) >= 1){
1496
+ foreach($_GET as $key => $value){$useURLQS[] = $key.'='.$value;}
1497
+ //TODO: Make this an option?
1498
  $finalQS = '?'.implode('&',$useURLQS);
1499
  $userrequest = preg_replace('/\?.*/', '', $userrequest);
1500
  }
1514
  }else{
1515
  if(array_key_exists($needle.'/', $haystack)){
1516
  $index = $needle.'/';
1517
+ }elseif(array_key_exists($needle.$finalQS, $haystack)){ //check if QS data might be part of the URL and not supposed to be added back.
1518
+ $index = $needle.$finalQS;
1519
+ $finalQS = ''; //remove it
1520
  }
1521
  }
1522
  if($index){
1523
  $val = $haystack[$index];
1524
  if($val) {
1525
+ $useURL = $this->pproverride_URL != '' ? $this->pproverride_URL : $val;
1526
  $useURL .= $finalQS; //add QS back
1527
  do_action('qppr_redirect',$useURL,$this->pproverride_type);
1528
  if($this->pproverride_type == 'meta'){
1568
  $this->ppr_metaurl = $redrurl;
1569
  add_action('wp_head', array($this,'ppr_addmetatohead_theme'),1);
1570
  }else{
1571
+ do_action('qppr_do_redirect',$urlsite,$this->pproverride_type);
1572
  wp_redirect($urlsite,$redrtype);
1573
  exit();
1574
  }
readme.txt CHANGED
@@ -3,19 +3,19 @@ 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.4.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.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: =
16
  * Works with new WordPress menus
17
  * Works with new WordPress Custom Post Types (set option on settings page)
18
- * 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)
@@ -129,6 +129,12 @@ 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.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.
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.5.1
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.3.
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)
129
  5. Summary of redirects plugin page.
130
 
131
  == Changelog ==
132
+ = 5.0.3 =
133
+ * Minor bug cleanup update - (no new features added)
134
+ * Bug fixes: Javascript ghost js file call fixed. Actions hooks not applying issue fixed. Querystring redirect issue addressed. Unset index errors addressed. Some Network/MU problems fixed.
135
+ * Modified Import and Export scripts to export a more editable export file. Import can be either old encoded version or new readable PIPE version.
136
+ * Typos and minor layout issues addressed.
137
+
138
  = 5.0.2 =
139
  * Bug fixes and jQuery now set to off until issues are resolved.
140
  * Set Case Sensetive to on by default - Some people having issues with infinite loops.