Version Description
- Server Environment Check to ensure there are no rewrite issues and the plugin can be safely deployed.
- Interactive feedback with hints and explanations for environment issues.
- Improved UI
- Clear fusion cache when plugin options changed if avada active
- Fix New Search Path replacement to include an end slash, to avoid catch wrong urls
- Check and tag for WordPress 5.7
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.6.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.2.4 to 1.6.3
- assets/css/wph.css +17 -3
- assets/images/rewrite-test-json-response.jpg +0 -0
- compatibility/themes/avada.php +5 -1
- include/admin-interface.class.php +98 -55
- include/admin-interfaces/notice-cache-path.php +4 -0
- include/admin-interfaces/notice-is-litespeed.php +5 -0
- include/admin-interfaces/notice-is-wpengine.php +5 -0
- include/admin-interfaces/notice-is_multisite.php +6 -0
- include/admin-interfaces/notice-mu-loader-update.php +5 -0
- include/admin-interfaces/notice-mu-loader.php +5 -0
- include/admin-interfaces/notice-no-permalinks.php +5 -0
- include/admin-interfaces/notice-rewrite-test.php +20 -0
- include/admin-interfaces/notice-server-not-supported.php +6 -0
- include/admin-interfaces/notice-write-check.php +8 -0
- include/admin-interfaces/setup.class.php +52 -51
- include/functions.class.php +252 -42
- include/rewrite-confirm.php +11 -0
- include/wph.class.php +84 -63
- modules/components/rewrite-default.php +137 -0
- modules/components/rewrite-search.php +2 -2
- readme.txt +14 -3
- screenshot-1.png +0 -0
- wp-hide.php +1 -1
assets/css/wph.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
#wph h2.nav-tab-wrapper{padding-left: 10px;margin-right: 140px;}
|
2 |
-
#wph h2 .nav-tab {font-size: 12px; font-weight: bold; padding: 2px 8px 3px; margin-right: 0;}
|
3 |
#wph h2 #reset_settings{font-size: 11px; height: auto; line-height: 20px; padding: 1px 5px;}
|
4 |
#wph .ajax_loading {display: none}
|
5 |
#wph .postbox .inside { margin: 0; padding: 0;}
|
@@ -9,7 +9,12 @@
|
|
9 |
#wph #reset_settings_form .reset_settings { margin-top: -31px;}
|
10 |
#wph h2 #reset_settings, #wph #reset_settings_form .reset_settings { }
|
11 |
#wph span.wph-pro {background-color: #f04d46; color:#FFF; font-weight: bold;display: inline-block; padding: 2px 4px;}
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
.wph-postbox {display: flex; border-color: #e5e5e5}
|
15 |
|
@@ -128,10 +133,19 @@ h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}
|
|
128 |
.start-container.title::before {font-size: 90px; content: "\f118";}
|
129 |
.start-container.title.warning::before {content: "\f534";}
|
130 |
.start-container.title.success::before {content: "\f147";}
|
|
|
|
|
|
|
|
|
131 |
|
132 |
.container-description {padding-left: 35px; padding-bottom: 30px}
|
133 |
.container-description .highlight{background-color: #f8ff24;}
|
134 |
.container-description img {max-width: 100%}
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
@media screen and (max-width: 650px) {
|
137 |
#info_box {display: block; padding: 20px}
|
1 |
+
#wph h2.nav-tab-wrapper{padding-left: 10px;margin-right: 140px; padding-top: 0px;}
|
2 |
+
#wph h2 .nav-tab {font-size: 12px; font-weight: bold; padding: 2px 8px 3px; margin-right: 0; margin-top: 5px;}
|
3 |
#wph h2 #reset_settings{font-size: 11px; height: auto; line-height: 20px; padding: 1px 5px;}
|
4 |
#wph .ajax_loading {display: none}
|
5 |
#wph .postbox .inside { margin: 0; padding: 0;}
|
9 |
#wph #reset_settings_form .reset_settings { margin-top: -31px;}
|
10 |
#wph h2 #reset_settings, #wph #reset_settings_form .reset_settings { }
|
11 |
#wph span.wph-pro {background-color: #f04d46; color:#FFF; font-weight: bold;display: inline-block; padding: 2px 4px;}
|
12 |
+
#wph .disabled { opacity: 0.2; -webkit-transition: opacity 0.3s ease-in-out;
|
13 |
+
-moz-transition: opacity 0.3s ease-in-out;
|
14 |
+
-ms-transition: opacity 0.3s ease-in-out;
|
15 |
+
-o-transition: opacity 0.3s ease-in-out;
|
16 |
+
transition: opacity 0.3s ease-in-out;}
|
17 |
+
#wph .disabled:hover {opacity: 1;}
|
18 |
|
19 |
.wph-postbox {display: flex; border-color: #e5e5e5}
|
20 |
|
133 |
.start-container.title::before {font-size: 90px; content: "\f118";}
|
134 |
.start-container.title.warning::before {content: "\f534";}
|
135 |
.start-container.title.success::before {content: "\f147";}
|
136 |
+
.start-container.title.setup::before {font-size: 90px; content: "\f107";}
|
137 |
+
.start-container.title.info::before {font-size: 90px; content: "\f111";}
|
138 |
+
.start-container.title.test::before {font-size: 90px; content: "\f226";}
|
139 |
+
.start-container.title.help::before {font-size: 90px; content: "\f468";}
|
140 |
|
141 |
.container-description {padding-left: 35px; padding-bottom: 30px}
|
142 |
.container-description .highlight{background-color: #f8ff24;}
|
143 |
.container-description img {max-width: 100%}
|
144 |
+
.container-description.environment-notices span.dashicons {font-size: 22px; padding-right: 4px}
|
145 |
+
.container-description.environment-notices span.dashicons.error {color: #dc3232;}
|
146 |
+
.container-description .framed {border: 1px dashed #000; padding: 10px; display: inline-block}
|
147 |
+
.container-description p {}
|
148 |
+
.container-description.environment-notices img {margin-top: 10px}
|
149 |
|
150 |
@media screen and (max-width: 650px) {
|
151 |
#info_box {display: block; padding: 20px}
|
assets/images/rewrite-test-json-response.jpg
ADDED
Binary file
|
compatibility/themes/avada.php
CHANGED
@@ -18,7 +18,11 @@
|
|
18 |
add_filter ('fusion_dynamic_css_final', array('WPH_conflict_theme_avada', 'url_replacement'), 999);
|
19 |
|
20 |
//flush avada cache when settings changes
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
}
|
24 |
|
18 |
add_filter ('fusion_dynamic_css_final', array('WPH_conflict_theme_avada', 'url_replacement'), 999);
|
19 |
|
20 |
//flush avada cache when settings changes
|
21 |
+
if ( function_exists ( 'avada_reset_all_cache' ) )
|
22 |
+
add_action('wph/settings_changed', 'avada_reset_all_cache');
|
23 |
+
if ( function_exists ( 'fusion_reset_all_caches' ) )
|
24 |
+
add_action('wph/settings_changed', 'fusion_reset_all_caches');
|
25 |
+
|
26 |
|
27 |
}
|
28 |
|
include/admin-interface.class.php
CHANGED
@@ -56,6 +56,8 @@
|
|
56 |
}
|
57 |
|
58 |
$this->_load_interface_data();
|
|
|
|
|
59 |
|
60 |
$this->_generate_interface_html();
|
61 |
|
@@ -67,6 +69,16 @@
|
|
67 |
|
68 |
$this->interface_data = $this->module->get_interface_data();
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
function _generate_interface_html()
|
72 |
{
|
@@ -79,51 +91,90 @@
|
|
79 |
|
80 |
echo $this->functions->get_ad_banner();
|
81 |
|
82 |
-
|
|
|
83 |
|
84 |
-
if( $
|
85 |
-
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
?>
|
88 |
-
|
89 |
-
<div
|
90 |
-
|
91 |
-
<?php
|
92 |
-
<div class="postbox">
|
93 |
-
<h3 class="handle"><?php echo $this->interface_data['handle_title'] ?></h3>
|
94 |
-
</div>
|
95 |
-
<?php } ?>
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
$this->_generate_module_html( $module_setting );
|
108 |
-
}
|
109 |
-
|
110 |
-
?>
|
111 |
-
</div>
|
112 |
-
|
113 |
-
<table class="wph_submit widefat">
|
114 |
-
<tbody>
|
115 |
-
<tr class="submit">
|
116 |
-
<td class="label"> </td>
|
117 |
-
<td class="label">
|
118 |
-
<input type="submit" value="<?php _e('Save', 'wp-hide-security-enhancer') ?>" class="button-primary alignright">
|
119 |
-
</td>
|
120 |
-
</tr>
|
121 |
-
</tbody>
|
122 |
-
</table>
|
123 |
-
</form>
|
124 |
</div>
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
</div>
|
128 |
|
129 |
<?php
|
@@ -296,25 +347,15 @@
|
|
296 |
<?php
|
297 |
|
298 |
}
|
299 |
-
|
300 |
-
|
301 |
-
function show_recovery()
|
302 |
-
{
|
303 |
-
?>
|
304 |
-
<div class="wph-notice">
|
305 |
-
<p class="important"><span class="dashicons dashicons-warning important" alt="f534"></span><?php _e('Copy the following link to a safe place. You can use later to reset all plugin options, if something go wrong.', 'wp-hide-security-enhancer') ?> <span id="wph-recovery-link" onClick="WPH.selectText( 'wph-recovery-link' )"><?php echo site_url() ?>?wph-recovery=<?php echo $this->functions->get_recovery_code() ?></span></p>
|
306 |
-
</div>
|
307 |
-
<?php
|
308 |
-
|
309 |
-
|
310 |
-
}
|
311 |
-
|
312 |
|
313 |
function _generate_interface_tabs()
|
314 |
{
|
315 |
|
316 |
?>
|
317 |
-
<h2 class="nav-tab-wrapper
|
|
|
|
|
318 |
<?php
|
319 |
|
320 |
//output all module components as tabs
|
@@ -334,7 +375,9 @@
|
|
334 |
|
335 |
?>
|
336 |
</h2>
|
337 |
-
<form id="reset_settings_form" action="<?php echo esc_url(admin_url( 'admin.php?page=wp-hide')) ?>" method="post"
|
|
|
|
|
338 |
<input type="hidden" name="reset-settings" value="true" />
|
339 |
<?php wp_nonce_field( 'wp-hide-reset-settings', '_wpnonce' ); ?>
|
340 |
|
56 |
}
|
57 |
|
58 |
$this->_load_interface_data();
|
59 |
+
|
60 |
+
$this->_do_pasive_actions();
|
61 |
|
62 |
$this->_generate_interface_html();
|
63 |
|
69 |
|
70 |
$this->interface_data = $this->module->get_interface_data();
|
71 |
}
|
72 |
+
|
73 |
+
|
74 |
+
function _do_pasive_actions()
|
75 |
+
{
|
76 |
+
|
77 |
+
if ( isset ( $_GET['wph_environment'] ) && $_GET['wph_environment'] == 'ignore-rewrite-test' )
|
78 |
+
update_option( 'wph-environment-ignore-rewrite-test', 'false' );
|
79 |
+
|
80 |
+
|
81 |
+
}
|
82 |
|
83 |
function _generate_interface_html()
|
84 |
{
|
91 |
|
92 |
echo $this->functions->get_ad_banner();
|
93 |
|
94 |
+
|
95 |
+
$results = $this->functions->check_server_environment();
|
96 |
|
97 |
+
if ( $results['found_issues'] !== FALSE )
|
98 |
+
{
|
99 |
|
100 |
+
?>
|
101 |
+
<div class="start-container title test <?php if ( $found_issues === TRUE ) { echo ' warning';} ?>">
|
102 |
+
<h2><?php _e( "Checking your environment ..", 'wp-hide-security-enhancer' ) ?></h2>
|
103 |
+
</div>
|
104 |
+
<div class="container-description environment-notices">
|
105 |
+
<?php
|
106 |
+
|
107 |
+
if ( $results['found_issues'] !== FALSE )
|
108 |
+
{
|
109 |
+
echo $results['errors'];
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( $results['critical_issues'] === TRUE )
|
113 |
+
{
|
114 |
+
?>
|
115 |
+
<p class="framed"><span class="dashicons dashicons-warning error"></span> <?php _e('Critical issues were identified on your site, please fix them before proceeding with customizations.', 'wp-hide-security-enhancer') ?></p>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( $results['found_issues'] === FALSE )
|
120 |
+
{
|
121 |
+
?>
|
122 |
+
<p><span class="dashicons dashicons-plugins-checked"></span> <?php _e('No problems have been found on your server environment.', 'wp-hide-security-enhancer') ?></p>
|
123 |
+
<?php
|
124 |
+
}
|
125 |
+
?></div><?php
|
126 |
+
}
|
127 |
+
|
128 |
?>
|
129 |
+
|
130 |
+
<div class="content<?php if( $results['critical_issues'] ) {echo (' disabled');} ?>">
|
131 |
+
|
132 |
+
<?php
|
|
|
|
|
|
|
|
|
133 |
|
134 |
+
if( $this->module->use_tabs === true )
|
135 |
+
$this->_generate_interface_tabs();
|
136 |
+
|
137 |
+
?>
|
138 |
+
|
139 |
+
<div id="poststuff">
|
140 |
+
|
141 |
+
<?php if(!empty($this->interface_data['handle_title'])) { ?>
|
142 |
+
<div class="postbox">
|
143 |
+
<h3 class="handle"><?php echo $this->interface_data['handle_title'] ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
</div>
|
145 |
+
<?php } ?>
|
146 |
+
|
147 |
+
<div class="inside">
|
148 |
+
|
149 |
+
<form method="post" action="">
|
150 |
+
<?php wp_nonce_field( 'wph/interface_fields', 'wph-interface-nonce' ); ?>
|
151 |
+
|
152 |
+
<div class="options">
|
153 |
+
<?php
|
154 |
+
|
155 |
+
foreach($this->module_settings as $module_setting)
|
156 |
+
{
|
157 |
+
$this->_generate_module_html( $module_setting );
|
158 |
+
}
|
159 |
+
|
160 |
+
?>
|
161 |
+
</div>
|
162 |
+
|
163 |
+
<table class="wph_submit widefat">
|
164 |
+
<tbody>
|
165 |
+
<tr class="submit">
|
166 |
+
<td class="label"> </td>
|
167 |
+
<td class="label">
|
168 |
+
<input type="submit" value="<?php _e('Save', 'wp-hide-security-enhancer') ?>" class="button-primary alignright">
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
</tbody>
|
172 |
+
</table>
|
173 |
+
</form>
|
174 |
+
</div>
|
175 |
+
|
176 |
+
</div>
|
177 |
+
</div>
|
178 |
</div>
|
179 |
|
180 |
<?php
|
347 |
<?php
|
348 |
|
349 |
}
|
350 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
function _generate_interface_tabs()
|
353 |
{
|
354 |
|
355 |
?>
|
356 |
+
<h2 class="nav-tab-wrapper<?php
|
357 |
+
if($this->wph->server_htaccess_config === FALSE && $this->wph->server_web_config === FALSE) {echo (' disabled');}
|
358 |
+
?>">
|
359 |
<?php
|
360 |
|
361 |
//output all module components as tabs
|
375 |
|
376 |
?>
|
377 |
</h2>
|
378 |
+
<form id="reset_settings_form" action="<?php echo esc_url(admin_url( 'admin.php?page=wp-hide')) ?>" method="post" <?php
|
379 |
+
if($this->wph->server_htaccess_config === FALSE && $this->wph->server_web_config === FALSE) {echo (' class="disabled"');}
|
380 |
+
?>>
|
381 |
<input type="hidden" name="reset-settings" value="true" />
|
382 |
<?php wp_nonce_field( 'wp-hide-reset-settings', '_wpnonce' ); ?>
|
383 |
|
include/admin-interfaces/notice-cache-path.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e( "Unable to create cache folder at ", 'wp-hide-security-enhancer' ) ?><?php echo WPH_CACHE_PATH ?><?php _e( " Is the folder writable? No cache data will be available.", 'wp-hide-security-enhancer' ) ?></p>
|
include/admin-interfaces/notice-is-litespeed.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e( "Your site runs on LiteSpeed ! Before starting, ensure your server is properly configured and it processes the .htaccess file, or there might be layout and functionality breaks.", 'wp-hide-security-enhancer' ) ?> <?php _e( "For more details check at", 'wp-hide-security-enhancer' ) ?> <a target="_blank" href="https://www.wp-hide.com/setup-wp-hide-on-litespeed/">Setup WP Hide on LiteSpeed</a></p>
|
include/admin-interfaces/notice-is-wpengine.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span><?php _e("Your server run on WPEngine which works on Nginx rewrite rules, the current version can't create the required rewrite data, please check with WP Hide ", 'wp-hide-security-enhancer') ?> <span class="wph-pro">PRO</span></p>
|
include/admin-interfaces/notice-is_multisite.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e("This plugin version can't handle MultiSite environment and may fail to provide specific features, please check with WP Hide PRO at", 'wp-hide-security-enhancer') ?> <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p>
|
6 |
+
|
include/admin-interfaces/notice-mu-loader-update.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e( "Unable to update /wp-content/mu-plugins/wp-hide-loader.php. Please make sure /wp-content/mu-plugins/ is writable so the plugin updates the required file.", 'wp-hide-security-enhancer' ) ?></p>
|
include/admin-interfaces/notice-mu-loader.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e( "Unable to launch WP Hide through /wp-content/mu-plugins/wp-hide-loader.php. Please make sure /wp-content/mu-plugins/ is writable so the plugin creates the required file.", 'wp-hide-security-enhancer' ) ?></p>
|
include/admin-interfaces/notice-no-permalinks.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e("Permalink is required to be turned ON at Settings > Permalinks, for WP Hide & Security Enhancer to work", 'wp-hide-security-enhancer') ?></p>
|
include/admin-interfaces/notice-rewrite-test.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
<?php
|
5 |
+
|
6 |
+
if ( $result === FALSE )
|
7 |
+
{
|
8 |
+
?>
|
9 |
+
<p><span class="dashicons dashicons-flag error"></span><b><?php _e("Rewrite test failed! ", 'wp-hide-security-enhancer') ?></b> <?php _e("Ensure the rewrites are active for your server.", 'wp-hide-security-enhancer') ?>.</p>
|
10 |
+
<?php
|
11 |
+
}
|
12 |
+
else
|
13 |
+
{
|
14 |
+
?>
|
15 |
+
<p><span class="dashicons dashicons-flag error"></span><b><?php _e("Rewrite test failed! ", 'wp-hide-security-enhancer') ?></b> <?php echo $result ?></p>
|
16 |
+
<?php
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
?>
|
include/admin-interfaces/notice-server-not-supported.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><span class="dashicons dashicons-flag error"></span> <?php _e( "Your site runs on a server type which the current version can't create the required rewrite data, please check with", 'wp-hide-security-enhancer' ) ?> <span class="wph-pro">PRO</span> <?php _e( "version at", 'wp-hide-security-enhancer' ) ?> <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a>
|
6 |
+
<br /><?php _e( "This basic version can work with Apache, LiteSpeed, IIS, Nginx set as reverse proxy for Apache, your site runs", 'wp-hide-security-enhancer' ) ?> <b><?php echo $_SERVER['SERVER_SOFTWARE'] ?></b></p>
|
include/admin-interfaces/notice-write-check.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p>
|
6 |
+
<span class="dashicons dashicons-flag error"></span><?php _e("Unable to write/update required rewrite rules to your site", 'wp-hide-security-enhancer') ?> <?php echo $rewrite_file_type ?>. <?php _e('Is this file writable? Until fixed, no changes are applied on the front side.', 'wp-hide-security-enhancer') ?>
|
7 |
+
<br /><?php _e("Try to go at Settings > Permalinks and save once, the core will attempt to update the required rewrites. If the problem persists, check with your host support on the correct file write permission.", 'wp-hide-security-enhancer') ?>
|
8 |
+
</p>
|
include/admin-interfaces/setup.class.php
CHANGED
@@ -17,7 +17,8 @@
|
|
17 |
$this->functions = new WPH_functions();
|
18 |
|
19 |
add_action( 'admin_init', array ( $this, 'run_sample_setup') );
|
20 |
-
add_action( '
|
|
|
21 |
|
22 |
}
|
23 |
|
@@ -63,6 +64,14 @@
|
|
63 |
}
|
64 |
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
function run_sample_setup()
|
67 |
{
|
68 |
if ( ! isset ( $_POST['wph-run-sample-setup'] ) )
|
@@ -140,77 +149,70 @@
|
|
140 |
|
141 |
<?php
|
142 |
|
143 |
-
if($
|
144 |
{
|
145 |
?>
|
146 |
-
<div class="start-container title
|
147 |
-
<h2><?php _e( "
|
148 |
</div>
|
149 |
<div class="container-description">
|
150 |
-
<p><?php _e( "
|
151 |
-
<p><?php _e( "
|
152 |
</div>
|
153 |
|
154 |
-
|
155 |
<?php
|
156 |
}
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
169 |
}
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
{
|
174 |
?>
|
175 |
-
|
176 |
-
<h2><?php _e( "System notice !", 'wp-hide-security-enhancer' ) ?></h2>
|
177 |
-
</div>
|
178 |
-
<div class="container-description">
|
179 |
-
<p><?php _e( "Your site runs on LiteSpeed ! Before starting, ensure your server is properly configured and it processes the .htaccess file properly, or there might be layout and functionality breaks.", 'wp-hide-security-enhancer' ) ?> <?php _e( "For more details check at", 'wp-hide-security-enhancer' ) ?> <a target="_blank" href="https://www.wp-hide.com/setup-wp-hide-on-litespeed/">Setup WP Hide on LiteSpeed</a></p>
|
180 |
-
</div>
|
181 |
<?php
|
182 |
}
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
{
|
187 |
?>
|
188 |
-
|
189 |
-
<h2><?php _e( "Sample Setup deployed !", 'wp-hide-security-enhancer' ) ?></h2>
|
190 |
-
</div>
|
191 |
-
<div class="container-description">
|
192 |
-
<p><?php _e( "A basic plugin set-up has been deployed, to get you started. A site cache clear is required to ensure the updates are reflected on the front side", 'wp-hide-security-enhancer' ) ?>. </p>
|
193 |
-
<p><?php _e( "Check with the front side to ensure everything is working. Further adjustments to other options are recommended", 'wp-hide-security-enhancer' ) ?>. </p>
|
194 |
-
</div>
|
195 |
-
|
196 |
-
<p><br /><br /><br /></p>
|
197 |
<?php
|
198 |
}
|
199 |
-
|
200 |
?>
|
201 |
-
|
202 |
<div class="start-container title">
|
203 |
<h2><?php _e( "Getting Started", 'wp-hide-security-enhancer' ) ?></h2>
|
204 |
</div>
|
205 |
<div class="container-description">
|
206 |
<p><b>WP Hide & Security Enhancer</b> <?php _e( "plugin helps to hide your WordPress, theme, and plugins", 'wp-hide-security-enhancer' ) ?>. <?php _e( "This improves the site security as hackers' boots can't exploit the vulnerabilities of your site, as not being aware of the user code", 'wp-hide-security-enhancer' ) ?>. <?php _e( "Daily, more vulnerabilities are found", 'wp-hide-security-enhancer' ) ?> <a href="https://wpvulndb.com/" target="_blank">WPVulndb.com/</a>, <?php _e( "but using WP Hide & Security Enhancer you will be perfectly safe", 'wp-hide-security-enhancer' ) ?> !</p>
|
207 |
|
208 |
-
</div>
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
<h2><?php _e( "Basic functionality", 'wp-hide-security-enhancer' ) ?></h2>
|
211 |
</div>
|
212 |
<div class="container-description">
|
213 |
-
<p><?php _e( "The basic principle of the plugin is to change default assets URLs, remove or change specific HTML elements, and disable unused services. This isn't
|
214 |
|
215 |
<p><?php _e( "A default directory structure for WordPress appears like this on outputted HTML", 'wp-hide-security-enhancer' ) ?>:<br />
|
216 |
https://--domain--<span class="highlight">/wp-includes/</span>css/dashicons.min.css or https://--domain--<span class="highlight">/wp-content/</span>themes/pub/wporg-plugins/css/style.css
|
@@ -224,7 +226,7 @@
|
|
224 |
|
225 |
</div>
|
226 |
|
227 |
-
<div class="start-container title">
|
228 |
<h2><?php _e( "Sample setup", 'wp-hide-security-enhancer' ) ?></h2>
|
229 |
</div>
|
230 |
<div class="container-description">
|
@@ -235,10 +237,9 @@
|
|
235 |
<input type="hidden" name="wph-run-sample-setup" value="true" />
|
236 |
<input type="hidden" name="wph-run-sample-setup-nonce" value="<?php echo wp_create_nonce( 'wph-run-sample-setup' ) ?>" />
|
237 |
</form>
|
238 |
-
</div>
|
239 |
-
|
240 |
-
<p><br /></p>
|
241 |
|
|
|
242 |
<div class="start-container">
|
243 |
<div class="text">
|
244 |
|
17 |
$this->functions = new WPH_functions();
|
18 |
|
19 |
add_action( 'admin_init', array ( $this, 'run_sample_setup') );
|
20 |
+
add_action( 'admin_init', array ( $this, 'pasive_actions') );
|
21 |
+
add_action( 'admin_notice', array ( $this, 'admin_notices' ) );
|
22 |
|
23 |
}
|
24 |
|
64 |
}
|
65 |
|
66 |
|
67 |
+
function pasive_actions()
|
68 |
+
{
|
69 |
+
|
70 |
+
if ( isset ( $_GET['wph_environment'] ) && $_GET['wph_environment'] == 'ignore-rewrite-test' )
|
71 |
+
update_option( 'wph-environment-ignore-rewrite-test', 'false' );
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
function run_sample_setup()
|
76 |
{
|
77 |
if ( ! isset ( $_POST['wph-run-sample-setup'] ) )
|
149 |
|
150 |
<?php
|
151 |
|
152 |
+
if( isset( $_GET['sample-setup-completed'] ) && $_GET['sample-setup-completed'] == 'true' )
|
153 |
{
|
154 |
?>
|
155 |
+
<div class="start-container title success">
|
156 |
+
<h2><?php _e( "Sample Setup deployed !", 'wp-hide-security-enhancer' ) ?></h2>
|
157 |
</div>
|
158 |
<div class="container-description">
|
159 |
+
<p><?php _e( "A basic plugin set-up has been deployed, to get you started. A site cache clear is required to ensure the updates are reflected on the front side", 'wp-hide-security-enhancer' ) ?>. </p>
|
160 |
+
<p><?php _e( "Check with the front side to ensure everything is working. Further adjustments to other options are recommended", 'wp-hide-security-enhancer' ) ?>. </p>
|
161 |
</div>
|
162 |
|
163 |
+
<p><br /><br /><br /></p>
|
164 |
<?php
|
165 |
}
|
166 |
+
|
167 |
+
$results = $this->functions->check_server_environment();
|
168 |
+
|
169 |
+
?>
|
170 |
+
<div class="start-container title test <?php if ( $found_issues === TRUE ) { echo ' warning';} ?>">
|
171 |
+
<h2><?php _e( "Checking your environment ..", 'wp-hide-security-enhancer' ) ?></h2>
|
172 |
+
</div>
|
173 |
+
<div class="container-description environment-notices">
|
174 |
+
<?php
|
175 |
+
|
176 |
+
if ( $results['found_issues'] !== FALSE )
|
177 |
+
{
|
178 |
+
echo $results['errors'];
|
179 |
}
|
180 |
+
|
181 |
+
if ( $results['critical_issues'] === TRUE )
|
182 |
+
{
|
|
|
183 |
?>
|
184 |
+
<p class="framed"><span class="dashicons dashicons-warning error"></span> <?php _e('Critical issues were identified on your site, please fix them before proceeding with customizations.', 'wp-hide-security-enhancer') ?></p>
|
|
|
|
|
|
|
|
|
|
|
185 |
<?php
|
186 |
}
|
187 |
+
|
188 |
+
if ( $results['found_issues'] === FALSE )
|
189 |
+
{
|
|
|
190 |
?>
|
191 |
+
<p><span class="dashicons dashicons-plugins-checked"></span> <?php _e('No problems have been found on your server environment.', 'wp-hide-security-enhancer') ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
<?php
|
193 |
}
|
|
|
194 |
?>
|
195 |
+
</div>
|
196 |
<div class="start-container title">
|
197 |
<h2><?php _e( "Getting Started", 'wp-hide-security-enhancer' ) ?></h2>
|
198 |
</div>
|
199 |
<div class="container-description">
|
200 |
<p><b>WP Hide & Security Enhancer</b> <?php _e( "plugin helps to hide your WordPress, theme, and plugins", 'wp-hide-security-enhancer' ) ?>. <?php _e( "This improves the site security as hackers' boots can't exploit the vulnerabilities of your site, as not being aware of the user code", 'wp-hide-security-enhancer' ) ?>. <?php _e( "Daily, more vulnerabilities are found", 'wp-hide-security-enhancer' ) ?> <a href="https://wpvulndb.com/" target="_blank">WPVulndb.com/</a>, <?php _e( "but using WP Hide & Security Enhancer you will be perfectly safe", 'wp-hide-security-enhancer' ) ?> !</p>
|
201 |
|
202 |
+
</div>
|
203 |
+
|
204 |
+
<div class="start-container title help">
|
205 |
+
<h2><?php _e( "Recovery", 'wp-hide-security-enhancer' ) ?></h2>
|
206 |
+
</div>
|
207 |
+
<div class="container-description">
|
208 |
+
<?php $this->functions->show_recovery() ?>
|
209 |
+
</div>
|
210 |
+
|
211 |
+
<div class="start-container title info">
|
212 |
<h2><?php _e( "Basic functionality", 'wp-hide-security-enhancer' ) ?></h2>
|
213 |
</div>
|
214 |
<div class="container-description">
|
215 |
+
<p><?php _e( "The basic principle of the plugin is to change default assets URLs, remove or change specific HTML elements, and disable unused services. This makes WordPress unrecognizable. The process isn't automated, so it needs to be done manually while getting feedback on the front side to ensure everything is still functional. No file and directory are being changed anywhere, everything is processed on the fly using output buffering and filters", 'wp-hide-security-enhancer' ) ?>..</p>
|
216 |
|
217 |
<p><?php _e( "A default directory structure for WordPress appears like this on outputted HTML", 'wp-hide-security-enhancer' ) ?>:<br />
|
218 |
https://--domain--<span class="highlight">/wp-includes/</span>css/dashicons.min.css or https://--domain--<span class="highlight">/wp-content/</span>themes/pub/wporg-plugins/css/style.css
|
226 |
|
227 |
</div>
|
228 |
|
229 |
+
<div class="start-container title setup">
|
230 |
<h2><?php _e( "Sample setup", 'wp-hide-security-enhancer' ) ?></h2>
|
231 |
</div>
|
232 |
<div class="container-description">
|
237 |
<input type="hidden" name="wph-run-sample-setup" value="true" />
|
238 |
<input type="hidden" name="wph-run-sample-setup-nonce" value="<?php echo wp_create_nonce( 'wph-run-sample-setup' ) ?>" />
|
239 |
</form>
|
240 |
+
</div>
|
|
|
|
|
241 |
|
242 |
+
|
243 |
<div class="start-container">
|
244 |
<div class="text">
|
245 |
|
include/functions.class.php
CHANGED
@@ -162,6 +162,9 @@
|
|
162 |
}
|
163 |
|
164 |
}
|
|
|
|
|
|
|
165 |
|
166 |
$unique_require_updated_settings = array();
|
167 |
|
@@ -553,13 +556,13 @@
|
|
553 |
|
554 |
|
555 |
|
556 |
-
|
557 |
* Set server type
|
558 |
*
|
559 |
*/
|
560 |
function set_server_type()
|
561 |
{
|
562 |
-
|
563 |
//Allow to set server type through filter
|
564 |
if ( ! empty ( apply_filters( 'wph/core/set_server_type' , '' ) ) )
|
565 |
return;
|
@@ -823,6 +826,113 @@
|
|
823 |
}
|
824 |
|
825 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
826 |
|
827 |
function get_write_check_string()
|
828 |
{
|
@@ -892,15 +1002,153 @@
|
|
892 |
{
|
893 |
$status = TRUE;
|
894 |
|
895 |
-
if(isset($this->wph->settings['write_check_string']) && !empty($this->wph->settings['write_check_string']))
|
896 |
{
|
897 |
$_write_check_string = $this->get_write_check_string();
|
898 |
-
if(empty($_write_check_string) || $_write_check_string != $this->wph->settings['write_check_string'])
|
899 |
$status = FALSE;
|
900 |
}
|
901 |
|
902 |
return $status;
|
903 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
|
905 |
|
906 |
/**
|
@@ -1829,45 +2077,7 @@
|
|
1829 |
|
1830 |
die();
|
1831 |
}
|
1832 |
-
|
1833 |
-
|
1834 |
-
/**
|
1835 |
-
* Check if filter / action exists for anonymous object
|
1836 |
-
*
|
1837 |
-
* @param mixed $tag
|
1838 |
-
* @param mixed $class
|
1839 |
-
* @param mixed $method
|
1840 |
-
*/
|
1841 |
-
function anonymous_object_filter_exists($tag, $class, $method)
|
1842 |
-
{
|
1843 |
-
if ( ! isset( $GLOBALS['wp_filter'][$tag] ) )
|
1844 |
-
return FALSE;
|
1845 |
-
|
1846 |
-
$filters = $GLOBALS['wp_filter'][$tag];
|
1847 |
-
|
1848 |
-
if ( ! $filters )
|
1849 |
-
return FALSE;
|
1850 |
-
|
1851 |
-
foreach ( $filters as $priority => $filter )
|
1852 |
-
{
|
1853 |
-
foreach ( $filter as $identifier => $function )
|
1854 |
-
{
|
1855 |
-
if ( ! is_array( $function ) )
|
1856 |
-
continue;
|
1857 |
-
|
1858 |
-
if ( ! $function['function'][0] instanceof $class )
|
1859 |
-
continue;
|
1860 |
-
|
1861 |
-
if ( $method == $function['function'][1] )
|
1862 |
-
{
|
1863 |
-
return TRUE;
|
1864 |
-
}
|
1865 |
-
}
|
1866 |
-
}
|
1867 |
|
1868 |
-
return FALSE;
|
1869 |
-
}
|
1870 |
-
|
1871 |
/**
|
1872 |
* Replace a filter / action from anonymous object
|
1873 |
*
|
162 |
}
|
163 |
|
164 |
}
|
165 |
+
|
166 |
+
//clean the environment ignore errors
|
167 |
+
delete_option( 'wph-environment-ignore-rewrite-test' );
|
168 |
|
169 |
$unique_require_updated_settings = array();
|
170 |
|
556 |
|
557 |
|
558 |
|
559 |
+
/**
|
560 |
* Set server type
|
561 |
*
|
562 |
*/
|
563 |
function set_server_type()
|
564 |
{
|
565 |
+
|
566 |
//Allow to set server type through filter
|
567 |
if ( ! empty ( apply_filters( 'wph/core/set_server_type' , '' ) ) )
|
568 |
return;
|
826 |
}
|
827 |
|
828 |
|
829 |
+
|
830 |
+
/**
|
831 |
+
* Return a list of the issues found on the server
|
832 |
+
*
|
833 |
+
*/
|
834 |
+
function check_server_environment()
|
835 |
+
{
|
836 |
+
|
837 |
+
$results = array(
|
838 |
+
'found_issues' => FALSE,
|
839 |
+
'critical_issues' => FALSE,
|
840 |
+
'errors' => array(),
|
841 |
+
);
|
842 |
+
|
843 |
+
ob_start();
|
844 |
+
|
845 |
+
if( $this->wph->server_htaccess_config === FALSE && $this->wph->server_web_config === FALSE)
|
846 |
+
{
|
847 |
+
$results['found_issues'] = TRUE;
|
848 |
+
$results['critical_issues'] = TRUE;
|
849 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-server-not-supported.php' );
|
850 |
+
}
|
851 |
+
|
852 |
+
if ( is_multisite() )
|
853 |
+
{
|
854 |
+
$results['found_issues'] = TRUE;
|
855 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-is_multisite.php' );
|
856 |
+
}
|
857 |
+
|
858 |
+
if( $this->is_litespeed() === TRUE )
|
859 |
+
{
|
860 |
+
$results['found_issues'] = TRUE;
|
861 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-is-litespeed.php' );
|
862 |
+
}
|
863 |
+
|
864 |
+
if ( ! $this->is_permalink_enabled())
|
865 |
+
{
|
866 |
+
$results['found_issues'] = TRUE;
|
867 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-no-permalinks.php' );
|
868 |
+
}
|
869 |
+
|
870 |
+
if ( empty ( get_option ( 'wph-environment-ignore-rewrite-test' ) ) )
|
871 |
+
{
|
872 |
+
$result = $this->test_sample_rewrite( );
|
873 |
+
if ( $result === FALSE || ! is_bool( $result ) )
|
874 |
+
{
|
875 |
+
$results['found_issues'] = TRUE;
|
876 |
+
$results['critical_issues'] = TRUE;
|
877 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-rewrite-test.php' );
|
878 |
+
}
|
879 |
+
}
|
880 |
+
|
881 |
+
//check if the htaccess file is not writable
|
882 |
+
if( ! $this->rewrite_rules_applied() && ( $this->wph->server_htaccess_config === TRUE || $this->wph->server_web_config === TRUE ) )
|
883 |
+
{
|
884 |
+
$results['found_issues'] = TRUE;
|
885 |
+
$results['critical_issues'] = TRUE;
|
886 |
+
$rewrite_file_type = '';
|
887 |
+
if( $this->wph->server_htaccess_config === TRUE )
|
888 |
+
$rewrite_file_type = '.htaccess';
|
889 |
+
|
890 |
+
if( $this->wph->server_web_config === TRUE )
|
891 |
+
$rewrite_file_type = 'web.config';
|
892 |
+
|
893 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-write-check.php' );
|
894 |
+
}
|
895 |
+
|
896 |
+
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
897 |
+
{
|
898 |
+
$results['found_issues'] = TRUE;
|
899 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-is-wpengine.php' );
|
900 |
+
}
|
901 |
+
|
902 |
+
if( ! $this->is_muloader())
|
903 |
+
{
|
904 |
+
$results['found_issues'] = TRUE;
|
905 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-mu-loader.php' );
|
906 |
+
}
|
907 |
+
if( $this->is_muloader() && defined( 'WPH_MULOADER_VERSION' ) && version_compare( WPH_MULOADER_VERSION, '1.3.5', '<' ) && ! isset( $this->wph->maintenances['mu_loader'] ) )
|
908 |
+
{
|
909 |
+
$results['found_issues'] = TRUE;
|
910 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-mu-loader-update.php' );
|
911 |
+
}
|
912 |
+
|
913 |
+
if( ! is_writable( WPH_CACHE_PATH ))
|
914 |
+
{
|
915 |
+
$results['found_issues'] = TRUE;
|
916 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-cache-path.php' );
|
917 |
+
}
|
918 |
+
|
919 |
+
$errors = ob_get_clean();
|
920 |
+
|
921 |
+
$results['errors'] = $errors;
|
922 |
+
|
923 |
+
return $results;
|
924 |
+
|
925 |
+
}
|
926 |
+
|
927 |
+
|
928 |
+
function show_recovery()
|
929 |
+
{
|
930 |
+
?>
|
931 |
+
<p class="important framed"><span class="dashicons dashicons-warning important" alt="f534"></span> <?php _e('Copy the following link to a safe place. You can use it later to reset all plugin options if something goes wrong or lost the new login URL.', 'wp-hide-security-enhancer') ?> <b><span id="wph-recovery-link" onClick="WPH.selectText( 'wph-recovery-link' )"><?php echo site_url() ?>?wph-recovery=<?php echo $this->get_recovery_code() ?></span></b></p>
|
932 |
+
<?php
|
933 |
+
|
934 |
+
}
|
935 |
+
|
936 |
|
937 |
function get_write_check_string()
|
938 |
{
|
1002 |
{
|
1003 |
$status = TRUE;
|
1004 |
|
1005 |
+
if( isset($this->wph->settings['write_check_string'] ) && ! empty( $this->wph->settings['write_check_string'] ) )
|
1006 |
{
|
1007 |
$_write_check_string = $this->get_write_check_string();
|
1008 |
+
if( empty( $_write_check_string ) || $_write_check_string != $this->wph->settings['write_check_string'])
|
1009 |
$status = FALSE;
|
1010 |
}
|
1011 |
|
1012 |
return $status;
|
1013 |
}
|
1014 |
+
|
1015 |
+
|
1016 |
+
|
1017 |
+
/**
|
1018 |
+
* Try to access a specific sample url to test the rewritea functinality
|
1019 |
+
*
|
1020 |
+
*/
|
1021 |
+
function test_sample_rewrite( )
|
1022 |
+
{
|
1023 |
+
|
1024 |
+
if( ! isset( $this->wph->settings['write_check_string'] ) || empty( $this->wph->settings['write_check_string'] ) )
|
1025 |
+
return TRUE;
|
1026 |
+
|
1027 |
+
$test_url = apply_filters( 'wp-hide/test_sample_rewrite/url', trailingslashit ( site_url() ) . 'rewrite_test_' . $this->wph->settings['write_check_string'] . '/' );
|
1028 |
+
$response = wp_remote_get( $test_url );
|
1029 |
+
|
1030 |
+
$response_message = '';
|
1031 |
+
$messages['manual_check'] = __( "Make a fix or manually check the ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a></b>, '. __( "if the result is a JSON response (contains a name and description), the rewrites are working correctly on your site and you can", 'wp-hide-security-enhancer' ) .' <a href="' . $this->get_current_url() . '&wph_environment=ignore-rewrite-test">' . __( "Ignore", 'wp-hide-security-enhancer' ) . '</a> ' . __( "this notification", 'wp-hide-security-enhancer' ) .'<br />';
|
1032 |
+
$messages['manual_check'] .= __( "Sample result, can be different from a browser to another:", 'wp-hide-security-enhancer' ) . '<br /><img src="' . WPH_URL . '/assets/images/rewrite-test-json-response.jpg" /><br />';
|
1033 |
+
$messages['manual_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br /><br />';
|
1034 |
+
$messages['manual_check'] .= __( "If the Test URL is not functional, the plugin will fail to provide specific features. Check your Hosting provider for more details regarding rewrites and how to activate on your account.", 'wp-hide-security-enhancer' ) . '<br />';
|
1035 |
+
|
1036 |
+
if ( is_array( $response ) )
|
1037 |
+
{
|
1038 |
+
|
1039 |
+
if ( ! isset( $response['response']['code'] ) )
|
1040 |
+
return __( "The wp_remote_get() returns invalid Response Code", 'wp-hide-security-enhancer' );
|
1041 |
+
|
1042 |
+
if ( $response['response']['code'] != 200 )
|
1043 |
+
{
|
1044 |
+
if ( $response['response']['code'] == 404 )
|
1045 |
+
{
|
1046 |
+
$home_path = $this->get_home_path();
|
1047 |
+
|
1048 |
+
//check if the .htaccess file include the test rewrite
|
1049 |
+
if ( $this->wph->server_htaccess_config === TRUE )
|
1050 |
+
{
|
1051 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . '.htaccess';
|
1052 |
+
if( ! file_exists( $file_path ) )
|
1053 |
+
{
|
1054 |
+
return __( "The .htaccess file does not appears to exists on the server. To fix, go to Settings > Permalinks and save once.", 'wp-hide-security-enhancer' );
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1058 |
+
{
|
1059 |
+
$response_message = __( "The test rewrite does not exist.", 'wp-hide-security-enhancer' ) . ' ' . __("To fix go to Settings > Permalinks and save once, the core will attempt to update the required rewrites. If the problem persists, check with your host support on the correct .htaccess file write permission.", 'wp-hide-security-enhancer');
|
1060 |
+
|
1061 |
+
return $response_message;
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
//check for web.config
|
1066 |
+
if ( $this->wph->server_web_config === TRUE )
|
1067 |
+
{
|
1068 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . 'web.config';
|
1069 |
+
if( ! file_exists( $file_path ) )
|
1070 |
+
return __( "The wp_remote_get() returns a Not Found page, the web.config file does not appears to exists on the server. To fix, go to Settings > Permalinks and save once.", 'wp-hide-security-enhancer' );
|
1071 |
+
|
1072 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1073 |
+
return __( "The wp_remote_get() returns a Not Found page, the test rewrite does not exist. To fix, go to Settings > Permalinks and save once. This can occour if you updated from an old plugin version. ", 'wp-hide-security-enhancer' );
|
1074 |
+
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
$response_message = __( "The wp_remote_get() returns a Not Found page, probably the Rewrites are not active on your server!", 'wp-hide-security-enhancer' );
|
1078 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1079 |
+
|
1080 |
+
return $response_message;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
if ( $response['response']['code'] == 401 )
|
1084 |
+
{
|
1085 |
+
$response_message = __( "The wp_remote_get() returns a 401 error code, the request could not be authenticated. Does the site use an httpd password?", 'wp-hide-security-enhancer' );
|
1086 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1087 |
+
|
1088 |
+
return $response_message;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
if ( ! empty ($response['response']['code'] ) )
|
1092 |
+
{
|
1093 |
+
$response_message = __( "The wp_remote_get() returns a", 'wp-hide-security-enhancer' ) . " " . $response['response']['code'] . " " . __( "error code", 'wp-hide-security-enhancer' );
|
1094 |
+
if ( ! empty ($response['response']['message'] ) )
|
1095 |
+
$response_message .= ":" . $response['response']['message'];
|
1096 |
+
|
1097 |
+
return $response_message;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
return __( "Unespected error code for wp_remote_get() call.", 'wp-hide-security-enhancer' );
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
$body = json_decode( $response['body'] );
|
1104 |
+
if ( $body === null || !isset( $body->name ) )
|
1105 |
+
return __( "The wp_remote_get() returns an invalid JSON data, probably the server blocks custom rewrites.", 'wp-hide-security-enhancer' );
|
1106 |
+
|
1107 |
+
|
1108 |
+
return TRUE;
|
1109 |
+
|
1110 |
+
}
|
1111 |
+
else if ( is_a( $response, 'WP_Error' ))
|
1112 |
+
{
|
1113 |
+
$response_message = $response->get_error_message();
|
1114 |
+
|
1115 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1116 |
+
|
1117 |
+
return $response_message;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
return FALSE;
|
1121 |
+
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
|
1125 |
+
|
1126 |
+
/**
|
1127 |
+
* Check a file for a specific marker
|
1128 |
+
*
|
1129 |
+
* @param mixed $file_path
|
1130 |
+
* @param mixed $marker
|
1131 |
+
*/
|
1132 |
+
function file_check_for_marker( $file_path, $marker )
|
1133 |
+
{
|
1134 |
+
|
1135 |
+
if ( ! file_exists ( $file_path ) )
|
1136 |
+
return FALSE;
|
1137 |
+
|
1138 |
+
$markerdata = explode( "\n", implode( '', file( $file_path ) ) );
|
1139 |
+
|
1140 |
+
if ( ! $markerdata );
|
1141 |
+
return FALSE;
|
1142 |
+
|
1143 |
+
foreach ( $markerdata as $markerline )
|
1144 |
+
{
|
1145 |
+
if (strpos($markerline, $marker) !== false)
|
1146 |
+
return TRUE;
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
return FALSE;
|
1150 |
+
|
1151 |
+
}
|
1152 |
|
1153 |
|
1154 |
/**
|
2077 |
|
2078 |
die();
|
2079 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2080 |
|
|
|
|
|
|
|
2081 |
/**
|
2082 |
* Replace a filter / action from anonymous object
|
2083 |
*
|
include/rewrite-confirm.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?PHP
|
2 |
+
|
3 |
+
header('Content-Type: application/json');
|
4 |
+
|
5 |
+
$data = array(
|
6 |
+
"name" => "nsp-code/wp-hide",
|
7 |
+
"description" => "Hide your WordPress and increase Security for your site using smart techniques. No files are changed on your server. Change default WordPress files URLs and login url.",
|
8 |
+
|
9 |
+
);
|
10 |
+
|
11 |
+
echo json_encode($data);
|
include/wph.class.php
CHANGED
@@ -272,6 +272,9 @@
|
|
272 |
}
|
273 |
|
274 |
}
|
|
|
|
|
|
|
275 |
|
276 |
}
|
277 |
|
@@ -398,67 +401,64 @@
|
|
398 |
|
399 |
do_action('wp-hide/admin_notices');
|
400 |
|
401 |
-
|
402 |
-
{
|
403 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __("Your server run on WPEngine which works on Nginx rewrite rules, please check with WP Hide PRO at", 'wp-hide-security-enhancer') .' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
|
404 |
-
}
|
405 |
-
|
406 |
-
if ( is_multisite() )
|
407 |
-
{
|
408 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __("This plugin version can't handle MultiSite environment and will fail to provide specific features, please check with WP Hide PRO version at", 'wp-hide-security-enhancer') . ' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
|
409 |
-
}
|
410 |
-
|
411 |
-
if(! $this->functions->is_muloader())
|
412 |
-
{
|
413 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __('Unable to launch WP Hide through mu-plugins/wp-hide-loader.php<br /> Please make sure this location is writable so the plugin create the required file.', 'wp-hide-security-enhancer') ."</p></div>";
|
414 |
-
}
|
415 |
-
|
416 |
-
//check if mu loader is up to date
|
417 |
-
if( $this->functions->is_muloader() && defined( 'WPH_MULOADER_VERSION' ) && version_compare( WPH_MULOADER_VERSION, '1.3.5', '<' ) && !isset($this->maintenances['mu_loader']) )
|
418 |
-
{
|
419 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __('Unable to update the /mu-plugins/wp-hide-loader.php<br /> Please make sure the file is writable so the plugin create the required file.', 'wp-hide-security-enhancer') ."</p></div>";
|
420 |
-
}
|
421 |
-
|
422 |
-
//check if the MU loader was succesfully updated
|
423 |
-
if( $this->functions->is_muloader() && defined( 'WPH_MULOADER_VERSION' ) && version_compare( WPH_MULOADER_VERSION, '1.3.5', '<' ))
|
424 |
-
{
|
425 |
-
//attempt to copy the new version
|
426 |
-
$status = WPH_functions::copy_mu_loader();
|
427 |
-
if ( $status === FALSE )
|
428 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __('Unable to update the <b>mu-plugins/wp-hide-loader.php</b><br /> Please manually copy the file from', 'wp-hide-security-enhancer') ." " . WPH_PATH . 'router/wp-hide-loader.php ' . __('to', 'wp-hide-security-enhancer') . " " . WPMU_PLUGIN_DIR ."/</p></div>";
|
429 |
-
}
|
430 |
|
431 |
-
|
432 |
-
if (!$this->functions->is_permalink_enabled())
|
433 |
{
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
//check if the htaccess file is not writable
|
444 |
-
if(isset($this->settings['write_check_string']) && !empty($this->settings['write_check_string']))
|
445 |
-
{
|
446 |
-
$_write_check_string = $this->functions->get_write_check_string();
|
447 |
-
if(empty($_write_check_string) || $_write_check_string != $this->settings['write_check_string'])
|
448 |
{
|
449 |
-
|
450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
-
|
453 |
-
echo "<div class='error'><p><b>WP Hide</b> ". __('Unable to write custom rules to your web.config. Is this file writable? <br />No changes are being applied.', 'wp-hide-security-enhancer') ."</p></div>";
|
454 |
}
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
}
|
463 |
|
464 |
if(isset($_GET['reset_settings']))
|
@@ -771,6 +771,8 @@
|
|
771 |
*/
|
772 |
function activated_plugin($plugin, $network_wide)
|
773 |
{
|
|
|
|
|
774 |
if($network_wide)
|
775 |
{
|
776 |
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
@@ -922,10 +924,17 @@
|
|
922 |
if($this->uninstall === TRUE)
|
923 |
return $rules;
|
924 |
|
925 |
-
$write_check_string = isset($this->settings['write_check_string']) ? $this->settings['write_check_string'] : '';
|
926 |
|
927 |
if ( empty ( $write_check_string ) )
|
928 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
|
930 |
$processing_data = $this->get_components_rules();
|
931 |
|
@@ -944,7 +953,12 @@
|
|
944 |
}
|
945 |
|
946 |
$rules .= "#WriteCheckString:" . $write_check_string . "\n";
|
947 |
-
$rules .= "RewriteRule .* - [E=HTTP_MOD_REWRITE:On]";
|
|
|
|
|
|
|
|
|
|
|
948 |
|
949 |
if(count($_rewrite_data) > 0)
|
950 |
{
|
@@ -1121,15 +1135,22 @@
|
|
1121 |
$_page_refresh = TRUE;
|
1122 |
}
|
1123 |
|
1124 |
-
$write_check_string
|
1125 |
-
|
1126 |
-
$this->functions->
|
|
|
1127 |
|
1128 |
//add a write stricng
|
1129 |
$_writestring_rule = '
|
1130 |
<rule name="wph-CheckString">
|
1131 |
<!-- WriteCheckString:'. $write_check_string .' -->
|
1132 |
-
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
1133 |
array_unshift($_rewrite_data, $_writestring_rule);
|
1134 |
|
1135 |
$this->iis7_add_rewrite_rule( $_rewrite_data, $web_config_file );
|
272 |
}
|
273 |
|
274 |
}
|
275 |
+
|
276 |
+
|
277 |
+
do_action( 'wp-hide/modules_components_run/completed' );
|
278 |
|
279 |
}
|
280 |
|
401 |
|
402 |
do_action('wp-hide/admin_notices');
|
403 |
|
404 |
+
$screen = get_current_screen();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
+
if ( $screen->parent_base != 'wp-hide' )
|
|
|
407 |
{
|
408 |
+
|
409 |
+
if( $this->functions->server_htaccess_config === FALSE && $this->functions->server_web_config === FALSE)
|
410 |
+
{
|
411 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-server-not-supported.php' );?></div><?php
|
412 |
+
}
|
413 |
+
|
414 |
+
if ( is_multisite() )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
{
|
416 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-is_multisite.php' );?></div><?php
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( ! $this->functions->is_permalink_enabled())
|
420 |
+
{
|
421 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-no-permalinks.php' );?></div><?php
|
422 |
+
}
|
423 |
+
|
424 |
+
|
425 |
+
if( ! $this->functions->rewrite_rules_applied() && ( $this->server_htaccess_config === TRUE || $this->server_web_config === TRUE ) )
|
426 |
+
{
|
427 |
+
$results['found_issues'] = TRUE;
|
428 |
+
$results['critical_issues'] = TRUE;
|
429 |
+
$rewrite_file_type = '';
|
430 |
+
if( $this->server_htaccess_config === TRUE )
|
431 |
+
$rewrite_file_type = '.htaccess';
|
432 |
+
|
433 |
+
if( $this->server_web_config === TRUE )
|
434 |
+
$rewrite_file_type = 'web.config';
|
435 |
|
436 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-write-check.php' ); ?></div><?php
|
|
|
437 |
}
|
438 |
+
|
439 |
+
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
440 |
+
{
|
441 |
+
$results['found_issues'] = TRUE;
|
442 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-is-wpengine.php' );?></div><?php
|
443 |
+
}
|
444 |
+
|
445 |
+
if( ! $this->functions->is_muloader())
|
446 |
+
{
|
447 |
+
$results['found_issues'] = TRUE;
|
448 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-mu-loader.php' );?></div><?php
|
449 |
+
}
|
450 |
+
if( $this->functions->is_muloader() && defined( 'WPH_MULOADER_VERSION' ) && version_compare( WPH_MULOADER_VERSION, '1.3.5', '<' ) && ! isset( $this->maintenances['mu_loader'] ) )
|
451 |
+
{
|
452 |
+
$results['found_issues'] = TRUE;
|
453 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-mu-loader-update.php' );?></div><?php
|
454 |
+
}
|
455 |
+
|
456 |
+
if( ! is_writable( WPH_CACHE_PATH ))
|
457 |
+
{
|
458 |
+
$results['found_issues'] = TRUE;
|
459 |
+
?><div class='error'><?php include ( WPH_PATH . 'include/admin-interfaces/notice-cache-path.php' );?></div><?php
|
460 |
+
}
|
461 |
+
|
462 |
}
|
463 |
|
464 |
if(isset($_GET['reset_settings']))
|
771 |
*/
|
772 |
function activated_plugin($plugin, $network_wide)
|
773 |
{
|
774 |
+
return;
|
775 |
+
|
776 |
if($network_wide)
|
777 |
{
|
778 |
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
924 |
if($this->uninstall === TRUE)
|
925 |
return $rules;
|
926 |
|
927 |
+
$write_check_string = isset( $this->settings['write_check_string'] ) ? $this->settings['write_check_string'] : '';
|
928 |
|
929 |
if ( empty ( $write_check_string ) )
|
930 |
+
{
|
931 |
+
//generate a new write_check_string
|
932 |
+
$write_check_string = time() . '_' . mt_rand(100, 99999);
|
933 |
+
$this->settings['write_check_string'] = $write_check_string;
|
934 |
+
|
935 |
+
//update the settings
|
936 |
+
$this->functions->update_settings( $this->settings );
|
937 |
+
}
|
938 |
|
939 |
$processing_data = $this->get_components_rules();
|
940 |
|
953 |
}
|
954 |
|
955 |
$rules .= "#WriteCheckString:" . $write_check_string . "\n";
|
956 |
+
$rules .= "RewriteRule .* - [E=HTTP_MOD_REWRITE:On]" . "\n";
|
957 |
+
|
958 |
+
$plugin_path = $this->functions->get_url_path( WP_PLUGIN_URL );
|
959 |
+
$rewrite_to = $this->functions->get_rewrite_to_base( trailingslashit( $plugin_path ) . 'wp-hide-security-enhancer/include/rewrite-confirm.php', TRUE, FALSE );
|
960 |
+
|
961 |
+
$rules .= "RewriteRule ^rewrite_test_" .$write_check_string ."/? ". $rewrite_to ." [L,QSA]";
|
962 |
|
963 |
if(count($_rewrite_data) > 0)
|
964 |
{
|
1135 |
$_page_refresh = TRUE;
|
1136 |
}
|
1137 |
|
1138 |
+
$write_check_string = isset( $this->settings['write_check_string'] ) ? $this->settings['write_check_string'] : '';
|
1139 |
+
|
1140 |
+
$plugin_path = $this->functions->get_url_path( WP_PLUGIN_URL );
|
1141 |
+
$rewrite_to = $this->functions->get_rewrite_to_base( trailingslashit( $plugin_path ) . 'wp-hide-security-enhancer/include/rewrite-confirm.php' );
|
1142 |
|
1143 |
//add a write stricng
|
1144 |
$_writestring_rule = '
|
1145 |
<rule name="wph-CheckString">
|
1146 |
<!-- WriteCheckString:'. $write_check_string .' -->
|
1147 |
+
</rule>
|
1148 |
+
<rule name="wph-RewriteTest" stopProcessing="true">
|
1149 |
+
<match url="^rewrite_test_'. $write_check_string .'/?" />
|
1150 |
+
<action type="Rewrite" url="'. $rewrite_to .'{R:1}" />
|
1151 |
+
</rule>
|
1152 |
+
|
1153 |
+
';
|
1154 |
array_unshift($_rewrite_data, $_writestring_rule);
|
1155 |
|
1156 |
$this->iis7_add_rewrite_rule( $_rewrite_data, $web_config_file );
|
modules/components/rewrite-default.php
CHANGED
@@ -22,6 +22,16 @@
|
|
22 |
return $this->module_settings;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
function _callback_saved_rewrite_default($saved_field_data)
|
@@ -33,6 +43,133 @@
|
|
33 |
}
|
34 |
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
}
|
38 |
?>
|
22 |
return $this->module_settings;
|
23 |
}
|
24 |
|
25 |
+
|
26 |
+
|
27 |
+
function _init_rewrite_default ( $saved_field_data )
|
28 |
+
{
|
29 |
+
|
30 |
+
//ensure to revert any urls of the superglobalvariables
|
31 |
+
add_action( 'wp-hide/modules_components_run/completed', array( $this, '_modules_components_run_completed' ) );
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
|
36 |
|
37 |
function _callback_saved_rewrite_default($saved_field_data)
|
43 |
}
|
44 |
|
45 |
|
46 |
+
|
47 |
+
/**
|
48 |
+
* re-Map the replacements to GET/POST/REQUET
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
function _do_superglobal_variables_replacements( $replacements )
|
52 |
+
{
|
53 |
+
|
54 |
+
if ( count ( $_GET ) > 0 )
|
55 |
+
{
|
56 |
+
foreach ( $_GET as $key => $value)
|
57 |
+
{
|
58 |
+
if ( is_array($value) )
|
59 |
+
{
|
60 |
+
$_GET[ $key ] = $this->_array_replacements_recursivelly( $_GET[ $key ], $replacements );
|
61 |
+
|
62 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
63 |
+
if ( $_key != $key )
|
64 |
+
$_GET[ $_key ] = $_GET[ $key ];
|
65 |
+
|
66 |
+
continue;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( ! apply_filters('wph/components/rewrite-default/superglobal_variables_replacements', TRUE, $key, 'GET' ) )
|
70 |
+
continue;
|
71 |
+
|
72 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
73 |
+
$_value = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $value );
|
74 |
+
|
75 |
+
if ( $_key != $key || $_value != $value )
|
76 |
+
$_GET[ $_key ] = $_value;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( count ( $_POST ) > 0 )
|
81 |
+
{
|
82 |
+
foreach ( $_POST as $key => $value)
|
83 |
+
{
|
84 |
+
if ( is_array($value) )
|
85 |
+
{
|
86 |
+
$_POST[ $key ] = $this->_array_replacements_recursivelly( $_POST[ $key ], $replacements );
|
87 |
+
|
88 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
89 |
+
if ( $_key != $key )
|
90 |
+
$_POST[ $_key ] = $_POST[ $key ];
|
91 |
+
|
92 |
+
continue;
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( ! apply_filters('wph/components/rewrite-default/superglobal_variables_replacements', TRUE, $key, 'POST' ) )
|
96 |
+
continue;
|
97 |
+
|
98 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
99 |
+
$_value = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $value );
|
100 |
+
|
101 |
+
if ( $_key != $key || $_value != $value )
|
102 |
+
$_POST[ $_key ] = $_value;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( count ( $_REQUEST ) > 0 )
|
107 |
+
{
|
108 |
+
foreach ( $_REQUEST as $key => $value)
|
109 |
+
{
|
110 |
+
if ( is_array($value) )
|
111 |
+
{
|
112 |
+
$_REQUEST[ $key ] = $this->_array_replacements_recursivelly( $_REQUEST[ $key ], $replacements );
|
113 |
+
|
114 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
115 |
+
if ( $_key != $key )
|
116 |
+
$_REQUEST[ $_key ] = $_REQUEST[ $key ];
|
117 |
+
|
118 |
+
continue;
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( ! apply_filters('wph/components/rewrite-default/superglobal_variables_replacements', TRUE, $key, 'REQUEST' ) )
|
122 |
+
continue;
|
123 |
+
|
124 |
+
$_key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
125 |
+
$_value = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $value );
|
126 |
+
|
127 |
+
if ( $_key != $key || $_value != $value )
|
128 |
+
$_REQUEST[ $_key ] = $_value;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
function _modules_components_run_completed()
|
138 |
+
{
|
139 |
+
|
140 |
+
$replacement_list = $this->wph->functions->get_replacement_list();
|
141 |
+
foreach ( $replacement_list as $key => $value )
|
142 |
+
{
|
143 |
+
$replacement_list[ $key ] = '/' . preg_quote ( $value, '/' ) . '/';
|
144 |
+
}
|
145 |
+
|
146 |
+
$this->_do_superglobal_variables_replacements( $replacement_list );
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
function _array_replacements_recursivelly ( $array, $replacements )
|
152 |
+
{
|
153 |
+
if ( !is_array( $array ) )
|
154 |
+
return $array;
|
155 |
+
|
156 |
+
$helper = array();
|
157 |
+
|
158 |
+
foreach ($array as $key => $value)
|
159 |
+
{
|
160 |
+
$key = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $key );
|
161 |
+
|
162 |
+
if ( is_array( $value ) )
|
163 |
+
$value = $this->_array_replacements_recursivelly( $value, $replacements );
|
164 |
+
else
|
165 |
+
$value = preg_replace( array_values ( $replacements ) , array_keys( $replacements ), $value );
|
166 |
+
|
167 |
+
$helper[ $key ] = $value;
|
168 |
+
}
|
169 |
+
|
170 |
+
return $helper;
|
171 |
+
}
|
172 |
+
|
173 |
|
174 |
}
|
175 |
?>
|
modules/components/rewrite-search.php
CHANGED
@@ -71,8 +71,8 @@
|
|
71 |
add_action( 'template_redirect', array( $this, 'template_redirect' ), -1);
|
72 |
|
73 |
//add default plugin path replacement
|
74 |
-
$url = trailingslashit( site_url() ) . 'search';
|
75 |
-
$replacement = trailingslashit( home_url() ) . $saved_field_data;
|
76 |
$this->wph->functions->add_replacement( $url , $replacement );
|
77 |
|
78 |
return TRUE;
|
71 |
add_action( 'template_redirect', array( $this, 'template_redirect' ), -1);
|
72 |
|
73 |
//add default plugin path replacement
|
74 |
+
$url = trailingslashit( site_url() ) . 'search/';
|
75 |
+
$replacement = trailingslashit( home_url() ) . trailingslashit ( $saved_field_data );
|
76 |
$this->wph->functions->add_replacement( $url , $replacement );
|
77 |
|
78 |
return TRUE;
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Contributors: nsp-code, tdgu
|
|
3 |
Donate link: https://www.nsp-code.com/
|
4 |
Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
-
Hide
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -349,6 +349,17 @@ Please get in touch with us and we'll do our best to include it for a next versi
|
|
349 |
|
350 |
== Changelog ==
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
= 1.6.2.4 =
|
353 |
* Reverse URLs when saving a options, to avoid custom urls to be writted within the database.
|
354 |
* Check if string before making a replacement on metadata
|
3 |
Donate link: https://www.nsp-code.com/
|
4 |
Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 5.7
|
7 |
+
Stable tag: 1.6.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
+
Hide WordPress default paths, wp-content, wp-includes, wp-admin, login URL, plugins, themes etc. Block the defaults for being still accessible. No files and data are changed on your server.
|
11 |
|
12 |
== Description ==
|
13 |
|
349 |
|
350 |
== Changelog ==
|
351 |
|
352 |
+
= 1.6.3 =
|
353 |
+
* Server Environment Check to ensure there are no rewrite issues and the plugin can be safely deployed.
|
354 |
+
* Interactive feedback with hints and explanations for environment issues.
|
355 |
+
* Improved UI
|
356 |
+
* Clear fusion cache when plugin options changed if avada active
|
357 |
+
* Fix New Search Path replacement to include an end slash, to avoid catch wrong urls
|
358 |
+
* Check and tag for WordPress 5.7
|
359 |
+
|
360 |
+
= 1.6.2.5 =
|
361 |
+
* Fix: Add slash for "New Search Path" to avoid wrong replacements with urls containing the new search slug.
|
362 |
+
|
363 |
= 1.6.2.4 =
|
364 |
* Reverse URLs when saving a options, to avoid custom urls to be writted within the database.
|
365 |
* Check if string before making a replacement on metadata
|
screenshot-1.png
CHANGED
Binary file
|
wp-hide.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.wp-hide.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.6.
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
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.6.3
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|