WP htaccess Control - Version 2.3

Version Description

(27/03/2011) = * Feature: "?s=search+term" redirects to "/search-base/search+term" (as requested by Tatron). * Removed "Rewrite Pairs" code and did some clean up. * Added donation link.

Download this release

Release Info

Developer dardna
Plugin Icon wp plugin WP htaccess Control
Version 2.3
Comparing to
See all releases

Code changes from version 2.2.4 to 2.3

readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link:
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
7
  Requires at least: 2.7
8
  Tested up to: 3.1
9
- Stable tag: 2.2.4
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
@@ -21,7 +21,7 @@ Despite the name, many of the options now present on this plugin do not use the
21
  * Removing the category base;
22
  * Customizing the Author Permalink Base;
23
  * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
24
- * Customizing the Search Permalink Base;
25
  * Category, Author and Tag based archives (ex: *"http://your-site.com/category/stories/2010/12"*, *"http://your-site.com/author/admin/2010/12/page/2"* and *"http://your-site.com/tag/wordpress/2010/12"*), this will also work if you've removed the category base;
26
  * Maintenance mode.
27
 
@@ -66,10 +66,16 @@ I still haven't tested this under **Wordpress multisite**, issues have however b
66
 
67
  == Additional Credit ==
68
 
69
- Removal of the category base is based on iDope's **WP No Category Base** but extended so that it works with category archives (ie.: *"http://example.com/my-category/2010/12"*)
 
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
73
  = 2.2.4 (26/03/2011) =
74
  * *Fix:* Still fixing 2.2 canonical bug.
75
 
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
7
  Requires at least: 2.7
8
  Tested up to: 3.1
9
+ Stable tag: 2.3
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
21
  * Removing the category base;
22
  * Customizing the Author Permalink Base;
23
  * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
24
+ * Customization (and canonization) of the Search Permalink Base;
25
  * Category, Author and Tag based archives (ex: *"http://your-site.com/category/stories/2010/12"*, *"http://your-site.com/author/admin/2010/12/page/2"* and *"http://your-site.com/tag/wordpress/2010/12"*), this will also work if you've removed the category base;
26
  * Maintenance mode.
27
 
66
 
67
  == Additional Credit ==
68
 
69
+ Removal of the category base is based on iDope's **WP No Category Base** but extended so that it works with category archives (ie.: *"http://example.com/my-category/2010/12"*).
70
+ Search redirection is based on Mark Jaquith's **Nice Search** but extended so that it works with custom search base (ie.: *"http://example.com/search-base/search-term"*).
71
 
72
  == Changelog ==
73
 
74
+ = 2.3 (27/03/2011) =
75
+ * *Feature:* "?s=search+term" redirects to "/search-base/search+term" (as requested by Tatron).
76
+ * Removed "Rewrite Pairs" code and did some clean up.
77
+ * Added donation link.
78
+
79
  = 2.2.4 (26/03/2011) =
80
  * *Fix:* Still fixing 2.2 canonical bug.
81
 
wp-htaccess-control-ui.css CHANGED
@@ -1,3 +1,5 @@
 
 
1
  .wphtc-menu{margin:10px 0;}
