Version Description
(23/06/2011) = * Fix: fixed search feed using custom search base.
Download this release
Release Info
Developer | dardna |
Plugin | WP htaccess Control |
Version | 2.5.4 |
Comparing to | |
See all releases |
Code changes from version 2.5.3 to 2.5.4
- readme.txt +3 -0
- wp-htaccess-control.php +37 -7
readme.txt
CHANGED
@@ -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.3 (23/06/2011) =
|
76 |
* *Fix:* fixed special characters on query using custom search base as 2.5.2 did not solve it.
|
77 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.5.4 (23/06/2011) =
|
76 |
+
* *Fix:* fixed search feed using custom search base.
|
77 |
+
|
78 |
= 2.5.3 (23/06/2011) =
|
79 |
* *Fix:* fixed special characters on query using custom search base as 2.5.2 did not solve it.
|
80 |
|
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.
|
7 |
Author: António Andrade
|
8 |
Author URI: http://dardna.com
|
9 |
*/
|
@@ -48,9 +48,25 @@ if (!class_exists("WPhtc")) {
|
|
48 |
# rewrite query
|
49 |
if(strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
|
50 |
global $wp_query;
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
}
|
@@ -58,12 +74,25 @@ if (!class_exists("WPhtc")) {
|
|
58 |
function wphtc_get_search_query_filter($query){
|
59 |
$WPhtc_data=get_option('WPhtc_data');
|
60 |
if($WPhtc_data['custom_search_permalink']!=''&&strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
|
61 |
-
|
62 |
-
$
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
return $query;
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
function wphtc_check_first_run(){
|
68 |
# flush rules to get some data filled
|
69 |
$WPhtc_data=get_option('WPhtc_data');
|
@@ -564,6 +593,7 @@ if (isset($WPhtc)) {
|
|
564 |
add_filter('get_pagenum_link',array($WPhtc,'wphtc_filter_get_pagenum_link'));
|
565 |
add_filter('redirect_canonical',array($WPhtc,'wphtc_filter_redirect_canonical'),10,10);
|
566 |
add_filter('get_search_query',array($WPhtc,'wphtc_get_search_query_filter'),10,10);
|
|
|
567 |
add_action('admin_menu', array($WPhtc,'configure_menu'));
|
568 |
add_action('sm_buildmap',array($WPhtc,'set_sm'));
|
569 |
add_action('init', array($WPhtc,'wphtc_init'));
|
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 |
*/
|
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')){
|
52 |
+
preg_match("/feed\/(feed|rdf|rss|rss2|atom)?/",$_SERVER["REQUEST_URI"], $feed);
|
53 |
+
if($feed[1]){
|
54 |
+
$format="&feed=".$feed[1];
|
55 |
+
}
|
56 |
+
else{
|
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 |
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 |
}
|
89 |
+
function wphtc_search_feed_link($link){
|
90 |
+
$WPhtc_data=get_option('WPhtc_data');
|
91 |
+
if($WPhtc_data['custom_search_permalink']!=''){
|
92 |
+
$link=str_replace("search",$WPhtc_data['custom_search_permalink'],$link);
|
93 |
+
}
|
94 |
+
return $link;
|
95 |
+
}
|
96 |
function wphtc_check_first_run(){
|
97 |
# flush rules to get some data filled
|
98 |
$WPhtc_data=get_option('WPhtc_data');
|
593 |
add_filter('get_pagenum_link',array($WPhtc,'wphtc_filter_get_pagenum_link'));
|
594 |
add_filter('redirect_canonical',array($WPhtc,'wphtc_filter_redirect_canonical'),10,10);
|
595 |
add_filter('get_search_query',array($WPhtc,'wphtc_get_search_query_filter'),10,10);
|
596 |
+
add_filter('search_feed_link',array($WPhtc,'wphtc_search_feed_link'),10,10);
|
597 |
add_action('admin_menu', array($WPhtc,'configure_menu'));
|
598 |
add_action('sm_buildmap',array($WPhtc,'set_sm'));
|
599 |
add_action('init', array($WPhtc,'wphtc_init'));
|