Plugin Directory

Changeset 446122


Ignore:
Timestamp:
10/01/2011 12:10:48 PM (15 years ago)
Author:
dardna
Message:
  • *Feature:* added option to "Disable file hotlinking" (thank you for the suggestion Syamsul Alam);
  • *Fix:* fixed erroneous description of the "Disable image hotlinking" option: if no redirection is to be done "_" should be input instead of "-".
Location:
wp-htaccess-control/trunk
Files:
3 edited

Legend:

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

    r428753 r446122  
    77Requires at least: 2.7
    88Tested up to: 3.2.1
    9 Stable tag: 2.6
     9Stable tag: 2.7
    1010
    1111Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
     
    3232* Disable directory browsing;
    3333* Disable and redirect image hotlinking;
     34* Disable and redirect file hotlinking;
    3435* Force canonical url (WWW or non-WWW);
    3536* Limit maximum file upload size;
     
    7475== Changelog ==
    7576
     77= 2.7 (01/10/2011) =
     78* *Feature:* added option to "Disable file hotlinking" (thank you for the suggestion Syamsul Alam);
     79* *Fix:* fixed erroneous description of the "Disable image hotlinking" option: if no redirection is to be done "_" should be input instead of "-".
     80
    7681= 2.6 (23/08/2011) =
    7782* *Feature:* added option to remove author base (good idea gavinhamm).
  • wp-htaccess-control/trunk/wp-htaccess-control-ui.php

    r428746 r446122  
    360360                    </tr>               
    361361                    <tr valign="top">
    362                         <th scope="row"><?php _e('Disable hotlinking', 'wp-htaccess-control'); ?></th>
     362                        <th scope="row"><?php _e('Disable image hotlinking', 'wp-htaccess-control'); ?></th>
    363363                        <td style="width:3%;">
    364364                            <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>           
    365365                        </td>
    366366                        <td valign="middle">
    367                             <p class="description"><?php _e('If set, this url will be used as redirection to hotlinked images (you should be using an image url here). If you prefer no output on hotlinked images use "-".', 'wp-htaccess-control'); ?></p>
     367                            <p class="description"><?php _e('If set, this url will be used as redirection to hotlinked images (you should be using an image url here). If you prefer no output on hotlinked images use "_".', 'wp-htaccess-control'); ?></p>
     368                        </td>
     369                    </tr>
     370                    <tr valign="top">
     371                        <th scope="row"><?php _e('Disable file hotlinking extensions', 'wp-htaccess-control'); ?></th>
     372                        <td style="width:3%;">
     373                            <input type="text" name="WPhtc_disable_file_hotlink_ext" value="<?php echo $WPhtc_data['disable_file_hotlink_ext']?>"/>         
     374                        </td>
     375                        <td valign="middle">
     376                            <p class="description"><?php _e('If set, this file extensions will not be hotlinkable.', 'wp-htaccess-control'); ?></p>
     377                            <p class="description"><?php _e('Separate different extensions with a white-space, ie: "pdf doc zip".', 'wp-htaccess-control'); ?></p>
     378                        </td>
     379                    </tr>
     380                    <tr valign="top">
     381                        <th scope="row"><?php _e('File hotlinking redirection', 'wp-htaccess-control'); ?></th>
     382                        <td style="width:3%;">
     383                            <input type="text" name="WPhtc_disable_file_hotlink_redir" value="<?php echo $WPhtc_data['disable_file_hotlink_redir']?>"/>         
     384                        </td>
     385                        <td valign="middle">
     386                            <p class="description"><?php _e('If set, this url will be used as redirection for hotlinked files.', 'wp-htaccess-control'); ?></p>
    368387                        </td>
    369388                    </tr>
  • wp-htaccess-control/trunk/wp-htaccess-control.php

    r428746 r446122  
    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.6
     6Version: 2.7
    77Author: António Andrade
    88Author URI: http://dardna.com
     
    395395                $new_rules.="\n# WPhtC: Disable image hotlinking\n";
    396396                $new_rules.="<IfModule mod_rewrite.c>\n";
    397                 $new_rules.="RewriteEngine On\n";
     397                $new_rules.="RewriteEngine on\n";
    398398                $new_rules.="RewriteCond %{HTTP_REFERER} !^$\n";
    399                 $new_rules.="RewriteCond %{HTTP_REFERER} !^http://(www\.)?".str_ireplace(array("http://","www."),"",get_bloginfo("url"))."/.*$ [NC]\n";
     399                $new_rules.="RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?".str_ireplace(array("http://","www."),"",get_bloginfo("url"))."/.*$ [NC]\n";
    400400                $new_rules.="RewriteRule \.(jpg|jpeg|png|gif)$ ".$WPhtc_data['disable_hotlink']." [NC,R,L]\n";
     401                $new_rules.="</IfModule>\n";
     402                }
     403            if($WPhtc_data['disable_file_hotlink_ext']){
     404                $redir = $WPhtc_data['disable_file_hotlink_redir'] ? $WPhtc_data['disable_file_hotlink_redir'] : "_";
     405                $new_rules.="\n# WPhtC: Disable file hotlinking\n";
     406                $new_rules.="<IfModule mod_rewrite.c>\n";
     407                $new_rules.="RewriteEngine on\n";
     408                $new_rules.="RewriteCond %{HTTP_REFERER} !^$\n";
     409                $new_rules.="RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?".str_ireplace(array("http://","www."),"",get_bloginfo("url"))."/.*$ [NC]\n";
     410                $new_rules.="RewriteRule \.(".str_replace(" ","|",$WPhtc_data['disable_file_hotlink_ext']).")$ ".$redir." [NC,R,L]\n";
    401411                $new_rules.="</IfModule>\n";
    402412                }
     
    613623                        $WPhtc_data['protect_comments']=$_POST['WPhtc_protect_comments'];
    614624                        $WPhtc_data['disable_hotlink']=trim($_POST['WPhtc_disable_hotlink']);
     625                        $WPhtc_data['disable_file_hotlink_ext']=trim($_POST['WPhtc_disable_file_hotlink_ext']);
     626                        $WPhtc_data['disable_file_hotlink_redir']=trim($_POST['WPhtc_disable_file_hotlink_redir']);
    615627                        $WPhtc_data['redirect_500']=trim($_POST['WPhtc_redirect_500']);
    616628                        $WPhtc_data['redirect_403']=trim($_POST['WPhtc_redirect_403']);
Note: See TracChangeset for help on using the changeset viewer.