WP htaccess Control - Version 2.2

Version Description

Download this release

Release Info

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

Code changes from version 2.1.2 to 2.2

readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://dardna.com/wp-htaccess-control
5
  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.0.4
9
- Stable tag: 2.1.2
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
@@ -21,6 +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
  * 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;
25
  * Maintenance mode.
26
 
@@ -69,6 +70,10 @@ Removal of the category base is based on iDope's **WP No Category Base** but ext
69
 
70
  == Changelog ==
71
 
 
 
 
 
72
  = 2.1.2 (01/02/2011) =
73
  * *Fix:* fix on canonical url setting (thank you 8bitkid for pointing it out).
74
 
5
  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
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
+ * 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
 
70
 
71
  == Changelog ==
72
 
73
+ = 2.1.2 (25/03/2011) =
74
+ * *Feature:* adding Custom Search Base;
75
+ * *Fix:* fixed a long time known canonical redirection bug where links like "/?p=55" wouldn't redirect to "/post-slug" (causing duplicated content).
76
+
77
  = 2.1.2 (01/02/2011) =
78
  * *Fix:* fix on canonical url setting (thank you 8bitkid for pointing it out).
79
 
wp-htaccess-control-ui.php CHANGED
@@ -74,6 +74,26 @@ $WPhtc_data=get_option('WPhtc_data');
74
  </tr>
75
  </table>
76
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  <!-- Remove Category Base -->
78
  <div class="wphtc-section">
79
  <div class="wphtc-section-title stuffbox">
74
  </tr>
75
  </table>
76
  </div>
77
+ <!-- Custom Search Permalink -->
78
+ <div class="wphtc-section">
79
+ <div class="wphtc-section-title stuffbox">
80
+ <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>
81
+ <h3><?php _e('Custom Search Permalink', 'wp-htaccess-control');?></h3>
82
+ </div>
83
+ <table class="form-table wphtc-inputs">
84
+ <tr valign="top">
85
+ <th scope="row" style="width:18%;"><?php _e('Search Base', 'wp-htaccess-control'); ?></th>
86
+ <td >
87
+ <input type="text" name="WPhtc_custom_search_permalink" value="<?php echo $WPhtc_data['custom_search_permalink']; ?>" />
88
+ <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/search-term</code></p>
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>
95
+ </table>
96
+ </div>
97
  <!-- Remove Category Base -->
98
  <div class="wphtc-section">
99
  <div class="wphtc-section-title stuffbox">
wp-htaccess-control.php CHANGED
@@ -3,7 +3,7 @@
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.1.2
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -67,17 +67,16 @@ if (!class_exists("WPhtc")) {
67
  return $link;
68
  }
69
  # Disable canonical redirection on urls using custom pagination permalink
70
- function wphtc_filter_redirect_canonical($redirect_url,$requested_url){
71
  $WPhtc_data=get_option('WPhtc_data');
72
- return false;
73
- if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&strpos($requested_url,urlencode($WPhtc_data['cpp']))){
74
  return false;
75
  }
76
  else{
77
- return $redirect_url;
78
  }
79
  }
80
- # Rewrite Rulus: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
81
  function wphtc_filter_rewrite_rules($rewrite_rules){
82
  $WPhtc_data=get_option('WPhtc_data');
83
  $page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
@@ -139,6 +138,10 @@ if (!class_exists("WPhtc")) {
139
  if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
140
  $rewrite_rules=str_replace('page/',$WPhtc_data['cpp'].'/',$rewrite_rules);
141
  }
 
 
 
 
142
  $rewrite_rules=unserialize(preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'",$rewrite_rules));
143
  }
144
  return $rewrite_rules;
@@ -440,6 +443,8 @@ if (!class_exists("WPhtc")) {
440
  $WPhtc_data['cap']=$_POST['WPhtc_cap'];
441
  # get Custom Pagination Permalink
442
  $WPhtc_data['cpp']=$_POST['WPhtc_cpp'];
 
 
443
  # wordpress htaccess and jim morgan's htaccess
444
  $WPhtc_data['wp_hta']=$_POST['WPhtc_wp_hta']."\n";
445
  $WPhtc_data['jim_morgan_hta']=$_POST['WPhtc_jim_morgan_hta'];
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
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
67
  return $link;
68
  }
69
  # Disable canonical redirection on urls using custom pagination permalink
70
+ function wphtc_filter_redirect_canonical($requested_url){
71
  $WPhtc_data=get_option('WPhtc_data');
72
+ if(isset($WPhtc_data['cpp'])&&preg_match($WPhtc_data['cpp'],$requested_url)){
 
73
  return false;
74
  }
75
  else{
76
+ return $requested_url;
77
  }
78
  }
79
+ # Rewrite Rules: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
80
  function wphtc_filter_rewrite_rules($rewrite_rules){
81
  $WPhtc_data=get_option('WPhtc_data');
82
  $page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
138
  if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
139
  $rewrite_rules=str_replace('page/',$WPhtc_data['cpp'].'/',$rewrite_rules);
140
  }
141
+ # Search
142
+ if(isset($WPhtc_data['custom_search_permalink'])&&$WPhtc_data['custom_search_permalink']!=''){
143
+ $rewrite_rules=str_replace('search/',$WPhtc_data['custom_search_permalink'].'/',$rewrite_rules);
144
+ }
145
  $rewrite_rules=unserialize(preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'",$rewrite_rules));
146
  }
147
  return $rewrite_rules;
443
  $WPhtc_data['cap']=$_POST['WPhtc_cap'];
444
  # get Custom Pagination Permalink
445
  $WPhtc_data['cpp']=$_POST['WPhtc_cpp'];
446
+ # get Custom Search Permalink
447
+ $WPhtc_data['custom_search_permalink']=$_POST['WPhtc_custom_search_permalink'];
448
  # wordpress htaccess and jim morgan's htaccess
449
  $WPhtc_data['wp_hta']=$_POST['WPhtc_wp_hta']."\n";
450
  $WPhtc_data['jim_morgan_hta']=$_POST['WPhtc_jim_morgan_hta'];