WP Hide & Security Enhancer - Version 1.4.5.6

Version Description

  • Prevent the wp-register.php redirect to new login page when using block
  • Prepare plugin for Composer package
  • URL Slash description update
  • xml_rpc_path add php_extension_required validation
  • File processor use ABSPATH instead DOCUMENT_ROOT environment variable to avoid different paths on certain systems
  • Allow path structure to be used for New Theme Path and Child - New Theme Path
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 WP Hide & Security Enhancer
Version 1.4.5.6
Comparing to
See all releases

Code changes from version 1.4.5.1 to 1.4.5.6

composer.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name" : "nsp-code/wp-hide",
3
+ "description" : "Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.",
4
+ "keywords" : ["wordpress hide", "hide", "security", "improve security", "hacking", "wp hide", "custom login", "wp-loging.php", "wp-admin", "admin hide"],
5
+ "homepage" : "https://www.wp-hide.com/",
6
+ "authors" : [
7
+ {
8
+ "name": "Nsp Code",
9
+ "email": "contact@nsp-code.com",
10
+ "homepage": "http://www.nsp-code.com/"
11
+ }
12
+ ],
13
+ "type" : "wordpress-plugin",
14
+ "require" : {
15
+ "composer/installers": "~1.0"
16
+ }
17
+ }
include/wph.class.php CHANGED
@@ -258,7 +258,8 @@
258
  */
259
  function on_init()
260
  {
261
-
 
262
 
263
 
264
  }
@@ -647,19 +648,19 @@
647
  * Create a staitc file which contain specific variables and will be used in router
648
  *
649
  */
650
- function set_static_environemnt_file()
651
  {
652
 
653
- $environment_variable = array();
654
 
655
- $environment_variable['theme'] = array(
656
  'folder_name' => $this->templates_data['main']['folder_name'],
657
  'mapped_name' => $this->settings['module_settings']['new_theme_path']
658
  );
659
 
660
  if(isset($this->templates_data['child']))
661
  {
662
- $environment_variable['child_theme'] = array(
663
  'folder_name' => $this->templates_data['child']['folder_name'],
664
  'mapped_name' => $this->settings['module_settings']['new_theme_child_path']
665
  );
@@ -676,18 +677,28 @@
676
  $themes_path = str_replace( '\\', '/', ABSPATH . ltrim($themes_url, '/'));
677
 
678
  //set the allowe paths
679
- $environment_variable['allowed_paths'] = apply_filters('wp-hide/environemnt_file/allowed_paths', array( $themes_path ));
680
-
681
- $environment_variable['cache_path'] = str_replace( '\\', '/', WPH_CACHE_PATH);
682
 
683
- $environment_variable['site_wordpress_relative_path'] = $this->default_variables['site_wordpress_relative_path'];
684
- $environment_variable['wordpress_directory'] = $this->default_variables['wordpress_directory'];
685
- $environment_variable['site_relative_path'] = $this->default_variables['site_relative_path'];
686
 
687
- $previous_hash = get_option('wph_environment_hash');
688
- if(!empty($previous_hash) && $previous_hash == md5(json_encode($environment_variable)) && file_exists(WPH_PATH . 'router/environment.php'))
689
- return;
690
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  global $wp_filesystem;
692
 
693
  if (empty($wp_filesystem))
@@ -701,7 +712,7 @@
701
  echo "<?php ";
702
  echo "if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly";
703
  echo "\n";
704
- echo '$environment_variable = \''. json_encode($environment_variable) .'\'';
705
  echo " ?>";
706
 
707
  $file_data = ob_get_contents();
@@ -726,10 +737,7 @@
726
 
727
  set_transient( 'wph-process_interface_save_errors', $process_interface_save_errors, HOUR_IN_SECONDS );
728
  }
729
- else
730
- {
731
- update_option('wph_environment_hash', md5(json_encode($environment_variable)));
732
- }
733
 
734
  }
735
 
258
  */
259
  function on_init()
260
  {
261
+ //create or update the environemnt file with required constants and variables
262
+ $this->set_static_environemnt_file();
263
 
264
 
265
  }
648
  * Create a staitc file which contain specific variables and will be used in router
649
  *
650
  */
