Plugin Directory

Changeset 365470


Ignore:
Timestamp:
03/27/2011 05:53:09 PM (15 years ago)
Author:
dardna
Message:

Preparing v 2.3

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

Legend:

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

    r365154 r365470  
    77Requires at least: 2.7
    88Tested up to: 3.1
    9 Stable tag: 2.2.4
     9Stable tag: 2.3
    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;
     24* Customization (and canonization) of the Search Permalink Base;
    2525* 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;
    2626* Maintenance mode.
     
    6767== Additional Credit ==
    6868
    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"*)
     69Removal 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"*).
     70Search 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"*).
    7071
    7172== 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.
    7278
    7379= 2.2.4 (26/03/2011) =
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.css

    r286964 r365470  
     1div.updated p img{margin: -5px 15px;}
     2div.updated p span{float:right;}
    13.wphtc-menu{margin:10px 0;}
    24.wphtc-section{background:#ddd;border:1px solid #ddd;border-bottom:0;margin-top:15px;-moz-border-radius:6px;-webkit-border-radius:6px;}
     
    1113#wphtc-footer{text-align:right;}
    1214textarea.readonly{background-color:#eee;}
    13 ul.description{/*list-style:square inside;*/margin-top:1em;}
     15ul.description{margin-top:1em;}
    1416ul.description a{text-decoration:none;}
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.js

    r286964 r365470  
    11jQuery(document).ready(function(){
    2     //addRewritePairButton();
    32    collapseSections();
    43    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         }*/
    264    function collapseSections(){
    275        jQuery(".wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide();
    28         //jQuery(".wphtc-menu").fadeOut(0);
    296        jQuery(".handlediv").fadeOut(0);
    307        jQuery(".wphtc-section").hover(
     
    4219                    }
    4320                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                     }*/
    5021                }
    5122            );
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.php

    r364744 r365470  
    2020        <?php if($echo!=''){?>
    2121            <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&currency_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 }?>
    2334        <!-- Custom Author Permalink -->
    2435        <div class="wphtc-section">
     
    90101                    <td valign="middle">
    91102                        <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>
    92104                        <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>
    93105                    </td>
     
    324336            </table>
    325337        </div>
    326             <!-- Rewrite Pairs -->
    327             <?php # deprecate in the future
    328             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                     <?php
    342                     $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 }?>
    353338        <!-- Maintenance Mode -->
    354339        <div class="wphtc-section">
     
    389374        </div> 
    390375        <input type="hidden" name="action" value="update" />
    391         <input id="WPhtc_num" type="hidden" name="WPhtc_num" value="<?php echo $num;?>" />
    392376        <div class="wphtc-menu">
    393377            <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  
    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.2.4
     6Version: 2.3
    77Author: António Andrade
    88Author URI: http://dardna.com
    99*/
    10 /*  Copyright 2010  António Andrade  (email : [email protected])
     10/*  Copyright 2010-2011  António Andrade  (email : [email protected])
    1111
    1212    This program is free software; you can redistribute it and/or modify
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2525*/
    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
    2729if (!class_exists("WPhtc")) {
    2830    class WPhtc {
     
    3739                }
    3840            }
     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            }
    3948        function wphtc_check_first_run(){
    4049            # flush rules to get some data filled
     
    6776            return $link;
    6877            }
    69         # Disable canonical redirection on urls using custom pagination permalink
     78       
    7079        function wphtc_filter_redirect_canonical($requested_url){
    7180            global $wp;
    7281            $WPhtc_data=get_option('WPhtc_data');
     82            # Disable canonical redirection on urls using custom pagination permalink
    7383            if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&preg_match("/".urlencode($WPhtc_data['cpp'])."/",$wp->request)){
    7484                return false;
     
    185195        function wphtc_wp_rewrite_rules($wp_rewrite){
    186196            $WPhtc_data=get_option('WPhtc_data');
    187            
    188                 # Deprecate in the future
    189                 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                
    196197            # Keeping a copy of the generated htaccess in our option array for later reviewing
    197198            $WPhtc_data['cur_hta']='# BEGIN Wordpress<br/>'.nl2br($wp_rewrite->mod_rewrite_rules())."# END Wordpress";
     
    412413        function wphtc_page_action(){
    413414            WPhtc::wphtc_check_first_run();
    414             $action=$_POST['action']?$_POST['action']:$_GET['action'];
     415            $action=$_REQUEST['action'];
    415416            global $echo;
    416417            if(isset($action)){
    417418                $WPhtc_data=get_option('WPhtc_data');
    418419                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;
    419425                    # if reseting everything just delete the option array
    420426                    case 'reset_rules':
     
    425431                    # if updating, save new rules in database and flush rewrite rules
    426432                    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();
    440436                            }
    441437                        # get Custom Htaccess
     
    517513                        $echo.=__('All options updated.', 'wp-htaccess-control');
    518514                        break;
    519                     # deleting individual rewrite pair
    520                     case 'delete_pair':
    521                         if(isset($_GET['pair'])){
    522                             # if it's the last pair
    523                             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;
    537515                    }
    538516                }
     
    553531    add_action('sm_buildmap',array($WPhtc,'set_sm'));
    554532    add_action('init', array($WPhtc,'wphtc_init'));
     533    add_action('template_redirect', array($WPhtc,'wphtc_template_redirect') );
    555534    add_filter('category_rewrite_rules', array($WPhtc,'remove_category_base_from_rewrite_rules'));
    556535    add_filter('category_link', array($WPhtc,'filter_category_link'),1000,2);
Note: See TracChangeset for help on using the changeset viewer.