WP htaccess Control - Version 2.7

Version Description

(01/10/2011) = * 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 "-".

Download this release

Release Info

Developer dardna
Plugin Icon wp plugin WP htaccess Control
Version 2.7
Comparing to
See all releases

Code changes from version 2.6 to 2.7

readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4man
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
7
  Requires at least: 2.7
8
  Tested up to: 3.2.1
9
- Stable tag: 2.6
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
@@ -31,6 +31,7 @@ Despite the name, many of the options now present on this plugin do not use the
31
  * Jim Morgan's htaccess;
32
  * Disable directory browsing;
33
  * Disable and redirect image hotlinking;
 
34
  * Force canonical url (WWW or non-WWW);
35
  * Limit maximum file upload size;
36
  * Protect wp-config.php file from access;
@@ -73,8 +74,12 @@ Search redirection is based on Mark Jaquith's **Nice Search** but extended so th
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 2.6 (23/08/2011) =
77
- * *Feature:* added option to remove author base.
78
 
79
  = 2.5.8 (23/08/2011) =
80
  * *Fix:* fixed file encoding introduced on 2.5.7 (which should always by UTF-8 without BOM).
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
7
  Requires at least: 2.7
8
  Tested up to: 3.2.1
9
+ Stable tag: 2.7
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
31
  * Jim Morgan's htaccess;
32
  * Disable directory browsing;
33
  * Disable and redirect image hotlinking;
34
+ * Disable and redirect file hotlinking;
35
  * Force canonical url (WWW or non-WWW);
36
  * Limit maximum file upload size;
37
  * Protect wp-config.php file from access;
74
 
75
  == Changelog ==
76
 
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
+
81
  = 2.6 (23/08/2011) =
82
+ * *Feature:* added option to remove author base (good idea gavinhamm).
83
 
84
  = 2.5.8 (23/08/2011) =
85
  * *Fix:* fixed file encoding introduced on 2.5.7 (which should always by UTF-8 without BOM).
wp-htaccess-control-ui.php CHANGED
@@ -359,12 +359,31 @@ $WPhtc_data=get_option('WPhtc_data');
359
  </td>
360
  </tr>
361
  <tr valign="top">
362
- <th scope="row"><?php _e('Disable hotlinking', 'wp-htaccess-control'); ?></th>
363
  <td style="width:3%;">
364
  <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
365
  </td>
366
  <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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  </td>
369
  </tr>
370
  <tr valign="top">
359
  </td>
360
  </tr>
361
  <tr valign="top">
362
+ <th scope="row"><?php _e('Disable image hotlinking', 'wp-htaccess-control'); ?></th>
363
  <td style="width:3%;">
364
  <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
365
  </td>
366
  <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>
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>
387
  </td>
388
  </tr>
389
  <tr valign="top">
wp-htaccess-control.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
- Version: 2.6
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -394,12 +394,22 @@ if (!class_exists("WPhtc")) {
394
  if($WPhtc_data['disable_hotlink']){
395
  $new_rules.="\n# WPhtC: Disable image hotlinking\n";
396
  $new_rules.="<IfModule mod_rewrite.c>\n";
397
- $new_rules.="RewriteEngine On\n";
398
  $new_rules.="RewriteCond %{HTTP_REFERER} !^$\n";
399
- $new_rules.="RewriteCond %{HTTP_REFERER} !^http://(www\.)?".str_ireplace(array("http://","www."),"",get_bloginfo("url"))."/.*$ [NC]\n";
400
  $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['canon']){
404
  $url=str_ireplace(array("http://","www."),"",get_bloginfo("url"));
405
  $domain=explode("/",$url);
@@ -612,6 +622,8 @@ if (!class_exists("WPhtc")) {
612
  $WPhtc_data['protect_htaccess']=$_POST['WPhtc_protect_htaccess'];
613
  $WPhtc_data['protect_comments']=$_POST['WPhtc_protect_comments'];
614
  $WPhtc_data['disable_hotlink']=trim($_POST['WPhtc_disable_hotlink']);
 
 
615
  $WPhtc_data['redirect_500']=trim($_POST['WPhtc_redirect_500']);
616
  $WPhtc_data['redirect_403']=trim($_POST['WPhtc_redirect_403']);
617
  $WPhtc_data['canon']=$_POST['WPhtc_canon'];
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
+ Version: 2.7
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
394
  if($WPhtc_data['disable_hotlink']){
395
  $new_rules.="\n# WPhtC: Disable image hotlinking\n";
396
  $new_rules.="<IfModule mod_rewrite.c>\n";
397
+ $new_rules.="RewriteEngine on\n";
398
  $new_rules.="RewriteCond %{HTTP_REFERER} !^$\n";
399
+ $new_rules.="RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?".str_ireplace(array("http://","www."),"",get_bloginfo("url"))."/.*$ [NC]\n";
400
  $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";
411
+ $new_rules.="</IfModule>\n";
412
+ }
413
  if($WPhtc_data['canon']){
414
  $url=str_ireplace(array("http://","www."),"",get_bloginfo("url"));
415
  $domain=explode("/",$url);
622
  $WPhtc_data['protect_htaccess']=$_POST['WPhtc_protect_htaccess'];
623
  $WPhtc_data['protect_comments']=$_POST['WPhtc_protect_comments'];
624
  $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']);
627
  $WPhtc_data['redirect_500']=trim($_POST['WPhtc_redirect_500']);
628
  $WPhtc_data['redirect_403']=trim($_POST['WPhtc_redirect_403']);
629
  $WPhtc_data['canon']=$_POST['WPhtc_canon'];