Version Description
- Improved server environment rewrite test checking routines.
- Separate rewrite tests for static files and PHP files. This avoids reporting issues for servers not supporting rewrites for php-files.
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 1.8.1
- assets/css/wph.css +1 -1
- include/admin-interface.class.php +1 -1
- include/admin-interfaces/notice-cache-path.php +2 -0
- include/admin-interfaces/notice-is-litespeed.php +2 -0
- include/admin-interfaces/notice-is-wpengine.php +2 -1
- include/admin-interfaces/notice-is_multisite.php +2 -1
- include/admin-interfaces/notice-mu-loader-update.php +2 -1
- include/admin-interfaces/notice-mu-loader.php +2 -1
- include/admin-interfaces/notice-no-permalinks.php +2 -1
- include/admin-interfaces/notice-rewrite-test-static-file.php +10 -0
- include/admin-interfaces/notice-rewrite-test.php +5 -4
- include/admin-interfaces/notice-server-not-supported.php +4 -3
- include/admin-interfaces/notice-write-check.php +5 -3
- include/admin-interfaces/setup.class.php +1 -1
- include/class.environment.php +2 -2
- include/functions.class.php +304 -30
- include/wph.class.php +12 -1
- readme.txt +5 -1
- wp-hide.php +1 -1
assets/css/wph.css
CHANGED
@@ -237,7 +237,7 @@ h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}
|
|
237 |
.container-description .highlight{background-color: #f8ff24;}
|
238 |
.container-description img {max-width: 100%}
|
239 |
.container-description.environment-notices span.dashicons {font-size: 22px; padding-right: 4px}
|
240 |
-
.container-description.environment-notices span.dashicons.error {color: #dc3232;}
|
241 |
.container-description .framed {border: 1px dashed #000; padding: 10px; display: inline-block; font-weight: bold}
|
242 |
.container-description p {}
|
243 |
.container-description.environment-notices img {margin-top: 10px}
|
237 |
.container-description .highlight{background-color: #f8ff24;}
|
238 |
.container-description img {max-width: 100%}
|
239 |
.container-description.environment-notices span.dashicons {font-size: 22px; padding-right: 4px}
|
240 |
+
.container-description.environment-notices span.dashicons.error.critical {color: #dc3232;}
|
241 |
.container-description .framed {border: 1px dashed #000; padding: 10px; display: inline-block; font-weight: bold}
|
242 |
.container-description p {}
|
243 |
.container-description.environment-notices img {margin-top: 10px}
|
include/admin-interface.class.php
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
}
|
33 |
|
34 |
|
35 |
-
function _render($interface_name)
|
36 |
{
|
37 |
|
38 |
$this->screen_slug = preg_replace( '/[^a-zA-Z0-9\-\_$]/m' , "", $_GET['page'] );
|
32 |
}
|
33 |
|
34 |
|
35 |
+
function _render( $interface_name )
|
36 |
{
|
37 |
|
38 |
$this->screen_slug = preg_replace( '/[^a-zA-Z0-9\-\_$]/m' , "", $_GET['page'] );
|
include/admin-interfaces/notice-cache-path.php
CHANGED
@@ -1,4 +1,6 @@
|
|
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>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
5 |
<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>
|
6 |
+
</li>
|
include/admin-interfaces/notice-is-litespeed.php
CHANGED
@@ -2,4 +2,6 @@
|
|
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://wp-hide.com/setup-wp-hide-on-litespeed/">Setup WP Hide on LiteSpeed</a></p>
|
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
|
5 |
+
<li>
|
6 |
<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://wp-hide.com/setup-wp-hide-on-litespeed/">Setup WP Hide on LiteSpeed</a></p>
|
7 |
+
</li>
|
include/admin-interfaces/notice-is-wpengine.php
CHANGED
@@ -1,5 +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 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>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
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>
|
6 |
+
</li>
|
include/admin-interfaces/notice-is_multisite.php
CHANGED
@@ -2,5 +2,6 @@
|
|
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://wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p>
|
6 |
-
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
|
5 |
+
<li>
|
6 |
<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://wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p>
|
7 |
+
</li>
|
include/admin-interfaces/notice-mu-loader-update.php
CHANGED
@@ -1,5 +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( "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>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
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>
|
6 |
+
</li>
|
include/admin-interfaces/notice-mu-loader.php
CHANGED
@@ -1,5 +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( "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>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
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>
|
6 |
+
</li>
|
include/admin-interfaces/notice-no-permalinks.php
CHANGED
@@ -1,5 +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("Permalink is required to be turned ON at Settings > Permalinks, for WP Hide & Security Enhancer to work", 'wp-hide-security-enhancer') ?></p>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
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>
|
6 |
+
</li>
|
include/admin-interfaces/notice-rewrite-test-static-file.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
|
5 |
+
<li>
|
6 |
+
<p><span class="dashicons dashicons-flag error"></span><b><?php _e("Rewrite test for static php files failed! ", 'wp-hide-security-enhancer') ?></b>
|
7 |
+
<?php echo $result ?>
|
8 |
+
<br /><?php _e("This is a <b>soft error</b> and impact only the option at Rewrite > Theme > 'Remove description header from Style file' and should be disabled until the issue fixed.", 'wp-hide-security-enhancer') ?>
|
9 |
+
</p>
|
10 |
+
</li>
|
include/admin-interfaces/notice-rewrite-test.php
CHANGED
@@ -1,20 +1,21 @@
|
|
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 |
-
?>
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?><li>
|
4 |
<?php
|
5 |
|
6 |
if ( $result === FALSE )
|
7 |
{
|
8 |
?>
|
9 |
+
<p><span class="dashicons dashicons-flag error critical"></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 critical"></span><b><?php _e("Rewrite test failed! ", 'wp-hide-security-enhancer') ?></b> <?php echo $result ?></p>
|
16 |
<?php
|
17 |
}
|
18 |
|
19 |
|
20 |
+
?>
|
21 |
+
</li>
|
include/admin-interfaces/notice-server-not-supported.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
-
|
5 |
-
|
6 |
-
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
+
<li>
|
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://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>
|
7 |
+
</li>
|
include/admin-interfaces/notice-write-check.php
CHANGED
@@ -2,7 +2,9 @@
|
|
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
|
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 |
-
|
|
|
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
?>
|
4 |
|
5 |
+
<li><p>
|
6 |
+
<span class="dashicons dashicons-flag error critical"></span><b><?php _e("Unable to write/update required rewrite rules to your site", 'wp-hide-security-enhancer') ?> <?php echo $rewrite_file_type ?></b>. <?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 |
+
<br /><?php _e("Once the file permission is fixed, Save the options once.", 'wp-hide-security-enhancer') ?>
|
9 |
+
</p>
|
10 |
+
</li>
|
include/admin-interfaces/setup.class.php
CHANGED
@@ -158,7 +158,7 @@
|
|
158 |
</div>
|
159 |
<div class="container-description">
|
160 |
<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>
|
161 |
-
<p><?php _e( "Check with the front side to ensure everything is working. Further adjustments to other options
|
162 |
</div>
|
163 |
|
164 |
<p><br /><br /><br /></p>
|
158 |
</div>
|
159 |
<div class="container-description">
|
160 |
<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>
|
161 |
+
<p><?php _e( "Check with the front side to ensure everything is working. Further adjustments to other options is recommended", 'wp-hide-security-enhancer' ) ?>. </p>
|
162 |
</div>
|
163 |
|
164 |
<p><br /><br /><br /></p>
|
include/class.environment.php
CHANGED
@@ -150,7 +150,7 @@
|
|
150 |
|
151 |
if ( ! is_dir( $wp_upload_dir['basedir'] . '/wph/' ) )
|
152 |
{
|
153 |
-
if ( $wp_filesystem->mkdir( $wp_upload_dir['basedir'] . '/wph/' ) )
|
154 |
{
|
155 |
$errors = TRUE;
|
156 |
$error_messages[] = array(
|
@@ -160,7 +160,7 @@
|
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
if(
|
164 |
{
|
165 |
$errors = TRUE;
|
166 |
|
150 |
|
151 |
if ( ! is_dir( $wp_upload_dir['basedir'] . '/wph/' ) )
|
152 |
{
|
153 |
+
if ( ! $wp_filesystem->mkdir( $wp_upload_dir['basedir'] . '/wph/' ) )
|
154 |
{
|
155 |
$errors = TRUE;
|
156 |
$error_messages[] = array(
|
160 |
}
|
161 |
}
|
162 |
|
163 |
+
if( ! $errors && ! $wp_filesystem->put_contents( $wp_upload_dir['basedir'] . '/wph/environment.php' , $file_data , FS_CHMOD_FILE) )
|
164 |
{
|
165 |
$errors = TRUE;
|
166 |
|
include/functions.class.php
CHANGED
@@ -787,9 +787,11 @@
|
|
787 |
'critical_issues' => FALSE,
|
788 |
'errors' => array(),
|
789 |
);
|
790 |
-
|
791 |
ob_start();
|
792 |
|
|
|
|
|
793 |
if( $this->wph->server_htaccess_config === FALSE && $this->wph->server_web_config === FALSE)
|
794 |
{
|
795 |
$results['found_issues'] = TRUE;
|
@@ -814,32 +816,7 @@
|
|
814 |
$results['found_issues'] = TRUE;
|
815 |
include ( WPH_PATH . 'include/admin-interfaces/notice-no-permalinks.php' );
|
816 |
}
|
817 |
-
|
818 |
-
if ( empty ( get_option ( 'wph-environment-ignore-rewrite-test' ) ) )
|
819 |
-
{
|
820 |
-
$result = $this->test_sample_rewrite( );
|
821 |
-
if ( $result === FALSE || ! is_bool( $result ) )
|
822 |
-
{
|
823 |
-
$results['found_issues'] = TRUE;
|
824 |
-
$results['critical_issues'] = TRUE;
|
825 |
-
include ( WPH_PATH . 'include/admin-interfaces/notice-rewrite-test.php' );
|
826 |
-
}
|
827 |
-
}
|
828 |
-
|
829 |
-
//check if the htaccess file is not writable
|
830 |
-
if( ! $this->rewrite_rules_applied() && ( $this->wph->server_htaccess_config === TRUE || $this->wph->server_web_config === TRUE ) )
|
831 |
-
{
|
832 |
-
$results['found_issues'] = TRUE;
|
833 |
-
$results['critical_issues'] = TRUE;
|
834 |
-
$rewrite_file_type = '';
|
835 |
-
if( $this->wph->server_htaccess_config === TRUE )
|
836 |
-
$rewrite_file_type = '.htaccess';
|
837 |
-
|
838 |
-
if( $this->wph->server_web_config === TRUE )
|
839 |
-
$rewrite_file_type = 'web.config';
|
840 |
-
|
841 |
-
include ( WPH_PATH . 'include/admin-interfaces/notice-write-check.php' );
|
842 |
-
}
|
843 |
|
844 |
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
845 |
{
|
@@ -862,8 +839,68 @@
|
|
862 |
{
|
863 |
$results['found_issues'] = TRUE;
|
864 |
include ( WPH_PATH . 'include/admin-interfaces/notice-cache-path.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
865 |
}
|
866 |
|
|
|
|
|
867 |
$errors = ob_get_clean();
|
868 |
|
869 |
$results['errors'] = $errors;
|
@@ -974,10 +1011,10 @@
|
|
974 |
|
975 |
$test_url = apply_filters( 'wp-hide/test_sample_rewrite/url', trailingslashit ( home_url() ) . 'rewrite_test_' . $this->wph->settings['write_check_string'] . '/' );
|
976 |
$response = wp_remote_get( $test_url );
|
977 |
-
|
978 |
$response_message = '';
|
979 |
$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 />';
|
980 |
-
$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 />';
|
981 |
$messages['manual_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br /><br />';
|
982 |
$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 />';
|
983 |
|
@@ -1044,7 +1081,7 @@
|
|
1044 |
|
1045 |
$messages['server_check'] = __( "A custom rewrite line has been inserted into your rewrite file for testing. The ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a></b> '. __( "expected to return a JSON response (contains a name and description) The server instead replied a", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['code'] . '</b> ' . __( "error with the message", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['message'] . '</b><br />';
|
1046 |
$messages['server_check'] .= "<br />" . __( "In certain environments ( e.g. Cloudflare) the plugin may not be allowed to check the test rewrite automatically. If checking manually 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 valid JSON response (contains a name and description), 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 />';
|
1047 |
-
$messages['server_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 />';
|
1048 |
$messages['server_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br />';
|
1049 |
$messages['server_check'] .= "<br />" . __( "If manually checking the Test URL fails too, you need to get in touch with your server support for a fix. The rewrite engine is either disabled for your account or their internal set-up does not allow such rewrites. ", 'wp-hide-security-enhancer' );
|
1050 |
|
@@ -1079,6 +1116,243 @@
|
|
1079 |
|
1080 |
|
1081 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1082 |
/**
|
1083 |
* Check a file for a specific marker
|
1084 |
*
|
787 |
'critical_issues' => FALSE,
|
788 |
'errors' => array(),
|
789 |
);
|
790 |
+
|
791 |
ob_start();
|
792 |
|
793 |
+
?><ol><?php
|
794 |
+
|
795 |
if( $this->wph->server_htaccess_config === FALSE && $this->wph->server_web_config === FALSE)
|
796 |
{
|
797 |
$results['found_issues'] = TRUE;
|
816 |
$results['found_issues'] = TRUE;
|
817 |
include ( WPH_PATH . 'include/admin-interfaces/notice-no-permalinks.php' );
|
818 |
}
|
819 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
|
821 |
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
822 |
{
|
839 |
{
|
840 |
$results['found_issues'] = TRUE;
|
841 |
include ( WPH_PATH . 'include/admin-interfaces/notice-cache-path.php' );
|
842 |
+
}
|
843 |
+
|
844 |
+
//check if the htaccess file is not writable
|
845 |
+
if( ! $this->rewrite_rules_applied() && ( $this->wph->server_htaccess_config === TRUE || $this->wph->server_web_config === TRUE ) && $results['found_issues'] === FALSE && $results['critical_issues'] === FALSE )
|
846 |
+
{
|
847 |
+
$results['found_issues'] = TRUE;
|
848 |
+
$results['critical_issues'] = TRUE;
|
849 |
+
$rewrite_file_type = '';
|
850 |
+
if( $this->wph->server_htaccess_config === TRUE )
|
851 |
+
$rewrite_file_type = '.htaccess';
|
852 |
+
|
853 |
+
if( $this->wph->server_web_config === TRUE )
|
854 |
+
$rewrite_file_type = 'web.config';
|
855 |
+
|
856 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-write-check.php' );
|
857 |
+
}
|
858 |
+
|
859 |
+
if ( empty ( get_option ( 'wph-environment-ignore-rewrite-test' ) ) && $results['found_issues'] === FALSE && $results['critical_issues'] === FALSE )
|
860 |
+
{
|
861 |
+
if ( isset ( $this->wph->settings['rewrite_engine_version'] ) && version_compare( $this->wph->settings['rewrite_engine_version'], '1.1', '>=') )
|
862 |
+
{
|
863 |
+
if ( ( isset ( $this->wph->settings['module_settings']['style_file_clean'] ) && $this->wph->settings['module_settings']['style_file_clean'] == 'yes' )
|
864 |
+
||
|
865 |
+
( isset ( $this->wph->settings['module_settings']['child_style_file_clean'] ) && $this->wph->settings['module_settings']['child_style_file_clean'] == 'yes' ) )
|
866 |
+
{
|
867 |
+
$result = $this->test_sample_rewrite_php_file( );
|
868 |
+
if ( $result === FALSE || ! is_bool( $result ) )
|
869 |
+
{
|
870 |
+
$results['found_issues'] = TRUE;
|
871 |
+
$results['issues_type'] = array ( '05' );
|
872 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-rewrite-test-static-file.php' );
|
873 |
+
}
|
874 |
+
}
|
875 |
+
|
876 |
+
$result = $this->test_sample_rewrite_static_file( );
|
877 |
+
if ( $result === FALSE || ! is_bool( $result ) )
|
878 |
+
{
|
879 |
+
$results['found_issues'] = TRUE;
|
880 |
+
$results['critical_issues'] = TRUE;
|
881 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-rewrite-test.php' );
|
882 |
+
}
|
883 |
+
|
884 |
+
if ( $results['critical_issues'] === TRUE )
|
885 |
+
{
|
886 |
+
$this->wph->custom_permalinks_applied = FALSE;
|
887 |
+
$this->wph->disable_ob_start_callback = TRUE;
|
888 |
+
}
|
889 |
+
}
|
890 |
+
else
|
891 |
+
{
|
892 |
+
$result = $this->test_sample_rewrite( );
|
893 |
+
if ( $result === FALSE || ! is_bool( $result ) )
|
894 |
+
{
|
895 |
+
$results['found_issues'] = TRUE;
|
896 |
+
$results['critical_issues'] = TRUE;
|
897 |
+
include ( WPH_PATH . 'include/admin-interfaces/notice-rewrite-test.php' );
|
898 |
+
}
|
899 |
+
}
|
900 |
}
|
901 |
|
902 |
+
?></ol><?php
|
903 |
+
|
904 |
$errors = ob_get_clean();
|
905 |
|
906 |
$results['errors'] = $errors;
|
1011 |
|
1012 |
$test_url = apply_filters( 'wp-hide/test_sample_rewrite/url', trailingslashit ( home_url() ) . 'rewrite_test_' . $this->wph->settings['write_check_string'] . '/' );
|
1013 |
$response = wp_remote_get( $test_url );
|
1014 |
+
|
1015 |
$response_message = '';
|
1016 |
$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 />';
|
1017 |
+
$messages['manual_check'] .= __( "Sample result, the appearance 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 />';
|
1018 |
$messages['manual_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br /><br />';
|
1019 |
$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 />';
|
1020 |
|
1081 |
|
1082 |
$messages['server_check'] = __( "A custom rewrite line has been inserted into your rewrite file for testing. The ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a></b> '. __( "expected to return a JSON response (contains a name and description) The server instead replied a", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['code'] . '</b> ' . __( "error with the message", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['message'] . '</b><br />';
|
1083 |
$messages['server_check'] .= "<br />" . __( "In certain environments ( e.g. Cloudflare) the plugin may not be allowed to check the test rewrite automatically. If checking manually 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 valid JSON response (contains a name and description), 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 />';
|
1084 |
+
$messages['server_check'] .= __( "Sample result, the appearance 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 />';
|
1085 |
$messages['server_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br />';
|
1086 |
$messages['server_check'] .= "<br />" . __( "If manually checking the Test URL fails too, you need to get in touch with your server support for a fix. The rewrite engine is either disabled for your account or their internal set-up does not allow such rewrites. ", 'wp-hide-security-enhancer' );
|
1087 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
+
|
1120 |
+
|
1121 |
+
/**
|
1122 |
+
* Try to access a specific sample url to test the rewritea functinality
|
1123 |
+
*
|
1124 |
+
*/
|
1125 |
+
function test_sample_rewrite_php_file( )
|
1126 |
+
{
|
1127 |
+
|
1128 |
+
if( ! isset( $this->wph->settings['write_check_string'] ) || empty( $this->wph->settings['write_check_string'] ) )
|
1129 |
+
return TRUE;
|
1130 |
+
|
1131 |
+
$test_url = apply_filters( 'wp-hide/test_sample_rewrite/url', trailingslashit ( home_url() ) . 'rewrite_test_' . $this->wph->settings['write_check_string'] . '/' );
|
1132 |
+
$response = wp_remote_get( $test_url );
|
1133 |
+
|
1134 |
+
$response_message = '';
|
1135 |
+
$messages['manual_check'] = __( "Make a fix and manually check the ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a>.</b>';
|
1136 |
+
|
1137 |
+
if ( is_array( $response ) )
|
1138 |
+
{
|
1139 |
+
|
1140 |
+
if ( ! isset( $response['response']['code'] ) )
|
1141 |
+
return __( "The wp_remote_get() returns invalid Response Code", 'wp-hide-security-enhancer' );
|
1142 |
+
|
1143 |
+
if ( $response['response']['code'] != 200 )
|
1144 |
+
{
|
1145 |
+
if ( $response['response']['code'] == 404 )
|
1146 |
+
{
|
1147 |
+
$home_path = $this->get_home_path();
|
1148 |
+
|
1149 |
+
//check if the .htaccess file include the test rewrite
|
1150 |
+
if ( $this->wph->server_htaccess_config === TRUE )
|
1151 |
+
{
|
1152 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . '.htaccess';
|
1153 |
+
if( ! file_exists( $file_path ) )
|
1154 |
+
{
|
1155 |
+
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' );
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1159 |
+
{
|
1160 |
+
$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');
|
1161 |
+
|
1162 |
+
return $response_message;
|
1163 |
+
}
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
//check for web.config
|
1167 |
+
if ( $this->wph->server_web_config === TRUE )
|
1168 |
+
{
|
1169 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . 'web.config';
|
1170 |
+
if( ! file_exists( $file_path ) )
|
1171 |
+
return __( "The wp_remote_get() returns a <b>Not Found</b> 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' );
|
1172 |
+
|
1173 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1174 |
+
return __( "The wp_remote_get() returns a <b>Not Found</b> 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' );
|
1175 |
+
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
$response_message = __( "The wp_remote_get() returns a <b>Not Found</b> page, probably the Rewrites are not active on your server!", 'wp-hide-security-enhancer' );
|
1179 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1180 |
+
|
1181 |
+
return $response_message;
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
if ( $response['response']['code'] == 401 )
|
1185 |
+
{
|
1186 |
+
$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' );
|
1187 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1188 |
+
|
1189 |
+
return $response_message;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
if ( ! empty ( $response['response']['code'] ) )
|
1193 |
+
{
|
1194 |
+
$response_message = __( "The wp_remote_get() returns a", 'wp-hide-security-enhancer' ) . " " . $response['response']['code'] . " " . __( "error code", 'wp-hide-security-enhancer' );
|
1195 |
+
if ( ! empty ($response['response']['message'] ) )
|
1196 |
+
$response_message .= ": <b>" . $response['response']['message'] . "</b>";
|
1197 |
+
|
1198 |
+
$messages['server_check'] = __( "Make a fix and manually check the ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a>.</b> ';
|
1199 |
+
|
1200 |
+
$response_message .= '<br />' . $messages['server_check'];
|
1201 |
+
|
1202 |
+
return $response_message;
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
return __( "Unespected error code for wp_remote_get() call.", 'wp-hide-security-enhancer' );
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
$body = json_decode( $response['body'] );
|
1209 |
+
if ( $body === null || !isset( $body->name ) )
|
1210 |
+
return __( "The wp_remote_get() returns an invalid JSON data, probably the server blocks custom rewrites.", 'wp-hide-security-enhancer' );
|
1211 |
+
|
1212 |
+
|
1213 |
+
return TRUE;
|
1214 |
+
|
1215 |
+
}
|
1216 |
+
else if ( is_a( $response, 'WP_Error' ))
|
1217 |
+
{
|
1218 |
+
$response_message = $response->get_error_message();
|
1219 |
+
|
1220 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1221 |
+
|
1222 |
+
return $response_message;
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
return FALSE;
|
1226 |
+
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
|
1230 |
+
|
1231 |
+
|
1232 |
+
/**
|
1233 |
+
* Try to access a static file to test the rewritea functinality
|
1234 |
+
*
|
1235 |
+
*/
|
1236 |
+
function test_sample_rewrite_static_file( )
|
1237 |
+
{
|
1238 |
+
|
1239 |
+
if( ! isset( $this->wph->settings['write_check_string'] ) || empty( $this->wph->settings['write_check_string'] ) )
|
1240 |
+
return TRUE;
|
1241 |
+
|
1242 |
+
$test_url = apply_filters( 'wp-hide/test_sample_rewrite/static_file_url', trailingslashit ( home_url() ) . 'rewrite_test_static_file_' . $this->wph->settings['write_check_string'] . '/' );
|
1243 |
+
$response = wp_remote_get( $test_url );
|
1244 |
+
|
1245 |
+
$response_message = '';
|
1246 |
+
$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 />';
|
1247 |
+
$messages['manual_check'] .= __( "Sample result, the appearance 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 />';
|
1248 |
+
$messages['manual_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br /><br />';
|
1249 |
+
$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 />';
|
1250 |
+
|
1251 |
+
if ( is_array( $response ) )
|
1252 |
+
{
|
1253 |
+
|
1254 |
+
if ( ! isset( $response['response']['code'] ) )
|
1255 |
+
return __( "The wp_remote_get() returns invalid Response Code", 'wp-hide-security-enhancer' );
|
1256 |
+
|
1257 |
+
if ( $response['response']['code'] != 200 )
|
1258 |
+
{
|
1259 |
+
if ( $response['response']['code'] == 404 )
|
1260 |
+
{
|
1261 |
+
$home_path = $this->get_home_path();
|
1262 |
+
|
1263 |
+
//check if the .htaccess file include the test rewrite
|
1264 |
+
if ( $this->wph->server_htaccess_config === TRUE )
|
1265 |
+
{
|
1266 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . '.htaccess';
|
1267 |
+
if( ! file_exists( $file_path ) )
|
1268 |
+
{
|
1269 |
+
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' );
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1273 |
+
{
|
1274 |
+
$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');
|
1275 |
+
|
1276 |
+
return $response_message;
|
1277 |
+
}
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
//check for web.config
|
1281 |
+
if ( $this->wph->server_web_config === TRUE )
|
1282 |
+
{
|
1283 |
+
$file_path = $home_path . DIRECTORY_SEPARATOR . 'web.config';
|
1284 |
+
if( ! file_exists( $file_path ) )
|
1285 |
+
return __( "The wp_remote_get() returns a <b>Not Found</b> 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' );
|
1286 |
+
|
1287 |
+
if ( ! $this->file_check_for_marker( $file_path, 'rewrite_test_' . $this->wph->settings['write_check_string'] ) )
|
1288 |
+
return __( "The wp_remote_get() returns a <b>Not Found</b> 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' );
|
1289 |
+
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
$response_message = __( "The wp_remote_get() returns a <b>Not Found</b> page, probably the Rewrites are not active on your server!", 'wp-hide-security-enhancer' );
|
1293 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1294 |
+
|
1295 |
+
return $response_message;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
if ( $response['response']['code'] == 401 )
|
1299 |
+
{
|
1300 |
+
$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' );
|
1301 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1302 |
+
|
1303 |
+
return $response_message;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
if ( ! empty ( $response['response']['code'] ) )
|
1307 |
+
{
|
1308 |
+
$response_message = __( "The wp_remote_get() returns a", 'wp-hide-security-enhancer' ) . " " . $response['response']['code'] . " " . __( "error code", 'wp-hide-security-enhancer' );
|
1309 |
+
if ( ! empty ($response['response']['message'] ) )
|
1310 |
+
$response_message .= ":" . $response['response']['message'];
|
1311 |
+
|
1312 |
+
$messages['server_check'] = __( "A custom rewrite line has been inserted into your rewrite file for testing. The ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a></b> '. __( "expected to return a JSON response (contains a name and description) The server instead replied a", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['code'] . '</b> ' . __( "error with the message", 'wp-hide-security-enhancer' ) . ' <b class="highlight">' . $response['response']['message'] . '</b><br />';
|
1313 |
+
$messages['server_check'] .= "<br />" . __( "In certain environments ( e.g. Cloudflare) the plugin may not be allowed to check the test rewrite automatically. If checking manually 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 valid JSON response (contains a name and description), 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 />';
|
1314 |
+
$messages['server_check'] .= __( "Sample result, the appearance 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 />';
|
1315 |
+
$messages['server_check'] .= __( "The Ignore action will be available until the next plugin options update.", 'wp-hide-security-enhancer' ) . '<br />';
|
1316 |
+
$messages['server_check'] .= "<br />" . __( "If manually checking the Test URL fails too, you need to get in touch with your server support for a fix. The rewrite engine is either disabled for your account or their internal set-up does not allow such rewrites. ", 'wp-hide-security-enhancer' );
|
1317 |
+
|
1318 |
+
$response_message .= '<br />' . $messages['server_check'];
|
1319 |
+
|
1320 |
+
return $response_message;
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
return __( "Unespected error code for wp_remote_get() call.", 'wp-hide-security-enhancer' );
|
1324 |
+
}
|
1325 |
+
|
1326 |
+
$body = json_decode( $response['body'] );
|
1327 |
+
if ( $body === null )
|
1328 |
+
{
|
1329 |
+
$messages['server_check'] = __( "The wp_remote_get() returns an invalid JSON data, probably the server blocks custom rewrites.", 'wp-hide-security-enhancer' );
|
1330 |
+
$messages['server_check'] .= "<br />" . __( "Make a fix and manually check the ", 'wp-hide-security-enhancer' ) . '<b><a target="_blank" href="' . $test_url . '">' . __( "Test URL", 'wp-hide-security-enhancer' ) . '</a>.</b>';
|
1331 |
+
|
1332 |
+
$response_message = $messages['server_check'];
|
1333 |
+
|
1334 |
+
return $response_message;
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
|
1338 |
+
return TRUE;
|
1339 |
+
|
1340 |
+
}
|
1341 |
+
else if ( is_a( $response, 'WP_Error' ))
|
1342 |
+
{
|
1343 |
+
$response_message = $response->get_error_message();
|
1344 |
+
|
1345 |
+
$response_message .= '<br />' . $messages['manual_check'];
|
1346 |
+
|
1347 |
+
return $response_message;
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
return FALSE;
|
1351 |
+
|
1352 |
+
}
|
1353 |
+
|
1354 |
+
|
1355 |
+
|
1356 |
/**
|
1357 |
* Check a file for a specific marker
|
1358 |
*
|
include/wph.class.php
CHANGED
@@ -960,6 +960,14 @@
|
|
960 |
//update the settings
|
961 |
$this->functions->update_settings( $this->settings );
|
962 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
963 |
|
964 |
$processing_data = $this->get_components_rules();
|
965 |
|
@@ -989,8 +997,11 @@
|
|
989 |
|
990 |
$plugin_path = $this->functions->get_url_path( WP_PLUGIN_URL );
|
991 |
$rewrite_to = $this->functions->get_rewrite_to_base( trailingslashit( $plugin_path ) . 'wp-hide-security-enhancer/include/rewrite-confirm.php', TRUE, FALSE );
|
|
|
992 |
|
993 |
-
$
|
|
|
|
|
994 |
if(count( $_rewrite_data_mod_rewrite ) > 0)
|
995 |
{
|
996 |
foreach( $_rewrite_data_mod_rewrite as $_htaccess_data_line)
|
960 |
//update the settings
|
961 |
$this->functions->update_settings( $this->settings );
|
962 |
}
|
963 |
+
|
964 |
+
//add a rewrite version
|
965 |
+
$rewrite_engine_version = isset( $this->settings['rewrite_engine_version'] ) ? $this->settings['rewrite_engine_version'] : '';
|
966 |
+
if ( empty ( $rewrite_engine_version ) )
|
967 |
+
{
|
968 |
+
$this->settings['rewrite_engine_version'] = '1.1';
|
969 |
+
$this->functions->update_settings( $this->settings );
|
970 |
+
}
|
971 |
|
972 |
$processing_data = $this->get_components_rules();
|
973 |
|
997 |
|
998 |
$plugin_path = $this->functions->get_url_path( WP_PLUGIN_URL );
|
999 |
$rewrite_to = $this->functions->get_rewrite_to_base( trailingslashit( $plugin_path ) . 'wp-hide-security-enhancer/include/rewrite-confirm.php', TRUE, FALSE );
|
1000 |
+
$rewrite_rules .= "RewriteRule ^rewrite_test_" .$write_check_string ."/? ". $rewrite_to ." [L,QSA]";
|
1001 |
|
1002 |
+
$rewrite_to = $this->functions->get_rewrite_to_base( trailingslashit( $plugin_path ) . 'wp-hide-security-enhancer/composer.json', TRUE, FALSE );
|
1003 |
+
$rewrite_rules .= "\nRewriteRule ^rewrite_test_static_file_" .$write_check_string ."/? ". $rewrite_to ." [L,QSA]";
|
1004 |
+
|
1005 |
if(count( $_rewrite_data_mod_rewrite ) > 0)
|
1006 |
{
|
1007 |
foreach( $_rewrite_data_mod_rewrite as $_htaccess_data_line)
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.nsp-code.com/
|
|
4 |
Tags: wordpress hide, hide, security, secuirty headers, 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: 6.0.1
|
7 |
-
Stable tag: 1.8
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide WordPress, wp-content, wp-includes, wp-admin, login URL, plugins, themes etc. Block the default URLs. Security Headers etc.
|
@@ -378,6 +378,10 @@ Please get in touch with us and we’ll do our best to include it inthe next ver
|
|
378 |
|
379 |
== Changelog ==
|
380 |
|
|
|
|
|
|
|
|
|
381 |
= 1.8 =
|
382 |
* Add a new button to reset the current page options.
|
383 |
* Use regex to sanitize the URL arguments
|
4 |
Tags: wordpress hide, hide, security, secuirty headers, 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: 6.0.1
|
7 |
+
Stable tag: 1.8.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide WordPress, wp-content, wp-includes, wp-admin, login URL, plugins, themes etc. Block the default URLs. Security Headers etc.
|
378 |
|
379 |
== Changelog ==
|
380 |
|
381 |
+
= 1.8.1 =
|
382 |
+
* Improved server environment rewrite test checking routines.
|
383 |
+
* Separate rewrite tests for static files and PHP files. This avoids reporting issues for servers not supporting rewrites for php-files.
|
384 |
+
|
385 |
= 1.8 =
|
386 |
* Add a new button to reset the current page options.
|
387 |
* Use regex to sanitize the URL arguments
|
wp-hide.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://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.8
|
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.8.1
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|