651
+ function set_static_environemnt_file( $force_create = FALSE )
652
  {
653
 
654
+ $_environment_variable = array();
655
 
656
+ $_environment_variable['theme'] = array(
657
  'folder_name' => $this->templates_data['main']['folder_name'],
658
  'mapped_name' => $this->settings['module_settings']['new_theme_path']
659
  );
660
 
661
  if(isset($this->templates_data['child']))
662
  {
663
+ $_environment_variable['child_theme'] = array(
664
  'folder_name' => $this->templates_data['child']['folder_name'],
665
  'mapped_name' => $this->settings['module_settings']['new_theme_child_path']
666
  );
677
  $themes_path = str_replace( '\\', '/', ABSPATH . ltrim($themes_url, '/'));
678
 
679
  //set the allowe paths
680
+ $_environment_variable['allowed_paths'] = apply_filters('wp-hide/environemnt_file/allowed_paths', array( $themes_path ));
 
 
681
 
682
+ $_environment_variable['cache_path'] = str_replace( '\\', '/', WPH_CACHE_PATH);
 
 
683
 
684
+ $_environment_variable['site_wordpress_relative_path'] = $this->default_variables['site_wordpress_relative_path'];
685
+ $_environment_variable['wordpress_directory'] = $this->default_variables['wordpress_directory'];
686
+ $_environment_variable['site_relative_path'] = $this->default_variables['site_relative_path'];
687
 
688
+ if( $force_create === FALSE )
689
+ {
690
+ $environment_variable = '';
691
+
692
+ if( file_exists(WPH_PATH . 'router/environment.php' ) )
693
+ {
694
+ require_once( WPH_PATH . 'router/environment.php');
695
+ }
696
+
697
+ //if nothing has changed exit
698
+ if ( $environment_variable == json_encode($_environment_variable) )
699
+ return;
700
+ }
701
+
702
  global $wp_filesystem;
703
 
704
  if (empty($wp_filesystem))
712
  echo "<?php ";
713
  echo "if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly";
714
  echo "\n";
715
+ echo '$environment_variable = \''. json_encode($_environment_variable) .'\'';
716
  echo " ?>";
717
 
718
  $file_data = ob_get_contents();
737
 
738
  set_transient( 'wph-process_interface_save_errors', $process_interface_save_errors, HOUR_IN_SECONDS );
739
  }
740
+
 
 
 
741
 
742
  }
743
 
modules/components/rewrite-new_theme_path.php CHANGED
@@ -26,7 +26,7 @@
26
  'value_description' => __('e.g. my_template', 'wp-hide-security-enhancer'),
27
  'input_type' => 'text',
28
 
29
- 'sanitize_type' => array('sanitize_title', 'strtolower'),
30
  'processing_order' => 10
31
  );
32
 
@@ -84,7 +84,7 @@
84
  'value_description' => __('e.g. my_child_template', 'wp-hide-security-enhancer'),
85
  'input_type' => 'text',
86
 
87
- 'sanitize_type' => array('sanitize_title', 'strtolower'),
88
  'processing_order' => 9
89
  );
90
 
26
  'value_description' => __('e.g. my_template', 'wp-hide-security-enhancer'),
27
  'input_type' => 'text',
28
 
29
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name'), 'strtolower'),
30
  'processing_order' => 10
31
  );
32
 
84
  'value_description' => __('e.g. my_child_template', 'wp-hide-security-enhancer'),
85
  'input_type' => 'text',
86
 
87
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name'), 'strtolower'),
88
  'processing_order' => 9
89
  );
90
 
modules/components/rewrite-new_xml-rpc-path.php CHANGED
@@ -20,7 +20,7 @@
20
  'value_description' => __('e.g. my-xml-rpc.php', 'wp-hide-security-enhancer'),
21
  'input_type' => 'text',
22
 
23
- 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
24
  'processing_order' => 50
25
  );
26
 
20
  'value_description' => __('e.g. my-xml-rpc.php', 'wp-hide-security-enhancer'),
21
  'input_type' => 'text',
22
 
23
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name'), array($this->wph->functions, 'php_extension_required')),
24
  'processing_order' => 50
25
  );
26
 
modules/components/rewrite-root-files.php CHANGED
@@ -296,14 +296,14 @@
296
  if($this->wph->server_htaccess_config === TRUE)
297
  {
298
  $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
299
- $text .= "RewriteRule ^" . $rewrite_file_base ." ". $this->wph->default_variables['site_wordpress_relative_path'] ."index.php [L]";
300
  }
301
 
302
  if($this->wph->server_web_config === TRUE)
303
  $text = '
304
  <rule name="wph-block_default_wp_register_php" stopProcessing="true">
305
  <match url="^wp-register.php" />
306
- <action type="Rewrite" url="'. $this->wph->default_variables['site_wordpress_relative_path'] .'index.php" />
307
  </rule>
308
  ';
309
 
296
  if($this->wph->server_htaccess_config === TRUE)
297
  {
298
  $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
299
+ $text .= "RewriteRule ^" . $rewrite_file_base ." ". $this->wph->default_variables['site_wordpress_relative_path'] ."index.php?wph-throw-404 [L]";
300
  }
301
 
302
  if($this->wph->server_web_config === TRUE)
303
  $text = '
304
  <rule name="wph-block_default_wp_register_php" stopProcessing="true">
305
  <match url="^wp-register.php" />
