WP htaccess Control - Version 2.4

Version Description

(04/05/2011) = * Feature: added htaccess suggestion "Protect comments.php"; * Added "Latest donations"; * Confirmed compatibility with WP 3.1.2.

Download this release

Release Info

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

Code changes from version 2.3 to 2.4

readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://dardna.com/wp-htaccess-control
5
  Donate link:
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.1
9
- Stable tag: 2.3
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
@@ -34,6 +34,7 @@ Despite the name, many of the options now present on this plugin do not use the
34
  * Limit maximum file upload size;
35
  * Protect wp-config.php file from access;
36
  * Protect .htaccess file from access;
 
37
  * Set 500 error page;
38
  * Set 403 error page;
39
  * Use mod_gzip if available;
@@ -71,6 +72,11 @@ Search redirection is based on Mark Jaquith's **Nice Search** but extended so th
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.
5
  Donate link:
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.1.2
9
+ Stable tag: 2.4
10
 
11
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
12
 
34
  * Limit maximum file upload size;
35
  * Protect wp-config.php file from access;
36
  * Protect .htaccess file from access;
37
+ * Protect comments.php from spam bots coming from nowhere;
38
  * Set 500 error page;
39
  * Set 403 error page;
40
  * Use mod_gzip if available;
72
 
73
  == Changelog ==
74
 
75
+ = 2.4 (04/05/2011) =
76
+ * *Feature:* added htaccess suggestion "Protect comments.php";
77
+ * Added "Latest donations";
78
+ * Confirmed compatibility with WP 3.1.2.
79
+
80
  = 2.3 (27/03/2011) =
81
  * *Feature:* "?s=search+term" redirects to "/search-base/search+term" (as requested by Tatron).
82
  * Removed "Rewrite Pairs" code and did some clean up.
wp-htaccess-control-ui.css CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  div.updated p img{margin: -5px 15px;}
2
  div.updated p span{float:right;}
3
  .wphtc-menu{margin:10px 0;}
