WP htaccess Control - Version 2.5.5

Version Description

(27/06/2011) = * Fix: fixed search pagination using custom search base; (better regex should be put in place or maybe go for an alternative solution).

Download this release

Release Info

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

Code changes from version 2.5.4 to 2.5.5

readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4man
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.3
9
- Stable tag: 2.5.3
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
@@ -72,6 +72,9 @@ Search redirection is based on Mark Jaquith's **Nice Search** but extended so th
72
 
73
  == Changelog ==
74
 
 
 
 
75
  = 2.5.4 (23/06/2011) =
76
  * *Fix:* fixed search feed using custom search base.
77
 
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.3
9
+ Stable tag: 2.5.5
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.5.5 (27/06/2011) =
76
+ * *Fix:* fixed search pagination using custom search base; (better regex should be put in place or maybe go for an alternative solution).
77
+
78
  = 2.5.4 (23/06/2011) =
79
  * *Fix:* fixed search feed using custom search base.
80
 
wp-htaccess-control-ui.php CHANGED
@@ -6,7 +6,7 @@ $purl='http'.((!empty($_SERVER['HTTPS'])) ? 's' : '').'://'.$_SERVER['HTTP_HOST'
6
  global $WPhtc, $echo;
7
  $WPhtc->wphtc_page_action();
8
  $WPhtc_data=get_option('WPhtc_data');
9
- //$nonce= wp_create_nonce('WPhtc_settings');
10
  ?>
11
  <div id="wphtc-page" class="wrap">
12
  <h2>Wp htaccess Control</h2>
6
  global $WPhtc, $echo;
7
  $WPhtc->wphtc_page_action();
8
  $WPhtc_data=get_option('WPhtc_data');
9
+ //global $wp_rewrite;print_r($wp_rewrite);
10
  ?>
11
  <div id="wphtc-page" class="wrap">
12
  <h2>Wp htaccess Control</h2>
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.5.4
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -43,9 +43,11 @@ if (!class_exists("WPhtc")) {
43
  if($WPhtc_data['custom_search_permalink']!=''){
44
  # redirect "?s=*" to "/search-base/*"
45
  if($_GET['s']){
46
- wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" . urlencode(get_query_var( 's' )) ) );
47
  }
48
  # rewrite query
 
 
49
  if(strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
50
  global $wp_query;
51
  if(strpos($_SERVER["REQUEST_URI"], '/feed')){
@@ -57,16 +59,23 @@ if (!class_exists("WPhtc")) {
57
  $format="&feed=feed";
58
  }
59
  }
60
- $page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
61
- # in need of better regex
62
- if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],$page_base)){
63
- $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
64
- }
65
- else{
66
- $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)\/feed|".$page_base."?/";
67
- }
68
- preg_match($pattern,$_SERVER["REQUEST_URI"], $matches);
69
- $wp_query=new WP_Query('s='.$matches[1].$format );
 
 
 
 
 
 
 
70
  }
71
  }
72
  }
@@ -74,15 +83,17 @@ if (!class_exists("WPhtc")) {
74
  function wphtc_get_search_query_filter($query){
75
  $WPhtc_data=get_option('WPhtc_data');
76
  if($WPhtc_data['custom_search_permalink']!=''&&strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
 
77
  # in need of better regex
78
- if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],$page_base)){
79
  $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
80
  }
81
  else{
82
  $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)\/feed|".$page_base."?/";
83
  }
84
  preg_match($pattern,$_SERVER["REQUEST_URI"], $matches);
85
- return urldecode($matches[1]);
 
86
  }
87
  return $query;
88
  }
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.5.5
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
43
  if($WPhtc_data['custom_search_permalink']!=''){
44
  # redirect "?s=*" to "/search-base/*"
45
  if($_GET['s']){
46
+ wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" . rawurlencode(get_query_var( 's' )) ) );
47
  }
48
  # rewrite query
49
+
50
+
51
  if(strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
52
  global $wp_query;
53
  if(strpos($_SERVER["REQUEST_URI"], '/feed')){
59
  $format="&feed=feed";
60
  }
61
  }
62
+ $page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
63
+ # in need of better regex
64
+
65
+ if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],$page_base)){
66
+ $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
67
+ }
68
+ else{
69
+ $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)\/feed|".$page_base."?/";
70
+ }
71
+
72
+ $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
73
+ preg_match($pattern,$_SERVER["REQUEST_URI"], $matches);
74
+ $results=split("/",$matches[1]);
75
+ if($results[1]==$page_base){
76
+ $page="&paged=".$results[2];
77
+ }
78
+ $wp_query=new WP_Query('s='.$results[0].$page.$format );
79
  }
80
  }
81
  }
83
  function wphtc_get_search_query_filter($query){
84
  $WPhtc_data=get_option('WPhtc_data');
85
  if($WPhtc_data['custom_search_permalink']!=''&&strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
86
+ $page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
87
  # in need of better regex
88
+ if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],"/".$page_base)){
89
  $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
90
  }
91
  else{
92
  $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)\/feed|".$page_base."?/";
93
  }
94
  preg_match($pattern,$_SERVER["REQUEST_URI"], $matches);
95
+ $results=split("/",$matches[1]);
96
+ return urldecode($results[0]);
97
  }
98
  return $query;
99
  }