2
  .wphtc-section{background:#ddd;border:1px solid #ddd;border-bottom:0;margin-top:15px;-moz-border-radius:6px;-webkit-border-radius:6px;}
3
  .wphtc-section-title{-moz-user-select: none;-khtml-user-select: none;user-select: none;margin-bottom:0;width:100%;border:0;}
@@ -10,5 +12,5 @@
10
  .form-table{margin:0;}
11
  #wphtc-footer{text-align:right;}
12
  textarea.readonly{background-color:#eee;}
13
- ul.description{/*list-style:square inside;*/margin-top:1em;}
14
  ul.description a{text-decoration:none;}
1
+ div.updated p img{margin: -5px 15px;}
2
+ div.updated p span{float:right;}
3
  .wphtc-menu{margin:10px 0;}
4
  .wphtc-section{background:#ddd;border:1px solid #ddd;border-bottom:0;margin-top:15px;-moz-border-radius:6px;-webkit-border-radius:6px;}
5
  .wphtc-section-title{-moz-user-select: none;-khtml-user-select: none;user-select: none;margin-bottom:0;width:100%;border:0;}
12
  .form-table{margin:0;}
13
  #wphtc-footer{text-align:right;}
14
  textarea.readonly{background-color:#eee;}
15
+ ul.description{margin-top:1em;}
16
  ul.description a{text-decoration:none;}
wp-htaccess-control-ui.js CHANGED
@@ -1,31 +1,8 @@
1
  jQuery(document).ready(function(){
2
- //addRewritePairButton();
3
  collapseSections();
4
  editWPhtaJM();
5
- /*function addRewritePairButton(){
6
- jQuery('.add-rewrite-pair').click(function(){addRule();});
7
- }
8
- function addRule(){
9
- num=parseInt(jQuery("#WPhtc_num").val());
10
- if(!jQuery('.add-rewrite-pair').hasClass('doing')){
11
- jQuery('.add-rewrite-pair').addClass('doing');
12
- lastrule=jQuery("#htaccess-rules tr:last").attr('id').split('-');
13
- newrule=parseInt(lastrule[1])+1;
14
- jQuery("#htaccess-rules tr:last").clone().attr('id','rule-'+newrule).hide().insertAfter("#htaccess-rules tr:last").fadeIn('slow',
15
- function(){
16
- jQuery('.add-rewrite-pair').removeClass('doing');
17
- }
18
- )
19
- .css({display: ""});
20
- jQuery("#rule-"+newrule+" input:first").val('').attr('name','WPhtc_pat'+newrule);
21
- jQuery("#rule-"+newrule+" input:last").val('').attr('name','WPhtc_sub'+newrule);
22
- jQuery("#rule-"+newrule+" td:last").empty();
23
- jQuery("#WPhtc_num").val(num+1);
24
- }
25
- }*/
26
  function collapseSections(){
27
  jQuery(".wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide();
28
- //jQuery(".wphtc-menu").fadeOut(0);
29
  jQuery(".handlediv").fadeOut(0);
30
  jQuery(".wphtc-section").hover(
31
  function(){
@@ -41,12 +18,6 @@ jQuery(document).ready(function(){
41
  jQuery(this).parent().find("a").toggle();
42
  }
43
  jQuery(this).parent().next(".wphtc-inputs").toggle();
44
- /*if(jQuery(".wphtc-inputs:visible").length<2){
45
- jQuery(".wphtc-menu").fadeOut(250);
46
- }
47
- else{
48
- jQuery(".wphtc-menu").fadeIn(250);
49
- }*/
50
  }
51
  );
52
  }
1
  jQuery(document).ready(function(){
 
2
  collapseSections();
3
  editWPhtaJM();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  function collapseSections(){
5
  jQuery(".wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide();
 
6
  jQuery(".handlediv").fadeOut(0);
7
  jQuery(".wphtc-section").hover(
8
  function(){
18
  jQuery(this).parent().find("a").toggle();
19
  }
20
  jQuery(this).parent().next(".wphtc-inputs").toggle();
 
 
 
 
 
 
21
  }
22
  );
23
  }
wp-htaccess-control-ui.php CHANGED
@@ -19,7 +19,18 @@ $WPhtc_data=get_option('WPhtc_data');
19
  <form method="post" action="<?php echo $purl?>">
20
  <?php if($echo!=''){?>
21
  <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
22
- <?php }?>
 
 
 
 
 
 
 
 
 
 
 
23
  <!-- Custom Author Permalink -->
24
  <div class="wphtc-section">
25
  <div class="wphtc-section-title stuffbox">
@@ -89,6 +100,7 @@ $WPhtc_data=get_option('WPhtc_data');
89
  </td>
90
  <td valign="middle">
91
  <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
 
92
  <p class="description"><?php _e('If you do not want to use a custom Search Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
93
  </td>
94
  </tr>
@@ -323,33 +335,6 @@ $WPhtc_data=get_option('WPhtc_data');
323
  </tr>
324
  </table>
325
  </div>
326
- <!-- Rewrite Pairs -->
327
- <?php # deprecate in the future
328
- if(isset($WPhtc_data['pats'][0])){?>
329
- <div class="wphtc-section">
330
- <div class="wphtc-section-title stuffbox">
331
- <div title="Click to toggle" class="handlediv" style="background:url('<?php bloginfo("wpurl")?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent"><br></div>
332
- <h3><?php _e('Rewrite Pairs', 'wp-htaccess-control'); ?><br/><span class="description" style="color:red;"><?php _e('You should migrate your rewrite pairs into the "Custom htaccess" rules above. The "Rewrite Pairs" will be removed in future versions as they lack functionality.')?></span> </h3>
333
-
334
- </div>
335
- <table id="htaccess-rules" class="form-table wphtc-inputs">
336
- <caption>
337
- <!--<a class="add-rewrite-pair button-secondary" href="#AddRewritePair" title="Add new htaccess redirection pair"><?php _e('Add rule', 'wp-htaccess-control'); ?></a>
338
- <span class="description"><?php _e('These are rewrite pairs (RewriteRule) which Wordpress can add inside its rules.', 'wp-htaccess-control'); ?></span>-->
339
-
340
- </caption>
341
- <?php
342
- $num=count($WPhtc_data['pats'])?count($WPhtc_data['pats']):1;
343
- for($i=0;$i<$num;$i++){?>
344
- <tr id="rule-<?php echo $i;?>" valign="top">
345
- <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_pat<?php echo $i;?>" value="<?php echo $WPhtc_data['pats'][$i]; ?>" /></td>
346
- <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_sub<?php echo $i;?>" value="<?php echo $WPhtc_data['subs'][$i]; ?>" /></td>
347
- <td style="width:10%;" valign="middle"><a class="button-secondary" href="<?php echo $purl ?>&action=delete_pair&pair=<?php echo $i?>"><?php _e('Delete Pair', 'wp-htaccess-control'); ?></a></td>
348
- </tr>
349
- <?php } ?>
350
- </table>
351
- </div>
352
- <?php }?>
353
  <!-- Maintenance Mode -->
354
  <div class="wphtc-section">
355
  <div class="wphtc-section-title stuffbox">
@@ -388,7 +373,6 @@ $WPhtc_data=get_option('WPhtc_data');
388
  </table>
389
  </div>
390
  <input type="hidden" name="action" value="update" />
391
- <input id="WPhtc_num" type="hidden" name="WPhtc_num" value="<?php echo $num;?>" />
392
  <div class="wphtc-menu">
393
  <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a>
394
  <input type="submit" class="button-primary" value="<?php _e('Save all changes', 'wp-htaccess-control'); ?>" />
19
  <form method="post" action="<?php echo $purl?>">
20
  <?php if($echo!=''){?>
21
  <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
22
+ <?php }
23
+ # Donation Message
24
+ if($WPhtc_data['donation_hidden_time']&&$WPhtc_data['donation_hidden_time']<time()){?>
25
+ <div class="updated">
26
+ <p>
27
+ <strong>Is this plugin useful? Consider making a donation encouraging me to continue supporting it!</strong>
28
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4mancha%40gmail%2ecom&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img alt="Donate" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_SM.gif"></a>
29
+ <span><a href="<?php echo $purl?>&action=hide_donation_message">Hide this message</a></span>
30
+ </p>
31
+
32
+ </div>
33
+ <?php }?>
34
  <!-- Custom Author Permalink -->
35
  <div class="wphtc-section">
36
  <div class="wphtc-section-title stuffbox">
100
  </td>
101
  <td valign="middle">
102
  <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
103
+ <p class="description"><?php _e('If set, the search base will always be used instead of "?s=search-term".', 'wp-htaccess-control'); ?></p>
104
  <p class="description"><?php _e('If you do not want to use a custom Search Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
105
  </td>
106
  </tr>
335
  </tr>
336
  </table>
337
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  <!-- Maintenance Mode -->
339
  <div class="wphtc-section">
340
  <div class="wphtc-section-title stuffbox">
373
  </table>
374
  </div>
375
  <input type="hidden" name="action" value="update" />
 
376
  <div class="wphtc-menu">
377
  <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a>
378
  <input type="submit" class="button-primary" value="<?php _e('Save all changes', 'wp-htaccess-control'); ?>" />
wp-htaccess-control.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
- Version: 2.2.4
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
10
- /* Copyright 2010 António Andrade (email : dardna@dardna.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
@@ -23,7 +23,9 @@ Author URI: http://dardna.com
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
- /* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008 */
 
 
27
  if (!class_exists("WPhtc")) {
28
  class WPhtc {
29
  function WPhtc() {
@@ -36,6 +38,13 @@ if (!class_exists("WPhtc")) {
36
  if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wp-htaccess-control', $moFile);
37
  }
38
  }
 
 
 
 
 
 
 
39
  function wphtc_check_first_run(){
40
  # flush rules to get some data filled
41
  $WPhtc_data=get_option('WPhtc_data');
@@ -66,10 +75,11 @@ if (!class_exists("WPhtc")) {
66
  }
67
  return $link;
68
  }
69
- # Disable canonical redirection on urls using custom pagination permalink
70
  function wphtc_filter_redirect_canonical($requested_url){
71
  global $wp;
72
  $WPhtc_data=get_option('WPhtc_data');
 
73
  if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&preg_match("/".urlencode($WPhtc_data['cpp'])."/",$wp->request)){
74
  return false;
75
  }
@@ -184,15 +194,6 @@ if (!class_exists("WPhtc")) {
184
  # Adding rewrite pairs to the .htaccess generated by Wordpress, everytime the rules are flush
185
  function wphtc_wp_rewrite_rules($wp_rewrite){
186
  $WPhtc_data=get_option('WPhtc_data');
187
-
188
- # Deprecate in the future
189
- for($i=0;$i<count($WPhtc_data['pats']);$i++){
190
- if($WPhtc_data['pats'][$i]!=''&&$WPhtc_data['subs'][$i]!=''){
191
- # Adding each custom rewrite pair to $wp_rewrite->non_wp_rules['pattern']='substitution'
192
- $wp_rewrite->non_wp_rules[$WPhtc_data['pats'][$i]]=$WPhtc_data['subs'][$i];
193
- }
194
- }
195
-
196
  # Keeping a copy of the generated htaccess in our option array for later reviewing
197
  $WPhtc_data['cur_hta']='# BEGIN Wordpress<br/>'.nl2br($wp_rewrite->mod_rewrite_rules())."# END Wordpress";
198
  # deprecating original_hta
@@ -411,11 +412,16 @@ if (!class_exists("WPhtc")) {
411
  # Options Page Actions
412
  function wphtc_page_action(){
413
  WPhtc::wphtc_check_first_run();
414
- $action=$_POST['action']?$_POST['action']:$_GET['action'];
415
  global $echo;
416
  if(isset($action)){
417
  $WPhtc_data=get_option('WPhtc_data');
418
  switch($action){
 
 
 
 
 
419
  # if reseting everything just delete the option array
420
  case 'reset_rules':
421
  delete_option('WPhtc_data');
@@ -424,19 +430,9 @@ if (!class_exists("WPhtc")) {
424
  break;
425
  # if updating, save new rules in database and flush rewrite rules
426
  case 'update':
427
- # get Rewrite Pairs
428
- for($i=0;$i<$_POST['WPhtc_num'];$i++){
429
- if(!empty($_POST['WPhtc_pat'.$i]) && !empty($_POST['WPhtc_sub'.$i])){
430
- $WPhtc_data['pats'][$i]=$_POST['WPhtc_pat'.$i];
431
- $WPhtc_data['subs'][$i]=$_POST['WPhtc_sub'.$i];
432
- }
433
- }
434
- if(count($WPhtc_data['pats'])>1 && $WPhtc_data['pats'][0]==''){
435
- unset($WPhtc_data['pats'][0],$WPhtc_data['subs'][0]);
436
- }
437
- if(is_array($WPhtc_data['pats'])&&is_array($WPhtc_data['subs'])){
438
- $WPhtc_data['pats']=array_values($WPhtc_data['pats']);
439
- $WPhtc_data['subs']=array_values($WPhtc_data['subs']);
440
  }
441
  # get Custom Htaccess
442
  $WPhtc_data['hta']=$_POST['WPhtc_hta'];
@@ -516,24 +512,6 @@ if (!class_exists("WPhtc")) {
516
  $this->refresh_rewrite_rules();
517
  $echo.=__('All options updated.', 'wp-htaccess-control');
518
  break;
519
- # deleting individual rewrite pair
520
- case 'delete_pair':
521
- if(isset($_GET['pair'])){
522
- # if it's the last pair
523
- if($_GET['pair']==0 && !isset($WPhtc_data['pats'][1])){
524
- unset($WPhtc_data['pats'], $WPhtc_data['subs']);
525
- $echo.=__('Wordpress Rewrite pairs reset.', 'wp-htaccess-control');
526
- }
527
- else{
528
- unset($WPhtc_data['pats'][$_GET['pair']],$WPhtc_data['subs'][$_GET['pair']]);
529
- $WPhtc_data['pats']=array_values($WPhtc_data['pats']);
530
- $WPhtc_data['subs']=array_values($WPhtc_data['subs']);
531
- $echo.=__('Wordpress Rewrite pair deleted.', 'wp-htaccess-control');
532
- }
533
- update_option('WPhtc_data',$WPhtc_data);
534
- $this->refresh_rewrite_rules();
535
- }
536
- break;
537
  }
538
  }
539
  }
@@ -552,6 +530,7 @@ if (isset($WPhtc)) {
552
  add_action('admin_menu', array($WPhtc,'configure_menu'));
553
  add_action('sm_buildmap',array($WPhtc,'set_sm'));
554
  add_action('init', array($WPhtc,'wphtc_init'));
 
555
  add_filter('category_rewrite_rules', array($WPhtc,'remove_category_base_from_rewrite_rules'));
556
  add_filter('category_link', array($WPhtc,'filter_category_link'),1000,2);
557
  add_action('created_category',array($WPhtc,'refresh_rewrite_rules'));
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
+ Version: 2.3
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
10
+ /* Copyright 2010-2011 António Andrade (email : dardna@dardna.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
+ /* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008
27
+ Search redirection is based on Nice Search by Mark Jaquith, 2011 */
28
+
29
  if (!class_exists("WPhtc")) {
30
  class WPhtc {
31
  function WPhtc() {
38
  if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wp-htaccess-control', $moFile);
39
  }
40
  }
41
+ function wphtc_template_redirect(){
42
+ # redirect "?s=*" to "/search-base/*"
43
+ $WPhtc_data=get_option('WPhtc_data');
44
+ if($_GET['s']&&$WPhtc_data['custom_search_permalink']!=''){
45
+ wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" . str_replace( array( ' ', '%20' ), array( '+', '+' ), get_query_var( 's' ) ) ) );
46
+ }
47
+ }
48
  function wphtc_check_first_run(){
49
  # flush rules to get some data filled
50
  $WPhtc_data=get_option('WPhtc_data');
75
  }
76
  return $link;
77
  }
78
+
79
  function wphtc_filter_redirect_canonical($requested_url){
80
  global $wp;
81
  $WPhtc_data=get_option('WPhtc_data');
82
+ # Disable canonical redirection on urls using custom pagination permalink
83
  if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&preg_match("/".urlencode($WPhtc_data['cpp'])."/",$wp->request)){
84
  return false;
85
  }
194
  # Adding rewrite pairs to the .htaccess generated by Wordpress, everytime the rules are flush
195
  function wphtc_wp_rewrite_rules($wp_rewrite){
196
  $WPhtc_data=get_option('WPhtc_data');
 
 
 
 
 
 
 
 
 
197
  # Keeping a copy of the generated htaccess in our option array for later reviewing
198
  $WPhtc_data['cur_hta']='# BEGIN Wordpress<br/>'.nl2br($wp_rewrite->mod_rewrite_rules())."# END Wordpress";
199
  # deprecating original_hta
412
  # Options Page Actions
413
  function wphtc_page_action(){
414
  WPhtc::wphtc_check_first_run();
415
+ $action=$_REQUEST['action'];
416
  global $echo;
417
  if(isset($action)){
418
  $WPhtc_data=get_option('WPhtc_data');
419
  switch($action){
420
+ # Hide donation message for one month
421
+ case 'hide_donation_message':
422
+ $WPhtc_data['donation_hidden_time']=time()+ 30 * 24 * 60 * 60;
423
+ update_option('WPhtc_data',$WPhtc_data);
424
+ break;
425
  # if reseting everything just delete the option array
426
  case 'reset_rules':
427
  delete_option('WPhtc_data');
430
  break;
431
  # if updating, save new rules in database and flush rewrite rules
432
  case 'update':
433
+ # first donation hidding time 'now'
434
+ if(!$WPhtc_data['donation_hidden_time']){
435
+ $WPhtc_data['donation_hidden_time']=time();
 
 
 
 
 
 
 
 
 
 
436
  }
437
  # get Custom Htaccess
438
  $WPhtc_data['hta']=$_POST['WPhtc_hta'];
512
  $this->refresh_rewrite_rules();
513
  $echo.=__('All options updated.', 'wp-htaccess-control');
514
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  }
516
  }
517
  }
530
  add_action('admin_menu', array($WPhtc,'configure_menu'));
531
  add_action('sm_buildmap',array($WPhtc,'set_sm'));
532
  add_action('init', array($WPhtc,'wphtc_init'));
533
+ add_action('template_redirect', array($WPhtc,'wphtc_template_redirect') );
534
  add_filter('category_rewrite_rules', array($WPhtc,'remove_category_base_from_rewrite_rules'));
535
  add_filter('category_link', array($WPhtc,'filter_category_link'),1000,2);
536
  add_action('created_category',array($WPhtc,'refresh_rewrite_rules'));