Plugin Directory

Changeset 364744


Ignore:
Timestamp:
03/25/2011 08:34:04 PM (15 years ago)
Author:
dardna
Message:

Fixed canonical redirect;
Custom search permalink.

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

Legend:

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

    r339488 r364744  
    66Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
    77Requires at least: 2.7
    8 Tested up to: 3.0.4
    9 Stable tag: 2.1.2
     8Tested up to: 3.1
     9Stable tag: 2.2
    1010
    1111Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
     
    2222* Customizing the Author Permalink Base;
    2323* Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
     24* Customizing the Search Permalink Base;
    2425* 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;
    2526* Maintenance mode.
     
    6970
    7071== 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).
    7176
    7277= 2.1.2 (01/02/2011) =
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.php

    r316135 r364744  
    7171                        <p class="description"><?php _e('If set, the page base will be used as shown next to the form field in every post listing (category, tag, archive, etc).', 'wp-htaccess-control'); ?></p>
    7272                        <p class="description"><?php _e('If you do not want to use a custom Pagination Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
     73                    </td>
     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>
    7393                    </td>
    7494                </tr>
  • wp-htaccess-control/trunk/wp-htaccess-control.php

    r339488 r364744  
    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.1.2
     6Version: 2.2
    77Author: António Andrade
    88Author URI: http://dardna.com
     
    6868            }
    6969        # 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']))){
     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)){
    7473                return false;
    7574                }
    7675            else{
    77                 return $redirect_url;
    78                 }
    79             }
    80         # Rewrite Rulus: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
     76                return $requested_url;
     77                }
     78            }
     79        # Rewrite Rules: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
    8180        function wphtc_filter_rewrite_rules($rewrite_rules){
    8281            $WPhtc_data=get_option('WPhtc_data');
     
    139138                if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
    140139                    $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);
    141144                    }
    142145                $rewrite_rules=unserialize(preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'",$rewrite_rules));
     
    441444                        # get Custom Pagination Permalink
    442445                        $WPhtc_data['cpp']=$_POST['WPhtc_cpp'];
     446                        # get Custom Search Permalink
     447                        $WPhtc_data['custom_search_permalink']=$_POST['WPhtc_custom_search_permalink'];
    443448                        # wordpress htaccess and jim morgan's htaccess
    444449                        $WPhtc_data['wp_hta']=$_POST['WPhtc_wp_hta']."\n";
Note: See TracChangeset for help on using the changeset viewer.