Plugin Directory

Changeset 402270


Ignore:
Timestamp:
06/28/2011 10:35:51 PM (15 years ago)
Author:
dardna
Message:

fixed search pagination using custom search base; (better regex should be put in place or maybe go for an alternative solution)

Location:
wp-htaccess-control/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-htaccess-control/trunk/readme.txt

    r400660 r402270  
    77Requires at least: 2.7
    88Tested up to: 3.1.3
    9 Stable tag: 2.5.4
     9Stable tag: 2.5.5
    1010
    1111Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
     
    7373== Changelog ==
    7474
     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
    7578= 2.5.4 (23/06/2011) =
    7679* *Fix:* fixed search feed using custom search base.
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.php

    r390830 r402270  
    77$WPhtc->wphtc_page_action();
    88$WPhtc_data=get_option('WPhtc_data');
    9 //$nonce= wp_create_nonce('WPhtc_settings');
     9//global $wp_rewrite;print_r($wp_rewrite);
    1010?>
    1111<div id="wphtc-page" class="wrap">
  • wp-htaccess-control/trunk/wp-htaccess-control.php

    r400579 r402270  
    44Plugin URI: http://dardna.com/wp-htaccess-control
    55Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
    6 Version: 2.5.4
     6Version: 2.5.5
    77Author: António Andrade
    88Author URI: http://dardna.com
     
    4444                # redirect "?s=*" to "/search-base/*"
    4545                if($_GET['s']){
    46                     wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" .  urlencode(get_query_var( 's' )) ) );
     46                    wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" .  rawurlencode(get_query_var( 's' )) ) );
    4747                    }
    4848                # rewrite query
     49
     50               
    4951                if(strpos($_SERVER["REQUEST_URI"], $WPhtc_data['custom_search_permalink'])){
    5052                    global $wp_query;
     
    5860                            }
    5961                        }
    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 );
     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 );
    7079                    }
    7180                }
     
    7584            $WPhtc_data=get_option('WPhtc_data');
    7685            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';
    7787                # in need of better regex
    78                 if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],$page_base)){
     88                if(!strpos($_SERVER["REQUEST_URI"], '/feed')&&!strpos($_SERVER["REQUEST_URI"],"/".$page_base)){
    7989                    $pattern="/\/".$WPhtc_data['custom_search_permalink']."\/(.+)/";
    8090                    }
     
    8393                    }
    8494                preg_match($pattern,$_SERVER["REQUEST_URI"], $matches);
    85                 return urldecode($matches[1]);
     95                $results=split("/",$matches[1]);
     96                return urldecode($results[0]);
    8697                }
    8798            return $query;
Note: See TracChangeset for help on using the changeset viewer.