Changeset 428746
- Timestamp:
- 08/25/2011 05:33:41 PM (15 years ago)
- Location:
- wp-htaccess-control/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (3 diffs)
-
wp-htaccess-control-ui.php (modified) (1 diff)
-
wp-htaccess-control.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-htaccess-control/trunk/readme.txt
r427640 r428746 7 7 Requires at least: 2.7 8 8 Tested up to: 3.2.1 9 Stable tag: 2. 5.89 Stable tag: 2.6 10 10 11 11 Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress. … … 19 19 20 20 * Customizing the htaccess file generated by Wordpress; 21 * Removing the category base; 21 * Removing the category base from permalinks; 22 * Removing the author base from permalinks; 22 23 * Customizing the Author Permalink Base; 23 24 * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language); … … 73 74 == Changelog == 74 75 76 = 2.6 (23/08/2011) = 77 * *Feature:* added option to remove author base. 78 75 79 = 2.5.8 (23/08/2011) = 76 80 * *Fix:* fixed file encoding introduced on 2.5.7 (which should always by UTF-8 without BOM). -
wp-htaccess-control/trunk/wp-htaccess-control-ui.php
r402270 r428746 157 157 <p class="description"><?php _e('If active, the category base will be removed from permalinks:'); ?></p> 158 158 <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category', 'wp-htaccess-control'); ?></code></p> 159 <p class="description"><strong><?php _e('Beware:'); ?></strong> <?php _e('This could conflict with the removal of the author base on a situation where a category slug is the same as a user nicename.'); ?></p> 160 </td> 161 </tr> 162 </table> 163 </div> 164 <!-- Remove Author Base --> 165 <div class="wphtc-section"> 166 <div class="wphtc-section-title stuffbox"> 167 <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> 168 <h3><?php _e('Remove Author Base', 'wp-htaccess-control');?></h3> 169 </div> 170 <table class="form-table wphtc-inputs"> 171 <tr valign="top"> 172 <th scope="row" style="width:18%;"><?php _e('Remove Author Base', 'wp-htaccess-control'); ?></th> 173 <td > 174 <input type="checkbox" name="WPhtc_remove_author_base" <?php if($WPhtc_data['remove_author_base']){echo "checked=checked";} ?> /> 175 </td> 176 <td valign="middle"> 177 <p class="description"><?php _e('If active, the author base will be removed from permalinks:'); ?></p> 178 <p class="description"><code><?php bloginfo('home')?>/<?php _e('the-author', 'wp-htaccess-control'); ?></code></p> 179 <p class="description"><strong><?php _e('Beware:'); ?></strong> <?php _e('This could conflict with the removal of the category base on a situation where a category slug is the same as a user nicename.'); ?></p> 180 <p class="description"><strong><?php _e('Beware:'); ?></strong> <?php _e('I have not evaluated the impact on performance when using this with dozens of users. Please tell me how it goes.'); ?></p> 159 181 </td> 160 182 </tr> -
wp-htaccess-control/trunk/wp-htaccess-control.php
r427627 r428746 4 4 Plugin URI: http://dardna.com/wp-htaccess-control 5 5 Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress. 6 Version: 2. 5.86 Version: 2.6 7 7 Author: António Andrade 8 8 Author URI: http://dardna.com … … 130 130 function wphtc_filter_author_link($link){ 131 131 $WPhtc_data=get_option('WPhtc_data'); 132 if(isset($WPhtc_data['cap']) && $WPhtc_data['cap']!=''){ 132 if($WPhtc_data['remove_author_base']){ 133 $link=str_replace("author/","",$link); 134 } 135 else if(isset($WPhtc_data['cap']) && $WPhtc_data['cap']!=''){ 133 136 $link=str_replace("author",urlencode($WPhtc_data['cap']),$link); 134 137 } … … 194 197 } 195 198 # Author Archives 196 if(isset($WPhtc_data['author_archives'])){ 199 if($WPhtc_data['remove_author_base']){ 200 $blogusers = get_users('who=authors'); 201 foreach ($blogusers as $user) { 202 203 $new_rules = array( 204 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]', 205 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&paged=$matches[3]', 206 207 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]', 208 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]', 209 210 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]', 211 '('.$user->user_nicename.')/([^/]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]'); 212 213 $rewrite_rules = $new_rules + $rewrite_rules; 214 } 215 } 216 else if(isset($WPhtc_data['author_archives'])){ 197 217 $author_base = ($WPhtc_data['cap']!='')?$WPhtc_data['cap']:'author'; 198 218 $new_rules = array( … … 480 500 } 481 501 return $category_rewrite; 502 } 503 # Filter Author Rewrite Rules 504 function remove_author_base_from_rewrite_rules($author_rewrite) { 505 $WPhtc_data=get_option('WPhtc_data'); 506 if($WPhtc_data['remove_author_base']){ 507 $author_rewrite=array(); 508 $blogusers = get_users('who=authors'); 509 foreach($blogusers as $user) { 510 $author_rewrite['('.$user->user_nicename.')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?author_name=$matches[1]&feed=$matches[2]'; 511 $author_rewrite['('.$user->user_nicename.')/page/?([0-9]{1,})/?$'] = 'index.php?author_name=$matches[1]&paged=$matches[2]'; 512 $author_rewrite['('.$user->user_nicename.')/?$'] = 'index.php?author_name=$matches[1]'; 513 } 514 } 515 return $author_rewrite; 482 516 } 483 517 # WP-htaccess Control options page interface … … 565 599 # Remove Category Base 566 600 $WPhtc_data['remove_category_base']=$_POST['WPhtc_remove_category_base']; 601 # Remove Author Base 602 $WPhtc_data['remove_author_base']=$_POST['WPhtc_remove_author_base']; 567 603 # Advanced Archives 568 604 $WPhtc_data['category_archives']=$_POST['WPhtc_category_archives']; … … 635 671 add_action('template_redirect', array($WPhtc,'wphtc_template_redirect') ); 636 672 add_filter('category_rewrite_rules', array($WPhtc,'remove_category_base_from_rewrite_rules')); 673 add_filter('author_rewrite_rules', array($WPhtc,'remove_author_base_from_rewrite_rules')); 637 674 add_filter('category_link', array($WPhtc,'filter_category_link'),1000,2); 638 675 add_action('created_category',array($WPhtc,'refresh_rewrite_rules'));
Note: See TracChangeset
for help on using the changeset viewer.