306
+ <action type="Rewrite" url="'. $this->wph->default_variables['site_wordpress_relative_path'] .'index.php?wph-throw-404" />
307
  </rule>
308
  ';
309
 
modules/components/rewrite-slash.php CHANGED
@@ -14,7 +14,9 @@
14
  $this->module_settings[] = array(
15
  'id' => 'add_slash',
16
  'label' => __('URL\'s add Slash', 'wp-hide-security-enhancer'),
17
- 'description' => __('Add an end slash to any links without. This disguise any existance uppon a file, folder or a wrong url, they will be all slashed.', 'wp-hide-security-enhancer') . '<br /> '. __('On certain systems this can produce a small lag measured in milliseconds.', 'wp-hide-security-enhancer'),
 
 
18
 
19
  'input_type' => 'radio',
20
  'options' => array(
14
  $this->module_settings[] = array(
15
  'id' => 'add_slash',
16
  'label' => __('URL\'s add Slash', 'wp-hide-security-enhancer'),
17
+ 'description' => array(
18
+ __('Add an end slash to any links without one. Disguise the existence of files and folders, they will be all slashed.', 'wp-hide-security-enhancer'). '<br /> '. __('On certain systems this can produce a small lag measured in milliseconds.', 'wp-hide-security-enhancer')
19
+ ,__('More details can be found at', 'wp-hide-security-enhancer') .' <a href="https://www.wp-hide.com/documentation/rewrite-url-slash/" target="_blank">Documentation</a>'),
20
 
21
  'input_type' => 'radio',
22
  'options' => array(
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
  Contributors: nsp-code, tdgu
3
  Donate link: http://www.nsp-code.com/donate.php
4
- Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, ap-admin, admin hide
5
  Requires at least: 2.8
6
- Tested up to: 4.8
7
- Stable tag: 1.4.5.1
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
@@ -243,6 +243,14 @@ Please get in touch with us and we'll do our best to include it for a next versi
243
 
244
  == Changelog ==
245
 
 
 
 
 
 
 
 
 
246
  = 1.4.5.1 =
247
  * Media Galery src images fix
248
  * Use separate variables for holding replacements to avoid key overwrite
1
  === Plugin Name ===
2
  Contributors: nsp-code, tdgu
3
  Donate link: http://www.nsp-code.com/donate.php
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: 4.8.1
7
+ Stable tag: 1.4.5.6
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
243
 
244
  == Changelog ==
245
 
246
+ = 1.4.5.6 =
247
+ * Prevent the wp-register.php redirect to new login page when using block
248
+ * Prepare plugin for Composer package
249
+ * URL Slash description update
250
+ * xml_rpc_path add php_extension_required validation
251
+ * File processor use ABSPATH instead DOCUMENT_ROOT environment variable to avoid different paths on certain systems
252
+ * Allow path structure to be used for New Theme Path and Child - New Theme Path
253
+
254
  = 1.4.5.1 =
255
  * Media Galery src images fix
256
  * Use separate variables for holding replacements to avoid key overwrite
router/class.file-processor.php CHANGED
@@ -24,7 +24,7 @@
24
  $this->replacement_path = $replacement_path;
25
 
26
  //append doc root to path
27
- $this->full_file_path = $_SERVER["DOCUMENT_ROOT"] . $this->file_path;
28
  $this->full_file_path = str_replace( '\\', '/', $this->full_file_path);
29
 
30
  //check if file exists
24
  $this->replacement_path = $replacement_path;
25
 
26
  //append doc root to path
27
+ $this->full_file_path = ABSPATH . ltrim($this->file_path, '\/');
28
  $this->full_file_path = str_replace( '\\', '/', $this->full_file_path);
29
 
30
  //check if file exists
router/environment.php CHANGED
@@ -1,2 +1,2 @@
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
- $environment_variable = '{"theme":{"folder_name":"twentyfifteen","mapped_name":"layout"},"child_theme":{"folder_name":"child-theme","mapped_name":"layout-child"},"allowed_paths":["F:\/htdocs\/wp-hide-demo\/wp-content\/themes"],"cache_path":"F:\/htdocs\/wp-hide-demo\/wp-content\/cache\/wph\/","site_wordpress_relative_path":"\/","wordpress_directory":"","site_relative_path":""}' ?>
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ $environment_variable = '{"theme":{"folder_name":"twentysixteen","mapped_name":"jd_content\/themes\/theme_name"},"allowed_paths":["F:\/htdocs\/wp-hide-demo\/wp-content\/themes"],"cache_path":"F:\/htdocs\/wp-hide-demo\/wp-content\/cache\/wph\/","site_wordpress_relative_path":"\/","wordpress_directory":"","site_relative_path":""}' ?>
wp-hide.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.4.5.1
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.4.5.6
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */