Version Description
- General / Html > Meta -> new option Remove DNS Prefetch
- New component - Comments
- Fix: Updated admin urls on plugin / theme / core update page
- fix: WP Rocket url replacements for non cached pages
- Regex patterns updates for better performance and compatibility
- Fix: WP Rocket - support HTML Optimization, including Inline CSS and Inline JS
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.3.9 |
Comparing to | |
See all releases |
Code changes from version 1.3.8.1 to 1.3.9
- conflicts/wp-rocket.php +55 -1
- modules/components/admin-admin_url.php +1 -1
- modules/components/general-html.php +5 -2
- modules/components/general-meta.php +99 -16
- modules/components/general-styles.php +22 -18
- modules/components/rewrite-comments.php +125 -0
- modules/components/rewrite-new_xml-rpc-path.php +20 -2
- modules/components/rewrite-root-files.php +2 -113
- modules/module-rewrite.php +3 -0
- readme.txt +15 -3
- wp-hide.php +2 -2
conflicts/wp-rocket.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
|
7 |
static function init()
|
8 |
{
|
9 |
-
add_action('
|
10 |
}
|
11 |
|
12 |
static function is_plugin_active()
|
@@ -29,12 +29,65 @@
|
|
29 |
if(is_admin() && ! defined( 'DOING_AJAX' ) )
|
30 |
return;
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
global $wph;
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
//disable default WPH buffering replacement filter and rely on a different one provided by wp rocket plugin
|
35 |
$wph->disable_ob_start_callback = TRUE;
|
36 |
|
37 |
add_filter( 'rocket_buffer', array( 'WPH_conflict_handle_wp_rocket', 'start_ob_start_callback'), 999 );
|
|
|
|
|
38 |
|
39 |
}
|
40 |
|
@@ -53,6 +106,7 @@
|
|
53 |
return $buffer;
|
54 |
|
55 |
}
|
|
|
56 |
|
57 |
}
|
58 |
|
6 |
|
7 |
static function init()
|
8 |
{
|
9 |
+
add_action('wp', array('WPH_conflict_handle_wp_rocket', 'wpcache') , -1);
|
10 |
}
|
11 |
|
12 |
static function is_plugin_active()
|
29 |
if(is_admin() && ! defined( 'DOING_AJAX' ) )
|
30 |
return;
|
31 |
|
32 |
+
if( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
33 |
+
return;
|
34 |
+
|
35 |
+
if ( ! isset( $_SERVER['REQUEST_METHOD'] ) || $_SERVER['REQUEST_METHOD'] != 'GET' )
|
36 |
+
return;
|
37 |
+
|
38 |
+
|
39 |
global $wph;
|
40 |
|
41 |
+
//if loged in and not using 'cache_logged_user' leave the default plugin ob callback
|
42 |
+
$wp_rocket_options = get_option( WP_ROCKET_SLUG );
|
43 |
+
$cache_logged_user = isset($wp_rocket_options['cache_logged_user']) ? $wp_rocket_options['cache_logged_user'] : '';
|
44 |
+
if (is_user_logged_in() && empty( $cache_logged_user ) )
|
45 |
+
return;
|
46 |
+
|
47 |
+
$request_uri = explode( '?', $_SERVER['REQUEST_URI'] );
|
48 |
+
$request_uri = reset(( $request_uri ));
|
49 |
+
|
50 |
+
// Don't cache disallowed extensions
|
51 |
+
if ( strtolower( $_SERVER['REQUEST_URI'] ) != '/index.php' && in_array( pathinfo( $request_uri, PATHINFO_EXTENSION ), array( 'php', 'xml', 'xsl' ) ) )
|
52 |
+
return;
|
53 |
+
|
54 |
+
//query GET
|
55 |
+
if ( ! empty( $_GET )
|
56 |
+
&& ( ! isset( $_GET['utm_source'], $_GET['utm_medium'], $_GET['utm_campaign'] ) )
|
57 |
+
&& ( ! isset( $_GET['utm_expid'] ) )
|
58 |
+
&& ( ! isset( $_GET['fb_action_ids'], $_GET['fb_action_types'], $_GET['fb_source'] ) )
|
59 |
+
&& ( ! isset( $_GET['gclid'] ) )
|
60 |
+
&& ( ! isset( $_GET['permalink_name'] ) )
|
61 |
+
&& ( ! isset( $_GET['lp-variation-id'] ) )
|
62 |
+
&& ( ! isset( $_GET['lang'] ) )
|
63 |
+
&& ( ! isset( $_GET['s'] ) )
|
64 |
+
&& ( ! isset( $_GET['age-verified'] ) )
|
65 |
+
&& ( ! isset( $rocket_cache_query_strings ) || ! array_intersect( array_keys( $_GET ), $rocket_cache_query_strings ) )
|
66 |
+
)
|
67 |
+
{
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
$rocket_cache_search = apply_filters( 'rocket_cache_search', false );
|
74 |
+
|
75 |
+
if ( function_exists( 'is_404' ) && is_404() )
|
76 |
+
return;
|
77 |
+
|
78 |
+
if ( function_exists( 'is_search' ) && is_search() || $rocket_cache_search) // Don't cache search results
|
79 |
+
return;
|
80 |
+
|
81 |
+
if ( defined( 'DONOTCACHEPAGE' ) )
|
82 |
+
return;
|
83 |
+
|
84 |
+
|
85 |
//disable default WPH buffering replacement filter and rely on a different one provided by wp rocket plugin
|
86 |
$wph->disable_ob_start_callback = TRUE;
|
87 |
|
88 |
add_filter( 'rocket_buffer', array( 'WPH_conflict_handle_wp_rocket', 'start_ob_start_callback'), 999 );
|
89 |
+
|
90 |
+
|
91 |
|
92 |
}
|
93 |
|
106 |
return $buffer;
|
107 |
|
108 |
}
|
109 |
+
|
110 |
|
111 |
}
|
112 |
|
modules/components/admin-admin_url.php
CHANGED
@@ -347,7 +347,7 @@
|
|
347 |
|
348 |
function wp_core_update_admin_url( $url, $path, $blog_id )
|
349 |
{
|
350 |
-
if( strpos( $_SERVER['REQUEST_URI'], "/update-core.php") === FALSE )
|
351 |
return $url;
|
352 |
|
353 |
//replace the wp-admin with custom slug
|
347 |
|
348 |
function wp_core_update_admin_url( $url, $path, $blog_id )
|
349 |
{
|
350 |
+
if( strpos( $_SERVER['REQUEST_URI'], "/update-core.php") === FALSE && strpos( $_SERVER['REQUEST_URI'], "/update.php") === FALSE)
|
351 |
return $url;
|
352 |
|
353 |
//replace the wp-admin with custom slug
|
modules/components/general-html.php
CHANGED
@@ -135,6 +135,9 @@
|
|
135 |
//replace any comments
|
136 |
$buffer = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->/sm', "" , $buffer);
|
137 |
|
|
|
|
|
|
|
138 |
return $buffer;
|
139 |
|
140 |
}
|
@@ -296,7 +299,7 @@
|
|
296 |
if(is_admin())
|
297 |
return $buffer;
|
298 |
|
299 |
-
$buffer = preg_replace_callback('/<img
|
300 |
|
301 |
return $buffer;
|
302 |
|
@@ -306,7 +309,7 @@
|
|
306 |
function clean_image_classes_preg_replace_callback( $matches )
|
307 |
{
|
308 |
$tag = isset($matches[0]) ? $matches[0] : '';
|
309 |
-
$classes = isset($matches[
|
310 |
|
311 |
if(empty($tag))
|
312 |
return '';
|
135 |
//replace any comments
|
136 |
$buffer = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->/sm', "" , $buffer);
|
137 |
|
138 |
+
//remove empty multiple new lines
|
139 |
+
$buffer = preg_replace("/(\n){2,}/", "\n", $buffer);
|
140 |
+
|
141 |
return $buffer;
|
142 |
|
143 |
}
|
299 |
if(is_admin())
|
300 |
return $buffer;
|
301 |
|
302 |
+
$buffer = preg_replace_callback('/<img([^>]+)class=["|\'](.*?)["|\']([^>]+)?>/i', array($this, "clean_image_classes_preg_replace_callback"), $buffer);
|
303 |
|
304 |
return $buffer;
|
305 |
|
309 |
function clean_image_classes_preg_replace_callback( $matches )
|
310 |
{
|
311 |
$tag = isset($matches[0]) ? $matches[0] : '';
|
312 |
+
$classes = isset($matches[2]) ? $matches[2] : '';
|
313 |
|
314 |
if(empty($tag))
|
315 |
return '';
|
modules/components/general-meta.php
CHANGED
@@ -40,7 +40,23 @@
|
|
40 |
|
41 |
'sanitize_type' => array('sanitize_title', 'strtolower')
|
42 |
|
43 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
$this->module_settings[] = array(
|
46 |
'id' => 'remove_resource_hints',
|
@@ -198,7 +214,7 @@
|
|
198 |
function ob_start_callback_remove_generator_meta( $buffer )
|
199 |
{
|
200 |
|
201 |
-
$buffer = preg_replace_callback('/(<meta
|
202 |
|
203 |
return $buffer;
|
204 |
|
@@ -236,7 +252,7 @@
|
|
236 |
function ob_start_callback_remove_other_generator_meta( $buffer )
|
237 |
{
|
238 |
|
239 |
-
$buffer = preg_replace_callback('/(<meta
|
240 |
|
241 |
return $buffer;
|
242 |
|
@@ -255,6 +271,47 @@
|
|
255 |
|
256 |
return $found;
|
257 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
|
260 |
function _init_remove_resource_hints($saved_field_data)
|
@@ -333,12 +390,27 @@
|
|
333 |
|
334 |
if(is_admin())
|
335 |
return $buffer;
|
336 |
-
|
337 |
-
$buffer = preg_replace('/(<link.*?rel=("|\')profile("|\').*?href=("|\')(.*?)("|\')(.*?)?\/?>|<link.*?href=("|\')(.*?)("|\').*?rel=("|\')profile("|\')(.*?)?\/?>)/i', "", $buffer);
|
338 |
-
|
339 |
-
return $buffer;
|
340 |
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
|
344 |
|
@@ -363,21 +435,32 @@
|
|
363 |
|
364 |
}
|
365 |
|
366 |
-
|
367 |
-
function cds_callback($matches)
|
368 |
-
{
|
369 |
-
return '123456';
|
370 |
-
}
|
371 |
|
372 |
-
|
373 |
function remove_canonical_tag( $buffer )
|
374 |
{
|
375 |
|
376 |
if(is_admin())
|
377 |
return $buffer;
|
378 |
|
379 |
-
$
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
return $buffer;
|
382 |
|
383 |
}
|
40 |
|
41 |
'sanitize_type' => array('sanitize_title', 'strtolower')
|
42 |
|
43 |
+
);
|
44 |
+
|
45 |
+
$this->module_settings[] = array(
|
46 |
+
'id' => 'remove_dns_prefetch',
|
47 |
+
'label' => 'Remove DNS Prefetch',
|
48 |
+
'description' => __('Remove DNS Prefetch meta generated tag.', 'wp-hide-security-enhancer'),
|
49 |
+
|
50 |
+
'input_type' => 'radio',
|
51 |
+
'options' => array(
|
52 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
53 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
54 |
+
),
|
55 |
+
'default_value' => 'no',
|
56 |
+
|
57 |
+
'sanitize_type' => array('sanitize_title', 'strtolower')
|
58 |
+
|
59 |
+
);
|
60 |
|
61 |
$this->module_settings[] = array(
|
62 |
'id' => 'remove_resource_hints',
|
214 |
function ob_start_callback_remove_generator_meta( $buffer )
|
215 |
{
|
216 |
|
217 |
+
$buffer = preg_replace_callback('/(<meta([^>]+)name=("|\')generator("|\')([^>]+)?\/?>)/im', array($this, "remove_generator_meta_preg_replace_callback"), $buffer);
|
218 |
|
219 |
return $buffer;
|
220 |
|
252 |
function ob_start_callback_remove_other_generator_meta( $buffer )
|
253 |
{
|
254 |
|
255 |
+
$buffer = preg_replace_callback('/(<meta([^>]+)name=("|\')generator("|\')([^>]+)?\/?>)/im', array($this, "remove_other_generator_meta_preg_replace_callback"), $buffer);
|
256 |
|
257 |
return $buffer;
|
258 |
|
271 |
|
272 |
return $found;
|
273 |
}
|
274 |
+
|
275 |
+
|
276 |
+
|
277 |
+
function _init_remove_dns_prefetch( $saved_field_data )
|
278 |
+
{
|
279 |
+
|
280 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
281 |
+
return FALSE;
|
282 |
+
|
283 |
+
add_filter( 'wph/ob_start_callback', array(&$this, 'ob_start_callback_remove_dns_prefetch'));
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
function ob_start_callback_remove_dns_prefetch( $buffer )
|
289 |
+
{
|
290 |
+
|
291 |
+
if(is_admin())
|
292 |
+
return $buffer;
|
293 |
+
|
294 |
+
$result = preg_match_all('/(<link([^>]+)rel=("|\')dns-prefetch("|\')([^>]+)?\/?>)/im', $buffer, $founds);
|
295 |
+
|
296 |
+
if(!isset($founds[0]) || count($founds[0]) < 1)
|
297 |
+
return $buffer;
|
298 |
+
|
299 |
+
if(count($founds[0]) > 0)
|
300 |
+
{
|
301 |
+
foreach ($founds[0] as $found)
|
302 |
+
{
|
303 |
+
if(empty($found))
|
304 |
+
continue;
|
305 |
+
|
306 |
+
$buffer = str_replace($found, "", $buffer);
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
}
|
311 |
+
|
312 |
+
return $buffer;
|
313 |
+
|
314 |
+
}
|
315 |
|
316 |
|
317 |
function _init_remove_resource_hints($saved_field_data)
|
390 |
|
391 |
if(is_admin())
|
392 |
return $buffer;
|
|
|
|
|
|
|
|
|
393 |
|
394 |
+
$result = preg_match_all('/(<link([^>]+)rel=("|\')profile("|\')([^>]+)?\/?>)/im', $buffer, $founds);
|
395 |
+
|
396 |
+
if(!isset($founds[0]) || count($founds[0]) < 1)
|
397 |
+
return $buffer;
|
398 |
+
|
399 |
+
if(count($founds[0]) > 0)
|
400 |
+
{
|
401 |
+
foreach ($founds[0] as $found)
|
402 |
+
{
|
403 |
+
if(empty($found))
|
404 |
+
continue;
|
405 |
+
|
406 |
+
$buffer = str_replace($found, "", $buffer);
|
407 |
+
|
408 |
+
}
|
409 |
+
|
410 |
+
}
|
411 |
+
|
412 |
+
return $buffer;
|
413 |
+
|
414 |
}
|
415 |
|
416 |
|
435 |
|
436 |
}
|
437 |
|
|
|
|
|
|
|
|
|
|
|
438 |
|
|
|
439 |
function remove_canonical_tag( $buffer )
|
440 |
{
|
441 |
|
442 |
if(is_admin())
|
443 |
return $buffer;
|
444 |
|
445 |
+
$result = preg_match_all('/(<link([^>]+)rel=("|\')canonical("|\')([^>]+)?\/?>)/im', $buffer, $founds);
|
446 |
+
|
447 |
+
if(!isset($founds[0]) || count($founds[0]) < 1)
|
448 |
+
return $buffer;
|
449 |
+
|
450 |
+
if(count($founds[0]) > 0)
|
451 |
+
{
|
452 |
+
foreach ($founds[0] as $found)
|
453 |
+
{
|
454 |
+
if(empty($found))
|
455 |
+
continue;
|
456 |
+
|
457 |
+
$buffer = str_replace($found, "", $buffer);
|
458 |
+
|
459 |
+
}
|
460 |
+
|
461 |
+
|
462 |
+
}
|
463 |
+
|
464 |
return $buffer;
|
465 |
|
466 |
}
|
modules/components/general-styles.php
CHANGED
@@ -102,29 +102,33 @@
|
|
102 |
*
|
103 |
* @param mixed $buffer
|
104 |
*/
|
105 |
-
function ob_start_callback_remove_id($buffer)
|
106 |
{
|
107 |
|
108 |
-
$
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
return $buffer;
|
111 |
|
112 |
}
|
113 |
-
|
114 |
-
|
115 |
-
function remove_id_preg_replace_callback( $matches )
|
116 |
-
{
|
117 |
-
$found = isset($matches[0]) ? $matches[0] : '';
|
118 |
-
|
119 |
-
if(empty($found))
|
120 |
-
return '';
|
121 |
-
|
122 |
-
$found = preg_replace( '/(id=("|\')(.*?)("|\') )/i', "", $found );
|
123 |
-
|
124 |
-
return $found;
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
|
129 |
}
|
130 |
?>
|
102 |
*
|
103 |
* @param mixed $buffer
|
104 |
*/
|
105 |
+
function ob_start_callback_remove_id( $buffer )
|
106 |
{
|
107 |
|
108 |
+
$result = preg_match_all('/(<link([^>]+)rel=("|\')stylesheet("|\')([^>]+)?\/?>)/im', $buffer, $founds);
|
109 |
+
|
110 |
+
if(!isset($founds[0]) || count($founds[0]) < 1)
|
111 |
+
return $buffer;
|
112 |
+
|
113 |
+
if(count($founds[0]) > 0)
|
114 |
+
{
|
115 |
+
foreach ($founds[0] as $found)
|
116 |
+
{
|
117 |
+
if(empty($found))
|
118 |
+
continue;
|
119 |
+
|
120 |
+
$found_replacement = preg_replace( '/(id=("|\')(.*?)("|\') )/i', "", $found );
|
121 |
+
$buffer = str_replace($found, $found_replacement, $buffer);
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
return $buffer;
|
129 |
|
130 |
}
|
131 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
}
|
134 |
?>
|
modules/components/rewrite-comments.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPH_module_rewrite_comments extends WPH_module_component
|
4 |
+
{
|
5 |
+
|
6 |
+
function get_component_title()
|
7 |
+
{
|
8 |
+
return "Comments";
|
9 |
+
}
|
10 |
+
|
11 |
+
function get_module_settings()
|
12 |
+
{
|
13 |
+
$this->module_settings[] = array(
|
14 |
+
'id' => 'new_wp_comments_post',
|
15 |
+
'label' => __('New wp-comments-post.php Path', 'wp-hide-security-enhancer'),
|
16 |
+
'description' => __('The default path is set to wp-comments-post.php', 'wp-hide-security-enhancer'),
|
17 |
+
|
18 |
+
'value_description' => 'e.g. user-input.php',
|
19 |
+
'input_type' => 'text',
|
20 |
+
|
21 |
+
'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name'), array($this->wph->functions, 'php_extension_required')),
|
22 |
+
'processing_order' => 60
|
23 |
+
);
|
24 |
+
|
25 |
+
$this->module_settings[] = array(
|
26 |
+
'id' => 'block_wp_comments_post_url',
|
27 |
+
'label' => __('Block wp-comments-post.php', 'wp-hide-security-enhancer'),
|
28 |
+
'description' => __('Block default wp-comments-post.php.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New wp-comments-post.php Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
|
29 |
+
|
30 |
+
'input_type' => 'radio',
|
31 |
+
'options' => array(
|
32 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
33 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
34 |
+
),
|
35 |
+
'default_value' => 'no',
|
36 |
+
|
37 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
38 |
+
'processing_order' => 60
|
39 |
+
|
40 |
+
);
|
41 |
+
|
42 |
+
|
43 |
+
return $this->module_settings;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
function _init_new_wp_comments_post($saved_field_data)
|
49 |
+
{
|
50 |
+
|
51 |
+
if(empty($saved_field_data))
|
52 |
+
return FALSE;
|
53 |
+
|
54 |
+
//add default plugin path replacement
|
55 |
+
$url = trailingslashit( site_url() ) . 'wp-comments-post.php';
|
56 |
+
$replacement = trailingslashit( home_url() ) . $saved_field_data;
|
57 |
+
$this->wph->functions->add_replacement( $url , $replacement );
|
58 |
+
|
59 |
+
return TRUE;
|
60 |
+
}
|
61 |
+
|
62 |
+
function _callback_saved_new_wp_comments_post($saved_field_data)
|
63 |
+
{
|
64 |
+
$processing_response = array();
|
65 |
+
|
66 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
67 |
+
return FALSE;
|
68 |
+
|
69 |
+
$default_path = $this->wph->functions->get_url_path( trailingslashit(site_url()) . 'wp-comments-post.php', TRUE );
|
70 |
+
|
71 |
+
if($this->wph->server_htaccess_config === TRUE)
|
72 |
+
$processing_response['rewrite'] = "\nRewriteRule ^" . $saved_field_data . ' '. $default_path .' [L,QSA]';
|
73 |
+
|
74 |
+
if($this->wph->server_web_config === TRUE)
|
75 |
+
$processing_response['rewrite'] = '
|
76 |
+
<rule name="wph-new_wp_comments_post" stopProcessing="true">
|
77 |
+
<match url="^'. $saved_field_data .'" />
|
78 |
+
<action type="Rewrite" url="'. $default_path .'" appendQueryString="true" />
|
79 |
+
</rule>
|
80 |
+
';
|
81 |
+
|
82 |
+
return $processing_response;
|
83 |
+
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
function _callback_saved_block_wp_comments_post_url($saved_field_data)
|
89 |
+
{
|
90 |
+
$processing_response = array();
|
91 |
+
|
92 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
93 |
+
return FALSE;
|
94 |
+
|
95 |
+
//prevent from blocking if the wp_comments_post is not modified
|
96 |
+
$new_wp_comments_post = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_wp_comments_post'), "/"), "/");
|
97 |
+
if (empty( $new_wp_comments_post ))
|
98 |
+
return FALSE;
|
99 |
+
|
100 |
+
$rewrite_file_base = !empty($this->wph->default_variables['wordpress_directory']) ? trailingslashit( $this->wph->default_variables['wordpress_directory'] ) . 'wp-comments-post.php' : 'wp-comments-post.php';
|
101 |
+
|
102 |
+
if($this->wph->server_htaccess_config === TRUE)
|
103 |
+
{
|
104 |
+
$text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
|
105 |
+
$text .= "RewriteRule ^" . $rewrite_file_base ." ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
|
106 |
+
}
|
107 |
+
|
108 |
+
if($this->wph->server_web_config === TRUE)
|
109 |
+
$text = '
|
110 |
+
<rule name="wph-block_wp_comments_post_url" stopProcessing="true">
|
111 |
+
<match url="^' . $rewrite_file_base . '" />
|
112 |
+
<action type="Rewrite" url="'. $this->wph->default_variables['site_relative_path'] .'index.php" />
|
113 |
+
</rule>
|
114 |
+
';
|
115 |
+
|
116 |
+
$processing_response['rewrite'] = $text;
|
117 |
+
|
118 |
+
return $processing_response;
|
119 |
+
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
}
|
125 |
+
?>
|
modules/components/rewrite-new_xml-rpc-path.php
CHANGED
@@ -168,9 +168,27 @@
|
|
168 |
function remove_xml_rpc_tag( $buffer )
|
169 |
{
|
170 |
|
171 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
-
return $buffer;
|
|
|
174 |
}
|
175 |
|
176 |
|
168 |
function remove_xml_rpc_tag( $buffer )
|
169 |
{
|
170 |
|
171 |
+
$result = preg_match_all('/(<link([^>]+)rel=("|\')pingback("|\')([^>]+)?\/?>)/im', $buffer, $founds);
|
172 |
+
|
173 |
+
if(!isset($founds[0]) || count($founds[0]) < 1)
|
174 |
+
return $buffer;
|
175 |
+
|
176 |
+
if(count($founds[0]) > 0)
|
177 |
+
{
|
178 |
+
foreach ($founds[0] as $found)
|
179 |
+
{
|
180 |
+
if(empty($found))
|
181 |
+
continue;
|
182 |
+
|
183 |
+
$buffer = str_replace($found, "", $buffer);
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
}
|
189 |
|
190 |
+
return $buffer;
|
191 |
+
|
192 |
}
|
193 |
|
194 |
|
modules/components/rewrite-root-files.php
CHANGED
@@ -10,42 +10,7 @@
|
|
10 |
|
11 |
function get_module_settings()
|
12 |
{
|
13 |
-
|
14 |
-
'id' => 'new_wp_comments_post',
|
15 |
-
'label' => __('New wp-comments-post.php Path', 'wp-hide-security-enhancer'),
|
16 |
-
'description' => __('The default path is set to wp-comments-post.php', 'wp-hide-security-enhancer'),
|
17 |
-
|
18 |
-
'value_description' => 'e.g. user-input.php',
|
19 |
-
'input_type' => 'text',
|
20 |
-
|
21 |
-
'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name'), array($this->wph->functions, 'php_extension_required')),
|
22 |
-
'processing_order' => 60
|
23 |
-
);
|
24 |
-
|
25 |
-
$this->module_settings[] = array(
|
26 |
-
'id' => 'block_wp_comments_post_url',
|
27 |
-
'label' => __('Block wp-comments-post.php', 'wp-hide-security-enhancer'),
|
28 |
-
'description' => __('Block default wp-comments-post.php.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New wp-comments-post.php Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
|
29 |
-
|
30 |
-
'input_type' => 'radio',
|
31 |
-
'options' => array(
|
32 |
-
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
33 |
-
'no' => __('No', 'wp-hide-security-enhancer'),
|
34 |
-
),
|
35 |
-
'default_value' => 'no',
|
36 |
-
|
37 |
-
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
38 |
-
'processing_order' => 60
|
39 |
-
|
40 |
-
);
|
41 |
-
|
42 |
-
|
43 |
-
$this->module_settings[] = array(
|
44 |
-
'type' => 'split'
|
45 |
-
|
46 |
-
);
|
47 |
-
|
48 |
-
|
49 |
|
50 |
$this->module_settings[] = array(
|
51 |
'id' => 'block_license_txt',
|
@@ -148,83 +113,7 @@
|
|
148 |
return $this->module_settings;
|
149 |
}
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
function _init_new_wp_comments_post($saved_field_data)
|
154 |
-
{
|
155 |
-
|
156 |
-
if(empty($saved_field_data))
|
157 |
-
return FALSE;
|
158 |
-
|
159 |
-
//add default plugin path replacement
|
160 |
-
$url = trailingslashit( site_url() ) . 'wp-comments-post.php';
|
161 |
-
$replacement = trailingslashit( home_url() ) . $saved_field_data;
|
162 |
-
$this->wph->functions->add_replacement( $url , $replacement );
|
163 |
-
|
164 |
-
return TRUE;
|
165 |
-
}
|
166 |
-
|
167 |
-
function _callback_saved_new_wp_comments_post($saved_field_data)
|
168 |
-
{
|
169 |
-
$processing_response = array();
|
170 |
-
|
171 |
-
if(empty($saved_field_data) || $saved_field_data == 'no')
|
172 |
-
return FALSE;
|
173 |
-
|
174 |
-
$default_path = $this->wph->functions->get_url_path( trailingslashit(site_url()) . 'wp-comments-post.php', TRUE );
|
175 |
-
|
176 |
-
if($this->wph->server_htaccess_config === TRUE)
|
177 |
-
$processing_response['rewrite'] = "\nRewriteRule ^" . $saved_field_data . ' '. $default_path .' [L,QSA]';
|
178 |
-
|
179 |
-
if($this->wph->server_web_config === TRUE)
|
180 |
-
$processing_response['rewrite'] = '
|
181 |
-
<rule name="wph-new_wp_comments_post" stopProcessing="true">
|
182 |
-
<match url="^'. $saved_field_data .'" />
|
183 |
-
<action type="Rewrite" url="'. $default_path .'" appendQueryString="true" />
|
184 |
-
</rule>
|
185 |
-
';
|
186 |
-
|
187 |
-
return $processing_response;
|
188 |
-
|
189 |
-
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
function _callback_saved_block_wp_comments_post_url($saved_field_data)
|
194 |
-
{
|
195 |
-
$processing_response = array();
|
196 |
-
|
197 |
-
if(empty($saved_field_data) || $saved_field_data == 'no')
|
198 |
-
return FALSE;
|
199 |
-
|
200 |
-
//prevent from blocking if the wp_comments_post is not modified
|
201 |
-
$new_wp_comments_post = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_wp_comments_post'), "/"), "/");
|
202 |
-
if (empty( $new_wp_comments_post ))
|
203 |
-
return FALSE;
|
204 |
-
|
205 |
-
$rewrite_file_base = !empty($this->wph->default_variables['wordpress_directory']) ? trailingslashit( $this->wph->default_variables['wordpress_directory'] ) . 'wp-comments-post.php' : 'wp-comments-post.php';
|
206 |
-
|
207 |
-
if($this->wph->server_htaccess_config === TRUE)
|
208 |
-
{
|
209 |
-
$text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
|
210 |
-
$text .= "RewriteRule ^" . $rewrite_file_base ." ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
|
211 |
-
}
|
212 |
-
|
213 |
-
if($this->wph->server_web_config === TRUE)
|
214 |
-
$text = '
|
215 |
-
<rule name="wph-block_wp_comments_post_url" stopProcessing="true">
|
216 |
-
<match url="^' . $rewrite_file_base . '" />
|
217 |
-
<action type="Rewrite" url="'. $this->wph->default_variables['site_relative_path'] .'index.php" />
|
218 |
-
</rule>
|
219 |
-
';
|
220 |
-
|
221 |
-
$processing_response['rewrite'] = $text;
|
222 |
-
|
223 |
-
return $processing_response;
|
224 |
-
|
225 |
-
|
226 |
-
}
|
227 |
-
|
228 |
|
229 |
function _callback_saved_block_license_txt($saved_field_data)
|
230 |
{
|
10 |
|
11 |
function get_module_settings()
|
12 |
{
|
13 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
$this->module_settings[] = array(
|
16 |
'id' => 'block_license_txt',
|
113 |
return $this->module_settings;
|
114 |
}
|
115 |
|
116 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
function _callback_saved_block_license_txt($saved_field_data)
|
119 |
{
|
modules/module-rewrite.php
CHANGED
@@ -26,6 +26,9 @@
|
|
26 |
include(WPH_PATH . "/modules/components/rewrite-new_upload_path.php");
|
27 |
$this->components[] = new WPH_module_rewrite_new_upload_path();
|
28 |
|
|
|
|
|
|
|
29 |
include(WPH_PATH . "/modules/components/rewrite-new_xml-rpc-path.php");
|
30 |
$this->components[] = new WPH_module_rewrite_new_xml_rpc_path();
|
31 |
|
26 |
include(WPH_PATH . "/modules/components/rewrite-new_upload_path.php");
|
27 |
$this->components[] = new WPH_module_rewrite_new_upload_path();
|
28 |
|
29 |
+
include(WPH_PATH . "/modules/components/rewrite-comments.php");
|
30 |
+
$this->components[] = new WPH_module_rewrite_comments();
|
31 |
+
|
32 |
include(WPH_PATH . "/modules/components/rewrite-new_xml-rpc-path.php");
|
33 |
$this->components[] = new WPH_module_rewrite_new_xml_rpc_path();
|
34 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.nsp-code.com/donate.php
|
|
4 |
Tags: hide, security, improve security, hacking, wp hide, wordpress hide, custom login url, wp-loging.php, ap-admin
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 4.7.1
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
@@ -105,6 +105,11 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
105 |
* New Uploads Path - Change default media files path / url
|
106 |
* Block uploads URL - Block default media files url
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
**Rewrite > XML-RPC**
|
109 |
|
110 |
* New XML-RPC Path - Change default XML-RPC path / url
|
@@ -123,8 +128,6 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
123 |
|
124 |
**Rewrite > Root Files**
|
125 |
|
126 |
-
* New wp-comments-post.php Path
|
127 |
-
* Block wp-comments-post.php
|
128 |
* Block license.txt - Block access to license.txt root file
|
129 |
* Block readme.html - Block access to readme.html root file
|
130 |
* Block wp-activate.php - Block access to wp-activate.php file
|
@@ -141,6 +144,7 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
141 |
|
142 |
* Remove WordPress Generator Meta
|
143 |
* Remove Other Generator Meta
|
|
|
144 |
* Remove Resource Hints
|
145 |
* Remove wlwmanifest Meta
|
146 |
* Remove feed_links Meta
|
@@ -235,6 +239,14 @@ Please get in touch with us and we'll do our best to include it for a next versi
|
|
235 |
|
236 |
== Changelog ==
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
= 1.3.8.1 =
|
239 |
* Fix - Create mu-plugins folder if not exists
|
240 |
|
4 |
Tags: hide, security, improve security, hacking, wp hide, wordpress hide, custom login url, wp-loging.php, ap-admin
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 4.7.1
|
7 |
+
Stable tag: 1.3.9
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
105 |
* New Uploads Path - Change default media files path / url
|
106 |
* Block uploads URL - Block default media files url
|
107 |
|
108 |
+
**Rewrite > Comments**
|
109 |
+
|
110 |
+
* New wp-comments-post.php Path
|
111 |
+
* Block wp-comments-post.php
|
112 |
+
|
113 |
**Rewrite > XML-RPC**
|
114 |
|
115 |
* New XML-RPC Path - Change default XML-RPC path / url
|
128 |
|
129 |
**Rewrite > Root Files**
|
130 |
|
|
|
|
|
131 |
* Block license.txt - Block access to license.txt root file
|
132 |
* Block readme.html - Block access to readme.html root file
|
133 |
* Block wp-activate.php - Block access to wp-activate.php file
|
144 |
|
145 |
* Remove WordPress Generator Meta
|
146 |
* Remove Other Generator Meta
|
147 |
+
* Remove DNS Prefetch
|
148 |
* Remove Resource Hints
|
149 |
* Remove wlwmanifest Meta
|
150 |
* Remove feed_links Meta
|
239 |
|
240 |
== Changelog ==
|
241 |
|
242 |
+
= 1.3.9 =
|
243 |
+
* General / Html > Meta -> new option Remove DNS Prefetch
|
244 |
+
* New component - Comments
|
245 |
+
* Fix: Updated admin urls on plugin / theme / core update page
|
246 |
+
* fix: WP Rocket url replacements for non cached pages
|
247 |
+
* Regex patterns updates for better performance and compatibility
|
248 |
+
* Fix: WP Rocket - support HTML Optimization, including Inline CSS and Inline JS
|
249 |
+
|
250 |
= 1.3.8.1 =
|
251 |
* Fix - Create mu-plugins folder if not exists
|
252 |
|
wp-hide.php
CHANGED
@@ -5,12 +5,12 @@ Plugin URI: http://www.nsp-code.com
|
|
5 |
Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
6 |
Author: Nsp Code
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
-
Version: 1.3.
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
12 |
|
13 |
-
define('WPH_VERSION', '1.3.
|
14 |
|
15 |
if(!defined('WPH_PATH'))
|
16 |
{
|
5 |
Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
6 |
Author: Nsp Code
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
+
Version: 1.3.9
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
12 |
|
13 |
+
define('WPH_VERSION', '1.3.9');
|
14 |
|
15 |
if(!defined('WPH_PATH'))
|
16 |
{
|