Changeset 365470
- Timestamp:
- 03/27/2011 05:53:09 PM (15 years ago)
- Location:
- wp-htaccess-control/trunk
- Files:
-
- 5 edited
-
readme.txt (modified) (3 diffs)
-
wp-htaccess-control-ui.css (modified) (2 diffs)
-
wp-htaccess-control-ui.js (modified) (2 diffs)
-
wp-htaccess-control-ui.php (modified) (4 diffs)
-
wp-htaccess-control.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-htaccess-control/trunk/readme.txt
r365154 r365470 7 7 Requires at least: 2.7 8 8 Tested up to: 3.1 9 Stable tag: 2. 2.49 Stable tag: 2.3 10 10 11 11 Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress. … … 22 22 * Customizing the Author Permalink Base; 23 23 * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language); 24 * Customiz ingthe Search Permalink Base;24 * Customization (and canonization) of the Search Permalink Base; 25 25 * 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; 26 26 * Maintenance mode. … … 67 67 == Additional Credit == 68 68 69 Removal of the category base is based on iDope's **WP No Category Base** but extended so that it works with category archives (ie.: *"http://example.com/my-category/2010/12"*) 69 Removal of the category base is based on iDope's **WP No Category Base** but extended so that it works with category archives (ie.: *"http://example.com/my-category/2010/12"*). 70 Search redirection is based on Mark Jaquith's **Nice Search** but extended so that it works with custom search base (ie.: *"http://example.com/search-base/search-term"*). 70 71 71 72 == Changelog == 73 74 = 2.3 (27/03/2011) = 75 * *Feature:* "?s=search+term" redirects to "/search-base/search+term" (as requested by Tatron). 76 * Removed "Rewrite Pairs" code and did some clean up. 77 * Added donation link. 72 78 73 79 = 2.2.4 (26/03/2011) = -
wp-htaccess-control/trunk/wp-htaccess-control-ui.css
r286964 r365470 1 div.updated p img{margin: -5px 15px;} 2 div.updated p span{float:right;} 1 3 .wphtc-menu{margin:10px 0;} 2 4 .wphtc-section{background:#ddd;border:1px solid #ddd;border-bottom:0;margin-top:15px;-moz-border-radius:6px;-webkit-border-radius:6px;} … … 11 13 #wphtc-footer{text-align:right;} 12 14 textarea.readonly{background-color:#eee;} 13 ul.description{ /*list-style:square inside;*/margin-top:1em;}15 ul.description{margin-top:1em;} 14 16 ul.description a{text-decoration:none;} -
wp-htaccess-control/trunk/wp-htaccess-control-ui.js
r286964 r365470 1 1 jQuery(document).ready(function(){ 2 //addRewritePairButton();3 2 collapseSections(); 4 3 editWPhtaJM(); 5 /*function addRewritePairButton(){6 jQuery('.add-rewrite-pair').click(function(){addRule();});7 }8 function addRule(){9 num=parseInt(jQuery("#WPhtc_num").val());10 if(!jQuery('.add-rewrite-pair').hasClass('doing')){11 jQuery('.add-rewrite-pair').addClass('doing');12 lastrule=jQuery("#htaccess-rules tr:last").attr('id').split('-');13 newrule=parseInt(lastrule[1])+1;14 jQuery("#htaccess-rules tr:last").clone().attr('id','rule-'+newrule).hide().insertAfter("#htaccess-rules tr:last").fadeIn('slow',15 function(){16 jQuery('.add-rewrite-pair').removeClass('doing');17 }18 )19 .css({display: ""});20 jQuery("#rule-"+newrule+" input:first").val('').attr('name','WPhtc_pat'+newrule);21 jQuery("#rule-"+newrule+" input:last").val('').attr('name','WPhtc_sub'+newrule);22 jQuery("#rule-"+newrule+" td:last").empty();23 jQuery("#WPhtc_num").val(num+1);24 }25 }*/26 4 function collapseSections(){ 27 5 jQuery(".wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide(); 28 //jQuery(".wphtc-menu").fadeOut(0);29 6 jQuery(".handlediv").fadeOut(0); 30 7 jQuery(".wphtc-section").hover( … … 42 19 } 43 20 jQuery(this).parent().next(".wphtc-inputs").toggle(); 44 /*if(jQuery(".wphtc-inputs:visible").length<2){45 jQuery(".wphtc-menu").fadeOut(250);46 }47 else{48 jQuery(".wphtc-menu").fadeIn(250);49 }*/50 21 } 51 22 ); -
wp-htaccess-control/trunk/wp-htaccess-control-ui.php
r364744 r365470 20 20 <?php if($echo!=''){?> 21 21 <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div> 22 <?php }?> 22 <?php } 23 # Donation Message 24 if($WPhtc_data['donation_hidden_time']&&$WPhtc_data['donation_hidden_time']<time()){?> 25 <div class="updated"> 26 <p> 27 <strong>Is this plugin useful? Consider making a donation encouraging me to continue supporting it!</strong> 28 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4mancha%40gmail%2ecom&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img alt="Donate" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_SM.gif"></a> 29 <span><a href="<?php echo $purl?>&action=hide_donation_message">Hide this message</a></span> 30 </p> 31 32 </div> 33 <?php }?> 23 34 <!-- Custom Author Permalink --> 24 35 <div class="wphtc-section"> … … 90 101 <td valign="middle"> 91 102 <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p> 103 <p class="description"><?php _e('If set, the search base will always be used instead of "?s=search-term".', 'wp-htaccess-control'); ?></p> 92 104 <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> 93 105 </td> … … 324 336 </table> 325 337 </div> 326 <!-- Rewrite Pairs -->327 <?php # deprecate in the future328 if(isset($WPhtc_data['pats'][0])){?>329 <div class="wphtc-section">330 <div class="wphtc-section-title stuffbox">331 <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>332 <h3><?php _e('Rewrite Pairs', 'wp-htaccess-control'); ?><br/><span class="description" style="color:red;"><?php _e('You should migrate your rewrite pairs into the "Custom htaccess" rules above. The "Rewrite Pairs" will be removed in future versions as they lack functionality.')?></span> </h3>333 334 </div>335 <table id="htaccess-rules" class="form-table wphtc-inputs">336 <caption>337 <!--<a class="add-rewrite-pair button-secondary" href="#AddRewritePair" title="Add new htaccess redirection pair"><?php _e('Add rule', 'wp-htaccess-control'); ?></a>338 <span class="description"><?php _e('These are rewrite pairs (RewriteRule) which Wordpress can add inside its rules.', 'wp-htaccess-control'); ?></span>-->339 340 </caption>341 <?php342 $num=count($WPhtc_data['pats'])?count($WPhtc_data['pats']):1;343 for($i=0;$i<$num;$i++){?>344 <tr id="rule-<?php echo $i;?>" valign="top">345 <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_pat<?php echo $i;?>" value="<?php echo $WPhtc_data['pats'][$i]; ?>" /></td>346 <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_sub<?php echo $i;?>" value="<?php echo $WPhtc_data['subs'][$i]; ?>" /></td>347 <td style="width:10%;" valign="middle"><a class="button-secondary" href="<?php echo $purl ?>&action=delete_pair&pair=<?php echo $i?>"><?php _e('Delete Pair', 'wp-htaccess-control'); ?></a></td>348 </tr>349 <?php } ?>350 </table>351 </div>352 <?php }?>353 338 <!-- Maintenance Mode --> 354 339 <div class="wphtc-section"> … … 389 374 </div> 390 375 <input type="hidden" name="action" value="update" /> 391 <input id="WPhtc_num" type="hidden" name="WPhtc_num" value="<?php echo $num;?>" />392 376 <div class="wphtc-menu"> 393 377 <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a> -
wp-htaccess-control/trunk/wp-htaccess-control.php
r365154 r365470 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. 2.46 Version: 2.3 7 7 Author: António Andrade 8 8 Author URI: http://dardna.com 9 9 */ 10 /* Copyright 2010 António Andrade (email : [email protected])10 /* Copyright 2010-2011 António Andrade (email : [email protected]) 11 11 12 12 This program is free software; you can redistribute it and/or modify … … 24 24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 25 */ 26 /* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008 */ 26 /* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008 27 Search redirection is based on Nice Search by Mark Jaquith, 2011 */ 28 27 29 if (!class_exists("WPhtc")) { 28 30 class WPhtc { … … 37 39 } 38 40 } 41 function wphtc_template_redirect(){ 42 # redirect "?s=*" to "/search-base/*" 43 $WPhtc_data=get_option('WPhtc_data'); 44 if($_GET['s']&&$WPhtc_data['custom_search_permalink']!=''){ 45 wp_redirect( home_url( $WPhtc_data['custom_search_permalink']. "/" . str_replace( array( ' ', '%20' ), array( '+', '+' ), get_query_var( 's' ) ) ) ); 46 } 47 } 39 48 function wphtc_check_first_run(){ 40 49 # flush rules to get some data filled … … 67 76 return $link; 68 77 } 69 # Disable canonical redirection on urls using custom pagination permalink78 70 79 function wphtc_filter_redirect_canonical($requested_url){ 71 80 global $wp; 72 81 $WPhtc_data=get_option('WPhtc_data'); 82 # Disable canonical redirection on urls using custom pagination permalink 73 83 if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&preg_match("/".urlencode($WPhtc_data['cpp'])."/",$wp->request)){ 74 84 return false; … … 185 195 function wphtc_wp_rewrite_rules($wp_rewrite){ 186 196 $WPhtc_data=get_option('WPhtc_data'); 187 188 # Deprecate in the future189 for($i=0;$i<count($WPhtc_data['pats']);$i++){190 if($WPhtc_data['pats'][$i]!=''&&$WPhtc_data['subs'][$i]!=''){191 # Adding each custom rewrite pair to $wp_rewrite->non_wp_rules['pattern']='substitution'192 $wp_rewrite->non_wp_rules[$WPhtc_data['pats'][$i]]=$WPhtc_data['subs'][$i];193 }194 }195 196 197 # Keeping a copy of the generated htaccess in our option array for later reviewing 197 198 $WPhtc_data['cur_hta']='# BEGIN Wordpress<br/>'.nl2br($wp_rewrite->mod_rewrite_rules())."# END Wordpress"; … … 412 413 function wphtc_page_action(){ 413 414 WPhtc::wphtc_check_first_run(); 414 $action=$_ POST['action']?$_POST['action']:$_GET['action'];415 $action=$_REQUEST['action']; 415 416 global $echo; 416 417 if(isset($action)){ 417 418 $WPhtc_data=get_option('WPhtc_data'); 418 419 switch($action){ 420 # Hide donation message for one month 421 case 'hide_donation_message': 422 $WPhtc_data['donation_hidden_time']=time()+ 30 * 24 * 60 * 60; 423 update_option('WPhtc_data',$WPhtc_data); 424 break; 419 425 # if reseting everything just delete the option array 420 426 case 'reset_rules': … … 425 431 # if updating, save new rules in database and flush rewrite rules 426 432 case 'update': 427 # get Rewrite Pairs 428 for($i=0;$i<$_POST['WPhtc_num'];$i++){ 429 if(!empty($_POST['WPhtc_pat'.$i]) && !empty($_POST['WPhtc_sub'.$i])){ 430 $WPhtc_data['pats'][$i]=$_POST['WPhtc_pat'.$i]; 431 $WPhtc_data['subs'][$i]=$_POST['WPhtc_sub'.$i]; 432 } 433 } 434 if(count($WPhtc_data['pats'])>1 && $WPhtc_data['pats'][0]==''){ 435 unset($WPhtc_data['pats'][0],$WPhtc_data['subs'][0]); 436 } 437 if(is_array($WPhtc_data['pats'])&&is_array($WPhtc_data['subs'])){ 438 $WPhtc_data['pats']=array_values($WPhtc_data['pats']); 439 $WPhtc_data['subs']=array_values($WPhtc_data['subs']); 433 # first donation hidding time 'now' 434 if(!$WPhtc_data['donation_hidden_time']){ 435 $WPhtc_data['donation_hidden_time']=time(); 440 436 } 441 437 # get Custom Htaccess … … 517 513 $echo.=__('All options updated.', 'wp-htaccess-control'); 518 514 break; 519 # deleting individual rewrite pair520 case 'delete_pair':521 if(isset($_GET['pair'])){522 # if it's the last pair523 if($_GET['pair']==0 && !isset($WPhtc_data['pats'][1])){524 unset($WPhtc_data['pats'], $WPhtc_data['subs']);525 $echo.=__('Wordpress Rewrite pairs reset.', 'wp-htaccess-control');526 }527 else{528 unset($WPhtc_data['pats'][$_GET['pair']],$WPhtc_data['subs'][$_GET['pair']]);529 $WPhtc_data['pats']=array_values($WPhtc_data['pats']);530 $WPhtc_data['subs']=array_values($WPhtc_data['subs']);531 $echo.=__('Wordpress Rewrite pair deleted.', 'wp-htaccess-control');532 }533 update_option('WPhtc_data',$WPhtc_data);534 $this->refresh_rewrite_rules();535 }536 break;537 515 } 538 516 } … … 553 531 add_action('sm_buildmap',array($WPhtc,'set_sm')); 554 532 add_action('init', array($WPhtc,'wphtc_init')); 533 add_action('template_redirect', array($WPhtc,'wphtc_template_redirect') ); 555 534 add_filter('category_rewrite_rules', array($WPhtc,'remove_category_base_from_rewrite_rules')); 556 535 add_filter('category_link', array($WPhtc,'filter_category_link'),1000,2);
Note: See TracChangeset
for help on using the changeset viewer.