WP htaccess Control - Version 1.4.3

Version Description

(22/03/2010) = * Custom Author Permalink now working when using wp_list_authors (thank you HW for the report); * Options page should only be seen by admins; * Prepared l10n.

Download this release

Release Info

Developer andrad
Plugin Icon wp plugin WP htaccess Control
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.4.2 to 1.4.3

readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link:
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect
7
  Requires at least: 2.7
8
  Tested up to: 2.9.2
9
- Stable tag: 1.4.2
10
 
11
  Provides an interface to add custom htaccess rules to the htaccess file generated by Wordpress and customisation of the Author Permalink Base.
12
 
@@ -49,15 +49,18 @@ Suggestions are of course very welcome and please report any bugs found!
49
  1. Administration page (as of v.1.4)
50
 
51
  == Changelog ==
52
- = 1.4.2 =
53
- (12/03/2010)
 
 
 
 
54
  * Readme formatting mistake.
55
- = 1.4.1 =
56
- (12/03/2010)
57
  * Clean up on debug left over on 1.4 for url canonization.
58
 
59
- = 1.4 =
60
- (12/03/2010)
61
  * Added "Suggested htaccess" features;
62
  * Improved Ui.
63
 
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect
7
  Requires at least: 2.7
8
  Tested up to: 2.9.2
9
+ Stable tag: 1.4.3
10
 
11
  Provides an interface to add custom htaccess rules to the htaccess file generated by Wordpress and customisation of the Author Permalink Base.
12
 
49
  1. Administration page (as of v.1.4)
50
 
51
  == Changelog ==
52
+ = 1.4.3 (22/03/2010) =
53
+ * Custom Author Permalink now working when using wp_list_authors (thank you HW for the report);
54
+ * Options page should only be seen by admins;
55
+ * Prepared l10n.
56
+
57
+ = 1.4.2 (12/03/2010) =
58
  * Readme formatting mistake.
59
+
60
+ = 1.4.1 (12/03/2010) =
61
  * Clean up on debug left over on 1.4 for url canonization.
62
 
63
+ = 1.4 (12/03/2010) =
 
64
  * Added "Suggested htaccess" features;
65
  * Improved Ui.
66
 
wp-htaccess-control-ui.css CHANGED
@@ -6,6 +6,6 @@
6
  .wphtc-inputs{background:#fff;border:1px solid #ddd;border-left:0;border-right:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
7
  .wphtc-inputs th{font-weight:bold;}
8
  .wphtc-inputs tr{border-bottom:1px solid #ddd}
9
- .wphtc-inputs caption{text-align:left;padding:10px;background:white;}
10
  .form-table{margin:0;}
11
  #wphtc-footer{text-align:right;}
6
  .wphtc-inputs{background:#fff;border:1px solid #ddd;border-left:0;border-right:0;-moz-border-radius:6px;-webkit-border-radius:6px;}
7
  .wphtc-inputs th{font-weight:bold;}
8
  .wphtc-inputs tr{border-bottom:1px solid #ddd}
9
+ .wphtc-inputs caption{text-align:left;padding:10px;background:#ddd;}
10
  .form-table{margin:0;}
11
  #wphtc-footer{text-align:right;}
wp-htaccess-control-ui.php CHANGED
@@ -9,6 +9,10 @@ $WPhtc_data=get_option('WPhtc_data');
9
  ?>
10
  <div id="wphtc-page" class="wrap">
11
  <h2>Wp htaccess Control</h2>
 
 
 
 
12
  <form method="post" action="<?php echo $purl?>">
13
  <?php if($echo!=''){?>
14
  <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
@@ -16,30 +20,30 @@ $WPhtc_data=get_option('WPhtc_data');
16
  <div class="wphtc-section">
17
  <div class="wphtc-section-title stuffbox">
18
  <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>
19
- <h3>Custom Author Permalink</h3>
20
  </div>
21
  <table class="form-table wphtc-inputs">
22
  <tr valign="top">
23
- <th scope="row" style="width:18%;">Author Base</th>
24
  <td >
25
  <input type="text" name="WPhtc_cap" value="<?php echo $WPhtc_data['cap']; ?>" />
26
- <p><code><?php bloginfo('home')?>/<em>(your-base)</em>/admin</code></p>
27
  </td>
28
  <td valign="middle">
29
- <p class="description">Permalink settings must be set and not Default (/?p=123).</p>
30
- <p class="description">If set, the author base will be used as shown next to the form field.</p>
31
- <p class="description">If you do not want to use a custom Author Permalink base just leave the field empty.</p>
32
  </td>
33
  </tr>
34
  <?php if(class_exists('GoogleSitemapGeneratorLoader')){?>
35
  <tr valign="top">
36
  <th>Google XML Sitemap</th>
37
  <td>
38
- <input type="checkbox" name="WPhtc_sm_enabled" value="true" <?php if($WPhtc_data['sm_enabled']){ echo "checked";}?>/> Apply Custom Author Permalink on Generated Sitemap
39
  </td>
40
  <td valign="middle" >
41
- <p class="description">Leave "Include author pages" unchecked on Google XML Sitemap options page if using this.</p>
42
- <p class="description">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>.</p>
43
  </td>
44
  </tr>
45
  <?php } ?>
@@ -48,7 +52,7 @@ $WPhtc_data=get_option('WPhtc_data');
48
  <div class="wphtc-section">
49
  <div class="wphtc-section-title stuffbox">
50
  <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>
51
- <h3>Custom htaccess</h3>
52
  </div>
53
  <table class="form-table wphtc-inputs">
54
  <tr valign="top">
@@ -60,8 +64,8 @@ $WPhtc_data=get_option('WPhtc_data');
60
  }?></textarea>
61
  </td>
62
  <td style="width:50%;">
63
- <p class="description">This rules will be printed before any Wordpress rules.</p>
64
- <p class="description">Please double check them before saving as a mistake could make your site unaccessable.</p>
65
  </td>
66
  </tr>
67
  </table>
@@ -69,88 +73,88 @@ $WPhtc_data=get_option('WPhtc_data');
69
  <div class="wphtc-section">
70
  <div class="wphtc-section-title stuffbox">
71
  <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>
72
- <h3>htaccess Suggestions</h3>
73
  </div>
74
  <table class="form-table wphtc-inputs">
75
  <tr valign="top">
76
- <th scope="row" style="width:18%;">ServerSignature</th>
77
  <td style="width:3%;" valign="middle">
78
  <input type="checkbox" name="WPhtc_disable_serversignature" value="true" <?php if($WPhtc_data['disable_serversignature']){ echo "checked";}?>/>
79
  </td>
80
- <td valign="middle">Disable the ServerSignature on server generated error pages.</td>
81
  </tr>
82
  <tr valign="top">
83
- <th scope="row">Indexes</th>
84
  <td style="width:3%;" valign="middle">
85
  <input type="checkbox" name="WPhtc_disable_indexes" value="true" <?php if($WPhtc_data['disable_indexes']){ echo "checked";}?>/>
86
  </td>
87
- <td valign="middle">Disable directory browsing.</td>
88
  </tr>
89
  <tr valign="top">
90
- <th scope="row">Protect wp-config.php file</th>
91
  <td style="width:3%;" valign="middle">
92
  <input type="checkbox" name="WPhtc_protect_wp_config" value="true" <?php if($WPhtc_data['protect_wp_config']){ echo "checked";}?>/>
93
  </td>
94
- <td valign="middle">Deny access to wp-config.php file.</td>
95
  </tr>
96
  <tr valign="top">
97
- <th scope="row">Protect htaccess file</th>
98
  <td style="width:3%;" valign="middle">
99
  <input type="checkbox" name="WPhtc_protect_htaccess" value="true" <?php if($WPhtc_data['protect_htaccess']){ echo "checked";}?>/>
100
  </td>
101
- <td valign="middle">Deny access to .htaccess file.</td>
102
  </tr>
103
  <tr valign="top">
104
- <th scope="row">Limit Upload Size</th>
105
  <td style="width:3%;" valign="middle">
106
  <input type="text" name="WPhtc_up_limit" value="<?php echo $WPhtc_data['up_limit']?>"/>
107
  </td>
108
- <td valign="middle">If set, this value in MB will be used as limit to file uploads.</td>
109
  </tr>
110
  <tr valign="top">
111
- <th scope="row">Admin Email</th>
112
  <td style="width:3%;">
113
  <input type="text" name="WPhtc_admin_email" value="<?php echo $WPhtc_data['admin_email']?>"/>
114
  </td>
115
- <td valign="middle">If set, this will be used as the admin email on server generated error pages.</td>
116
  </tr>
117
  <tr valign="top">
118
- <th scope="row">Disable hotlinking</th>
119
  <td style="width:3%;">
120
  <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
121
  </td>
122
- <td valign="middle">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 "-".</td>
123
  </tr>
124
  <tr valign="top">
125
- <th scope="row">500 error</th>
126
  <td style="width:3%;" valign="middle">
127
  <input type="text" name="WPhtc_redirect_500" value="<?php echo $WPhtc_data['redirect_500']?>"/>
128
  </td>
129
- <td valign="middle">If set, this path will be used as page to 500 errors (example: /error.php).</td>
130
  </tr>
131
  <tr valign="top">
132
- <th scope="row" valign="middle">Canonical Url</th>
133
  <td style="width:3%;" valign="middle">
134
  <select name="WPhtc_canon">
135
  <option value=""></option>
136
- <option value="www" <?php if($WPhtc_data['canon']=='www'){echo "selected";} ?>>Force WWW</option>
137
- <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>>Force non-WWW</option>
138
  </select>
139
  </td>
140
- <td valign="middle">This will force canonization.</td>
141
  </tr>
142
  </table>
143
  </div>
144
  <div class="wphtc-section">
145
  <div class="wphtc-section-title stuffbox">
146
  <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>
147
- <h3>Rewrite Pairs</h3>
148
 
149
  </div>
150
  <table id="htaccess-rules" class="form-table wphtc-inputs">
151
  <caption>
152
- <a class="add-rewrite-pair button-secondary" href="#AddRewritePair" title="Add new htaccess redirection pair">Add rule</a>
153
- <span class="description">These are rewrite pairs (RewriteRule) which Wordpress can add inside its rules.</span>
154
  </caption>
155
  <?php
156
  $num=count($WPhtc_data['pats'])?count($WPhtc_data['pats']):1;
@@ -158,7 +162,7 @@ $WPhtc_data=get_option('WPhtc_data');
158
  <tr id="rule-<?php echo $i;?>" valign="top">
159
  <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_pat<?php echo $i;?>" value="<?php echo $WPhtc_data['pats'][$i]; ?>" /></td>
160
  <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_sub<?php echo $i;?>" value="<?php echo $WPhtc_data['subs'][$i]; ?>" /></td>
161
- <td style="width:10%;" valign="middle"><a class="button-secondary" href="<?php echo $purl ?>&action=delete_pair&pair=<?php echo $i?>">Delete Pair</a></td>
162
  </tr>
163
  <?php } ?>
164
  </table>
@@ -166,14 +170,14 @@ $WPhtc_data=get_option('WPhtc_data');
166
  <input type="hidden" name="action" value="update" />
167
  <input id="WPhtc_num" type="hidden" name="WPhtc_num" value="<?php echo $num;?>" />
168
  <div class="wphtc-menu">
169
- <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules">Reset all rules</a>
170
- <input type="submit" class="button-primary" value="Save all changes" />
171
  </div>
172
  </form>
173
  <div class="wphtc-section">
174
  <div class="wphtc-section-title stuffbox">
175
  <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>
176
- <h3>Current htaccess file as it is generated by Wordpress</h3>
177
  </div>
178
  <div class="wphtc-inputs">
179
  <p style="margin-left:10px;">
@@ -181,5 +185,5 @@ $WPhtc_data=get_option('WPhtc_data');
181
  </p>
182
  </div>
183
  </div>
184
- <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> by <a href="http://dardna.com" title="Visit dardna.com">António Andrade</a></p>
185
  </div>
9
  ?>
10
  <div id="wphtc-page" class="wrap">
11
  <h2>Wp htaccess Control</h2>
12
+ <?php if(!current_user_can("administrator")) {
13
+ echo '<p>'.__('Please log in as admin','wp-htaccess-control').'</p>';
14
+ return;
15
+ } ?>
16
  <form method="post" action="<?php echo $purl?>">
17
  <?php if($echo!=''){?>
18
  <div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);"><p><?php echo $echo;?></p></div>
20
  <div class="wphtc-section">
21
  <div class="wphtc-section-title stuffbox">
22
  <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>
23
+ <h3><?php _e('Custom Author Permalink', 'wp-htaccess-control');?></h3>
24
  </div>
25
  <table class="form-table wphtc-inputs">
26
  <tr valign="top">
27
+ <th scope="row" style="width:18%;"><?php _e('Author Base', 'wp-htaccess-control'); ?></th>
28
  <td >
29
  <input type="text" name="WPhtc_cap" value="<?php echo $WPhtc_data['cap']; ?>" />
30
+ <p><code><?php bloginfo('home')?>/<em><?php _e('(your-base)', 'wp-htaccess-control');?></em>/admin</code></p>
31
  </td>
32
  <td valign="middle">
33
+ <p class="description"><?php _e('Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control'); ?></p>
34
+ <p class="description"><?php _e('If set, the author base will be used as shown next to the form field.', 'wp-htaccess-control'); ?></p>
35
+ <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>
36
  </td>
37
  </tr>
38
  <?php if(class_exists('GoogleSitemapGeneratorLoader')){?>
39
  <tr valign="top">
40
  <th>Google XML Sitemap</th>
41
  <td>
42
+ <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'); ?>
43
  </td>
44
  <td valign="middle" >
45
+ <p class="description"><?php _e('Leave "Include author pages" unchecked on Google XML Sitemap options page if using this.', 'wp-htaccess-control'); ?></p>
46
+ <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>
47
  </td>
48
  </tr>
49
  <?php } ?>
52
  <div class="wphtc-section">
53
  <div class="wphtc-section-title stuffbox">
54
  <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>
55
+ <h3><?php _e('Custom htaccess', 'wp-htaccess-control'); ?></h3>
56
  </div>
57
  <table class="form-table wphtc-inputs">
58
  <tr valign="top">
64
  }?></textarea>
65
  </td>
66
  <td style="width:50%;">
67
+ <p class="description"><?php _e('This rules will be printed before any Wordpress rules.', 'wp-htaccess-control'); ?></p>
68
+ <p class="description"><?php _e('Please double check them before saving as a mistake could make your site unaccessable.', 'wp-htaccess-control'); ?></p>
69
  </td>
70
  </tr>
71
  </table>
73
  <div class="wphtc-section">
74
  <div class="wphtc-section-title stuffbox">
75
  <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>
76
+ <h3><?php _e('htaccess Suggestions', 'wp-htaccess-control'); ?></h3>
77
  </div>
78
  <table class="form-table wphtc-inputs">
79
  <tr valign="top">
80
+ <th scope="row" style="width:18%;"><?php _e('ServerSignature', 'wp-htaccess-control'); ?></th>
81
  <td style="width:3%;" valign="middle">
82
  <input type="checkbox" name="WPhtc_disable_serversignature" value="true" <?php if($WPhtc_data['disable_serversignature']){ echo "checked";}?>/>
83
  </td>
84
+ <td valign="middle"><?php _e('Disable the ServerSignature on server generated error pages.', 'wp-htaccess-control'); ?></td>
85
  </tr>
86
  <tr valign="top">
87
+ <th scope="row"><?php _e('Indexes', 'wp-htaccess-control'); ?></th>
88
  <td style="width:3%;" valign="middle">
89
  <input type="checkbox" name="WPhtc_disable_indexes" value="true" <?php if($WPhtc_data['disable_indexes']){ echo "checked";}?>/>
90
  </td>
91
+ <td valign="middle"><?php _e('Disable directory browsing.', 'wp-htaccess-control'); ?></td>
92
  </tr>
93
  <tr valign="top">
94
+ <th scope="row"><?php _e('Protect wp-config.php file', 'wp-htaccess-control'); ?></th>
95
  <td style="width:3%;" valign="middle">
96
  <input type="checkbox" name="WPhtc_protect_wp_config" value="true" <?php if($WPhtc_data['protect_wp_config']){ echo "checked";}?>/>
97
  </td>
98
+ <td valign="middle"><?php _e('Deny access to wp-config.php file.', 'wp-htaccess-control'); ?></td>
99
  </tr>
100
  <tr valign="top">
101
+ <th scope="row"><?php _e('Protect htaccess file', 'wp-htaccess-control'); ?></th>
102
  <td style="width:3%;" valign="middle">
103
  <input type="checkbox" name="WPhtc_protect_htaccess" value="true" <?php if($WPhtc_data['protect_htaccess']){ echo "checked";}?>/>
104
  </td>
105
+ <td valign="middle"><?php _e('Deny access to .htaccess file.', 'wp-htaccess-control'); ?></td>
106
  </tr>
107
  <tr valign="top">
108
+ <th scope="row"><?php _e('Limit Upload Size', 'wp-htaccess-control'); ?></th>
109
  <td style="width:3%;" valign="middle">
110
  <input type="text" name="WPhtc_up_limit" value="<?php echo $WPhtc_data['up_limit']?>"/>
111
  </td>
112
+ <td valign="middle"><?php _e('If set, this value in MB will be used as limit to file uploads.', 'wp-htaccess-control'); ?></td>
113
  </tr>
114
  <tr valign="top">
115
+ <th scope="row"><?php _e('Admin Email', 'wp-htaccess-control'); ?></th>
116
  <td style="width:3%;">
117
  <input type="text" name="WPhtc_admin_email" value="<?php echo $WPhtc_data['admin_email']?>"/>
118
  </td>
119
+ <td valign="middle"><?php _e('If set, this will be used as the admin email on server generated error pages.', 'wp-htaccess-control'); ?></td>
120
  </tr>
121
  <tr valign="top">
122
+ <th scope="row"><?php _e('Disable hotlinking', 'wp-htaccess-control'); ?></th>
123
  <td style="width:3%;">
124
  <input type="text" name="WPhtc_disable_hotlink" value="<?php echo $WPhtc_data['disable_hotlink']?>"/>
125
  </td>
126
+ <td valign="middle"><?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'); ?></td>
127
  </tr>
128
  <tr valign="top">
129
+ <th scope="row"><?php _e('500 error', 'wp-htaccess-control'); ?></th>
130
  <td style="width:3%;" valign="middle">
131
  <input type="text" name="WPhtc_redirect_500" value="<?php echo $WPhtc_data['redirect_500']?>"/>
132
  </td>
133
+ <td valign="middle"><?php _e('If set, this path will be used as page to 500 errors (example: /error.php).', 'wp-htaccess-control'); ?></td>
134
  </tr>
135
  <tr valign="top">
136
+ <th scope="row" valign="middle"><?php _e('Canonical Url', 'wp-htaccess-control'); ?></th>
137
  <td style="width:3%;" valign="middle">
138
  <select name="WPhtc_canon">
139
  <option value=""></option>
140
+ <option value="www" <?php if($WPhtc_data['canon']=='www'){echo "selected";} ?>><?php _e('Force WWW', 'wp-htaccess-control'); ?></option>
141
+ <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>><?php _e('Force non-WWW', 'wp-htaccess-control'); ?></option>
142
  </select>
143
  </td>
144
+ <td valign="middle"><?php _e('This will force canonization.', 'wp-htaccess-control'); ?></td>
145
  </tr>
146
  </table>
147
  </div>
148
  <div class="wphtc-section">
149
  <div class="wphtc-section-title stuffbox">
150
  <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>
151
+ <h3><?php _e('Rewrite Pairs', 'wp-htaccess-control'); ?></h3>
152
 
153
  </div>
154
  <table id="htaccess-rules" class="form-table wphtc-inputs">
155
  <caption>
156
+ <a class="add-rewrite-pair button-secondary" href="#AddRewritePair" title="Add new htaccess redirection pair"><?php _e('Add rule', 'wp-htaccess-control'); ?></a>
157
+ <span class="description"><?php _e('These are rewrite pairs (RewriteRule) which Wordpress can add inside its rules.', 'wp-htaccess-control'); ?></span>
158
  </caption>
159
  <?php
160
  $num=count($WPhtc_data['pats'])?count($WPhtc_data['pats']):1;
162
  <tr id="rule-<?php echo $i;?>" valign="top">
163
  <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_pat<?php echo $i;?>" value="<?php echo $WPhtc_data['pats'][$i]; ?>" /></td>
164
  <td style="width:45%"><input type="text" style="width:100%" name="WPhtc_sub<?php echo $i;?>" value="<?php echo $WPhtc_data['subs'][$i]; ?>" /></td>
165
+ <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>
166
  </tr>
167
  <?php } ?>
168
  </table>
170
  <input type="hidden" name="action" value="update" />
171
  <input id="WPhtc_num" type="hidden" name="WPhtc_num" value="<?php echo $num;?>" />
172
  <div class="wphtc-menu">
173
+ <a class="button-secondary" href="<?php echo $purl?>&action=reset_rules"><?php _e('Reset all rules', 'wp-htaccess-control'); ?></a>
174
+ <input type="submit" class="button-primary" value="<?php _e('Save all changes', 'wp-htaccess-control'); ?>" />
175
  </div>
176
  </form>
177
  <div class="wphtc-section">
178
  <div class="wphtc-section-title stuffbox">
179
  <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>
180
+ <h3><?php _e('Current htaccess file as it is generated by Wordpress', 'wp-htaccess-control'); ?></h3>
181
  </div>
182
  <div class="wphtc-inputs">
183
  <p style="margin-left:10px;">
185
  </p>
186
  </div>
187
  </div>
188
+ <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>
189
  </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: Provides an interface to add custom htaccess rules to the htaccess file generated by wordpress. Also provides customisation of the Author Permalink Base.
6
- Version: 1.4.2
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -26,7 +26,14 @@ Author URI: http://dardna.com
26
  if (!class_exists("WPhtc")) {
27
  class WPhtc {
28
  function WPhtc() {
29
- }
 
 
 
 
 
 
 
30
  # Replacing the Wordpress Author Permalink by rewriting its rules if we have a Custom Author Permalink, everytime the rules are flush
31
  function wphtc_cap($rules){
32
  $WPhtc_data=get_option('WPhtc_data');
@@ -35,6 +42,14 @@ if (!class_exists("WPhtc")) {
35
  }
36
  return $rules;
37
  }
 
 
 
 
 
 
 
 
38
  # Adding our Custom Author Base to the sitemap generated by Google XML Sitemaps
39
  # Adapted from sitemap-core.php line 2036
40
  function set_sm(){
@@ -172,9 +187,11 @@ if (!class_exists("WPhtc")) {
172
  }
173
  # Adding our options page to the admin menu
174
  function configure_menu(){
175
- $page=add_submenu_page("options-general.php","WP htaccess Control", "WP htaControl", 6, __FILE__, array('WPhtc','wphtc_page'));
176
- add_action('admin_print_scripts-'.$page, array('WPhtc','wphtc_page_script'));
177
- add_action('admin_print_styles-'.$page, array('WPhtc','wphtc_page_style'));
 
 
178
  }
179
  # Enqueue Ui Scripts on Plugin page
180
  function wphtc_page_script(){
@@ -194,7 +211,7 @@ if (!class_exists("WPhtc")) {
194
  # if reseting everything just delete the option array
195
  case 'reset_rules':
196
  delete_option('WPhtc_data');
197
- $echo.="All rules reset.";
198
  global $wp_rewrite;
199
  $wp_rewrite->flush_rules();
200
  break;
@@ -249,7 +266,7 @@ if (!class_exists("WPhtc")) {
249
  # Flush Rewrite Rules
250
  global $wp_rewrite;
251
  $wp_rewrite->flush_rules();
252
- $echo.="All options updated.";
253
  break;
254
  # deleting individual rewrite pair
255
  case 'delete_pair':
@@ -257,13 +274,13 @@ if (!class_exists("WPhtc")) {
257
  # if it's the last pair
258
  if($_GET['pair']==0 && !isset($WPhtc_data['pats'][1])){
259
  unset($WPhtc_data['pats'], $WPhtc_data['subs']);
260
- $echo.="Wordpress Rewrite pairs reset.";
261
  }
262
  else{
263
  unset($WPhtc_data['pats'][$_GET['pair']],$WPhtc_data['subs'][$_GET['pair']]);
264
  $WPhtc_data['pats']=array_values($WPhtc_data['pats']);
265
  $WPhtc_data['subs']=array_values($WPhtc_data['subs']);
266
- $echo.='Wordpress Rewrite pair deleted!';
267
  }
268
  update_option('WPhtc_data',$WPhtc_data);
269
  global $wp_rewrite;
@@ -282,7 +299,9 @@ if (isset($WPhtc)) {
282
  add_filter('mod_rewrite_rules', array($WPhtc,'wphtc_hta_rules'));
283
  add_filter('generate_rewrite_rules', array($WPhtc,'wphtc_wp_rewrite_rules'));
284
  add_filter('rewrite_rules_array',array($WPhtc,'wphtc_cap'));
 
285
  add_action('admin_menu', array($WPhtc,'configure_menu'));
286
  add_action('sm_buildmap',array($WPhtc,'set_sm'));
 
287
  }
288
  ?>
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Provides an interface to add custom htaccess rules to the htaccess file generated by wordpress. Also provides customisation of the Author Permalink Base.
6
+ Version: 1.4.3
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
26
  if (!class_exists("WPhtc")) {
27
  class WPhtc {
28
  function WPhtc() {
29
+ }
30
+ function wphtc_init(){
31
+ $currentLocale = get_locale();
32
+ if(!empty($currentLocale)) {
33
+ $moFile = dirname(__FILE__) . "/lang/wp-htaccess-control-" . $currentLocale . ".mo";
34
+ if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wp-htaccess-control', $moFile);
35
+ }
36
+ }
37
  # Replacing the Wordpress Author Permalink by rewriting its rules if we have a Custom Author Permalink, everytime the rules are flush
38
  function wphtc_cap($rules){
39
  $WPhtc_data=get_option('WPhtc_data');
42
  }
43
  return $rules;
44
  }
45
+ # Filter link generated by get_author_posts_url() to use the Custom Author Permalink
46
+ function wphtc_filter_author_link($link){
47
+ $WPhtc_data=get_option('WPhtc_data');
48
+ if(isset($WPhtc_data['cap']) && $WPhtc_data['cap']!=''){
49
+ $link=str_replace("author",$WPhtc_data['cap'],$link);
50
+ }
51
+ return $link;
52
+ }
53
  # Adding our Custom Author Base to the sitemap generated by Google XML Sitemaps
54
  # Adapted from sitemap-core.php line 2036
55
  function set_sm(){
187
  }
188
  # Adding our options page to the admin menu
189
  function configure_menu(){
190
+ if(current_user_can("administrator")){
191
+ $page=add_submenu_page("options-general.php","WP htaccess Control", "WP htaControl", 6, __FILE__, array('WPhtc','wphtc_page'));
192
+ add_action('admin_print_scripts-'.$page, array('WPhtc','wphtc_page_script'));
193
+ add_action('admin_print_styles-'.$page, array('WPhtc','wphtc_page_style'));
194
+ }
195
  }
196
  # Enqueue Ui Scripts on Plugin page
197
  function wphtc_page_script(){
211
  # if reseting everything just delete the option array
212
  case 'reset_rules':
213
  delete_option('WPhtc_data');
214
+ $echo.=__('All rules reset.', 'wp-htaccess-control');
215
  global $wp_rewrite;
216
  $wp_rewrite->flush_rules();
217
  break;
266
  # Flush Rewrite Rules
267
  global $wp_rewrite;
268
  $wp_rewrite->flush_rules();
269
+ $echo.=__('All options updated.', 'wp-htaccess-control');
270
  break;
271
  # deleting individual rewrite pair
272
  case 'delete_pair':
274
  # if it's the last pair
275
  if($_GET['pair']==0 && !isset($WPhtc_data['pats'][1])){
276
  unset($WPhtc_data['pats'], $WPhtc_data['subs']);
277
+ $echo.=__('Wordpress Rewrite pairs reset.', 'wp-htaccess-control');
278
  }
279
  else{
280
  unset($WPhtc_data['pats'][$_GET['pair']],$WPhtc_data['subs'][$_GET['pair']]);
281
  $WPhtc_data['pats']=array_values($WPhtc_data['pats']);
282
  $WPhtc_data['subs']=array_values($WPhtc_data['subs']);
283
+ $echo.=__('Wordpress Rewrite pair deleted.', 'wp-htaccess-control');
284
  }
285
  update_option('WPhtc_data',$WPhtc_data);
286
  global $wp_rewrite;
299
  add_filter('mod_rewrite_rules', array($WPhtc,'wphtc_hta_rules'));
300
  add_filter('generate_rewrite_rules', array($WPhtc,'wphtc_wp_rewrite_rules'));
301
  add_filter('rewrite_rules_array',array($WPhtc,'wphtc_cap'));
302
+ add_filter('author_link',array($WPhtc,'wphtc_filter_author_link'));
303
  add_action('admin_menu', array($WPhtc,'configure_menu'));
304
  add_action('sm_buildmap',array($WPhtc,'set_sm'));
305
+ add_action('init', array($WPhtc,'wphtc_init'));
306
  }
307
  ?>