@@ -6,11 +12,13 @@ div.updated p span{float:right;}
6
  .wphtc-section-title h3{margin:0;padding:10px;cursor:pointer;border-bottom:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
7
  .wphtc-section-title .handlediv {float:right;height:35px;width:23px;cursor:pointer;}
8
  .wphtc-inputs{background:#fff;border:1px solid #ddd;border-left:0;border-right:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
 
9
  .wphtc-inputs th{font-weight:bold;}
10
  .wphtc-inputs tr{border-bottom:1px solid #ddd}
11
  .wphtc-inputs caption{text-align:left;padding:10px;background:#ddd;}
12
  .form-table{margin:0;}
13
- #wphtc-footer{text-align:right;}
14
  textarea.readonly{background-color:#eee;}
15
  ul.description{margin-top:1em;}
16
- ul.description a{text-decoration:none;}
 
1
+ #wphtc-main{margin-bottom:25px;}
2
+ #wphtc-sidebar{width:19%;float:right;}
3
+ #wphtc-sidebar ul{margin:1em 0 1em 10px;}
4
+ #wphtc-sidebar a{text-decoration:none;}
5
+ #wphtc-sidebar a img{margin-right:5px;}
6
+ #wphtc-main{float:left;width:80%;}
7
  div.updated p img{margin: -5px 15px;}
8
  div.updated p span{float:right;}
9
  .wphtc-menu{margin:10px 0;}
12
  .wphtc-section-title h3{margin:0;padding:10px;cursor:pointer;border-bottom:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
13
  .wphtc-section-title .handlediv {float:right;height:35px;width:23px;cursor:pointer;}
14
  .wphtc-inputs{background:#fff;border:1px solid #ddd;border-left:0;border-right:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
15
+ .wphtc-inputs p,.wphtc-inputs ul{margin-left:10px}
16
  .wphtc-inputs th{font-weight:bold;}
17
  .wphtc-inputs tr{border-bottom:1px solid #ddd}
18
  .wphtc-inputs caption{text-align:left;padding:10px;background:#ddd;}
19
  .form-table{margin:0;}
20
+ #foot{text-align:center;font-size:8px;color:#aaa;margin:2em 0;}
21
  textarea.readonly{background-color:#eee;}
22
  ul.description{margin-top:1em;}
23
+ ul.description a{text-decoration:none;}
24
+ #donations{list-style:square inside;}
wp-htaccess-control-ui.js CHANGED
@@ -2,9 +2,9 @@ jQuery(document).ready(function(){
2
  collapseSections();
3
  editWPhtaJM();
4
  function collapseSections(){
5
- jQuery(".wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide();
6
  jQuery(".handlediv").fadeOut(0);
7
- jQuery(".wphtc-section").hover(
8
  function(){
9
  jQuery(this).find(".handlediv").fadeIn(150);
10
  },
@@ -12,7 +12,7 @@ jQuery(document).ready(function(){
12
  jQuery(this).find(".handlediv").fadeOut(150);
13
  }
14
  )
15
- jQuery(".wphtc-section-title h3").click(
16
  function(){
17
  if(jQuery(this).parent().find("a")){
18
  jQuery(this).parent().find("a").toggle();
2
  collapseSections();
3
  editWPhtaJM();
4
  function collapseSections(){
5
+ jQuery("#wphtc-main .wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs:last").hide();
6
  jQuery(".handlediv").fadeOut(0);
7
+ jQuery("#wphtc-main .wphtc-section").hover(
8
  function(){
9
  jQuery(this).find(".handlediv").fadeIn(150);
10
  },
12
  jQuery(this).find(".handlediv").fadeOut(150);
13
  }
14
  )
15
+ jQuery("#wphtc-main .wphtc-section-title h3").click(
16
  function(){
17
  if(jQuery(this).parent().find("a")){
18
  jQuery(this).parent().find("a").toggle();
wp-htaccess-control-ui.php CHANGED
@@ -16,378 +16,421 @@ $WPhtc_data=get_option('WPhtc_data');
16
  return;
17
  }
18
  ?>
19
- <form method="post" action="<?php echo $purl?>">
20
- <?php if($echo!=''){?>
21
- <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
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 }?>
34
- <!-- Custom Author Permalink -->
35
  <div class="wphtc-section">
36
  <div class="wphtc-section-title stuffbox">
37
- <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>
38
- <h3><?php _e('Custom Author Permalink', 'wp-htaccess-control');?></h3>
39
  </div>
40
- <table class="form-table wphtc-inputs">
41
- <tr valign="top">
42
- <th scope="row" style="width:18%;"><?php _e('Author Base', 'wp-htaccess-control'); ?></th>
43
- <td >
44
- <input type="text" name="WPhtc_cap" value="<?php echo $WPhtc_data['cap']; ?>" />
45
- <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/admin</code></p>
46
- </td>
47
- <td valign="middle">
48
- <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
49
- <p class="description"><?php _e('If set, the author base will be used as shown next to the form field.', 'wp-htaccess-control'); ?></p>
50
- <p class="description"><?php _e('If you do not want to use a custom Author Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
51
- </td>
52
- </tr>
53
- <?php if(class_exists('GoogleSitemapGeneratorLoader')){?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  <tr valign="top">
55
- <th>Google XML Sitemap</th>
56
- <td>
57
- <input type="checkbox" name="WPhtc_sm_enabled" value="true" <?php if($WPhtc_data['sm_enabled']){ echo "checked";}?>/> <?php _e('Apply Custom Author Permalink on Generated Sitemap', 'wp-htaccess-control'); ?>
 
58
  </td>
59
- <td valign="middle" >
60
- <p class="description"><?php _e('Leave "Include author pages" unchecked on Google XML Sitemap options page if using this.', 'wp-htaccess-control'); ?></p>
61
- <p class="description"><?php _e('However, if you want to adjust the "Priority" or "Change frequency" you should do so on the <a href="options-general.php?page=google-sitemap-generator/sitemap.php">Google XML Sitemap options page</a>.', 'wp-htaccess-control'); ?></p>
 
62
  </td>
63
  </tr>
64
- <?php } ?>
65
- </table>
66
- </div>
67
- <!-- Custom Pagination Permalink -->
68
- <div class="wphtc-section">
69
- <div class="wphtc-section-title stuffbox">
70
- <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>
71
- <h3><?php _e('Custom Pagination Permalink', 'wp-htaccess-control');?></h3>
 
 
 
 
 
72
  </div>
73
- <table class="form-table wphtc-inputs">
74
- <tr valign="top">
75
- <th scope="row" style="width:18%;"><?php _e('Page Base', 'wp-htaccess-control'); ?></th>
76
- <td >
77
- <input type="text" name="WPhtc_cpp" value="<?php echo $WPhtc_data['cpp']; ?>" />
78
- <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/2</code></p>
79
- </td>
80
- <td valign="middle">
81
- <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
82
- <p class="description"><?php _e('If set, the page base will be used as shown next to the form field in every post listing (category, tag, archive, etc).', 'wp-htaccess-control'); ?></p>
83
- <p class="description"><?php _e('If you do not want to use a custom Pagination Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
84
- </td>
85
- </tr>
86
- </table>
87
- </div>
88
- <!-- Custom Search Permalink -->
89
- <div class="wphtc-section">
90
- <div class="wphtc-section-title stuffbox">
91
- <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>
92
- <h3><?php _e('Custom Search Permalink', 'wp-htaccess-control');?></h3>
93
  </div>
94
- <table class="form-table wphtc-inputs">
95
- <tr valign="top">
96
- <th scope="row" style="width:18%;"><?php _e('Search Base', 'wp-htaccess-control'); ?></th>
97
- <td >
98
- <input type="text" name="WPhtc_custom_search_permalink" value="<?php echo $WPhtc_data['custom_search_permalink']; ?>" />
99
- <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/search-term</code></p>
100
- </td>
101
- <td valign="middle">
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>
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>
105
- </td>
106
- </tr>
107
- </table>
108
- </div>
109
- <!-- Remove Category Base -->
110
- <div class="wphtc-section">
111
- <div class="wphtc-section-title stuffbox">
112
- <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>
113
- <h3><?php _e('Remove Category Base', 'wp-htaccess-control');?></h3>
114
  </div>
115
- <table class="form-table wphtc-inputs">
116
- <tr valign="top">
117
- <th scope="row" style="width:18%;"><?php _e('Remove Category Base', 'wp-htaccess-control'); ?></th>
118
- <td >
119
- <input type="checkbox" name="WPhtc_remove_category_base" <?php if($WPhtc_data['remove_category_base']){echo "checked=checked";} ?> />
120
- </td>
121
- <td valign="middle">
122
- <p class="description"><?php _e('If active, the category base will be removed from permalinks:'); ?></p>
123
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category', 'wp-htaccess-control'); ?></code></p>
124
- </td>
125
- </tr>
126
- </table>
127
- </div>
128
- <!-- Advanced Archives -->
129
- <div class="wphtc-section">
130
- <div class="wphtc-section-title stuffbox">
131
- <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>
132
- <h3><?php _e('Advanced Archives', 'wp-htaccess-control');?></h3>
133
  </div>
134
- <table class="form-table wphtc-inputs">
135
- <tr valign="top">
136
- <th scope="row" style="width:18%;"><?php _e('Category Archives', 'wp-htaccess-control'); ?></th>
137
- <td >
138
- <input type="checkbox" name="WPhtc_category_archives" <?php if($WPhtc_data['category_archives']){echo "checked=checked";} ?> />
139
- </td>
140
- <td valign="middle">
141
- <p class="description"><?php _e('If active, category-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
142
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category-base', 'wp-htaccess-control'); ?>/<?php _e('your-category', 'wp-htaccess-control'); ?>/2010</code></p>
143
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category-base', 'wp-htaccess-control'); ?>/<?php _e('your-category', 'wp-htaccess-control'); ?>/2010/12</code></p>
144
- <p class="description"><?php _e("This will also work if you've removed the category base.", 'wp-htaccess-control'); ?></p>
145
- </td>
146
- </tr>
147
- <tr valign="top">
148
- <th scope="row" style="width:18%;"><?php _e('Author Archives', 'wp-htaccess-control'); ?></th>
149
- <td >
150
- <input type="checkbox" name="WPhtc_author_archives" <?php if($WPhtc_data['author_archives']){echo "checked=checked";} ?> />
151
- </td>
152
- <td valign="middle">
153
- <p class="description"><?php _e('If active, author-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
154
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-author-base', 'wp-htaccess-control'); ?>/<?php _e('your-author', 'wp-htaccess-control'); ?>/2010</code></p>
155
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-author-base', 'wp-htaccess-control'); ?>/<?php _e('your-author', 'wp-htaccess-control'); ?>/2010/12</code></p>
156
- </td>
157
- </tr>
158
- <tr valign="top">
159
- <th scope="row" style="width:18%;"><?php _e('Tag Archives', 'wp-htaccess-control'); ?></th>
160
- <td >
161
- <input type="checkbox" name="WPhtc_tag_archives" <?php if($WPhtc_data['tag_archives']){echo "checked=checked";} ?> />
162
- </td>
163
- <td valign="middle">
164
- <p class="description"><?php _e('If active, tag-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
165
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-tag-base', 'wp-htaccess-control'); ?>/<?php _e('your-tag', 'wp-htaccess-control'); ?>/2010</code></p>
166
- <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-tag-base', 'wp-htaccess-control'); ?>/<?php _e('your-tag', 'wp-htaccess-control'); ?>/2010/12</code></p>
167
- </td>
168
- </tr>
169
- </table>
170
- </div>
171
- <!-- Custom htaccess -->
172
- <div class="wphtc-section">
173
- <div class="wphtc-section-title stuffbox">
174
- <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>
175
- <h3><?php _e('Custom htaccess', 'wp-htaccess-control'); ?></h3>
176
  </div>
177
- <table class="form-table wphtc-inputs">
178
- <tr valign="top">
179
- <td>
180
- <textarea name="WPhtc_hta" style="width:100%;" rows="7"><?php echo stripslashes($WPhtc_data['hta']); ?></textarea>
181
- </td>
182
- <td style="width:50%;">
183
- <p class="description"><?php _e('This rules will be printed before any Wordpress rules.', 'wp-htaccess-control'); ?></p>
184
- <p class="description"><?php _e('Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control'); ?></p>
185
- <ul class="description">
186
- <li><a href="http://www.google.com/search?q=htaccess+tutorial" title="Search for htaccess tutorials"><img width="16px" src="http://google.com/favicon.ico" alt="google favicon"> htaccess tutorial</a></li>
187
- <li><a href="http://httpd.apache.org/docs/current/howto/htaccess.html" title="Read about htaccess at apache.org"><img width="16px" src="http://apache.org/favicon.ico" alt="apache favicon"> htaccess</a></li>
188
- <li><a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html" title="Read about mod_rewrite at apache.org"><img width="16px" src="http://apache.org/favicon.ico" alt="apache favicon"> mod_rewrite</a></li>
189
- </ul>
190
- </td>
191
- </tr>
192
- </table>
193
- </div>
194
- <!-- Replace Wordpress htaccess -->
195
- <div class="wphtc-section">
196
- <div class="wphtc-section-title stuffbox">
197
- <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>
198
- <h3><?php _e('Replace Wordpress htaccess', 'wp-htaccess-control'); ?></h3>
199
  </div>
200
- <table class="form-table wphtc-inputs">
201
- <tr valign="top">
202
- <td>
203
- <textarea name="WPhtc_wp_hta" style="width:100%;" rows="7" <?php if($WPhtc_data['jim_morgan_hta']){ echo "readonly='true' class='readonly'";}?>><?php echo stripslashes($WPhtc_data['wp_hta']); ?></textarea>
204
- <p class="description"><?php _e('Leave empty for default.', 'wp-htaccess-control'); ?></p>
205
- <p><input type="checkbox" name="WPhtc_jim_morgan_hta" value="true" <?php if($WPhtc_data['jim_morgan_hta']){ echo "checked";}?>/>
206
- <?php _e("<strong>Use <a href='http://www.webmasterworld.com/apache/4053973.htm'>Jim Morgan's wordpress htaccess</a></strong> (has been reported to \"speed up your WP mod_rewrite code by a factor of more than two\")", 'wp-htaccess-control'); ?></p>
207
- </td>
208
- <td style="width:50%;">
209
- <p class="description"><?php _e('This rules will be printed instead of Wordpress rules.', 'wp-htaccess-control'); ?></p>
210
- <p class="description"><?php _e('Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control'); ?></p>
211
- <p class="description"><?php _e('Original rules:', 'wp-htaccess-control'); ?></p>
212
- <p class="description">
213
- <code><?php echo nl2br(htmlspecialchars(substr($WPhtc_data['htaccess_original'],0,-1)));?></code>
214
- </p>
215
- </td>
216
- </tr>
217
- </table>
218
- </div>
219
- <!-- htaccess Suggestions -->
220
- <div class="wphtc-section">
221
- <div class="wphtc-section-title stuffbox">
222
- <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>
223
- <h3><?php _e('htaccess Suggestions', 'wp-htaccess-control'); ?></h3>
224
  </div>
225
- <table class="form-table wphtc-inputs">
226
- <tr valign="top">
227
- <th scope="row" style="width:18%;"><?php _e('ServerSignature', 'wp-htaccess-control'); ?></th>
228
- <td style="width:3%;" valign="middle">
229
- <input type="checkbox" name="WPhtc_disable_serversignature" value="true" <?php if($WPhtc_data['disable_serversignature']){ echo "checked";}?>/>
230
- </td>
231
- <td valign="middle">
232
- <p class="description"><?php _e('Disable the ServerSignature on server generated error pages.', 'wp-htaccess-control'); ?></p>
233
- </td>
234
- </tr>
235
- <tr valign="top">
236
- <th scope="row"><?php _e('Indexes', 'wp-htaccess-control'); ?></th>
237
- <td style="width:3%;" valign="middle">
238
- <input type="checkbox" name="WPhtc_disable_indexes" value="true" <?php if($WPhtc_data['disable_indexes']){ echo "checked";}?>/>
239
- </td>
240
- <td valign="middle">
241
- <p class="description"><?php _e('Disable directory browsing.', 'wp-htaccess-control'); ?></p>
242
- </td>
243
- </tr>
244
- <tr valign="top">
245
- <th scope="row"><?php _e('Protect wp-config.php file', 'wp-htaccess-control'); ?></th>
246
- <td style="width:3%;" valign="middle">
247
- <input type="checkbox" name="WPhtc_protect_wp_config" value="true" <?php if($WPhtc_data['protect_wp_config']){ echo "checked";}?>/> </td>
248
- <td valign="middle">
249
- <p class="description"><?php _e('Deny access to wp-config.php file.', 'wp-htaccess-control'); ?></p>
250
- </td>
251
- </tr>
252
- <tr valign="top">
253
- <th scope="row"><?php _e('Protect htaccess file', 'wp-htaccess-control'); ?></th>
254
- <td style="width:3%;" valign="middle">
255
- <input type="checkbox" name="WPhtc_protect_htaccess" value="true" <?php if($WPhtc_data['protect_htaccess']){ echo "checked";}?>/> </td>
256
- <td valign="middle">
257
- <p class="description"><?php _e('Deny access to .htaccess file.', 'wp-htaccess-control'); ?></p>
258
- </td>
259
- </tr>
260
- <tr valign="top">
261
- <th scope="row"><?php _e('mod_gzip', 'wp-htaccess-control'); ?></th>
262
- <td style="width:3%;" valign="middle">
263
- <input type="checkbox" name="WPhtc_gzip" value="true" <?php if($WPhtc_data['gzip']){ echo "checked";}?>/>
264
- </td>
265
- <td valign="middle">
266
- <p class="description"><?php _e('Use mod_gzip if available.', 'wp-htaccess-control'); ?></p>
267
- </td>
268
- </tr>
269
- <tr valign="top">
270
- <th scope="row"><?php _e('mod_deflate', 'wp-htaccess-control'); ?></th>
271
- <td style="width:3%;" valign="middle">
272
- <input type="checkbox" name="WPhtc_deflate" value="true" <?php if($WPhtc_data['deflate']){ echo "checked";}?>/>
273
- </td>
274
- <td valign="middle">
275
- <p class="description"><?php _e('Use mod_deflate if available.', 'wp-htaccess-control'); ?></p>
276
- </td>
277
- </tr>
278
- <tr valign="top">
279
- <th scope="row"><?php _e('Limit Upload Size', 'wp-htaccess-control'); ?></th>
280
- <td style="width:3%;" valign="middle">
281
- <input type="text" name="WPhtc_up_limit" value="<?php echo $WPhtc_data['up_limit']?>"/>
282
- </td>
283
- <td valign="middle">
284
- <p class="description"><?php _e('If set, this value in MB will be used as limit to file uploads.', 'wp-htaccess-control'); ?></p>
285
- </td>
286
- </tr>
287
- <tr valign="top">
288
- <th scope="row"><?php _e('Admin Email', 'wp-htaccess-control'); ?></th>
289
- <td style="width:3%;">
290
- <input type="text" name="WPhtc_admin_email" value="<?php echo $WPhtc_data['admin_email']?>"/>
291
- </td>
292
- <td valign="middle">
293
- <p class="description"><?php _e('If set, this will be used as the admin email on server generated error pages.', 'wp-htaccess-control'); ?></p>
294
- </td>
295
- </tr>
296
- <tr valign="top">
297
- <th scope="row"><?php _e('Disable hotlinking', 'wp-htaccess-control'); ?></th>
298
- <td style="width:3%;">
299
- <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
300
- </td>
301
- <td valign="middle">
302
- <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>
303
- </td>
304
- </tr>
305
- <tr valign="top">
306
- <th scope="row"><?php _e('500 error', 'wp-htaccess-control'); ?></th>
307
- <td style="width:3%;" valign="middle">
308
- <input type="text" name="WPhtc_redirect_500" value="<?php echo $WPhtc_data['redirect_500']?>"/>
309
- </td>
310
- <td valign="middle">
311
- <p class="description"><?php _e('If set, this path will be used as page to 500 errors (example: /error.php).', 'wp-htaccess-control'); ?></p>
312
- </td>
313
- </tr>
314
- <tr valign="top">
315
- <th scope="row"><?php _e('403 error', 'wp-htaccess-control'); ?></th>
316
- <td style="width:3%;" valign="middle">
317
- <input type="text" name="WPhtc_redirect_403" value="<?php echo $WPhtc_data['redirect_403']?>"/>
318
- </td>
319
- <td valign="middle">
320
- <p class="description"><?php _e('If set, this path will be used as page to 403 errors (example: /error.php).', 'wp-htaccess-control'); ?></p>
321
- </td>
322
- </tr>
323
- <tr valign="top">
324
- <th scope="row" valign="middle"><?php _e('Canonical Url', 'wp-htaccess-control'); ?></th>
325
- <td style="width:3%;" valign="middle">
326
- <select name="WPhtc_canon">
327
- <option value=""></option>
328
- <option value="www" <?php if($WPhtc_data['canon']=='www'){echo "selected";} ?>><?php _e('Force WWW', 'wp-htaccess-control'); ?></option>
329
- <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>><?php _e('Force non-WWW', 'wp-htaccess-control'); ?></option>
330
- </select>
331
- </td>
332
- <td valign="middle">
333
- <p class="description"><?php _e('This will force canonization. This will be done by simply modifying the wordpress "site url" and "home" options (not htaccess).', 'wp-htaccess-control'); ?></p>
334
- </td>
335
- </tr>
336
- </table>
337
- </div>
338
- <!-- Maintenance Mode -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  <div class="wphtc-section">
340
  <div class="wphtc-section-title stuffbox">
341
  <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>
342
- <h3><?php _e('Maintenance Mode', 'wp-htaccess-control'); ?></h3>
343
- </div>
344
- <table class="form-table wphtc-inputs">
345
- <tr valign="top">
346
- <th scope="row" style="width:18%;"><?php _e('Maintenance Active', 'wp-htaccess-control'); ?></th>
347
- <td valign="middle">
348
- <input type="checkbox" name="WPhtc_maintenance_active" value="true" <?php if($WPhtc_data['maintenance_active']){ echo "checked";}?>/>
349
- </td>
350
- <td valign="middle">
351
- <p class="description"><?php _e('Toggles Maintenance Mode.', 'wp-htaccess-control'); ?></p>
352
- </td>
353
- </tr>
354
- <tr valign="top">
355
- <th scope="row" style="width:18%;"><?php _e('Allowed IPs', 'wp-htaccess-control'); ?></th>
356
- <td>
357
- <textarea name="WPhtc_maintenance_ips"><?php if(isset($WPhtc_data['maintenance_ips'])){echo implode($WPhtc_data['maintenance_ips'],"\n");}?></textarea>
358
- </td>
359
- <td valign="middle">
360
- <p class="description"><?php _e('List of allowed IPs.', 'wp-htaccess-control'); ?></p>
361
- <p class="description"><?php _e('All the IPs not listed will view the 403 error page or be redirected to a page set below.', 'wp-htaccess-control'); ?></p>
362
- </td>
363
- </tr>
364
- <tr valign="top">
365
- <th scope="row" style="width:18%;"><?php _e('Redirection', 'wp-htaccess-control'); ?></th>
366
- <td>
367
- <input type="text" name="WPhtc_maintenance_redirection" value="<?php echo $WPhtc_data['maintenance_redirection']?>"/>
368
- </td>
369
- <td valign="middle">
370
- <p class="description"><?php _e('If set, this will be used as redirection for disallowed IPs. This could be an external url or a document on your server (local paths begin with a trailing slash)', 'wp-htaccess-control'); ?></p>
371
- </td>
372
- </tr>
373
- </table>
374
- </div>
375
- <input type="hidden" name="action" value="update" />
376
- <div class="wphtc-menu">
377
- <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a>
378
- <input type="submit" class="button-primary" value="<?php _e('Save all changes', 'wp-htaccess-control'); ?>" />
379
- </div>
380
- </form>
381
- <div class="wphtc-section">
382
- <div class="wphtc-section-title stuffbox">
383
- <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>
384
- <h3><?php _e('Current htaccess file as it is generated by Wordpress', 'wp-htaccess-control'); ?></h3>
385
- </div>
386
- <div class="wphtc-inputs">
387
- <p style="margin-left:10px;">
388
- <code><?php echo str_replace(array("&lt;br /&gt;","&lt;br/&gt;"),"<br/>",htmlspecialchars($WPhtc_data['cur_hta']));?></code>
389
- </p>
390
  </div>
391
  </div>
392
- <p id="wphtc-footer"><small><a href="http://dardna.com/wp-htaccess-control" title="Visit WP htaccess Control page at dardna.com">WP htaccess Control</a> <?php _e('by', 'wp-htaccess-control'); ?> <a href="http://dardna.com" title="Visit dardna.com">António Andrade</a></p>
393
  </div>
16
  return;
17
  }
18
  ?>
19
+ <div id="wphtc-sidebar">
20
+ <?php $d = file_get_contents('http://dardna.com/wp-htaccess-control-donations');
21
+ if($d){?>
22
+ <div class="wphtc-section">
23
+ <div class="wphtc-section-title stuffbox">
24
+ <!--<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>-->
25
+ <h3><?php _e('Latest donations', 'wp-htaccess-control'); ?></h3>
26
+ </div>
27
+ <div class="wphtc-inputs">
28
+ <ul id="donations">
29
+ <?php
30
+ preg_match_all("'<ul>(.*?)</ul>'si",$d,$out);
31
+ echo $out[1][0];
32
+ ?>
33
+ </ul>
34
+ </div>
35
  </div>
36
+ <? } ?>
 
37
  <div class="wphtc-section">
38
  <div class="wphtc-section-title stuffbox">
39
+ <!--<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>-->
40
+ <h3><?php _e('About this Plugin', 'wp-htaccess-control'); ?></h3>
41
  </div>
42
+ <div class="wphtc-inputs">
43
+ <ul>
44
+ <li><a href="http://dardna.com/wp-htaccess-control"><img src="http://dardna.com/favicon.ico"> Plugin Homepage</a></li>
45
+ <li><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"><img src="http://s.wordpress.org/favicon.ico?3"> Plugin at Wordpress.org </a></li>
46
+ <!--<li><a href="http://dardna.com/"><img src="http://dardna.com/favicon.ico"> Author Homepage</a></li>-->
47
+ <li><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 src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/i/icon/pp_favicon_x.ico"> Donate with Paypal</a></li>
48
+ </ul>
49
+ </div>
50
+ </div>
51
+ <p id="foot">WP htaccess Control <?php _e('by', 'wp-htaccess-control'); ?> António Andrade</p>
52
+ </div>
53
+ <div id="wphtc-main">
54
+ <form method="post" action="<?php echo $purl?>">
55
+ <?php if($echo!=''){?>
56
+ <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
57
+ <?php }
58
+ # Donation Message
59
+ if($WPhtc_data['donation_hidden_time']&&$WPhtc_data['donation_hidden_time']<time()){?>
60
+ <div class="updated">
61
+ <p>
62
+ <strong>Is this plugin useful? Consider making a donation encouraging me to continue supporting it!</strong>
63
+ <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>
64
+ <span><a href="<?php echo $purl?>&action=hide_donation_message">Hide this message</a></span>
65
+ </p>
66
+ </div>
67
+ <?php }?>
68
+
69
+ <!-- Custom Author Permalink -->
70
+ <div class="wphtc-section">
71
+ <div class="wphtc-section-title stuffbox">
72
+ <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>
73
+ <h3><?php _e('Custom Author Permalink', 'wp-htaccess-control');?></h3>
74
+ </div>
75
+ <table class="form-table wphtc-inputs">
76
  <tr valign="top">
77
+ <th scope="row" style="width:18%;"><?php _e('Author Base', 'wp-htaccess-control'); ?></th>
78
+ <td >
79
+ <input type="text" name="WPhtc_cap" value="<?php echo $WPhtc_data['cap']; ?>" />
80
+ <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/admin</code></p>
81
  </td>
82
+ <td valign="middle">
83
+ <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
84
+ <p class="description"><?php _e('If set, the author base will be used as shown next to the form field.', 'wp-htaccess-control'); ?></p>
85
+ <p class="description"><?php _e('If you do not want to use a custom Author Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
86
  </td>
87
  </tr>
88
+ <?php if(class_exists('GoogleSitemapGeneratorLoader')){?>
89
+ <tr valign="top">
90
+ <th>Google XML Sitemap</th>
91
+ <td>
92
+ <input type="checkbox" name="WPhtc_sm_enabled" value="true" <?php if($WPhtc_data['sm_enabled']){ echo "checked";}?>/> <?php _e('Apply Custom Author Permalink on Generated Sitemap', 'wp-htaccess-control'); ?>
93
+ </td>
94
+ <td valign="middle" >
95
+ <p class="description"><?php _e('Leave "Include author pages" unchecked on Google XML Sitemap options page if using this.', 'wp-htaccess-control'); ?></p>
96
+ <p class="description"><?php _e('However, if you want to adjust the "Priority" or "Change frequency" you should do so on the <a href="options-general.php?page=google-sitemap-generator/sitemap.php">Google XML Sitemap options page</a>.', 'wp-htaccess-control'); ?></p>
97
+ </td>
98
+ </tr>
99
+ <?php } ?>
100
+ </table>
101
  </div>
102
+ <!-- Custom Pagination Permalink -->
103
+ <div class="wphtc-section">
104
+ <div class="wphtc-section-title stuffbox">
105
+ <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>
106
+ <h3><?php _e('Custom Pagination Permalink', 'wp-htaccess-control');?></h3>
107
+ </div>
108
+ <table class="form-table wphtc-inputs">
109
+ <tr valign="top">
110
+ <th scope="row" style="width:18%;"><?php _e('Page Base', 'wp-htaccess-control'); ?></th>
111
+ <td >
112
+ <input type="text" name="WPhtc_cpp" value="<?php echo $WPhtc_data['cpp']; ?>" />
113
+ <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/2</code></p>
114
+ </td>
115
+ <td valign="middle">
116
+ <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
117
+ <p class="description"><?php _e('If set, the page base will be used as shown next to the form field in every post listing (category, tag, archive, etc).', 'wp-htaccess-control'); ?></p>
118
+ <p class="description"><?php _e('If you do not want to use a custom Pagination Permalink base just leave the field empty.', 'wp-htaccess-control'); ?></p>
119
+ </td>
120
+ </tr>
121
+ </table>
122
  </div>
123
+ <!-- Custom Search Permalink -->
124
+ <div class="wphtc-section">
125
+ <div class="wphtc-section-title stuffbox">
126
+ <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>
127
+ <h3><?php _e('Custom Search Permalink', 'wp-htaccess-control');?></h3>
128
+ </div>
129
+ <table class="form-table wphtc-inputs">
130
+ <tr valign="top">
131
+ <th scope="row" style="width:18%;"><?php _e('Search Base', 'wp-htaccess-control'); ?></th>
132
+ <td >
133
+ <input type="text" name="WPhtc_custom_search_permalink" value="<?php echo $WPhtc_data['custom_search_permalink']; ?>" />
134
+ <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/search-term</code></p>
135
+ </td>
136
+ <td valign="middle">
137
+ <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
138
+ <p class="description"><?php _e('If set, the search base will always be used instead of "?s=search-term".', 'wp-htaccess-control'); ?></p>
139
+ <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>
140
+ </td>
141
+ </tr>
142
+ </table>
143
  </div>
144
+ <!-- Remove Category Base -->
145
+ <div class="wphtc-section">
146
+ <div class="wphtc-section-title stuffbox">
147
+ <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>
148
+ <h3><?php _e('Remove Category Base', 'wp-htaccess-control');?></h3>
149
+ </div>
150
+ <table class="form-table wphtc-inputs">
151
+ <tr valign="top">
152
+ <th scope="row" style="width:18%;"><?php _e('Remove Category Base', 'wp-htaccess-control'); ?></th>
153
+ <td >
154
+ <input type="checkbox" name="WPhtc_remove_category_base" <?php if($WPhtc_data['remove_category_base']){echo "checked=checked";} ?> />
155
+ </td>
156
+ <td valign="middle">
157
+ <p class="description"><?php _e('If active, the category base will be removed from permalinks:'); ?></p>
158
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category', 'wp-htaccess-control'); ?></code></p>
159
+ </td>
160
+ </tr>
161
+ </table>
162
  </div>
163
+ <!-- Advanced Archives -->
164
+ <div class="wphtc-section">
165
+ <div class="wphtc-section-title stuffbox">
166
+ <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>
167
+ <h3><?php _e('Advanced Archives', 'wp-htaccess-control');?></h3>
168
+ </div>
169
+ <table class="form-table wphtc-inputs">
170
+ <tr valign="top">
171
+ <th scope="row" style="width:18%;"><?php _e('Category Archives', 'wp-htaccess-control'); ?></th>
172
+ <td >
173
+ <input type="checkbox" name="WPhtc_category_archives" <?php if($WPhtc_data['category_archives']){echo "checked=checked";} ?> />
174
+ </td>
175
+ <td valign="middle">
176
+ <p class="description"><?php _e('If active, category-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
177
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category-base', 'wp-htaccess-control'); ?>/<?php _e('your-category', 'wp-htaccess-control'); ?>/2010</code></p>
178
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-category-base', 'wp-htaccess-control'); ?>/<?php _e('your-category', 'wp-htaccess-control'); ?>/2010/12</code></p>
179
+ <p class="description"><?php _e("This will also work if you've removed the category base.", 'wp-htaccess-control'); ?></p>
180
+ </td>
181
+ </tr>
182
+ <tr valign="top">
183
+ <th scope="row" style="width:18%;"><?php _e('Author Archives', 'wp-htaccess-control'); ?></th>
184
+ <td >
185
+ <input type="checkbox" name="WPhtc_author_archives" <?php if($WPhtc_data['author_archives']){echo "checked=checked";} ?> />
186
+ </td>
187
+ <td valign="middle">
188
+ <p class="description"><?php _e('If active, author-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
189
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-author-base', 'wp-htaccess-control'); ?>/<?php _e('your-author', 'wp-htaccess-control'); ?>/2010</code></p>
190
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-author-base', 'wp-htaccess-control'); ?>/<?php _e('your-author', 'wp-htaccess-control'); ?>/2010/12</code></p>
191
+ </td>
192
+ </tr>
193
+ <tr valign="top">
194
+ <th scope="row" style="width:18%;"><?php _e('Tag Archives', 'wp-htaccess-control'); ?></th>
195
+ <td >
196
+ <input type="checkbox" name="WPhtc_tag_archives" <?php if($WPhtc_data['tag_archives']){echo "checked=checked";} ?> />
197
+ </td>
198
+ <td valign="middle">
199
+ <p class="description"><?php _e('If active, tag-based archives will be accessible using the structure:', 'wp-htaccess-control'); ?></p>
200
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-tag-base', 'wp-htaccess-control'); ?>/<?php _e('your-tag', 'wp-htaccess-control'); ?>/2010</code></p>
201
+ <p class="description"><code><?php bloginfo('home')?>/<?php _e('your-tag-base', 'wp-htaccess-control'); ?>/<?php _e('your-tag', 'wp-htaccess-control'); ?>/2010/12</code></p>
202
+ </td>
203
+ </tr>
204
+ </table>
205
  </div>
206
+ <!-- Custom htaccess -->
207
+ <div class="wphtc-section">
208
+ <div class="wphtc-section-title stuffbox">
209
+ <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>
210
+ <h3><?php _e('Custom htaccess', 'wp-htaccess-control'); ?></h3>
211
+ </div>
212
+ <table class="form-table wphtc-inputs">
213
+ <tr valign="top">
214
+ <td>
215
+ <textarea name="WPhtc_hta" style="width:100%;" rows="7"><?php echo stripslashes($WPhtc_data['hta']); ?></textarea>
216
+ </td>
217
+ <td style="width:50%;">
218
+ <p class="description"><?php _e('This rules will be printed before any Wordpress rules.', 'wp-htaccess-control'); ?></p>
219
+ <p class="description"><?php _e('Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control'); ?></p>
220
+ <ul class="description">
221
+ <li><a href="http://www.google.com/search?q=htaccess+tutorial" title="Search for htaccess tutorials"><img width="16px" src="http://google.com/favicon.ico" alt="google favicon"> htaccess tutorial</a></li>
222
+ <li><a href="http://httpd.apache.org/docs/current/howto/htaccess.html" title="Read about htaccess at apache.org"><img width="16px" src="http://apache.org/favicon.ico" alt="apache favicon"> htaccess</a></li>
223
+ <li><a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html" title="Read about mod_rewrite at apache.org"><img width="16px" src="http://apache.org/favicon.ico" alt="apache favicon"> mod_rewrite</a></li>
224
+ </ul>
225
+ </td>
226
+ </tr>
227
+ </table>
228
  </div>
229
+ <!-- Replace Wordpress htaccess -->
230
+ <div class="wphtc-section">
231
+ <div class="wphtc-section-title stuffbox">
232
+ <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>
233
+ <h3><?php _e('Replace Wordpress htaccess', 'wp-htaccess-control'); ?></h3>
234
+ </div>
235
+ <table class="form-table wphtc-inputs">
236
+ <tr valign="top">
237
+ <td>
238
+ <textarea name="WPhtc_wp_hta" style="width:100%;" rows="7" <?php if($WPhtc_data['jim_morgan_hta']){ echo "readonly='true' class='readonly'";}?>><?php echo stripslashes($WPhtc_data['wp_hta']); ?></textarea>
239
+ <p class="description"><?php _e('Leave empty for default.', 'wp-htaccess-control'); ?></p>
240
+ <p><input type="checkbox" name="WPhtc_jim_morgan_hta" value="true" <?php if($WPhtc_data['jim_morgan_hta']){ echo "checked";}?>/>
241
+ <?php _e("<strong>Use <a href='http://www.webmasterworld.com/apache/4053973.htm'>Jim Morgan's wordpress htaccess</a></strong> (has been reported to \"speed up your WP mod_rewrite code by a factor of more than two\")", 'wp-htaccess-control'); ?></p>
242
+ </td>
243
+ <td style="width:50%;">
244
+ <p class="description"><?php _e('This rules will be printed instead of Wordpress rules.', 'wp-htaccess-control'); ?></p>
245
+ <p class="description"><?php _e('Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control'); ?></p>
246
+ <p class="description"><?php _e('Original rules:', 'wp-htaccess-control'); ?></p>
247
+ <p class="description">
248
+ <code><?php echo nl2br(htmlspecialchars(substr($WPhtc_data['htaccess_original'],0,-1)));?></code>
249
+ </p>
250
+ </td>
251
+ </tr>
252
+ </table>
253
  </div>
254
+ <!-- htaccess Suggestions -->
255
+ <div class="wphtc-section">
256
+ <div class="wphtc-section-title stuffbox">
257
+ <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>
258
+ <h3><?php _e('htaccess Suggestions', 'wp-htaccess-control'); ?></h3>
259
+ </div>
260
+ <table class="form-table wphtc-inputs">
261
+ <tr valign="top">
262
+ <th scope="row" style="width:18%;"><?php _e('ServerSignature', 'wp-htaccess-control'); ?></th>
263
+ <td style="width:3%;" valign="middle">
264
+ <input type="checkbox" name="WPhtc_disable_serversignature" value="true" <?php if($WPhtc_data['disable_serversignature']){ echo "checked";}?>/>
265
+ </td>
266
+ <td valign="middle">
267
+ <p class="description"><?php _e('Disable the ServerSignature on server generated error pages.', 'wp-htaccess-control'); ?></p>
268
+ </td>
269
+ </tr>
270
+ <tr valign="top">
271
+ <th scope="row"><?php _e('Indexes', 'wp-htaccess-control'); ?></th>
272
+ <td style="width:3%;" valign="middle">
273
+ <input type="checkbox" name="WPhtc_disable_indexes" value="true" <?php if($WPhtc_data['disable_indexes']){ echo "checked";}?>/>
274
+ </td>
275
+ <td valign="middle">
276
+ <p class="description"><?php _e('Disable directory browsing.', 'wp-htaccess-control'); ?></p>
277
+ </td>
278
+ </tr>
279
+ <tr valign="top">
280
+ <th scope="row"><?php _e('Protect wp-config.php file', 'wp-htaccess-control'); ?></th>
281
+ <td style="width:3%;" valign="middle">
282
+ <input type="checkbox" name="WPhtc_protect_wp_config" value="true" <?php if($WPhtc_data['protect_wp_config']){ echo "checked";}?>/> </td>
283
+ <td valign="middle">
284
+ <p class="description"><?php _e('Deny access to wp-config.php file.', 'wp-htaccess-control'); ?></p>
285
+ </td>
286
+ </tr>
287
+ <tr valign="top">
288
+ <th scope="row"><?php _e('Protect htaccess file', 'wp-htaccess-control'); ?></th>
289
+ <td style="width:3%;" valign="middle">
290
+ <input type="checkbox" name="WPhtc_protect_htaccess" value="true" <?php if($WPhtc_data['protect_htaccess']){ echo "checked";}?>/> </td>
291
+ <td valign="middle">
292
+ <p class="description"><?php _e('Deny access to .htaccess file.', 'wp-htaccess-control'); ?></p>
293
+ </td>
294
+ </tr>
295
+ <tr valign="top">
296
+ <th scope="row"><?php _e('Protect comments.php', 'wp-htaccess-control'); ?></th>
297
+ <td style="width:3%;" valign="middle">
298
+ <input type="checkbox" name="WPhtc_protect_comments" value="true" <?php if($WPhtc_data['protect_comments']){ echo "checked";}?>/> </td>
299
+ <td valign="middle">
300
+ <p class="description"><?php _e('Deny comment posting to no referrer requests. This will avoid spam bots coming from nowhere.', 'wp-htaccess-control'); ?></p>
301
+ </td>
302
+ </tr>
303
+ <tr valign="top">
304
+ <th scope="row"><?php _e('mod_gzip', 'wp-htaccess-control'); ?></th>
305
+ <td style="width:3%;" valign="middle">
306
+ <input type="checkbox" name="WPhtc_gzip" value="true" <?php if($WPhtc_data['gzip']){ echo "checked";}?>/>
307
+ </td>
308
+ <td valign="middle">
309
+ <p class="description"><?php _e('Use mod_gzip if available.', 'wp-htaccess-control'); ?></p>
310
+ </td>
311
+ </tr>
312
+ <tr valign="top">
313
+ <th scope="row"><?php _e('mod_deflate', 'wp-htaccess-control'); ?></th>
314
+ <td style="width:3%;" valign="middle">
315
+ <input type="checkbox" name="WPhtc_deflate" value="true" <?php if($WPhtc_data['deflate']){ echo "checked";}?>/>
316
+ </td>
317
+ <td valign="middle">
318
+ <p class="description"><?php _e('Use mod_deflate if available.', 'wp-htaccess-control'); ?></p>
319
+ </td>
320
+ </tr>
321
+ <tr valign="top">
322
+ <th scope="row"><?php _e('Limit Upload Size', 'wp-htaccess-control'); ?></th>
323
+ <td style="width:3%;" valign="middle">
324
+ <input type="text" name="WPhtc_up_limit" value="<?php echo $WPhtc_data['up_limit']?>"/>
325
+ </td>
326
+ <td valign="middle">
327
+ <p class="description"><?php _e('If set, this value in MB will be used as limit to file uploads.', 'wp-htaccess-control'); ?></p>
328
+ </td>
329
+ </tr>
330
+ <tr valign="top">
331
+ <th scope="row"><?php _e('Admin Email', 'wp-htaccess-control'); ?></th>
332
+ <td style="width:3%;">
333
+ <input type="text" name="WPhtc_admin_email" value="<?php echo $WPhtc_data['admin_email']?>"/>
334
+ </td>
335
+ <td valign="middle">
336
+ <p class="description"><?php _e('If set, this will be used as the admin email on server generated error pages.', 'wp-htaccess-control'); ?></p>
337
+ </td>
338
+ </tr>
339
+ <tr valign="top">
340
+ <th scope="row"><?php _e('Disable hotlinking', 'wp-htaccess-control'); ?></th>
341
+ <td style="width:3%;">
342
+ <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
343
+ </td>
344
+ <td valign="middle">
345
+ <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>
346
+ </td>
347
+ </tr>
348
+ <tr valign="top">
349
+ <th scope="row"><?php _e('500 error', 'wp-htaccess-control'); ?></th>
350
+ <td style="width:3%;" valign="middle">
351
+ <input type="text" name="WPhtc_redirect_500" value="<?php echo $WPhtc_data['redirect_500']?>"/>
352
+ </td>
353
+ <td valign="middle">
354
+ <p class="description"><?php _e('If set, this path will be used as page to 500 errors (example: /error.php).', 'wp-htaccess-control'); ?></p>
355
+ </td>
356
+ </tr>
357
+ <tr valign="top">
358
+ <th scope="row"><?php _e('403 error', 'wp-htaccess-control'); ?></th>
359
+ <td style="width:3%;" valign="middle">
360
+ <input type="text" name="WPhtc_redirect_403" value="<?php echo $WPhtc_data['redirect_403']?>"/>
361
+ </td>
362
+ <td valign="middle">
363
+ <p class="description"><?php _e('If set, this path will be used as page to 403 errors (example: /error.php).', 'wp-htaccess-control'); ?></p>
364
+ </td>
365
+ </tr>
366
+ <tr valign="top">
367
+ <th scope="row" valign="middle"><?php _e('Canonical Url', 'wp-htaccess-control'); ?></th>
368
+ <td style="width:3%;" valign="middle">
369
+ <select name="WPhtc_canon">
370
+ <option value=""></option>
371
+ <option value="www" <?php if($WPhtc_data['canon']=='www'){echo "selected";} ?>><?php _e('Force WWW', 'wp-htaccess-control'); ?></option>
372
+ <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>><?php _e('Force non-WWW', 'wp-htaccess-control'); ?></option>
373
+ </select>
374
+ </td>
375
+ <td valign="middle">
376
+ <p class="description"><?php _e('This will force canonization. This will be done by simply modifying the wordpress "site url" and "home" options (not htaccess).', 'wp-htaccess-control'); ?></p>
377
+ </td>
378
+ </tr>
379
+ </table>
380
+ </div>
381
+ <!-- Maintenance Mode -->
382
+ <div class="wphtc-section">
383
+ <div class="wphtc-section-title stuffbox">
384
+ <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>
385
+ <h3><?php _e('Maintenance Mode', 'wp-htaccess-control'); ?></h3>
386
+ </div>
387
+ <table class="form-table wphtc-inputs">
388
+ <tr valign="top">
389
+ <th scope="row" style="width:18%;"><?php _e('Maintenance Active', 'wp-htaccess-control'); ?></th>
390
+ <td valign="middle">
391
+ <input type="checkbox" name="WPhtc_maintenance_active" value="true" <?php if($WPhtc_data['maintenance_active']){ echo "checked";}?>/>
392
+ </td>
393
+ <td valign="middle">
394
+ <p class="description"><?php _e('Toggles Maintenance Mode.', 'wp-htaccess-control'); ?></p>
395
+ </td>
396
+ </tr>
397
+ <tr valign="top">
398
+ <th scope="row" style="width:18%;"><?php _e('Allowed IPs', 'wp-htaccess-control'); ?></th>
399
+ <td>
400
+ <textarea name="WPhtc_maintenance_ips"><?php if(isset($WPhtc_data['maintenance_ips'])){echo implode($WPhtc_data['maintenance_ips'],"\n");}?></textarea>
401
+ </td>
402
+ <td valign="middle">
403
+ <p class="description"><?php _e('List of allowed IPs.', 'wp-htaccess-control'); ?></p>
404
+ <p class="description"><?php _e('All the IPs not listed will view the 403 error page or be redirected to a page set below.', 'wp-htaccess-control'); ?></p>
405
+ </td>
406
+ </tr>
407
+ <tr valign="top">
408
+ <th scope="row" style="width:18%;"><?php _e('Redirection', 'wp-htaccess-control'); ?></th>
409
+ <td>
410
+ <input type="text" name="WPhtc_maintenance_redirection" value="<?php echo $WPhtc_data['maintenance_redirection']?>"/>
411
+ </td>
412
+ <td valign="middle">
413
+ <p class="description"><?php _e('If set, this will be used as redirection for disallowed IPs. This could be an external url or a document on your server (local paths begin with a trailing slash)', 'wp-htaccess-control'); ?></p>
414
+ </td>
415
+ </tr>
416
+ </table>
417
+ </div>
418
+ <input type="hidden" name="action" value="update" />
419
+ <div class="wphtc-menu">
420
+ <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a>
421
+ <input type="submit" class="button-primary" value="<?php _e('Save all changes', 'wp-htaccess-control'); ?>" />
422
+ </div>
423
+ </form>
424
  <div class="wphtc-section">
425
  <div class="wphtc-section-title stuffbox">
426
  <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>
427
+ <h3><?php _e('Current htaccess file as it is generated by Wordpress', 'wp-htaccess-control'); ?></h3>
428
+ </div>
429
+ <div class="wphtc-inputs">
430
+ <p>
431
+ <code><?php echo str_replace(array("&lt;br /&gt;","&lt;br/&gt;"),"<br/>",htmlspecialchars($WPhtc_data['cur_hta']));?></code>
432
+ </p>
433
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  </div>
435
  </div>
 
436
  </div>
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.3
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -280,6 +280,14 @@ if (!class_exists("WPhtc")) {
280
  $new_rules.="deny from all\n";
281
  $new_rules.="</files>\n";
282
  }
 
 
 
 
 
 
 
 
283
  if($WPhtc_data['disable_hotlink']){
284
  $new_rules.="\n# WPhtC: Disable image hotlinking\n";
285
  $new_rules.="<IfModule mod_rewrite.c>\n";
@@ -419,7 +427,7 @@ if (!class_exists("WPhtc")) {
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;
425
  # if reseting everything just delete the option array
@@ -475,6 +483,7 @@ if (!class_exists("WPhtc")) {
475
  $WPhtc_data['up_limit']=(is_numeric($_POST['WPhtc_up_limit'])&&$_POST['WPhtc_up_limit']>0)?$_POST['WPhtc_up_limit']:'';
476
  $WPhtc_data['protect_wp_config']=$_POST['WPhtc_protect_wp_config'];
477
  $WPhtc_data['protect_htaccess']=$_POST['WPhtc_protect_htaccess'];
 
478
  $WPhtc_data['disable_hotlink']=trim($_POST['WPhtc_disable_hotlink']);
479
  $WPhtc_data['redirect_500']=trim($_POST['WPhtc_redirect_500']);
480
  $WPhtc_data['redirect_403']=trim($_POST['WPhtc_redirect_403']);
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.4
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
280
  $new_rules.="deny from all\n";
281
  $new_rules.="</files>\n";
282
  }
283
+ if($WPhtc_data['protect_comments']){
284
+ $new_rules.="\n# WPhtC: Protect comments.php\n";
285
+ $new_rules.="RewriteCond %{REQUEST_METHOD} POST\n";
286
+ $new_rules.="RewriteCond %{REQUEST_URI} .wp-comments-post\.php*\n";
287
+ $new_rules.="RewriteCond %{HTTP_REFERER} !.*".get_bloginfo('home').".* [OR]\n";
288
+ $new_rules.="RewriteCond %{HTTP_USER_AGENT} ^$\n";
289
+ $new_rules.="RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]\n";
290
+ }
291
  if($WPhtc_data['disable_hotlink']){
292
  $new_rules.="\n# WPhtC: Disable image hotlinking\n";
293
  $new_rules.="<IfModule mod_rewrite.c>\n";
427
  switch($action){
428
  # Hide donation message for one month
429
  case 'hide_donation_message':
430
+ $WPhtc_data['donation_hidden_time']=time()+ 90 * 24 * 60 * 60;
431
  update_option('WPhtc_data',$WPhtc_data);
432
  break;
433
  # if reseting everything just delete the option array
483
  $WPhtc_data['up_limit']=(is_numeric($_POST['WPhtc_up_limit'])&&$_POST['WPhtc_up_limit']>0)?$_POST['WPhtc_up_limit']:'';
484
  $WPhtc_data['protect_wp_config']=$_POST['WPhtc_protect_wp_config'];
485
  $WPhtc_data['protect_htaccess']=$_POST['WPhtc_protect_htaccess'];
486
+ $WPhtc_data['protect_comments']=$_POST['WPhtc_protect_comments'];
487
  $WPhtc_data['disable_hotlink']=trim($_POST['WPhtc_disable_hotlink']);
488
  $WPhtc_data['redirect_500']=trim($_POST['WPhtc_redirect_500']);
489
  $WPhtc_data['redirect_403']=trim($_POST['WPhtc_redirect_403']);