Version Description
Download this release
Release Info
Developer | antonioandra.de |
Plugin | WP htaccess Control |
Version | 3.5 |
Comparing to | |
See all releases |
Code changes from version 3.4.5 to 3.5
- admin-ui-includes/advanced-archives.php +42 -36
- admin-ui-includes/custom-author-permalink.php +37 -37
- admin-ui-includes/custom-htaccess.php +31 -31
- admin-ui-includes/custom-pagination-permalink.php +23 -22
- admin-ui-includes/custom-search-permalink.php +23 -23
- admin-ui-includes/htaccess-suggestions.php +172 -172
- admin-ui-includes/login-control.php +63 -63
- admin-ui-includes/maintenance-mode.php +43 -43
- admin-ui-includes/more-rewrite.php +27 -25
- admin-ui-includes/remove-bases.php +57 -56
- admin-ui-includes/replace-htaccess.php +30 -30
- admin-ui-includes/sidebar.php +32 -29
- index.php +48 -21
- readme.txt +3 -3
- wp-htaccess-control-ui.css +96 -59
- wp-htaccess-control-ui.js +37 -36
- wp-htaccess-control-ui.php +136 -119
- wp-htaccess-control-ui.scss +5 -5
- wp-htaccess-control.php +815 -787
admin-ui-includes/advanced-archives.php
CHANGED
@@ -1,42 +1,48 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Advanced Archives -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Advanced Archives -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Advanced Archives', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<?php foreach ( get_taxonomies( '', 'objects' ) as $taxonomy ) {
|
12 |
+
if ( ! $taxonomy->rewrite ) {
|
13 |
+
continue;
|
14 |
+
}
|
15 |
+
?>
|
16 |
+
<tr valign="top">
|
17 |
+
<th scope="row" style="width:18%;"><?php _e( 'Create', 'wp-htaccess-control' );
|
18 |
+
echo " " . $taxonomy->labels->name . " ";
|
19 |
+
_e( 'Archives', 'wp-htaccess-control' ); ?></th>
|
20 |
+
<td>
|
21 |
+
<input type="checkbox"
|
22 |
+
name="WPhtc_create_archive[<?php echo $taxonomy->name; ?>]" <?php if ( $WPhtc->get_data( 'create_archive', $taxonomy->name ) ) {
|
23 |
+
echo "checked=checked";
|
24 |
+
} ?> />
|
25 |
+
</td>
|
26 |
+
<td valign="middle">
|
27 |
+
<p class="description"><?php _e( 'If active, taxonomy-based archives will be accessible:', 'wp-htaccess-control' ); ?></p>
|
28 |
|
29 |
+
<p class="description">
|
30 |
+
<code><?php bloginfo( 'url' ) ?>/<?php echo $taxonomy->name . "_base"; ?>
|
31 |
+
/<?php echo $taxonomy->name; ?>_term/2010</code>
|
32 |
+
</p>
|
33 |
|
34 |
+
<p class="description">
|
35 |
+
<code><?php bloginfo( 'url' ) ?>/<?php echo $taxonomy->name . "_base"; ?>
|
36 |
+
/<?php echo $taxonomy->name; ?>_term/2010/12</code>
|
37 |
+
</p>
|
38 |
|
39 |
+
<p class="description"><?php _e( "This will also work if you've removed the", 'wp-htaccess-control' ); ?>
|
40 |
+
<?php echo $taxonomy->labels->name; ?>
|
41 |
+
<?php _e( "base.", 'wp-htaccess-control' ); ?></p>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
<?php
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
</table>
|
48 |
</div>
|
admin-ui-includes/custom-author-permalink.php
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Custom Author Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Custom Author Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Custom Author Permalink', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( 'Author Base', 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td>
|
14 |
+
<input type="text" name="WPhtc_cap" value="<?php echo $WPhtc->get_data( 'cap' ); ?>"/>
|
15 |
|
16 |
+
<p><code><?php bloginfo( 'url' ) ?>
|
17 |
+
/<em><?php _e( '(your-base)', 'wp-htaccess-control' ); ?></em>/admin</code></p>
|
18 |
+
</td>
|
19 |
+
<td valign="middle">
|
20 |
+
<p class="description"><?php _e( 'Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control' ); ?></p>
|
21 |
|
22 |
+
<p class="description"><?php _e( 'If set, the author base will be used as shown next to the form field.', 'wp-htaccess-control' ); ?></p>
|
23 |
|
24 |
+
<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>
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
<?php if ( class_exists( 'GoogleSitemapGeneratorLoader' ) ) { ?>
|
28 |
+
<tr valign="top">
|
29 |
+
<th>Google XML Sitemap</th>
|
30 |
+
<td>
|
31 |
+
<input type="checkbox" name="WPhtc_sm_enabled"
|
32 |
+
value="true" <?php if ( $WPhtc->get_data( 'sm_enabled' ) ) {
|
33 |
+
echo "checked";
|
34 |
+
} ?>/> <?php _e( 'Apply Custom Author Permalink on Generated Sitemap', 'wp-htaccess-control' ); ?>
|
35 |
+
</td>
|
36 |
+
<td valign="middle">
|
37 |
+
<p class="description"><?php _e( 'Leave "Include author pages" unchecked on Google XML Sitemap options page if using this.', 'wp-htaccess-control' ); ?></p>
|
38 |
|
39 |
+
<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>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<?php } ?>
|
43 |
+
</table>
|
44 |
</div>
|
admin-ui-includes/custom-htaccess.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Custom htaccess -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<textarea name="WPhtc_hta" style="width:100%;"
|
14 |
-
rows="7"><?php echo stripslashes($WPhtc->get_data('hta')); ?></textarea>
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Custom htaccess -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Custom htaccess', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<td>
|
13 |
<textarea name="WPhtc_hta" style="width:100%;"
|
14 |
+
rows="7"><?php echo stripslashes( $WPhtc->get_data( 'hta' ) ); ?></textarea>
|
15 |
+
</td>
|
16 |
+
<td style="width:50%;">
|
17 |
+
<p class="description"><?php _e( 'This rules will be printed before any WordPress rules.', 'wp-htaccess-control' ); ?></p>
|
18 |
|
19 |
+
<p class="description"><?php _e( 'Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control' ); ?></p>
|
20 |
+
<ul class="description">
|
21 |
+
<li><a href="http://www.google.com/search?q=htaccess+tutorial"
|
22 |
+
title="Search for htaccess tutorials"><img width="16px" src="http://google.com/favicon.ico"
|
23 |
+
alt="google favicon"> htaccess tutorial</a></li>
|
24 |
+
<li><a href="http://httpd.apache.org/docs/current/howto/htaccess.html"
|
25 |
+
title="Read about htaccess at apache.org"><img width="16px"
|
26 |
+
src="http://apache.org/favicon.ico"
|
27 |
+
alt="apache favicon"> htaccess</a></li>
|
28 |
+
<li><a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html"
|
29 |
+
title="Read about mod_rewrite at apache.org"><img width="16px"
|
30 |
+
src="http://apache.org/favicon.ico"
|
31 |
+
alt="apache favicon"> mod_rewrite</a></li>
|
32 |
+
</ul>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
</table>
|
36 |
</div>
|
admin-ui-includes/custom-pagination-permalink.php
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Custom Pagination Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Custom Pagination Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Custom Pagination Permalink', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( 'Page Base', 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td>
|
14 |
+
<input type="text" name="WPhtc_cpp" value="<?php echo $WPhtc->get_data( 'cpp' ); ?>"/>
|
15 |
|
16 |
+
<p><code><?php bloginfo( 'url' ) ?>
|
17 |
+
/<em><?php _e( '(your-base)', 'wp-htaccess-control' ); ?></em>/2</code>
|
18 |
+
</p>
|
19 |
+
</td>
|
20 |
+
<td valign="middle">
|
21 |
+
<p class="description"><?php _e( 'Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control' ); ?></p>
|
22 |
|
23 |
+
<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>
|
24 |
|
25 |
+
<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>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
</div>
|
admin-ui-includes/custom-search-permalink.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Custom Search Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Custom Search Permalink -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Custom Search Permalink', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( 'Search Base', 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td>
|
14 |
+
<input type="text" name="WPhtc_custom_search_permalink"
|
15 |
+
value="<?php echo $WPhtc->get_data( 'custom_search_permalink' ); ?>"/>
|
16 |
|
17 |
+
<p><code><?php bloginfo( 'url' ) ?>/<em><?php _e( '(your-base)', 'wp-htaccess-control' ); ?></em>/search-term</code>
|
18 |
+
</p>
|
19 |
+
</td>
|
20 |
+
<td valign="middle">
|
21 |
+
<p class="description"><?php _e( 'Permalink settings must be set and not Default (/?p=123).', 'wp-htaccess-control' ); ?></p>
|
22 |
|
23 |
+
<p class="description"><?php _e( 'If set, the search base will always be used instead of "?s=search-term".', 'wp-htaccess-control' ); ?></p>
|
24 |
|
25 |
+
<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>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
</div>
|
admin-ui-includes/htaccess-suggestions.php
CHANGED
@@ -1,176 +1,176 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- htaccess Suggestions -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- htaccess Suggestions -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'htaccess Suggestions', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( 'ServerSignature', 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td style="width:3%;" valign="middle">
|
14 |
+
<input type="checkbox" name="WPhtc_disable_serversignature"
|
15 |
+
value="true" <?php if ( $WPhtc->get_data( 'disable_serversignature' ) ) {
|
16 |
+
echo "checked";
|
17 |
+
} ?>/>
|
18 |
+
</td>
|
19 |
+
<td valign="middle">
|
20 |
+
<p class="description"><?php _e( 'Disable the ServerSignature on server generated error pages.', 'wp-htaccess-control' ); ?></p>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row"><?php _e( 'Indexes', 'wp-htaccess-control' ); ?></th>
|
25 |
+
<td style="width:3%;" valign="middle">
|
26 |
+
<input type="checkbox" name="WPhtc_disable_indexes"
|
27 |
+
value="true" <?php if ( $WPhtc->get_data( 'disable_indexes' ) ) {
|
28 |
+
echo "checked";
|
29 |
+
} ?>/>
|
30 |
+
</td>
|
31 |
+
<td valign="middle">
|
32 |
+
<p class="description"><?php _e( 'Disable directory browsing.', 'wp-htaccess-control' ); ?></p>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr valign="top">
|
36 |
+
<th scope="row"><?php _e( 'Protect wp-config.php file', 'wp-htaccess-control' ); ?></th>
|
37 |
+
<td style="width:3%;" valign="middle">
|
38 |
+
<input type="checkbox" name="WPhtc_protect_wp_config"
|
39 |
+
value="true" <?php if ( $WPhtc->get_data( 'protect_wp_config' ) ) {
|
40 |
+
echo "checked";
|
41 |
+
} ?>/></td>
|
42 |
+
<td valign="middle">
|
43 |
+
<p class="description"><?php _e( 'Deny access to wp-config.php file.', 'wp-htaccess-control' ); ?></p>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
<tr valign="top">
|
47 |
+
<th scope="row"><?php _e( 'Protect htaccess file', 'wp-htaccess-control' ); ?></th>
|
48 |
+
<td style="width:3%;" valign="middle">
|
49 |
+
<input type="checkbox" name="WPhtc_protect_htaccess"
|
50 |
+
value="true" <?php if ( $WPhtc->get_data( 'protect_htaccess' ) ) {
|
51 |
+
echo "checked";
|
52 |
+
} ?>/></td>
|
53 |
+
<td valign="middle">
|
54 |
+
<p class="description"><?php _e( 'Deny access to .htaccess file.', 'wp-htaccess-control' ); ?></p>
|
55 |
+
</td>
|
56 |
+
</tr>
|
57 |
+
<tr valign="top">
|
58 |
+
<th scope="row"><?php _e( 'Protect comments.php', 'wp-htaccess-control' ); ?></th>
|
59 |
+
<td style="width:3%;" valign="middle">
|
60 |
+
<input type="checkbox" name="WPhtc_protect_comments"
|
61 |
+
value="true" <?php if ( $WPhtc->get_data( 'protect_comments' ) ) {
|
62 |
+
echo "checked";
|
63 |
+
} ?>/></td>
|
64 |
+
<td valign="middle">
|
65 |
+
<p class="description"><?php _e( 'Deny comment posting to no referrer requests. This will avoid spam bots coming from nowhere.', 'wp-htaccess-control' ); ?></p>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
<tr valign="top">
|
69 |
+
<th scope="row"><?php _e( 'mod_gzip', 'wp-htaccess-control' ); ?></th>
|
70 |
+
<td style="width:3%;" valign="middle">
|
71 |
+
<input type="checkbox" name="WPhtc_gzip" value="true" <?php if ( $WPhtc->get_data( 'gzip' ) ) {
|
72 |
+
echo "checked";
|
73 |
+
} ?>/>
|
74 |
+
</td>
|
75 |
+
<td valign="middle">
|
76 |
+
<p class="description"><?php _e( 'Use mod_gzip if available.', 'wp-htaccess-control' ); ?></p>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tr valign="top">
|
80 |
+
<th scope="row"><?php _e( 'mod_deflate', 'wp-htaccess-control' ); ?></th>
|
81 |
+
<td style="width:3%;" valign="middle">
|
82 |
+
<input type="checkbox" name="WPhtc_deflate" value="true" <?php if ( $WPhtc->get_data( 'deflate' ) ) {
|
83 |
+
echo "checked";
|
84 |
+
} ?>/>
|
85 |
+
</td>
|
86 |
+
<td valign="middle">
|
87 |
+
<p class="description"><?php _e( 'Use mod_deflate if available.', 'wp-htaccess-control' ); ?></p>
|
88 |
+
</td>
|
89 |
+
</tr>
|
90 |
+
<tr valign="top">
|
91 |
+
<th scope="row"><?php _e( 'Limit Upload Size', 'wp-htaccess-control' ); ?></th>
|
92 |
+
<td style="width:3%;" valign="middle">
|
93 |
+
<input type="text" name="WPhtc_up_limit" value="<?php echo $WPhtc->get_data( 'up_limit' ); ?>"/>
|
94 |
+
</td>
|
95 |
+
<td valign="middle">
|
96 |
+
<p class="description"><?php _e( 'If set, this value in MB will be used as limit to file uploads.', 'wp-htaccess-control' ); ?></p>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<tr valign="top">
|
100 |
+
<th scope="row"><?php _e( 'Admin Email', 'wp-htaccess-control' ); ?></th>
|
101 |
+
<td style="width:3%;">
|
102 |
+
<input type="text" name="WPhtc_admin_email" value="<?php echo $WPhtc->get_data( 'admin_email' ) ?>"/>
|
103 |
+
</td>
|
104 |
+
<td valign="middle">
|
105 |
+
<p class="description"><?php _e( 'If set, this will be used as the admin email on server generated error pages.', 'wp-htaccess-control' ); ?></p>
|
106 |
+
</td>
|
107 |
+
</tr>
|
108 |
+
<tr valign="top">
|
109 |
+
<th scope="row"><?php _e( 'Disable image hotlinking', 'wp-htaccess-control' ); ?></th>
|
110 |
+
<td style="width:3%;">
|
111 |
+
<input type="text" name="WPhtc_disable_hotlink"
|
112 |
+
value="<?php echo $WPhtc->get_data( 'disable_hotlink' ); ?>"/>
|
113 |
+
</td>
|
114 |
+
<td valign="middle">
|
115 |
+
<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>
|
116 |
+
</td>
|
117 |
+
</tr>
|
118 |
+
<tr valign="top">
|
119 |
+
<th scope="row"><?php _e( 'Disable file hotlinking extensions', 'wp-htaccess-control' ); ?></th>
|
120 |
+
<td style="width:3%;">
|
121 |
+
<input type="text" name="WPhtc_disable_file_hotlink_ext"
|
122 |
+
value="<?php echo $WPhtc->get_data( 'disable_file_hotlink_ext' ) ?>"/>
|
123 |
+
</td>
|
124 |
+
<td valign="middle">
|
125 |
+
<p class="description"><?php _e( 'If set, this file extensions will not be hotlinkable.', 'wp-htaccess-control' ); ?></p>
|
126 |
|
127 |
+
<p class="description"><?php _e( 'Separate different extensions with a white-space, ie: "pdf doc zip".', 'wp-htaccess-control' ); ?></p>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
<tr valign="top">
|
131 |
+
<th scope="row"><?php _e( 'File hotlinking redirection', 'wp-htaccess-control' ); ?></th>
|
132 |
+
<td style="width:3%;">
|
133 |
+
<input type="text" name="WPhtc_disable_file_hotlink_redir"
|
134 |
+
value="<?php echo $WPhtc->get_data( 'disable_file_hotlink_redir' ) ?>"/>
|
135 |
+
</td>
|
136 |
+
<td valign="middle">
|
137 |
+
<p class="description"><?php _e( 'If set, this url will be used as redirection for hotlinked files.', 'wp-htaccess-control' ); ?></p>
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<tr valign="top">
|
141 |
+
<th scope="row"><?php _e( '500 error', 'wp-htaccess-control' ); ?></th>
|
142 |
+
<td style="width:3%;" valign="middle">
|
143 |
+
<input type="text" name="WPhtc_redirect_500" value="<?php echo $WPhtc->get_data( 'redirect_500' ); ?>"/>
|
144 |
+
</td>
|
145 |
+
<td valign="middle">
|
146 |
+
<p class="description"><?php _e( 'If set, this path will be used as page to 500 errors (example: /error.php).', 'wp-htaccess-control' ); ?></p>
|
147 |
+
</td>
|
148 |
+
</tr>
|
149 |
+
<tr valign="top">
|
150 |
+
<th scope="row"><?php _e( '403 error', 'wp-htaccess-control' ); ?></th>
|
151 |
+
<td style="width:3%;" valign="middle">
|
152 |
+
<input type="text" name="WPhtc_redirect_403" value="<?php echo $WPhtc->get_data( 'redirect_403' ); ?>"/>
|
153 |
+
</td>
|
154 |
+
<td valign="middle">
|
155 |
+
<p class="description"><?php _e( 'If set, this path will be used as page to 403 errors (example: /error.php).', 'wp-htaccess-control' ); ?></p>
|
156 |
+
</td>
|
157 |
+
</tr>
|
158 |
+
<tr valign="top">
|
159 |
+
<th scope="row" valign="middle"><?php _e( 'Canonical Url', 'wp-htaccess-control' ); ?></th>
|
160 |
+
<td style="width:3%;" valign="middle">
|
161 |
+
<select name="WPhtc_canon">
|
162 |
+
<option value=""></option>
|
163 |
+
<option value="www" <?php if ( $WPhtc->get_data( 'canon' ) == 'www' ) {
|
164 |
+
echo "selected";
|
165 |
+
} ?>><?php _e( 'Force WWW', 'wp-htaccess-control' ); ?></option>
|
166 |
+
<option value="simple" <?php if ( $WPhtc->get_data( 'canon' ) == 'simple' ) {
|
167 |
+
echo "selected";
|
168 |
+
} ?>><?php _e( 'Force non-WWW', 'wp-htaccess-control' ); ?></option>
|
169 |
+
</select>
|
170 |
+
</td>
|
171 |
+
<td valign="middle">
|
172 |
+
<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>
|
173 |
+
</td>
|
174 |
+
</tr>
|
175 |
+
</table>
|
176 |
</div>
|
admin-ui-includes/login-control.php
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Login Control -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
<textarea name="WPhtc_login_ips"><?php if ($WPhtc->get_data('login_ips')) {
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Login Control -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Login Control', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"></th>
|
13 |
+
<td valign="middle" colspan="2">
|
14 |
+
<p class="description"><?php _e( 'The options below concern wp-login.php. You\'ll be able to redirect all traffic away from that page and set some allowed IPs.', 'wp-htaccess-control' ); ?></p>
|
15 |
|
16 |
+
<p class="description"><?php _e( 'BEWARE: once disabled you won\'t be able to login through that form in any way, except for the listed IPs.', 'wp-htaccess-control' ); ?></p>
|
17 |
|
18 |
+
<p class="description"><?php _e( 'If everything goes wrong directly edit your .htaccess file and delete the relevant part somewhere at the top.', 'wp-htaccess-control' ); ?></p>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
<tr valign="top">
|
22 |
+
<th scope="row" style="width:18%;"><?php _e( 'Disable wp-login.php', 'wp-htaccess-control' ); ?></th>
|
23 |
+
<td>
|
24 |
+
<input type="checkbox" name="WPhtc_login_disabled"
|
25 |
+
value="true" <?php if ( $WPhtc->get_data( 'login_disabled' ) ) {
|
26 |
+
echo "checked";
|
27 |
+
} ?>/>
|
28 |
+
</td>
|
29 |
+
<td valign="middle">
|
30 |
+
<p class="description"><?php _e( 'This is the main switch. Make sure you know what you\'re doing.', 'wp-htaccess-control' ); ?></p>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
<tr valign="top">
|
34 |
+
<th scope="row" style="width:18%;"><?php _e( 'Redirect', 'wp-htaccess-control' ); ?></th>
|
35 |
+
<td valign="middle">
|
36 |
+
<input type="text" name="WPhtc_login_redirection"
|
37 |
+
value="<?php echo $WPhtc->get_data( 'login_redirection' ) ?>"/>
|
38 |
+
</td>
|
39 |
+
<td valign="middle">
|
40 |
+
<p class="description"><?php _e( 'This will be used as redirection url. You might use something like "member-login" to redirect people to "http://yoursite.com/member-login/". If empty the home page will be served as redirection.', 'wp-htaccess-control' ); ?></p>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
<tr valign="top">
|
44 |
+
<th scope="row" style="width:18%;"><?php _e( 'Allowed IPs', 'wp-htaccess-control' ); ?></th>
|
45 |
+
<td>
|
46 |
+
<textarea name="WPhtc_login_ips"><?php if ( $WPhtc->get_data( 'login_ips' ) ) {
|
47 |
+
echo implode( $WPhtc->get_data( 'login_ips' ), "\n" );
|
48 |
+
} ?></textarea>
|
49 |
+
</td>
|
50 |
+
<td valign="middle">
|
51 |
+
<p class="description"><?php _e( 'List of IPs allowed to access wp-login.php.', 'wp-htaccess-control' ); ?></p>
|
52 |
|
53 |
+
<p class="description"><?php _e( 'Make sure you are have a static IP when using this.' ); ?></p>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
<tr valign="top">
|
57 |
+
<th scope="row" style="width:18%;"><?php _e( 'Half-mode', 'wp-htaccess-control' ); ?></th>
|
58 |
+
<td>
|
59 |
+
<input type="checkbox" name="WPhtc_login_half_mode"
|
60 |
+
value="true" <?php if ( $WPhtc->get_data( 'login_half_mode' ) ) {
|
61 |
+
echo "checked";
|
62 |
+
} ?>/>
|
63 |
+
</td>
|
64 |
+
<td valign="middle">
|
65 |
+
<p class="description"><?php _e( '(BETA) If set, this will still allow access to POST (login) requests, logout and to the password recovery form. I don\'t think this is very useful at the moment (login error messages will still show up on wp-login.php) but may be helpful for AJAX use.', 'wp-htaccess-control' ); ?></p>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
</table>
|
69 |
</div>
|
admin-ui-includes/maintenance-mode.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Maintenance Mode -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
<textarea name="WPhtc_maintenance_ips"><?php if ($WPhtc->get_data('maintenance_ips')) {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Maintenance Mode -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Maintenance Mode', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( 'Maintenance Active', 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td valign="middle">
|
14 |
+
<input type="checkbox" name="WPhtc_maintenance_active"
|
15 |
+
value="true" <?php if ( $WPhtc->get_data( 'maintenance_active' ) ) {
|
16 |
+
echo "checked";
|
17 |
+
} ?>/>
|
18 |
+
</td>
|
19 |
+
<td valign="middle">
|
20 |
+
<p class="description"><?php _e( 'Toggles Maintenance Mode.', 'wp-htaccess-control' ); ?></p>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row" style="width:18%;"><?php _e( 'Allowed IPs', 'wp-htaccess-control' ); ?></th>
|
25 |
+
<td>
|
26 |
+
<textarea name="WPhtc_maintenance_ips"><?php if ( $WPhtc->get_data( 'maintenance_ips' ) ) {
|
27 |
+
echo implode( $WPhtc->get_data( 'maintenance_ips' ), "\n" );
|
28 |
+
} ?></textarea>
|
29 |
+
</td>
|
30 |
+
<td valign="middle">
|
31 |
+
<p class="description"><?php _e( 'List of allowed IPs.', 'wp-htaccess-control' ); ?></p>
|
32 |
|
33 |
+
<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>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
<tr valign="top">
|
37 |
+
<th scope="row" style="width:18%;"><?php _e( 'Redirection', 'wp-htaccess-control' ); ?></th>
|
38 |
+
<td>
|
39 |
+
<input type="text" name="WPhtc_maintenance_redirection"
|
40 |
+
value="<?php echo $WPhtc->get_data( 'maintenance_redirection' ) ?>"/>
|
41 |
+
</td>
|
42 |
+
<td valign="middle">
|
43 |
+
<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>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</table>
|
47 |
</div>
|
admin-ui-includes/more-rewrite.php
CHANGED
@@ -1,33 +1,35 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- More Rewrite Settings -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
<th scope="row" style="width:18%;"><?php _e(".html suffix", 'wp-htaccess-control'); ?></th>
|
25 |
<td style="width:3%;" valign="middle">
|
26 |
-
<input type="checkbox" name="WPhtc_suffix_html" value="true" <?php if($WPhtc->get_data('suffix_html')){
|
|
|
|
|
27 |
</td>
|
28 |
<td valign="middle">
|
29 |
-
<p class="description"><?php _e("Add '.html' at the end of taxonomy permalinks.", 'wp-htaccess-control'); ?></p>
|
30 |
</td>
|
31 |
</tr>-->
|
32 |
-
|
33 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- More Rewrite Settings -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'More Rewrite Settings', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<th scope="row" style="width:18%;"><?php _e( "Remove hierarchy", 'wp-htaccess-control' ); ?></th>
|
13 |
+
<td style="width:3%;" valign="middle">
|
14 |
+
<input type="checkbox" name="WPhtc_remove_hierarchy"
|
15 |
+
value="true" <?php if ( $WPhtc->get_data( 'remove_hierarchy' ) ) {
|
16 |
+
echo "checked";
|
17 |
+
} ?>/>
|
18 |
+
</td>
|
19 |
+
<td valign="middle">
|
20 |
+
<p class="description"><?php _e( "Remove hierarchy from taxonomy permalinks (this might be interesting when removing the category base).", 'wp-htaccess-control' ); ?></p>
|
21 |
+
</td>
|
22 |
+
</tr>
|
23 |
+
<!--<tr valign="top">
|
24 |
+
<th scope="row" style="width:18%;"><?php _e( ".html suffix", 'wp-htaccess-control' ); ?></th>
|
25 |
<td style="width:3%;" valign="middle">
|
26 |
+
<input type="checkbox" name="WPhtc_suffix_html" value="true" <?php if ( $WPhtc->get_data( 'suffix_html' ) ) {
|
27 |
+
echo "checked";
|
28 |
+
} ?>/>
|
29 |
</td>
|
30 |
<td valign="middle">
|
31 |
+
<p class="description"><?php _e( "Add '.html' at the end of taxonomy permalinks.", 'wp-htaccess-control' ); ?></p>
|
32 |
</td>
|
33 |
</tr>-->
|
34 |
+
</table>
|
35 |
</div>
|
admin-ui-includes/remove-bases.php
CHANGED
@@ -1,63 +1,64 @@
|
|
1 |
-
<?php global $WPhtc
|
2 |
<!-- Remove Taxonomies and Author Base -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
</div>
|
1 |
+
<?php global $WPhtc; ?>
|
2 |
<!-- Remove Taxonomies and Author Base -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Remove Taxonomies and Author Base', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<!-- Remove Author Base -->
|
12 |
+
<tr valign="top">
|
13 |
+
<th scope="row" style="width:18%;"><?php _e( 'Remove Author Base', 'wp-htaccess-control' ); ?></th>
|
14 |
+
<td>
|
15 |
+
<input type="checkbox"
|
16 |
+
name="WPhtc_remove_author_base" <?php if ( $WPhtc->get_data( 'remove_author_base' ) ) {
|
17 |
+
echo "checked=checked";
|
18 |
+
} ?> />
|
19 |
+
</td>
|
20 |
+
<td valign="middle">
|
21 |
+
<p class="description"><?php _e( 'If active, the author base will be removed from permalinks:' ); ?></p>
|
22 |
|
23 |
+
<p class="description"><code><?php bloginfo( 'url' ) ?>
|
24 |
+
/<?php _e( 'the-author', 'wp-htaccess-control' ); ?></code></p>
|
25 |
|
26 |
+
<p class="description">
|
27 |
+
<strong><?php _e( 'Beware:' ); ?></strong> <?php _e( 'This could conflict with the removal of the category base on a situation where a category slug is the same as a user nicename.' ); ?>
|
28 |
+
</p>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
<!-- Remove Taxonomies Base -->
|
32 |
+
<?php foreach ( get_taxonomies( '', 'objects' ) as $taxonomy ) {
|
33 |
+
if ( ! $taxonomy->rewrite ) {
|
34 |
+
continue;
|
35 |
+
}
|
36 |
+
?>
|
37 |
+
<tr valign="top">
|
38 |
+
<th scope="row" style="width:18%;"><?php _e( 'Remove', 'wp-htaccess-control' );
|
39 |
+
echo " " . $taxonomy->labels->name . " ";
|
40 |
+
_e( 'Base', 'wp-htaccess-control' ); ?></th>
|
41 |
+
<td>
|
42 |
+
<input type="checkbox"
|
43 |
+
name="WPhtc_remove_base[<?php echo $taxonomy->name; ?>]" <?php if ( $WPhtc->get_data( 'remove_taxonomy_base', $taxonomy->name ) ) {
|
44 |
+
echo "checked=checked";
|
45 |
+
} ?> />
|
46 |
+
</td>
|
47 |
+
<td valign="middle">
|
48 |
+
<p class="description"><?php _e( 'If active, the' );
|
49 |
+
echo " " . $taxonomy->labels->name . " ";
|
50 |
+
_e( 'base will be removed from permalinks:' ); ?></p>
|
51 |
|
52 |
+
<p class="description"><code><?php bloginfo( 'url' ) ?>/<?php echo $taxonomy->name; ?>_term</code>
|
53 |
+
</p>
|
54 |
|
55 |
+
<p class="description">
|
56 |
+
<strong><?php _e( 'Beware:' ); ?></strong> <?php _e( 'This could conflict with the removal of the other permalink bases on a situation where a term slug is the same.' ); ?>
|
57 |
+
</p>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
?>
|
63 |
+
</table>
|
64 |
</div>
|
admin-ui-includes/replace-htaccess.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
<?php global $WPhtc; ?>
|
2 |
<!-- Replace WordPress htaccess -->
|
3 |
<div class="wphtc-section">
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
<textarea name="WPhtc_wp_hta" style="width:100%;"
|
14 |
-
rows="7" <?php if ($WPhtc->get_data('jim_morgan_hta')) {
|
15 |
-
|
16 |
-
} ?>><?php echo stripslashes($WPhtc->get_data('wp_hta')); ?></textarea>
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
<pre>RewriteEngine on
|
37 |
# Unless you have set a different RewriteBase preceding this point,
|
@@ -50,8 +50,8 @@ RewriteRule ^(.*)$ - [S=1]
|
|
50 |
# else rewrite the request to WP
|
51 |
RewriteRule . /index.php [L]
|
52 |
</pre>
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
</div>
|
1 |
<?php global $WPhtc; ?>
|
2 |
<!-- Replace WordPress htaccess -->
|
3 |
<div class="wphtc-section">
|
4 |
+
<div class="wphtc-section-title stuffbox">
|
5 |
+
<div title="Click to toggle" class="handlediv"
|
6 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
7 |
+
<br></div>
|
8 |
+
<h3><?php _e( 'Replace WordPress htaccess', 'wp-htaccess-control' ); ?></h3>
|
9 |
+
</div>
|
10 |
+
<table class="form-table wphtc-inputs">
|
11 |
+
<tr valign="top">
|
12 |
+
<td>
|
13 |
<textarea name="WPhtc_wp_hta" style="width:100%;"
|
14 |
+
rows="7" <?php if ( $WPhtc->get_data( 'jim_morgan_hta' ) ) {
|
15 |
+
echo "readonly='true' class='readonly'";
|
16 |
+
} ?>><?php echo stripslashes( $WPhtc->get_data( 'wp_hta' ) ); ?></textarea>
|
17 |
|
18 |
+
<p class="description"><?php _e( 'Leave empty for default.', 'wp-htaccess-control' ); ?></p>
|
19 |
+
</td>
|
20 |
+
<td style="width:50%;">
|
21 |
+
<p class="description"><?php _e( 'This rules will be printed instead of WordPress rules.', 'wp-htaccess-control' ); ?></p>
|
22 |
|
23 |
+
<p class="description"><?php _e( 'Please double check them before saving as a mistake could make your site inaccessible.', 'wp-htaccess-control' ); ?></p>
|
24 |
|
25 |
+
<p class="description"><?php _e( 'Original rules:', 'wp-htaccess-control' ); ?></p>
|
26 |
|
27 |
+
<p class="description">
|
28 |
+
<code><?php echo nl2br( htmlspecialchars( substr( $WPhtc->get_data( 'htaccess_original' ), 0, - 1 ) ) ); ?></code>
|
29 |
+
</p>
|
30 |
+
</td>
|
31 |
+
</tr>
|
32 |
+
<tr>
|
33 |
+
<td colspan="2">
|
34 |
+
<p><?php _e( "For instance, <strong><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>
|
35 |
|
36 |
<pre>RewriteEngine on
|
37 |
# Unless you have set a different RewriteBase preceding this point,
|
50 |
# else rewrite the request to WP
|
51 |
RewriteRule . /index.php [L]
|
52 |
</pre>
|
53 |
+
<p><?php _e( "Please note, if your WordPress install is in a subdirectory, you'll have to adjust the first RewriteBase and the last RewriteRule accordingly <br/>(ie: <code>RewriteBase /SUBDIRECTORY/</code> and <code>RewriteRule . /SUBDIRECTORY/index.php [L]</code>)", 'wp-htaccess-control' ); ?></p>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
</table>
|
57 |
</div>
|
admin-ui-includes/sidebar.php
CHANGED
@@ -1,36 +1,39 @@
|
|
1 |
<?php
|
2 |
global $WPhtc;
|
3 |
$plugin_path = $WPhtc->plugin_path;
|
4 |
-
$plugin_url
|
5 |
?>
|
6 |
|
7 |
<div id="wphtc-sidebar">
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
36 |
</div>
|
1 |
<?php
|
2 |
global $WPhtc;
|
3 |
$plugin_path = $WPhtc->plugin_path;
|
4 |
+
$plugin_url = $WPhtc->plugin_url;
|
5 |
?>
|
6 |
|
7 |
<div id="wphtc-sidebar">
|
8 |
+
<div class="wphtc-section">
|
9 |
+
<div class="wphtc-section-title stuffbox">
|
10 |
+
<!--<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>-->
|
11 |
+
<h3><?php _e( 'About this Plugin', 'wp-htaccess-control' ); ?></h3>
|
12 |
+
</div>
|
13 |
+
<div class="wphtc-inputs">
|
14 |
+
<ul>
|
15 |
+
<li><a href="http://antonioandra.de/"><img width="16" height="16"
|
16 |
+
src="<?php echo $plugin_url ?>/images/antonioandra.de_favicon.png">
|
17 |
+
Author Homepage</a></li>
|
18 |
+
<li><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"><img
|
19 |
+
src="<?php echo $plugin_url ?>/images/favicon.ico"> Plugin at WordPress.org </a></li>
|
20 |
+
<li>
|
21 |
+
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=antonio%40antonioandra%2ede&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img
|
22 |
+
width="16" height="16" src="<?php echo $plugin_url ?>/images/pp_favicon_x.ico"> Donate with
|
23 |
+
Paypal</a></li>
|
24 |
+
</ul>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
<!--
|
28 |
+
<div class="wphtc-section">
|
29 |
+
<div class="wphtc-section-title stuffbox">
|
30 |
+
<h3><?php _e( 'Latest donations', 'wp-htaccess-control' ); ?></h3>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
<div class="wphtc-inputs">
|
34 |
+
<iframe width="100%" src="http://antonioandra.de/wp-htaccess-control-donations"></iframe>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
-->
|
38 |
+
<p id="foot">WP htaccess Control <?php _e( 'by', 'wp-htaccess-control' ); ?> António Andrade</p>
|
39 |
</div>
|
index.php
CHANGED
@@ -1,24 +1,51 @@
|
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2 |
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
html{
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</html>
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5 |
+
<style type="text/css">
|
6 |
+
html {
|
7 |
+
background-color: #E4F2FD;
|
8 |
+
}
|
9 |
+
|
10 |
+
body {
|
11 |
+
color: #333;
|
12 |
+
font-family: Verdana;
|
13 |
+
font-size: 0.8em;
|
14 |
+
width: 600px;
|
15 |
+
margin: 75px auto;
|
16 |
+
padding: 30px;
|
17 |
+
background: white;
|
18 |
+
}
|
19 |
+
|
20 |
+
h1, h2 {
|
21 |
+
font-family: Georgia;
|
22 |
+
}
|
23 |
+
|
24 |
+
a {
|
25 |
+
color: #21759B;
|
26 |
+
text-decoration: none;
|
27 |
+
cursor: pointer;
|
28 |
+
}
|
29 |
+
|
30 |
+
a:hover {
|
31 |
+
color: #D54E21;
|
32 |
+
text-decoration: underline;
|
33 |
+
}
|
34 |
+
</style>
|
35 |
+
<title>WP htaccess Control Plugin</title>
|
36 |
+
</head>
|
37 |
+
<body>
|
38 |
+
<h1><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"
|
39 |
+
title="Visit this Plugin at the WordPress Plugin Directory">WP htaccess Control</a></h1>
|
40 |
+
|
41 |
+
<p><strong>Plugin Author:</strong> <a href="http://antonioandra.de/" title="Visit the Author">António Andrade</a></p>
|
42 |
+
|
43 |
+
<h2>Links</h2>
|
44 |
+
<ul>
|
45 |
+
<li><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"
|
46 |
+
title="Visit this Plugin at the WordPress Plugin Directory">WP htaccess Control at the Plugin Directory</a>
|
47 |
+
</li>
|
48 |
+
<li><a href="http://antonioandra.de/" title="Visit the Author">Author Homepage</a></li>
|
49 |
+
</ul>
|
50 |
+
</body>
|
51 |
</html>
|
readme.txt
CHANGED
@@ -5,9 +5,9 @@ Plugin URI: http://antonioandra.de/
|
|
5 |
Contributors: antonioandra.de
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=antonio%40antonioandra%2ede&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest
|
7 |
Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
|
8 |
-
Requires at least: 3.
|
9 |
-
Tested up to: 3.
|
10 |
-
Stable tag: 3.
|
11 |
|
12 |
Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by WordPress.
|
13 |
|
5 |
Contributors: antonioandra.de
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=antonio%40antonioandra%2ede&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest
|
7 |
Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
|
8 |
+
Requires at least: 3.9
|
9 |
+
Tested up to: 4.3.1
|
10 |
+
Stable tag: 3.5
|
11 |
|
12 |
Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by WordPress.
|
13 |
|
wp-htaccess-control-ui.css
CHANGED
@@ -1,94 +1,131 @@
|
|
1 |
#wphtc-sidebar {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
#wphtc-main {
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
div.updated p img {
|
17 |
-
|
|
|
|
|
18 |
div.updated p span {
|
19 |
-
|
|
|
20 |
|
21 |
.wphtc-menu {
|
22 |
-
|
|
|
23 |
|
24 |
.wphtc-section {
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
.wphtc-section-title {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
margin: 0;
|
41 |
padding: 10px;
|
42 |
cursor: pointer;
|
43 |
border-bottom: 0;
|
44 |
-moz-border-radius: 6px;
|
45 |
-
-webkit-border-radius: 6px;
|
46 |
-
|
|
|
|
|
47 |
float: right;
|
48 |
height: 34px;
|
49 |
width: 23px;
|
50 |
-
cursor: pointer;
|
|
|
51 |
|
52 |
.wphtc-inputs {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
font-weight: bold;
|
63 |
-
padding-left: 12px;
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
text-align: left;
|
68 |
padding: 10px;
|
69 |
-
background: #ddd;
|
70 |
-
|
|
|
|
|
71 |
margin: 2.5%;
|
72 |
width: 95%;
|
73 |
-
overflow: auto;
|
|
|
74 |
|
75 |
.form-table {
|
76 |
-
|
|
|
77 |
|
78 |
#foot {
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
83 |
|
84 |
textarea.readonly {
|
85 |
-
|
|
|
86 |
|
87 |
ul.description {
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
1 |
#wphtc-sidebar {
|
2 |
+
width: 19%;
|
3 |
+
float: right;
|
4 |
+
}
|
5 |
+
|
6 |
+
#wphtc-sidebar ul {
|
7 |
+
margin: 1em 0 1em 10px;
|
8 |
+
}
|
9 |
+
|
10 |
+
#wphtc-sidebar a {
|
11 |
+
text-decoration: none;
|
12 |
+
}
|
13 |
+
|
14 |
+
#wphtc-sidebar a img {
|
15 |
+
margin-right: 5px;
|
16 |
+
}
|
17 |
|
18 |
#wphtc-main {
|
19 |
+
float: left;
|
20 |
+
width: 80%;
|
21 |
+
margin-bottom: 25px;
|
22 |
+
}
|
23 |
|
24 |
div.updated p img {
|
25 |
+
margin: -5px 15px;
|
26 |
+
}
|
27 |
+
|
28 |
div.updated p span {
|
29 |
+
float: right;
|
30 |
+
}
|
31 |
|
32 |
.wphtc-menu {
|
33 |
+
margin: 10px 0;
|
34 |
+
}
|
35 |
|
36 |
.wphtc-section {
|
37 |
+
background: #ddd;
|
38 |
+
border: 1px solid #ddd;
|
39 |
+
border-bottom: 0;
|
40 |
+
margin-top: 15px;
|
41 |
+
-moz-border-radius: 6px;
|
42 |
+
-webkit-border-radius: 6px;
|
43 |
+
}
|
44 |
|
45 |
.wphtc-section-title {
|
46 |
+
-moz-user-select: none;
|
47 |
+
-khtml-user-select: none;
|
48 |
+
user-select: none;
|
49 |
+
margin-bottom: 0;
|
50 |
+
width: 100%;
|
51 |
+
border: 0;
|
52 |
+
}
|
53 |
+
|
54 |
+
.wphtc-section-title h3 {
|
55 |
margin: 0;
|
56 |
padding: 10px;
|
57 |
cursor: pointer;
|
58 |
border-bottom: 0;
|
59 |
-moz-border-radius: 6px;
|
60 |
+
-webkit-border-radius: 6px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.wphtc-section-title .handlediv {
|
64 |
float: right;
|
65 |
height: 34px;
|
66 |
width: 23px;
|
67 |
+
cursor: pointer;
|
68 |
+
}
|
69 |
|
70 |
.wphtc-inputs {
|
71 |
+
background: #fff;
|
72 |
+
border: 1px solid #ddd;
|
73 |
+
border-left: 0;
|
74 |
+
border-right: 0;
|
75 |
+
-moz-border-radius: 6px;
|
76 |
+
-webkit-border-radius: 6px;
|
77 |
+
}
|
78 |
+
|
79 |
+
.wphtc-inputs p, .wphtc-inputs ul {
|
80 |
+
margin-left: 10px;
|
81 |
+
}
|
82 |
+
|
83 |
+
.wphtc-inputs th {
|
84 |
font-weight: bold;
|
85 |
+
padding-left: 12px;
|
86 |
+
}
|
87 |
+
|
88 |
+
.wphtc-inputs tr {
|
89 |
+
border-bottom: 1px solid #dddddd;
|
90 |
+
}
|
91 |
+
|
92 |
+
.wphtc-inputs caption {
|
93 |
text-align: left;
|
94 |
padding: 10px;
|
95 |
+
background: #ddd;
|
96 |
+
}
|
97 |
+
|
98 |
+
.wphtc-inputs pre {
|
99 |
margin: 2.5%;
|
100 |
width: 95%;
|
101 |
+
overflow: auto;
|
102 |
+
}
|
103 |
|
104 |
.form-table {
|
105 |
+
margin: 0;
|
106 |
+
}
|
107 |
|
108 |
#foot {
|
109 |
+
text-align: center;
|
110 |
+
font-size: 8px;
|
111 |
+
color: #aaa;
|
112 |
+
margin: 2em 0;
|
113 |
+
}
|
114 |
|
115 |
textarea.readonly {
|
116 |
+
background-color: #eee;
|
117 |
+
}
|
118 |
|
119 |
ul.description {
|
120 |
+
margin-top: 1em;
|
121 |
+
margin-left: 2em;
|
122 |
+
font-style: italic;
|
123 |
+
}
|
124 |
+
|
125 |
+
ul.description a {
|
126 |
+
text-decoration: none;
|
127 |
+
}
|
128 |
+
|
129 |
+
ul.description li {
|
130 |
+
color: #666;
|
131 |
+
}
|
wp-htaccess-control-ui.js
CHANGED
@@ -1,36 +1,37 @@
|
|
1 |
-
jQuery(document).ready(function(){
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
1 |
+
jQuery(document).ready(function () {
|
2 |
+
collapseSections();
|
3 |
+
editWPhtaJM();
|
4 |
+
function collapseSections() {
|
5 |
+
jQuery("#wphtc-main .wphtc-inputs,.wphtc-section-title a").not(".wphtc-inputs.start-open").hide();
|
6 |
+
jQuery(".handlediv").fadeOut(0);
|
7 |
+
jQuery("#wphtc-main .wphtc-section").hover(
|
8 |
+
function () {
|
9 |
+
jQuery(this).find(".handlediv").fadeIn(150);
|
10 |
+
},
|
11 |
+
function () {
|
12 |
+
jQuery(this).find(".handlediv").fadeOut(150);
|
13 |
+
}
|
14 |
+
)
|
15 |
+
jQuery("#wphtc-main .wphtc-section:not(.permanently-open) .wphtc-section-title h3").click(
|
16 |
+
function () {
|
17 |
+
if (jQuery(this).parent().find("a")) {
|
18 |
+
jQuery(this).parent().find("a").toggle();
|
19 |
+
}
|
20 |
+
jQuery(this).parent().next(".wphtc-inputs").toggle();
|
21 |
+
}
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
function editWPhtaJM() {
|
26 |
+
jQuery("input[name='WPhtc_jim_morgan_hta']").click(
|
27 |
+
function () {
|
28 |
+
if (jQuery("textarea[name='WPhtc_wp_hta']").attr('readonly') == true) {
|
29 |
+
jQuery("textarea[name='WPhtc_wp_hta']").text('').removeAttr("readonly").removeClass('readonly');
|
30 |
+
}
|
31 |
+
else {
|
32 |
+
jQuery("textarea[name='WPhtc_wp_hta']").addClass('readonly');
|
33 |
+
}
|
34 |
+
}
|
35 |
+
);
|
36 |
+
}
|
37 |
+
});
|
wp-htaccess-control-ui.php
CHANGED
@@ -1,139 +1,156 @@
|
|
1 |
<?php
|
2 |
global $WPhtc, $WPhtcEcho;
|
3 |
-
$debug
|
4 |
-
$WPhtc->plugin_path
|
5 |
-
$WPhtc->plugin_url
|
6 |
|
7 |
//$q=explode('&',$_SERVER['QUERY_STRING']);
|
8 |
//$purl='http'.((!empty($_SERVER['HTTPS'])) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$q[0];
|
9 |
|
10 |
-
$q
|
11 |
$purl = $q[0];
|
12 |
$WPhtc->page_action();
|
13 |
|
14 |
-
function WPHTCui($namesArray){
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
|
|
23 |
?>
|
24 |
|
25 |
<div id="wphtc-page" class="wrap">
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
<pre>
|
128 |
-
<?php print_r($WPhtc->data); ?>
|
129 |
</pre>
|
130 |
|
131 |
<pre>
|
132 |
<?php global $wp_rewrite;
|
133 |
-
print_r($wp_rewrite); ?>
|
134 |
</pre>
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
</div>
|
1 |
<?php
|
2 |
global $WPhtc, $WPhtcEcho;
|
3 |
+
$debug = false;
|
4 |
+
$WPhtc->plugin_path = $plugin_path = WP_CONTENT_DIR . '/plugins/' . plugin_basename( dirname( __FILE__ ) );
|
5 |
+
$WPhtc->plugin_url = $plugin_url = WP_CONTENT_URL . '/plugins/' . plugin_basename( dirname( __FILE__ ) );
|
6 |
|
7 |
//$q=explode('&',$_SERVER['QUERY_STRING']);
|
8 |
//$purl='http'.((!empty($_SERVER['HTTPS'])) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$q[0];
|
9 |
|
10 |
+
$q = explode( "&", $_SERVER['REQUEST_URI'] );
|
11 |
$purl = $q[0];
|
12 |
$WPhtc->page_action();
|
13 |
|
14 |
+
function WPHTCui( $namesArray ) {
|
15 |
+
$plugin_path = WP_CONTENT_DIR . '/plugins/' . plugin_basename( dirname( __FILE__ ) );
|
16 |
+
if ( ! is_array( $namesArray ) ) {
|
17 |
+
$namesArray = array( $namesArray );
|
18 |
+
}
|
19 |
+
foreach ( $namesArray as $name ) {
|
20 |
+
include( $plugin_path . '/admin-ui-includes/' . $name . '.php' );
|
21 |
+
}
|
22 |
}
|
23 |
+
|
24 |
?>
|
25 |
|
26 |
<div id="wphtc-page" class="wrap">
|
27 |
+
<h2>WP htaccess Control</h2>
|
28 |
+
<?php
|
29 |
+
if ( ! current_user_can( "administrator" ) ) {
|
30 |
+
echo '<p>' . __( 'Please log in as admin', 'wp-htaccess-control' ) . '</p>';
|
31 |
+
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
?>
|
35 |
+
|
36 |
+
<?php WPHTCui( 'sidebar' ) ?>
|
37 |
+
|
38 |
+
<div id="wphtc-main">
|
39 |
+
<form method="post" action="<?php echo $purl ?>">
|
40 |
+
<?php if ( $WPhtcEcho != '' ) { ?>
|
41 |
+
<div class="updated fade" id="message" style="background-color: rgb(255, 251, 204);">
|
42 |
+
<p><?php echo $WPhtcEcho; ?></p>
|
43 |
+
</div>
|
44 |
+
<?php
|
45 |
+
}
|
46 |
+
# Donation Message
|
47 |
+
if ( $WPhtc->get_data( 'donation_hidden_time' ) && $WPhtc->get_data( 'donation_hidden_time' ) < time() ) {
|
48 |
+
?>
|
49 |
+
<div class="updated">
|
50 |
+
<p>
|
51 |
+
<strong>Is this plugin useful? Consider making a donation encouraging me to continue supporting
|
52 |
+
it!</strong>
|
53 |
+
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=antonio%40antonioandra%2ede&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest">
|
54 |
+
<img alt="Donate" border="0"
|
55 |
+
src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png">
|
56 |
+
</a>
|
57 |
+
<span><a href="<?php echo $purl ?>&action=hide_donation_message">Hide this message</a></span>
|
58 |
+
</p>
|
59 |
+
</div>
|
60 |
+
<?php } ?>
|
61 |
+
<?php WPHTCui( array(
|
62 |
+
'custom-author-permalink',
|
63 |
+
'custom-pagination-permalink',
|
64 |
+
'custom-search-permalink',
|
65 |
+
'remove-bases',
|
66 |
+
'advanced-archives',
|
67 |
+
'more-rewrite',
|
68 |
+
'custom-htaccess',
|
69 |
+
'replace-htaccess',
|
70 |
+
'htaccess-suggestions',
|
71 |
+
'maintenance-mode'
|
72 |
+
) ) ?>
|
73 |
+
|
74 |
+
<?php wp_nonce_field( 'WPhtc_settings' ); ?>
|
75 |
+
<input type="hidden" name="action" value="update"/>
|
76 |
+
|
77 |
+
<div class="wphtc-menu">
|
78 |
+
<a class="button-secondary"
|
79 |
+
href="<?php echo wp_nonce_url( $purl . "&action=reset_rules", 'WPhtc_reset_settings' ); ?>"><?php _e( 'Reset all rules', 'wp-htaccess-control' ); ?></a>
|
80 |
+
<input type="submit" class="button-primary"
|
81 |
+
value="<?php _e( 'Save all changes', 'wp-htaccess-control' ); ?>"/>
|
82 |
+
</div>
|
83 |
+
</form>
|
84 |
+
<div class="wphtc-section">
|
85 |
+
<div class="wphtc-section-title stuffbox">
|
86 |
+
<div title="Click to toggle" class="handlediv"
|
87 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
88 |
+
<br></div>
|
89 |
+
<h3><?php _e( 'Current htaccess file as it is generated by WordPress', 'wp-htaccess-control' ); ?></h3>
|
90 |
+
</div>
|
91 |
+
<div class="wphtc-inputs start-open">
|
92 |
+
<p>
|
93 |
+
<code><?php echo str_replace( array(
|
94 |
+
"<br />",
|
95 |
+
"<br/>"
|
96 |
+
), "<br/>", htmlspecialchars( $WPhtc->get_data( 'cur_hta' ) ) ); ?></code>
|
97 |
+
</p>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<!-- INSTRUCTIONS -->
|
102 |
+
<div class="wphtc-section permanently-open">
|
103 |
+
<div class="wphtc-section-title stuffbox">
|
104 |
+
<h3><?php _e( 'Read Me', 'wp-table-of-paginated-contents' ); ?></h3>
|
105 |
+
</div>
|
106 |
+
<table class="form-table wphtc-inputs start-open">
|
107 |
+
<tr valign="top">
|
108 |
+
<th scope="row" style="width:18%;"></th>
|
109 |
+
<td>
|
110 |
+
<p class="description"><?php _e( 'This plugin has made such a long way that it should really now be called <strong>WP htaccess and Rewrite Control</strong>.', 'wp-htaccess-control' ); ?></p>
|
111 |
+
|
112 |
+
<p class="description"><?php _e( 'Some of the features it provides might not work as expect on all environments and setups. You are advised to test configurations on a separate staging, on the same server and with the same theme and plugins. Please report any issues you might face.', 'wp-htaccess-control' ); ?></p>
|
113 |
+
|
114 |
+
<p class="description"><?php _e( 'If your setup seems to get out of control there are a few options to reverse all changes:', 'wp-htaccess-control' ); ?></p>
|
115 |
+
<ul class="description">
|
116 |
+
<li>
|
117 |
+
1) <?php _e( 'Click on "Reset all rules", at the bottom of this page;', 'wp-htaccess-control' ); ?></li>
|
118 |
+
<li>
|
119 |
+
2) <?php _e( 'rename/delete the plugin folder and re-submit your permalink settings under "Settings > Permalinks"', 'wp-htaccess-control' ); ?> </li>
|
120 |
+
<li>
|
121 |
+
3) <?php _e( 'if the previous did not solve your issue, remove the .htaccess file on your blog\'s root directory and repeat step 2;', 'wp-htaccess-control' ); ?></li>
|
122 |
+
<li>
|
123 |
+
4) <?php _e( 'in such cases you might want to get back back to the last version you knew working, which you\'ll find at', 'wp-htaccess-control' ); ?>
|
124 |
+
<a href="http://wordpress.org/extend/plugins/wp-htaccess-control/download/">http://wordpress.org/extend/plugins/wp-htaccess-control/download/</a>.
|
125 |
+
</li>
|
126 |
+
</ul>
|
127 |
+
<p><?php _e( 'Version 3.3 was tested up to WordPress 3.5.1.', 'wp-htaccess-control' ); ?></p>
|
128 |
+
|
129 |
+
<p><?php _e( 'Version 3.4 was tested on WordPress 3.9.', 'wp-htaccess-control' ); ?></p>
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
</table>
|
133 |
+
</div>
|
134 |
+
|
135 |
+
<?php if ( $debug ) { ?>
|
136 |
+
<div class="wphtc-section start-open">
|
137 |
+
<div class="wphtc-section-title stuffbox">
|
138 |
+
<div title="Click to toggle" class="handlediv"
|
139 |
+
style="background:url('<?php bloginfo( "wpurl" ) ?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent">
|
140 |
+
<br></div>
|
141 |
+
<h3><?php _e( 'Debug Data', 'wp-htaccess-control' ); ?></h3>
|
142 |
+
</div>
|
143 |
+
<div class="wphtc-inputs">
|
144 |
<pre>
|
145 |
+
<?php print_r( $WPhtc->data ); ?>
|
146 |
</pre>
|
147 |
|
148 |
<pre>
|
149 |
<?php global $wp_rewrite;
|
150 |
+
print_r( $wp_rewrite ); ?>
|
151 |
</pre>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
<?php } ?>
|
155 |
+
</div>
|
156 |
</div>
|
wp-htaccess-control-ui.scss
CHANGED
@@ -79,7 +79,7 @@ div.updated p {
|
|
79 |
|
80 |
th {
|
81 |
font-weight: bold;
|
82 |
-
padding-left:12px;
|
83 |
}
|
84 |
|
85 |
tr {
|
@@ -116,12 +116,12 @@ textarea.readonly {
|
|
116 |
|
117 |
ul.description {
|
118 |
margin-top: 1em;
|
119 |
-
margin-left:2em;
|
120 |
-
font-style:italic;
|
121 |
a {
|
122 |
text-decoration: none;
|
123 |
}
|
124 |
-
li{
|
125 |
-
color
|
126 |
}
|
127 |
}
|
79 |
|
80 |
th {
|
81 |
font-weight: bold;
|
82 |
+
padding-left: 12px;
|
83 |
}
|
84 |
|
85 |
tr {
|
116 |
|
117 |
ul.description {
|
118 |
margin-top: 1em;
|
119 |
+
margin-left: 2em;
|
120 |
+
font-style: italic;
|
121 |
a {
|
122 |
text-decoration: none;
|
123 |
}
|
124 |
+
li {
|
125 |
+
color: #666;
|
126 |
}
|
127 |
}
|
wp-htaccess-control.php
CHANGED
@@ -26,339 +26,330 @@ Author URI: http://antonioandra.de
|
|
26 |
/* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008
|
27 |
Search redirection is based on Nice Search by Mark Jaquith, 2011 */
|
28 |
|
29 |
-
if (!class_exists("WPhtc")) {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
function set_sm()
|
354 |
-
{
|
355 |
-
|
356 |
-
if (class_exists('GoogleSitemapGenerator') && $this->data['cap'] != '') {
|
357 |
-
$generatorObject = & GoogleSitemapGenerator::GetInstance();
|
358 |
-
if ($generatorObject != null) {
|
359 |
-
/* var $wpdb WP_DB */
|
360 |
-
global $wpdb, $wp_version;
|
361 |
-
$sql = "SELECT DISTINCT
|
362 |
p.ID,
|
363 |
u.user_nicename,
|
364 |
MAX(p.post_modified_gmt) AS last_post
|
@@ -370,464 +361,501 @@ if (!class_exists("WPhtc")) {
|
|
370 |
AND p.post_status = 'publish'
|
371 |
AND p.post_type = 'post'
|
372 |
AND p.post_password = ''
|
373 |
-
" . (floatval($wp_version) < 2.1 ? "AND p.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "
|
374 |
GROUP BY
|
375 |
u.ID,
|
376 |
u.user_nicename";
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
777 |
}
|
778 |
-
if (class_exists("WPhtc")) {
|
779 |
-
|
780 |
}
|
781 |
-
if (isset($WPhtc)) {
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
|
|
832 |
}
|
833 |
?>
|
26 |
/* Removal of the Category Base is based on WP No Category Base by Saurabh Gupta, 2008
|
27 |
Search redirection is based on Nice Search by Mark Jaquith, 2011 */
|
28 |
|
29 |
+
if ( ! class_exists( "WPhtc" ) ) {
|
30 |
+
class WPhtc {
|
31 |
+
|
32 |
+
public $data;
|
33 |
+
|
34 |
+
public $defaultData = array(
|
35 |
+
"maintenance_active" => false,
|
36 |
+
"login_disabled" => false,
|
37 |
+
"hta" => false,
|
38 |
+
"disable_serversignature" => false,
|
39 |
+
"admin_email" => false,
|
40 |
+
"disable_indexes" => false,
|
41 |
+
"up_limit" => false,
|
42 |
+
"redirect_500" => false,
|
43 |
+
"redirect_403" => false,
|
44 |
+
"protect_wp_config" => false,
|
45 |
+
"protect_htaccess" => false,
|
46 |
+
"protect_comments" => false,
|
47 |
+
"disable_hotlink" => false,
|
48 |
+
"disable_file_hotlink_ext" => false,
|
49 |
+
"canon" => false,
|
50 |
+
"gzip" => false,
|
51 |
+
"deflate" => false,
|
52 |
+
"wp_hta" => false,
|
53 |
+
"cpp" => false,
|
54 |
+
"cap" => false,
|
55 |
+
"custom_search_permalink" => false,
|
56 |
+
"remove_taxonomy_base" => false,
|
57 |
+
"create_archive" => false,
|
58 |
+
"remove_author_base" => false,
|
59 |
+
"htaccess_original" => false,
|
60 |
+
"suffix_html" => false,
|
61 |
+
"donation_hidden_time" => false,
|
62 |
+
);
|
63 |
+
|
64 |
+
function WPhtc() {
|
65 |
+
$data = get_option( 'WPhtc_data' );
|
66 |
+
if ( $data ) {
|
67 |
+
$this->data = array_merge( $this->defaultData, $data );
|
68 |
+
} else {
|
69 |
+
add_option( 'WPhtc_data', $this->defaultData );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/*
|
74 |
+
* @param $key
|
75 |
+
*/
|
76 |
+
function get_data( $key, $key_inner = null ) {
|
77 |
+
if ( isset( $this->data[ $key ] ) ) {
|
78 |
+
if ( $key_inner != "" && isset( $this->data[ $key ][ $key_inner ] ) ) {
|
79 |
+
return $this->data[ $key ][ $key_inner ];
|
80 |
+
} else if ( ! isset( $key_inner ) ) {
|
81 |
+
return $this->data[ $key ];
|
82 |
+
}
|
83 |
+
} else {
|
84 |
+
return null;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
function init() {
|
89 |
+
# set locale
|
90 |
+
$currentLocale = get_locale();
|
91 |
+
if ( ! empty( $currentLocale ) ) {
|
92 |
+
$moFile = dirname( __FILE__ ) . "/lang/wp-htaccess-control-" . $currentLocale . ".mo";
|
93 |
+
if ( @file_exists( $moFile ) && is_readable( $moFile ) ) {
|
94 |
+
load_textdomain( 'wp-htaccess-control', $moFile );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
function search_template_redirect() {
|
100 |
+
# redirect "?s=*" to "/search-base/*"
|
101 |
+
if ( $_GET['s'] ) {
|
102 |
+
wp_redirect( home_url( $this->data['custom_search_permalink'] . "/" . rawurlencode( get_query_var( 's' ) ) ) );
|
103 |
+
}
|
104 |
+
|
105 |
+
# rewrite query
|
106 |
+
if ( strpos( $_SERVER["REQUEST_URI"], $this->data['custom_search_permalink'] ) ) {
|
107 |
+
global $wp_query;
|
108 |
+
if ( strpos( $_SERVER["REQUEST_URI"], '/feed' ) ) {
|
109 |
+
preg_match( "/feed\/(feed|rdf|rss|rss2|atom)?/", $_SERVER["REQUEST_URI"], $feed );
|
110 |
+
if ( $feed[1] ) {
|
111 |
+
$format = "&feed=" . $feed[1];
|
112 |
+
} else {
|
113 |
+
$format = "&feed=feed";
|
114 |
+
}
|
115 |
+
}
|
116 |
+
$page_base = ( $this->data['cpp'] != '' ) ? $this->data['cpp'] : 'page';
|
117 |
+
|
118 |
+
# in need of better regex
|
119 |
+
if ( ! strpos( $_SERVER["REQUEST_URI"], '/feed' ) && ! strpos( $_SERVER["REQUEST_URI"], $page_base ) ) {
|
120 |
+
$pattern = "/\/" . $this->data['custom_search_permalink'] . "\/(.+)/";
|
121 |
+
} else {
|
122 |
+
$pattern = "/\/" . $this->data['custom_search_permalink'] . "\/(.+)\/feed|" . $page_base . "?/";
|
123 |
+
}
|
124 |
+
|
125 |
+
$pattern = "/\/" . $this->data['custom_search_permalink'] . "\/(.+)/";
|
126 |
+
preg_match( $pattern, $_SERVER["REQUEST_URI"], $matches );
|
127 |
+
$results = split( "/", $matches[1] );
|
128 |
+
if ( $results[1] == $page_base ) {
|
129 |
+
$page = "&paged=" . $results[2];
|
130 |
+
}
|
131 |
+
$wp_query = new WP_Query( 's=' . $results[0] . $page . $format );
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
# return get_search_query on custom search base
|
136 |
+
function get_search_query_filter( $query ) {
|
137 |
+
|
138 |
+
if ( $this->data['custom_search_permalink'] != '' && strpos( $_SERVER["REQUEST_URI"], $this->data['custom_search_permalink'] ) ) {
|
139 |
+
$page_base = ( $this->data['cpp'] != '' ) ? $this->data['cpp'] : 'page';
|
140 |
+
# in need of better regex
|
141 |
+
if ( ! strpos( $_SERVER["REQUEST_URI"], '/feed' ) && ! strpos( $_SERVER["REQUEST_URI"], "/" . $page_base ) ) {
|
142 |
+
$pattern = "/\/" . $this->data['custom_search_permalink'] . "\/(.+)/";
|
143 |
+
} else {
|
144 |
+
$pattern = "/\/" . $this->data['custom_search_permalink'] . "\/(.+)\/feed|" . $page_base . "?/";
|
145 |
+
}
|
146 |
+
preg_match( $pattern, $_SERVER["REQUEST_URI"], $matches );
|
147 |
+
$results = split( "/", $matches[1] );
|
148 |
+
|
149 |
+
return urldecode( $results[0] );
|
150 |
+
}
|
151 |
+
|
152 |
+
return $query;
|
153 |
+
}
|
154 |
+
|
155 |
+
function search_feed_link( $link ) {
|
156 |
+
|
157 |
+
$link = str_replace( "search", $this->data['custom_search_permalink'], $link );
|
158 |
+
|
159 |
+
return $link;
|
160 |
+
}
|
161 |
+
|
162 |
+
function check_first_run() {
|
163 |
+
# flush rules to get some data filled on first usage
|
164 |
+
if ( ! isset( $this->data['htaccess_original'] ) ) {
|
165 |
+
$this->refresh_rewrite_rules();
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
# Flush rules
|
170 |
+
/*
|
171 |
+
* @var $wp_rewrite WP_Rewrite
|
172 |
+
*/
|
173 |
+
function refresh_rewrite_rules() {
|
174 |
+
global $wp_rewrite;
|
175 |
+
$wp_rewrite->flush_rules();
|
176 |
+
}
|
177 |
+
|
178 |
+
function refresh_rewrite_rules_later() {
|
179 |
+
wp_schedule_single_event( time(), 'flush_event' );
|
180 |
+
}
|
181 |
+
|
182 |
+
# Filter pagination links generated by WordPress
|
183 |
+
function filter_get_pagenum_link( $result ) {
|
184 |
+
$result = preg_replace( "/" . urlencode( $this->data['cpp'] ) . "\/[0-9]+[\/]?/", "", $result );
|
185 |
+
$result = str_replace( "page", urlencode( $this->data['cpp'] ), $result );
|
186 |
+
|
187 |
+
return $result;
|
188 |
+
}
|
189 |
+
|
190 |
+
# Filter link generated by get_author_posts_url() to use the Custom Author Permalink
|
191 |
+
function filter_author_link( $link ) {
|
192 |
+
|
193 |
+
if ( $this->data['remove_author_base'] ) {
|
194 |
+
$link = str_replace( "author/", "", $link );
|
195 |
+
} else if ( isset( $this->data['cap'] ) && $this->data['cap'] != '' ) {
|
196 |
+
$link = str_replace( "author", urlencode( $this->data['cap'] ), $link );
|
197 |
+
}
|
198 |
+
|
199 |
+
return $link;
|
200 |
+
}
|
201 |
+
|
202 |
+
function filter_redirect_canonical( $requested_url ) {
|
203 |
+
global $wp;
|
204 |
+
|
205 |
+
# Disable canonical redirection on urls using custom pagination permalink
|
206 |
+
if ( isset( $this->data['cpp'] ) && $this->data['cpp'] != '' && get_query_var( 'paged' ) > 1 && preg_match( "/" . urlencode( $this->data['cpp'] ) . "/", $wp->request ) ) {
|
207 |
+
return false;
|
208 |
+
} else {
|
209 |
+
return $requested_url;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
# ancestors nesting method
|
214 |
+
function term_ancestors( $tax, $id ) {
|
215 |
+
$term = get_term( $id, $tax );
|
216 |
+
$ancestor = $term->slug;
|
217 |
+
|
218 |
+
if ( $term->parent != 0 && ! $this->data['remove_hierarchy'] ) {
|
219 |
+
$ancestor = $this->term_ancestors( $tax, $term->parent ) . "/" . $ancestor;
|
220 |
+
}
|
221 |
+
|
222 |
+
return $ancestor;
|
223 |
+
}
|
224 |
+
|
225 |
+
# Rewrite Rules: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
|
226 |
+
function filter_rewrite_rules( $rewrite_rules ) {
|
227 |
+
|
228 |
+
$new_rules = array();
|
229 |
+
|
230 |
+
$page_base = ( $this->data['cpp'] != '' ) ? $this->data['cpp'] : 'page';
|
231 |
+
|
232 |
+
// if we have either to remove the tax base or create tax archives
|
233 |
+
if ( isset( $this->data['create_archive'] ) or isset( $this->data['remove_taxonomy_base'] ) ) {
|
234 |
+
foreach ( get_taxonomies( '', 'objects' ) as $taxonomy ) {
|
235 |
+
if ( ! $taxonomy->rewrite
|
236 |
+
or (
|
237 |
+
(
|
238 |
+
isset( $this->data['remove_taxonomy_base'][ $taxonomy->name ] )
|
239 |
+
and (
|
240 |
+
isset( $this->data['remove_taxonomy_base'][ $taxonomy->name ] )
|
241 |
+
and ! $this->data['remove_taxonomy_base'][ $taxonomy->name ] )
|
242 |
+
)
|
243 |
+
and ! $this->data['create_archive'][ $taxonomy->name ]
|
244 |
+
)
|
245 |
+
) {
|
246 |
+
continue;
|
247 |
+
}
|
248 |
+
/*
|
249 |
+
* @todo this should be rewritten: UNLESS we are removing the tax base we should be using a wildcard for tax term
|
250 |
+
*/
|
251 |
+
$terms = get_terms( $taxonomy->name, array( "hide_empty" => false ) );
|
252 |
+
foreach ( $terms as $term ) {
|
253 |
+
$base = isset( $this->data['remove_taxonomy_base'], $this->data['remove_taxonomy_base'][ $taxonomy->name ] )
|
254 |
+
? ""
|
255 |
+
: $taxonomy->rewrite['slug'] . "/";
|
256 |
+
if ( $term->parent != 0 && ! $this->data['remove_hierarchy'] ) {
|
257 |
+
$ancestors = $this->term_ancestors( $taxonomy->name, $term->parent ) . "/";
|
258 |
+
} else {
|
259 |
+
$ancestors = "";
|
260 |
+
}
|
261 |
+
|
262 |
+
$tax_name = $taxonomy->name;
|
263 |
+
|
264 |
+
# create archives
|
265 |
+
if ( isset( $this->data['create_archive'][ $tax_name ] ) ) {
|
266 |
+
#year
|
267 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]';
|
268 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/' . $page_base . '/?([0-9]{1,})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]&paged=$matches[3]';
|
269 |
+
#year/month
|
270 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/([0-9]{2})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]&monthnum=$matches[3]';
|
271 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]';
|
272 |
+
#year/month/day
|
273 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]';
|
274 |
+
$new_rules[ $base . $ancestors . '(' . $term->slug . ')/([0-9]{4})/([0-9]{2})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]';
|
275 |
+
}
|
276 |
+
# create rewrite rules with tax base
|
277 |
+
|
278 |
+
# appending ".html" to taxonomy permalinks
|
279 |
+
$suffix = $this->data['suffix_html'] ? ".html" : "";
|
280 |
+
|
281 |
+
if ( ! $base ) {
|
282 |
+
$new_rules[ $ancestors . '(' . $term->slug . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&feed=$matches[2]';
|
283 |
+
$new_rules[ $ancestors . '(' . $term->slug . ')/page/?([0-9]{1,})/?$' ] = 'index.php?' . $tax_name . '=$matches[1]&paged=$matches[2]';
|
284 |
+
$new_rules[ $ancestors . '(' . $term->slug . ')' . $suffix . '/?$' ] = 'index.php?' . $tax_name . '=$matches[1]';
|
285 |
+
}
|
286 |
+
$rewrite_rules = $new_rules + $rewrite_rules;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
# Author Archives
|
292 |
+
if ( $this->data['remove_author_base'] ) {
|
293 |
+
$blogusers = get_users( 'who=authors' );
|
294 |
+
foreach ( $blogusers as $user ) {
|
295 |
+
|
296 |
+
$new_rules = array(
|
297 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]',
|
298 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&paged=$matches[3]',
|
299 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]',
|
300 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]',
|
301 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]',
|
302 |
+
'(' . $user->user_nicename . ')/([0-9]{4})/([0-9]{2})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]'
|
303 |
+
);
|
304 |
+
|
305 |
+
$rewrite_rules = $new_rules + $rewrite_rules;
|
306 |
+
}
|
307 |
+
} else if ( isset( $this->data['author_archives'] ) ) {
|
308 |
+
$author_base = ( $this->data['cap'] != '' ) ? $this->data['cap'] : 'author';
|
309 |
+
$new_rules = array(
|
310 |
+
$author_base . '/([^/]+)/([0-9]{4})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]',
|
311 |
+
$author_base . '/([^/]+)/([0-9]{4})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&paged=$matches[3]',
|
312 |
+
$author_base . '/([^/]+)/([0-9]{4})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]',
|
313 |
+
$author_base . '/([^/]+)/([0-9]{4})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]',
|
314 |
+
$author_base . '/([^/]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]',
|
315 |
+
$author_base . '/([^/]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/' . $page_base . '/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&day=$matches[4]&paged=$matches[5]'
|
316 |
+
);
|
317 |
+
|
318 |
+
$rewrite_rules = $new_rules + $rewrite_rules;
|
319 |
+
}
|
320 |
+
|
321 |
+
# Custom Pagination; Custom Author Permalink
|
322 |
+
if ( ( isset( $this->data['cap'] ) && $this->data['cap'] != '' ) || ( isset( $this->data['cpp'] ) && $this->data['cpp'] != '' ) ) {
|
323 |
+
$rewrite_rules = serialize( $rewrite_rules );
|
324 |
+
# Author
|
325 |
+
if ( isset( $this->data['cap'] ) && $this->data['cap'] != '' ) {
|
326 |
+
$rewrite_rules = str_replace( 'author/', $this->data['cap'] . '/', $rewrite_rules );
|
327 |
+
}
|
328 |
+
# Pagination
|
329 |
+
if ( isset( $this->data['cpp'] ) && $this->data['cpp'] != '' ) {
|
330 |
+
$rewrite_rules = str_replace( 'page/', $this->data['cpp'] . '/', $rewrite_rules );
|
331 |
+
}
|
332 |
+
# Search
|
333 |
+
if ( isset( $this->data['custom_search_permalink'] ) && $this->data['custom_search_permalink'] != '' ) {
|
334 |
+
$rewrite_rules = str_replace( 'search/', $this->data['custom_search_permalink'] . '/', $rewrite_rules );
|
335 |
+
}
|
336 |
+
|
337 |
+
$rewrite_rules = unserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $rewrite_rules ) );
|
338 |
+
}
|
339 |
+
|
340 |
+
return $rewrite_rules;
|
341 |
+
}
|
342 |
+
|
343 |
+
# Adding our Custom Author Base to the sitemap generated by Google XML Sitemaps
|
344 |
+
# Adapted from sitemap-core.php (line ~2036)
|
345 |
+
function set_sm() {
|
346 |
+
|
347 |
+
if ( class_exists( 'GoogleSitemapGenerator' ) && $this->data['cap'] != '' ) {
|
348 |
+
$generatorObject = &GoogleSitemapGenerator::GetInstance();
|
349 |
+
if ( $generatorObject != null ) {
|
350 |
+
/* var $wpdb WP_DB */
|
351 |
+
global $wpdb, $wp_version;
|
352 |
+
$sql = "SELECT DISTINCT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
p.ID,
|
354 |
u.user_nicename,
|
355 |
MAX(p.post_modified_gmt) AS last_post
|
361 |
AND p.post_status = 'publish'
|
362 |
AND p.post_type = 'post'
|
363 |
AND p.post_password = ''
|
364 |
+
" . ( floatval( $wp_version ) < 2.1 ? "AND p.post_date_gmt <= '" . gmdate( 'Y-m-d H:i:59' ) . "'" : "" ) . "
|
365 |
GROUP BY
|
366 |
u.ID,
|
367 |
u.user_nicename";
|
368 |
+
$authors = $wpdb->get_results( $sql );
|
369 |
+
if ( $authors && is_array( $authors ) ) {
|
370 |
+
foreach ( $authors as $author ) {
|
371 |
+
$url = get_bloginfo( 'url' ) . "/" . $this->data['cap'] . "/" . $author->user_nicename . "/";
|
372 |
+
$generatorObject->AddUrl( $url, $generatorObject->GetTimestampFromMySql( $author->last_post ), $generatorObject->GetOption( "cf_auth" ), $generatorObject->GetOption( "pr_auth" ) );
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
# Adding rewrite pairs to the .htaccess generated by WordPress, everytime the rules are flush
|
380 |
+
/*
|
381 |
+
* @var $wp_rewrite WP_Rewrite
|
382 |
+
* @return WP_Rewrite
|
383 |
+
*/
|
384 |
+
function wp_rewrite_rules( $wp_rewrite ) {
|
385 |
+
# Keeping a copy of the generated htaccess in our option array for later reviewing
|
386 |
+
$this->data['cur_hta'] = '# BEGIN WordPress<br/>' . nl2br( $wp_rewrite->mod_rewrite_rules() ) . "# END WordPress";
|
387 |
+
update_option( 'WPhtc_data', $this->data );
|
388 |
+
|
389 |
+
return $wp_rewrite;
|
390 |
+
}
|
391 |
+
|
392 |
+
# Adding Custom Rules to htaccess file generated by WordPress, everytime the rules are flush
|
393 |
+
function hta_rules( $rules ) {
|
394 |
+
|
395 |
+
# keeping original hta
|
396 |
+
if ( ! isset( $this->data['htaccess_original'] ) ) {
|
397 |
+
$this->data['htaccess_original'] = $rules;
|
398 |
+
update_option( 'WPhtc_data', $this->data );
|
399 |
+
}
|
400 |
+
|
401 |
+
$new_rules = "";
|
402 |
+
|
403 |
+
# Maintenance Mode
|
404 |
+
if ( $this->data['maintenance_active'] && isset( $this->data['maintenance_ips'][0] ) ) {
|
405 |
+
$no_ips = count( $this->data['maintenance_ips'] );
|
406 |
+
$new_rules .= "\n# WPhtc: Begin Maintenance Mode\n";
|
407 |
+
# redirect
|
408 |
+
if ( $this->data['maintenance_redirection'] != '' ) {
|
409 |
+
$new_rules .= "RewriteEngine on\n";
|
410 |
+
$new_rules .= "RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif) [NC]\n";
|
411 |
+
for ( $i = 0; $i < $no_ips; $i ++ ) {
|
412 |
+
$new_rules .= "RewriteCond %{REMOTE_HOST} !^" . str_replace( ".", "\.", trim( $this->data['maintenance_ips'][ $i ] ) ) . "\n";
|
413 |
+
}
|
414 |
+
if ( substr( $this->data['maintenance_redirection'], 0, 1 ) == "/" ) {
|
415 |
+
$new_rules .= "RewriteCond %{REQUEST_URI} !" . $this->data['maintenance_redirection'] . "$ [NC]\n";
|
416 |
+
}
|
417 |
+
$new_rules .= "RewriteRule .* " . $this->data['maintenance_redirection'] . " [R=302,L]\n";
|
418 |
+
} # no redirection
|
419 |
+
else {
|
420 |
+
$new_rules .= "order deny,allow\n";
|
421 |
+
$new_rules .= "deny from all\n";
|
422 |
+
foreach ( $this->data['maintenance_ips'] as $ip ) {
|
423 |
+
$new_rules .= "allow from " . $ip . "\n";
|
424 |
+
}
|
425 |
+
}
|
426 |
+
$new_rules .= "# WPhtc: End Maintenance Mode\n";
|
427 |
+
}
|
428 |
+
|
429 |
+
# Login Control
|
430 |
+
if ( $this->data['login_disabled'] ) {
|
431 |
+
$no_ips = count( $this->data['login_ips'] );
|
432 |
+
$new_rules .= "\n# WPhtc: Begin Login Control (start deleting here if you're having trouble logging in)\n";
|
433 |
+
# redirect
|
434 |
+
$new_rules .= "RewriteEngine on\n";
|
435 |
+
$new_rules .= "RewriteCond %{REQUEST_URI} .wp-login\.php* [NC]\n";
|
436 |
+
if ( $this->data['login_half_mode'] ) {
|
437 |
+
$new_rules .= "RewriteCond %{REQUEST_METHOD} !=POST\n";
|
438 |
+
$new_rules .= "RewriteCond %{QUERY_STRING} !action=(logout|lostpassword|postpass|retrievepassword|resetpass|rp)*\n";
|
439 |
+
}
|
440 |
+
if ( $no_ips > 0 ) {
|
441 |
+
for ( $i = 0; $i < $no_ips; $i ++ ) {
|
442 |
+
$new_rules .= "RewriteCond %{REMOTE_HOST} !^" . str_replace( ".", "\.", trim( $this->data['login_ips'][ $i ] ) ) . "\n";
|
443 |
+
}
|
444 |
+
}
|
445 |
+
$new_rules .= "RewriteRule .* " . $this->data['login_redirection'] . " [R=301,L]\n";
|
446 |
+
$new_rules .= "# WPhtc: End Login Control Mode (stop deleting here if you're having trouble logging in)\n";
|
447 |
+
}
|
448 |
+
# Custom htaccess
|
449 |
+
if ( $this->data['hta'] ) {
|
450 |
+
$new_rules .= "\n# WPhtc: Begin Custom htaccess\n";
|
451 |
+
$new_rules .= stripslashes( $this->data['hta'] ) . "\n";
|
452 |
+
$new_rules .= "# WPhtc: End Custom htaccess\n";
|
453 |
+
}
|
454 |
+
# htaccess suggestions
|
455 |
+
if ( $this->data['disable_serversignature'] ) {
|
456 |
+
$new_rules .= "\n# WPhtC: Disable ServerSignature on generated error pages\n";
|
457 |
+
$new_rules .= "ServerSignature Off\n";
|
458 |
+
}
|
459 |
+
if ( $this->data['admin_email'] ) {
|
460 |
+
$new_rules .= "\n# WPhtC: Set admin email\n";
|
461 |
+
$new_rules .= "SetEnv SERVER_ADMIN " . $this->data['admin_email'] . "\n\n";
|
462 |
+
}
|
463 |
+
if ( $this->data['disable_indexes'] ) {
|
464 |
+
$new_rules .= "\n# WPhtC: Disable directory browsing\n";
|
465 |
+
$new_rules .= "Options All -Indexes\n";
|
466 |
+
}
|
467 |
+
if ( $this->data['up_limit'] ) {
|
468 |
+
$new_rules .= "\n# WPhtC: Limit upload size to " . $this->data['up_limit'] . " MB\n";
|
469 |
+
$new_rules .= "LimitRequestBody " . ( $this->data['up_limit'] * 1024 * 1024 ) . " \n";
|
470 |
+
}
|
471 |
+
if ( $this->data['redirect_500'] ) {
|
472 |
+
$new_rules .= "\n# WPhtC: Setting 500 Error page\n";
|
473 |
+
$new_rules .= "ErrorDocument 500 " . $this->data['redirect_500'] . "\n";
|
474 |
+
}
|
475 |
+
if ( $this->data['redirect_403'] ) {
|
476 |
+
$new_rules .= "\n# WPhtC: Setting 403 Error page\n";
|
477 |
+
$new_rules .= "ErrorDocument 403 " . $this->data['redirect_403'] . "\n";
|
478 |
+
}
|
479 |
+
if ( $this->data['protect_wp_config'] ) {
|
480 |
+
$new_rules .= "\n# WPhtC: Protect WP-config.php\n";
|
481 |
+
$new_rules .= "<files wp-config.php>\n";
|
482 |
+
$new_rules .= "order allow,deny\n";
|
483 |
+
$new_rules .= "deny from all\n";
|
484 |
+
$new_rules .= "</files>\n";
|
485 |
+
}
|
486 |
+
if ( $this->data['protect_htaccess'] ) {
|
487 |
+
$new_rules .= "\n# WPhtC: Protect .htaccess file\n";
|
488 |
+
$new_rules .= "<files ~ \"^.*\.([Hh][Tt][Aa])\">\n";
|
489 |
+
$new_rules .= "order allow,deny\n";
|
490 |
+
$new_rules .= "deny from all\n";
|
491 |
+
$new_rules .= "</files>\n";
|
492 |
+
}
|
493 |
+
if ( $this->data['protect_comments'] ) {
|
494 |
+
$new_rules .= "\n# WPhtC: Protect comments.php\n";
|
495 |
+
$new_rules .= "RewriteCond %{REQUEST_METHOD} POST\n";
|
496 |
+
$new_rules .= "RewriteCond %{REQUEST_URI} .wp-comments-post\.php*\n";
|
497 |
+
$new_rules .= "RewriteCond %{HTTP_REFERER} !.*" . get_bloginfo( 'url' ) . ".* [OR]\n";
|
498 |
+
$new_rules .= "RewriteCond %{HTTP_USER_AGENT} ^$\n";
|
499 |
+
$new_rules .= "RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]\n";
|
500 |
+
}
|
501 |
+
if ( $this->data['disable_hotlink'] ) {
|
502 |
+
$new_rules .= "\n# WPhtC: Disable image hotlinking\n";
|
503 |
+
$new_rules .= "<IfModule mod_rewrite.c>\n";
|
504 |
+
$new_rules .= "RewriteEngine on\n";
|
505 |
+
$new_rules .= "RewriteCond %{HTTP_REFERER} !^$\n";
|
506 |
+
$new_rules .= "RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?" . str_ireplace( array(
|
507 |
+
"http://",
|
508 |
+
"www."
|
509 |
+
), "", get_bloginfo( "url" ) ) . "/.*$ [NC]\n";
|
510 |
+
$new_rules .= "RewriteRule \.(jpg|jpeg|png|gif)$ " . $this->data['disable_hotlink'] . " [NC,R,L]\n";
|
511 |
+
$new_rules .= "</IfModule>\n";
|
512 |
+
}
|
513 |
+
if ( $this->data['disable_file_hotlink_ext'] ) {
|
514 |
+
$redir = $this->data['disable_file_hotlink_redir'] ? $this->data['disable_file_hotlink_redir'] : "_";
|
515 |
+
$new_rules .= "\n# WPhtC: Disable file hotlinking\n";
|
516 |
+
$new_rules .= "<IfModule mod_rewrite.c>\n";
|
517 |
+
$new_rules .= "RewriteEngine on\n";
|
518 |
+
$new_rules .= "RewriteCond %{HTTP_REFERER} !^$\n";
|
519 |
+
$new_rules .= "RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?" . str_ireplace( array(
|
520 |
+
"http://",
|
521 |
+
"www."
|
522 |
+
), "", get_bloginfo( "url" ) ) . "/.*$ [NC]\n";
|
523 |
+
$new_rules .= "RewriteRule \.(" . str_replace( " ", "|", $this->data['disable_file_hotlink_ext'] ) . ")$ " . $redir . " [NC,R,L]\n";
|
524 |
+
$new_rules .= "</IfModule>\n";
|
525 |
+
}
|
526 |
+
if ( $this->data['canon'] ) {
|
527 |
+
$url = str_ireplace( array( "http://", "www." ), "", get_bloginfo( "url" ) );
|
528 |
+
$domain = explode( "/", $url );
|
529 |
+
$escaped_domain = str_ireplace( ".", "\.", $domain[0] );
|
530 |
+
if ( $this->data['canon'] == 'www' ) {
|
531 |
+
$siteurl = get_option( 'siteurl' );
|
532 |
+
if ( ! preg_match( '/^http:\/\/www\./', $siteurl ) ) {
|
533 |
+
$siteurl = str_replace( "http://", "http://www.", $siteurl );
|
534 |
+
update_option( 'siteurl', $siteurl );
|
535 |
+
}
|
536 |
+
$homeurl = get_option( 'home' );
|
537 |
+
if ( ! preg_match( '/^http:\/\/www\./', $homeurl ) ) {
|
538 |
+
$homeurl = str_replace( "http://", "http://www.", $homeurl );
|
539 |
+
update_option( 'home', $homeurl );
|
540 |
+
}
|
541 |
+
} else if ( $this->data['canon'] == 'simple' ) {
|
542 |
+
$siteurl = get_option( 'siteurl' );
|
543 |
+
if ( preg_match( '/^http:\/\/www\./', $siteurl ) ) {
|
544 |
+
$siteurl = str_replace( "http://www.", "http://", $siteurl );
|
545 |
+
update_option( 'siteurl', $siteurl );
|
546 |
+
}
|
547 |
+
$homeurl = get_option( 'home' );
|
548 |
+
if ( preg_match( '/^http:\/\/www\./', $homeurl ) ) {
|
549 |
+
$homeurl = str_replace( "http://www.", "http://", $homeurl );
|
550 |
+
update_option( 'home', $homeurl );
|
551 |
+
}
|
552 |
+
}
|
553 |
+
}
|
554 |
+
if ( $this->data['gzip'] ) {
|
555 |
+
$new_rules .= "\n# WPhtC: Setting mod_gzip\n";
|
556 |
+
$new_rules .= "<ifModule mod_gzip.c>\n";
|
557 |
+
$new_rules .= "mod_gzip_on Yes\n";
|
558 |
+
$new_rules .= "mod_gzip_dechunk Yes\n";
|
559 |
+
$new_rules .= "mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$\n";
|
560 |
+
$new_rules .= "mod_gzip_item_include handler ^cgi-script$\n";
|
561 |
+
$new_rules .= "mod_gzip_item_include mime ^text/.*\n";
|
562 |
+
$new_rules .= "mod_gzip_item_include mime ^application/x-javascript.*\n";
|
563 |
+
$new_rules .= "mod_gzip_item_exclude mime ^image/.*\n";
|
564 |
+
$new_rules .= "mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*\n";
|
565 |
+
$new_rules .= "</ifModule>\n";
|
566 |
+
}
|
567 |
+
if ( $this->data['deflate'] ) {
|
568 |
+
$new_rules .= "\n# WPhtC: Setting mod_deflate\n";
|
569 |
+
$new_rules .= "<IfModule mod_deflate.c>\n";
|
570 |
+
$new_rules .= "AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript\n";
|
571 |
+
$new_rules .= "BrowserMatch ^Mozilla/4 gzip-only-text/html\n";
|
572 |
+
$new_rules .= "BrowserMatch ^Mozilla/4.0[678] no-gzip\n";
|
573 |
+
$new_rules .= "BrowserMatch bMSIE !no-gzip !gzip-only-text/html\n";
|
574 |
+
$new_rules .= "Header append Vary User-Agent env=!dont-vary\n";
|
575 |
+
$new_rules .= "</IfModule>\n";
|
576 |
+
}
|
577 |
+
if ( $this->data['wp_hta'] && trim( $this->data['wp_hta'] ) != '' ) {
|
578 |
+
$new_rules .= "\n" . $this->data['wp_hta'];
|
579 |
+
} else {
|
580 |
+
$new_rules .= "\n" . $rules;
|
581 |
+
}
|
582 |
+
|
583 |
+
return $new_rules;
|
584 |
+
}
|
585 |
+
|
586 |
+
# Filter Term Link
|
587 |
+
function filter_term_link( $termlink, $term, $taxonomy ) {
|
588 |
+
// WPhtc -> this
|
589 |
+
if ( $this->data['remove_taxonomy_base'][ $taxonomy ] ) {
|
590 |
+
$txs = get_taxonomies( array( 'name' => $taxonomy ), "object" );
|
591 |
+
foreach ( $txs as $t ) {
|
592 |
+
//return str_replace($t->rewrite['slug']."/","",$termlink);
|
593 |
+
if ( $term->parent != 0 && ! $this->data['remove_hierarchy'] ) {
|
594 |
+
return get_bloginfo( 'url' ) . "/" . $this->term_ancestors( $taxonomy, $term->parent ) . "/" . $term->slug;
|
595 |
+
} else {
|
596 |
+
return get_bloginfo( 'url' ) . "/" . $term->slug;
|
597 |
+
}
|
598 |
+
}
|
599 |
+
} else {
|
600 |
+
return $termlink;
|
601 |
+
}
|
602 |
+
}
|
603 |
+
|
604 |
+
# Filter Taxonomy Base
|
605 |
+
function remove_taxonomy_base_from_rewrite_rules( $rules ) {
|
606 |
+
# Let's remove every taxonomy rule here, we'll reacreate them at filter_rewrite_rules()
|
607 |
+
return array();
|
608 |
+
//return $rules;
|
609 |
+
}
|
610 |
+
|
611 |
+
# Filter Author Rewrite Rules
|
612 |
+
function remove_author_base_from_rewrite_rules( $author_rewrite ) {
|
613 |
+
|
614 |
+
if ( $this->data['remove_author_base'] ) {
|
615 |
+
$author_rewrite = array();
|
616 |
+
$blogusers = get_users( 'who=authors' );
|
617 |
+
foreach ( $blogusers as $user ) {
|
618 |
+
$author_rewrite[ '(' . $user->user_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?author_name=$matches[1]&feed=$matches[2]';
|
619 |
+
$author_rewrite[ '(' . $user->user_nicename . ')/page/?([0-9]{1,})/?$' ] = 'index.php?author_name=$matches[1]&paged=$matches[2]';
|
620 |
+
$author_rewrite[ '(' . $user->user_nicename . ')/?$' ] = 'index.php?author_name=$matches[1]';
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
return $author_rewrite;
|
625 |
+
}
|
626 |
+
|
627 |
+
# WP-htaccess Control options page interface
|
628 |
+
public static function page() {
|
629 |
+
include( dirname( __FILE__ ) . '/wp-htaccess-control-ui.php' );
|
630 |
+
}
|
631 |
+
|
632 |
+
# Adding our options page to the admin menu
|
633 |
+
function configure_menu() {
|
634 |
+
if ( current_user_can( "administrator" ) ) {
|
635 |
+
$page = add_submenu_page( "options-general.php", "WP htaccess Control", "htaccess Control", 'activate_plugins', __FILE__, array(
|
636 |
+
'WPhtc',
|
637 |
+
'page'
|
638 |
+
) );
|
639 |
+
add_action( 'admin_print_scripts-' . $page, array( 'WPhtc', 'page_script' ) );
|
640 |
+
add_action( 'admin_print_styles-' . $page, array( 'WPhtc', 'page_style' ) );
|
641 |
+
}
|
642 |
+
}
|
643 |
+
|
644 |
+
# Enqueue Ui Scripts on Plugin page
|
645 |
+
public static function page_script() {
|
646 |
+
wp_enqueue_script( "htaccess-control-js", WP_PLUGIN_URL . '/wp-htaccess-control/wp-htaccess-control-ui.js' );
|
647 |
+
}
|
648 |
+
|
649 |
+
# Enqueue Ui Scripts on Plugin page
|
650 |
+
public static function page_style() {
|
651 |
+
wp_enqueue_style( "htaccess-control-css", WP_PLUGIN_URL . '/wp-htaccess-control/wp-htaccess-control-ui.css' );
|
652 |
+
}
|
653 |
+
|
654 |
+
# Filter "View" Link on Administration
|
655 |
+
function filter_tax_table_actions( $actions, $tag ) {
|
656 |
+
if ( $tag->parent != 0 ) {
|
657 |
+
$actions['view'] = '<a href="' . get_bloginfo( 'url' ) . '/' . $this->term_ancestors( $tag->taxonomy, $tag->parent ) . '/' . $tag->slug . '">View</a>';
|
658 |
+
}
|
659 |
+
|
660 |
+
return $actions;
|
661 |
+
}
|
662 |
+
|
663 |
+
# Options Page Actions
|
664 |
+
function page_action() {
|
665 |
+
$this->check_first_run();
|
666 |
+
$this->data = array_merge( $this->defaultData, get_option( 'WPhtc_data' ) );
|
667 |
+
if ( isset( $_REQUEST['action'] ) ) {
|
668 |
+
$action = $_REQUEST['action'];
|
669 |
+
global $WPhtcEcho;
|
670 |
+
|
671 |
+
switch ( $action ) {
|
672 |
+
# Hide donation message for one month
|
673 |
+
case 'hide_donation_message':
|
674 |
+
$this->data['donation_hidden_time'] = time() + 90 * 24 * 60 * 60;
|
675 |
+
update_option( 'WPhtc_data', $this->data );
|
676 |
+
break;
|
677 |
+
# if reseting everything just delete the option array
|
678 |
+
case 'reset_rules':
|
679 |
+
# nonce
|
680 |
+
if ( ! check_admin_referer( 'WPhtc_reset_settings' ) ) {
|
681 |
+
die( "You have no permission to do this." );
|
682 |
+
}
|
683 |
+
$this->data = $this->defaultData;
|
684 |
+
delete_option( 'WPhtc_data' );
|
685 |
+
//update_option('WPhtc_data',$this->data);
|
686 |
+
$WPhtcEcho .= __( 'All rules reset.', 'wp-htaccess-control' );
|
687 |
+
$this->refresh_rewrite_rules();
|
688 |
+
break;
|
689 |
+
# if updating, save new rules in database and flush rewrite rules
|
690 |
+
case 'update':
|
691 |
+
# first donation hidding time 'now'
|
692 |
+
if ( ! $this->data['donation_hidden_time'] ) {
|
693 |
+
$this->data['donation_hidden_time'] = time();
|
694 |
+
}
|
695 |
+
# nonce
|
696 |
+
if ( ! check_admin_referer( 'WPhtc_settings' ) ) {
|
697 |
+
die( "You have no permission to do this." );
|
698 |
+
}
|
699 |
+
|
700 |
+
// @todo replace this with defaultData
|
701 |
+
foreach (
|
702 |
+
array(
|
703 |
+
"hta",
|
704 |
+
"cap",
|
705 |
+
"cpp",
|
706 |
+
"custom_search_permalink",
|
707 |
+
"remove_author_base",
|
708 |
+
"category_archives",
|
709 |
+
"author_archives",
|
710 |
+
"tag_archives",
|
711 |
+
"disable_serversignature",
|
712 |
+
"disable_indexes",
|
713 |
+
"protect_wp_config",
|
714 |
+
"protect_htaccess",
|
715 |
+
"protect_comments",
|
716 |
+
"disable_hotlink",
|
717 |
+
"disable_file_hotlink_ext",
|
718 |
+
"disable_file_hotlink_redir",
|
719 |
+
"redirect_500",
|
720 |
+
"redirect_403",
|
721 |
+
"canon",
|
722 |
+
"admin_email",
|
723 |
+
"deflate",
|
724 |
+
"gzip",
|
725 |
+
"maintenance_active",
|
726 |
+
"maintenance_redirection",
|
727 |
+
"login_disabled",
|
728 |
+
"login_half_mode",
|
729 |
+
"login_redirection",
|
730 |
+
"sm_enabled",
|
731 |
+
"remove_hierarchy",
|
732 |
+
"suffix_html"
|
733 |
+
)
|
734 |
+
as $k
|
735 |
+
) {
|
736 |
+
$this->data[ $k ] = isset( $_POST[ 'WPhtc_' . $k ] ) ? $_POST[ 'WPhtc_' . $k ] : '';
|
737 |
+
}
|
738 |
+
|
739 |
+
# wordpress htaccess and jim morgan's htaccess
|
740 |
+
$this->data['wp_hta'] = $_POST['WPhtc_wp_hta'] . "\n";
|
741 |
+
|
742 |
+
# get htaccess Suggestions
|
743 |
+
$this->data['up_limit'] = ( is_numeric( $_POST['WPhtc_up_limit'] ) && $_POST['WPhtc_up_limit'] > 0 ) ? $_POST['WPhtc_up_limit'] : '';
|
744 |
+
# get maintenance
|
745 |
+
$lines = preg_split( "/\n|,/", $_POST['WPhtc_maintenance_ips'] );
|
746 |
+
$this->data['maintenance_ips'] = array();
|
747 |
+
foreach ( $lines as $line ) {
|
748 |
+
trim( $line );
|
749 |
+
if ( preg_match( "/[a-z,0-9,\.]/", $line ) ) {
|
750 |
+
$this->data['maintenance_ips'][] = $line;
|
751 |
+
}
|
752 |
+
}
|
753 |
+
# get login control data
|
754 |
+
if ( isset( $_POST['WPhtc_login_ips'] ) ) {
|
755 |
+
$lines = preg_split( "/\n|,/", $_POST['WPhtc_login_ips'] );
|
756 |
+
$this->data['login_ips'] = array();
|
757 |
+
foreach ( $lines as $line ) {
|
758 |
+
trim( $line );
|
759 |
+
if ( preg_match( "/[a-z,0-9,\.]/", $line ) ) {
|
760 |
+
$this->data['login_ips'][] = $line;
|
761 |
+
}
|
762 |
+
}
|
763 |
+
}
|
764 |
+
|
765 |
+
# Unsetting inclusion of Author pages on Google XML Sitemap options, we'll add those links to the sitemap later with our Custom Author Permalink
|
766 |
+
if ( $this->data['sm_enabled'] == true ) {
|
767 |
+
$SMoptions = get_option( "sm_options" );
|
768 |
+
if ( $SMoptions && is_array( $SMoptions ) ) {
|
769 |
+
$SMoptions = get_option( "sm_options" );
|
770 |
+
$SMoptions['sm_in_auth'] = 0;
|
771 |
+
update_option( 'sm_options', $SMoptions );
|
772 |
+
# Try to rebuild Sitemap
|
773 |
+
do_action( "sm_rebuild" );
|
774 |
+
}
|
775 |
+
}
|
776 |
+
|
777 |
+
# Taxonomy Base removal options
|
778 |
+
unset( $this->data['remove_taxonomy_base'] );
|
779 |
+
if ( isset( $_POST['WPhtc_remove_base'] ) and $_POST['WPhtc_remove_base'] ) {
|
780 |
+
foreach ( $_POST['WPhtc_remove_base'] as $tax_key => $remove ) {
|
781 |
+
$this->data['remove_taxonomy_base'][ $tax_key ] = $remove;
|
782 |
+
}
|
783 |
+
}
|
784 |
+
|
785 |
+
# Advanced archives
|
786 |
+
unset( $this->data['create_archive'] );
|
787 |
+
if ( isset( $_POST['WPhtc_create_archive'] ) ) {
|
788 |
+
foreach ( $_POST['WPhtc_create_archive'] as $tax_key => $create_archive ) {
|
789 |
+
$this->data['create_archive'][ $tax_key ] = $create_archive;
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
# Update WP htaccess Control options
|
794 |
+
update_option( 'WPhtc_data', $this->data );
|
795 |
+
|
796 |
+
# Flush Rewrite Rules
|
797 |
+
$this->refresh_rewrite_rules();
|
798 |
+
$WPhtcEcho .= __( 'All options updated.', 'wp-htaccess-control' );
|
799 |
+
break;
|
800 |
+
}
|
801 |
+
}
|
802 |
+
}
|
803 |
+
}
|
804 |
}
|
805 |
+
if ( class_exists( "WPhtc" ) ) {
|
806 |
+
$WPhtc = new WPhtc();
|
807 |
}
|
808 |
+
if ( isset( $WPhtc ) ) {
|
809 |
+
|
810 |
+
add_action( 'init', array( $WPhtc, 'init' ) );
|
811 |
+
add_filter( 'mod_rewrite_rules', array( $WPhtc, 'hta_rules' ) );
|
812 |
+
add_filter( 'redirect_canonical', array( $WPhtc, 'filter_redirect_canonical' ), 10, 10 );
|
813 |
+
add_action( 'admin_menu', array( $WPhtc, 'configure_menu' ) );
|
814 |
+
add_action( 'flush_event', array( $WPhtc, 'refresh_rewrite_rules' ) );
|
815 |
+
add_filter( 'generate_rewrite_rules', array( $WPhtc, 'wp_rewrite_rules' ) );
|
816 |
+
add_filter( 'rewrite_rules_array', array( $WPhtc, 'filter_rewrite_rules' ) );
|
817 |
+
|
818 |
+
// AUTHOR improve this
|
819 |
+
if ( $WPhtc->data['cap'] != '' || $WPhtc->data['remove_author_base'] ) {
|
820 |
+
add_filter( 'author_link', array( $WPhtc, 'filter_author_link' ) );
|
821 |
+
add_filter( 'author_rewrite_rules', array( $WPhtc, 'remove_author_base_from_rewrite_rules' ) );
|
822 |
+
}
|
823 |
+
|
824 |
+
// Filter pagination links
|
825 |
+
if ( $WPhtc->data['cpp'] != '' ) {
|
826 |
+
add_filter( 'paginate_links', array( $WPhtc, 'filter_get_pagenum_link' ) );
|
827 |
+
add_filter( 'get_pagenum_link', array( $WPhtc, 'filter_get_pagenum_link' ) );
|
828 |
+
}
|
829 |
+
|
830 |
+
// Filter search
|
831 |
+
if ( trim( $WPhtc->data['custom_search_permalink'] ) != '' ) {
|
832 |
+
add_filter( 'search_feed_link', array( $WPhtc, 'search_feed_link' ), 10, 10 );
|
833 |
+
add_filter( 'get_search_query', array( $WPhtc, 'get_search_query_filter' ), 10, 10 );
|
834 |
+
add_action( 'template_redirect', array( $WPhtc, 'search_template_redirect' ) );
|
835 |
+
}
|
836 |
+
|
837 |
+
|
838 |
+
add_action( 'sm_buildmap', array( $WPhtc, 'set_sm' ) );
|
839 |
+
|
840 |
+
// Taxonomy Base Removal
|
841 |
+
if ( $WPhtc->data['remove_taxonomy_base'] ) {
|
842 |
+
add_filter( 'term_link', array( $WPhtc, 'filter_term_link' ), 10, 3 );
|
843 |
+
foreach ( $WPhtc->data['remove_taxonomy_base'] as $tax => $v ) {
|
844 |
+
if ( $v ) {
|
845 |
+
add_filter( $tax . '_rewrite_rules', array( $WPhtc, 'remove_taxonomy_base_from_rewrite_rules' ) );
|
846 |
+
add_filter( $tax . "_row_actions", array( $WPhtc, 'filter_tax_table_actions' ), 10, 2 );
|
847 |
+
}
|
848 |
+
}
|
849 |
+
}
|
850 |
+
/* Term management actions*/
|
851 |
+
if ( $WPhtc->data['remove_taxonomy_base'] || $WPhtc->data['create_archive'] ) {
|
852 |
+
add_action( 'created_term', array( $WPhtc, 'refresh_rewrite_rules_later' ) );
|
853 |
+
add_action( 'edited_term', array( $WPhtc, 'refresh_rewrite_rules_later' ) );
|
854 |
+
add_action( 'delete_term', array( $WPhtc, 'refresh_rewrite_rules_later' ) );
|
855 |
+
}
|
856 |
+
|
857 |
+
/* This flush should maybe be conditional to content authors only, maybe not */
|
858 |
+
add_action( 'user_register', array( $WPhtc, 'refresh_rewrite_rules_later' ) );
|
859 |
+
add_action( 'delete_user', array( $WPhtc, 'refresh_rewrite_rules_later' ) );
|
860 |
}
|
861 |
?>
|