WP Hide & Security Enhancer - Version 1.5.4

Version Description

  • Compatibility re-structure, use a general module
  • Compatibility fix for Shield Security wp-simple-firewall
  • Removed the upload_dir filtering as produce some issues on specific environment, possible incompatibilities will be post-processed within General compatibility module
  • Filter the post content on save_post action, to reverse any custom slugs like media urls, to preserve backward compatibility, in case plugin disable
  • Ensure wp-simple-firewall run once when called from multiple components
  • Update for Rewrite Slash component, use a rewrite conditional to ensure the code is not trigger for POST method
Download this release

Release Info

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

Code changes from version 1.5.3.1 to 1.5.4

{conflicts → compatibility}/buddypress.php RENAMED
File without changes
compatibility/general.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * General compatibility class to be used for groups of plugins
6
+ *
7
+ */
8
+
9
+
10
+ class WPH_conflict_handle_General
11
+ {
12
+
13
+ static function init()
14
+ {
15
+ if( self::is_plugin_active( 'wp-job-manager/wp-job-manager.php'))
16
+ {
17
+ //adjust the uplod_data
18
+ add_filter('upload_dir', array('WPH_conflict_handle_General', 'upload_dir' ), 999);
19
+ }
20
+ }
21
+
22
+ static function is_plugin_active( $plugin_path )
23
+ {
24
+
25
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
26
+
27
+ if(is_plugin_active( $plugin_path ) || is_plugin_active_for_network( $plugin_path ))
28
+ return TRUE;
29
+ else
30
+ return FALSE;
31
+ }
32
+
33
+ /**
34
+ * Process the upload_dir data
35
+ *
36
+ * @param mixed $data
37
+ */
38
+ static function upload_dir( $data )
39
+ {
40
+
41
+ if ( ! self::check_backtrace_for_caller('create_attachment', 'WP_Job_Manager_Form_Submit_Job'))
42
+ return $data;
43
+
44
+ global $wph;
45
+
46
+ $new_upload_path = $wph->functions->untrailingslashit_all( $wph->functions->get_module_item_setting('new_upload_path') );
47
+ $new_content_path = $wph->functions->untrailingslashit_all( $wph->functions->get_module_item_setting('new_content_path') );
48
+
49
+ if ( empty ( $new_upload_path ) && empty ( $new_content_path ) )
50
+ return $data;
51
+
52
+ if ( ! empty ( $new_upload_path ) )
53
+ {
54
+ $new_url = trailingslashit( home_url() ) . $new_upload_path;
55
+
56
+ if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) )
57
+ {
58
+ $ms_dir = '/sites/' . get_current_blog_id();
59
+ $new_url .= $ms_dir;
60
+ }
61
+ }
62
+ else
63
+ {
64
+ $new_url = trailingslashit( home_url() ) . str_replace( '/wp-content' , $new_content_path, $wph->default_variables['uploads_directory'] );
65
+ }
66
+
67
+ $data['url'] = str_replace($data['baseurl'], $new_url, $data['url']);
68
+ $data['baseurl'] = $new_url;
69
+
70
+ return $data;
71
+ }
72
+
73
+
74
+ static function check_backtrace_for_caller( $function_name, $class_name = FALSE )
75
+ {
76
+
77
+ $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
78
+ foreach ( $backtrace as $block )
79
+ {
80
+ if ( $block['function'] == $function_name )
81
+ {
82
+ if ( $class_name === FALSE )
83
+ return TRUE;
84
+
85
+ if ( $class_name != FALSE && !isset( $block['class'] ) )
86
+ return FALSE;
87
+
88
+ if ( $block['class'] == $class_name )
89
+ return TRUE;
90
+
91
+ return FALSE;
92
+
93
+ }
94
+
95
+ }
96
+
97
+ return FALSE;
98
+ }
99
+
100
+
101
+ }
102
+
103
+
104
+ WPH_conflict_handle_General::init();
105
+
106
+
107
+ ?>
{conflicts → compatibility}/js/wp_simple_firewall.js RENAMED
File without changes
{conflicts → compatibility}/super-cache.php RENAMED
File without changes
conflicts/theme-avada.php → compatibility/themes/avada.php RENAMED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
-
 
4
  class WPH_conflict_theme_avada
5
  {
6
 
@@ -8,26 +9,9 @@
8
  {
9
  add_action('plugins_loaded', array('WPH_conflict_theme_avada', 'run') , -1);
10
  }
11
-
12
- static function is_theme_active()
13
- {
14
-
15
- $theme = wp_get_theme();
16
-
17
- if( ! $theme instanceof WP_Theme )
18
- return FALSE;
19
-
20
- if (isset( $theme->template ) && strtolower( $theme->template ) == 'avada')
21
- return TRUE;
22
-
23
- return FALSE;
24
-
25
- }
26
-
27
  static public function run()
28
  {
29
- if( ! self::is_theme_active())
30
- return FALSE;
31
 
32
  global $wph;
33
 
@@ -52,6 +36,9 @@
52
  }
53
 
54
  }
 
 
 
55
 
56
 
57
  ?>
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
  class WPH_conflict_theme_avada
6
  {
7
 
9
  {
10
  add_action('plugins_loaded', array('WPH_conflict_theme_avada', 'run') , -1);
11
  }
12
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  static public function run()
14
  {
 
 
15
 
16
  global $wph;
17
 
36
  }
37
 
38
  }
39
+
40
+
41
+ WPH_conflict_theme_avada::init();
42
 
43
 
44
  ?>
compatibility/themes/divi.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Theme Compatibility : DIVI
5
+ * Introduced at version : 3.17.6*
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
+
10
+
11
+ class WPH_conflict_theme_divi
12
+ {
13
+
14
+ static function init()
15
+ {
16
+ add_action('et_divi_theme_customizer_css_output', array('WPH_conflict_theme_divi', 'process'));
17
+ add_action('et_divi_fonts_css_output', array('WPH_conflict_theme_divi', 'process'));
18
+ add_action('et_divi_sidebar_width_css_output', array('WPH_conflict_theme_divi', 'process'));
19
+ add_action('et_divi_module_customizer_css_output', array('WPH_conflict_theme_divi', 'process'));
20
+
21
+ add_action('et_builder_custom_fonts', array('WPH_conflict_theme_divi', 'process_et_builder_custom_fonts'));
22
+ }
23
+
24
+
25
+ static public function process( $buffer )
26
+ {
27
+
28
+ global $wph;
29
+
30
+ $replacement_list = $wph->functions->get_replacement_list();
31
+
32
+ //replace the urls
33
+ $buffer = $wph->functions->content_urls_replacement( $buffer, $replacement_list );
34
+
35
+ return $buffer;
36
+
37
+ }
38
+
39
+
40
+ /**
41
+ * Process the cutom fonts
42
+ *
43
+ * @param mixed $all_custom_fonts
44
+ */
45
+ static public function process_et_builder_custom_fonts( $all_custom_fonts )
46
+ {
47
+
48
+ if ( ! is_array($all_custom_fonts) || count ( $all_custom_fonts ) < 1 )
49
+ return $all_custom_fonts;
50
+
51
+ global $wph;
52
+
53
+ $replacement_list = $wph->functions->get_replacement_list();
54
+
55
+ foreach ( $all_custom_fonts as $font => $font_data )
56
+ {
57
+ $font_urls = $font_data['font_url'];
58
+ if ( !is_array( $font_urls ) || count ( $font_urls ) < 1 )
59
+ continue;
60
+
61
+ foreach ( $font_urls as $type => $url )
62
+ {
63
+ $font_urls[$type] = $wph->functions->content_urls_replacement( $url, $replacement_list );
64
+ }
65
+
66
+ $all_custom_fonts[$font]['font_url'] = $font_urls;
67
+ }
68
+
69
+ return $all_custom_fonts;
70
+
71
+ }
72
+
73
+ }
74
+
75
+
76
+ WPH_conflict_theme_divi::init();
77
+
78
+
79
+ ?>
{conflicts → compatibility}/w3-cache.php RENAMED
File without changes
compatibility/woo-global-cart.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Compatibility for Plugin Name: WooGlobalCart
5
+ * Compatibility checked on Version: 1.3.8
6
+ */
7
+
8
+
9
+ class WPH_conflict_handle_wgc
10
+ {
11
+
12
+ static function init()
13
+ {
14
+ add_action('plugins_loaded', array('WPH_conflict_handle_wgc', 'run') , -1);
15
+ }
16
+
17
+ static function is_plugin_active()
18
+ {
19
+
20
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
21
+
22
+ if(is_plugin_active( 'woo-global-cart/woo-global-cart.php' ))
23
+ return TRUE;
24
+ else
25
+ return FALSE;
26
+ }
27
+
28
+ static public function run()
29
+ {
30
+ if( ! self::is_plugin_active())
31
+ return FALSE;
32
+
33
+ global $wph;
34
+
35
+ add_filter ('woogc/on_shutdown/ob_buferring_output', array('WPH_conflict_handle_wgc', 'status_ob_buferring_output'), 10, 2);
36
+
37
+ }
38
+
39
+ static function status_ob_buferring_output( $status, $ob_get_status )
40
+ {
41
+
42
+ if ( is_array( $ob_get_status ) && $ob_get_status['name'] == 'WPH::ob_start_callback' )
43
+ {
44
+ $status = FALSE;
45
+ }
46
+
47
+ return $status;
48
+ }
49
+
50
+ }
51
+
52
+
53
+ ?>
{conflicts → compatibility}/woocommerce.php RENAMED
@@ -44,7 +44,7 @@
44
  global $wph;
45
 
46
  //if no change on the upload slug, return as is
47
- $new_upload_path = $wph->functions->get_module_item_setting('new_upload_path');
48
  if( empty ( $new_upload_path ) )
49
  return $data;
50
 
@@ -55,7 +55,7 @@
55
  $replace = trailingslashit ( site_url() ) . $new_upload_path;
56
  $replace = str_replace(array("http:", "https:") , "", $replace );
57
 
58
- $replace_with = $wph->default_variables['upload_url'];
59
  $replace_with = str_replace(array("http:", "https:") , "", $replace_with );
60
 
61
  $file = str_replace($replace, $replace_with , $file);
44
  global $wph;
45
 
46
  //if no change on the upload slug, return as is
47
+ $new_upload_path = $wph->functions->get_site_module_saved_value('new_upload_path');
48
  if( empty ( $new_upload_path ) )
49
  return $data;
50
 
55
  $replace = trailingslashit ( site_url() ) . $new_upload_path;
56
  $replace = str_replace(array("http:", "https:") , "", $replace );
57
 
58
+ $replace_with = $wph->default_variables['url'] . $wph->default_variables['uploads_directory'];
59
  $replace_with = str_replace(array("http:", "https:") , "", $replace_with );
60
 
61
  $file = str_replace($replace, $replace_with , $file);
{conflicts → compatibility}/wp-fastest-cache.php RENAMED
@@ -27,7 +27,7 @@
27
 
28
  global $wph;
29
 
30
- //add_action('plugins_loaded', array('WPH_conflict_handle_wp_fastest_cache', 'plugins_loaded'));
31
 
32
  }
33
 
27
 
28
  global $wph;
29
 
30
+ add_action('plugins_loaded', array('WPH_conflict_handle_wp_fastest_cache', 'plugins_loaded'));
31
 
32
  }
33
 
{conflicts → compatibility}/wp-rocket.php RENAMED
@@ -6,6 +6,9 @@
6
 
7
  static function init()
8
  {
 
 
 
9
  add_action('wp', array('WPH_conflict_handle_wp_rocket', 'wpcache') , -1);
10
  }
11
 
@@ -22,9 +25,7 @@
22
 
23
  static public function wpcache()
24
  {
25
- if( ! self::is_plugin_active())
26
- return FALSE;
27
-
28
  //only on front side
29
  if(is_admin() && ! defined( 'DOING_AJAX' ) )
30
  return;
@@ -82,10 +83,7 @@
82
  return;
83
 
84
 
85
- //disable default WPH buffering replacement filter and rely on a different one provided by wp rocket plugin
86
- $wph->disable_ob_start_callback = TRUE;
87
-
88
- add_filter( 'rocket_buffer', array( 'WPH_conflict_handle_wp_rocket', 'start_ob_start_callback'), 999 );
89
 
90
 
91
 
@@ -95,18 +93,57 @@
95
  * reenable the ob_start_Callback
96
  *
97
  */
98
- static public function start_ob_start_callback( $buffer )
99
  {
100
 
101
  global $wph;
102
 
103
- $wph->disable_ob_start_callback = FALSE;
104
- $buffer = $wph->ob_start_callback( $buffer );
105
 
106
  return $buffer;
107
 
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  }
112
 
6
 
7
  static function init()
8
  {
9
+ if( ! self::is_plugin_active())
10
+ return FALSE;
11
+
12
  add_action('wp', array('WPH_conflict_handle_wp_rocket', 'wpcache') , -1);
13
  }
14
 
25
 
26
  static public function wpcache()
27
  {
28
+
 
 
29
  //only on front side
30
  if(is_admin() && ! defined( 'DOING_AJAX' ) )
31
  return;
83
  return;
84
 
85
 
86
+ add_filter( 'rocket_buffer', array( 'WPH_conflict_handle_wp_rocket', 'set_cache_possible_write_marker'), 999 );
 
 
 
87
 
88
 
89
 
93
  * reenable the ob_start_Callback
94
  *
95
  */
96
+ static public function set_cache_possible_write_marker( $buffer )
97
  {
98
 
99
  global $wph;
100
 
101
+ if ( apply_filters( 'do_rocket_generate_caching_files', true ) )
102
+ add_filter('wp-hide/ob_start_callback', array('WPH_conflict_handle_wp_rocket', 'save_correct_cache') , 999);
103
 
104
  return $buffer;
105
 
106
  }
107
 
108
+
109
+ static public function save_correct_cache( $buffer )
110
+ {
111
+ global $request_uri_path, $rocket_cache_filepath, $is_nginx;
112
+
113
+
114
+ // Create cache folders of the request uri.
115
+ rocket_mkdir_p( $request_uri_path );
116
+
117
+ $footprint = '';
118
+
119
+ // Save the cache file.
120
+ rocket_put_content( $rocket_cache_filepath, $buffer . $footprint );
121
+
122
+ if ( get_rocket_option( 'do_caching_mobile_files' ) ) {
123
+ if ( $is_nginx ) {
124
+ // Create a hidden empty file for mobile detection on NGINX with the Rocket NGINX configuration.
125
+ $nginx_mobile_detect_file = $request_uri_path . '/.mobile-active';
126
+
127
+ if ( ! rocket_direct_filesystem()->exists( $nginx_mobile_detect_file ) ) {
128
+ rocket_direct_filesystem()->touch( $nginx_mobile_detect_file );
129
+ }
130
+ }
131
+ }
132
+
133
+ if ( function_exists( 'gzencode' ) ) {
134
+ rocket_put_content( $rocket_cache_filepath . '_gzip', gzencode( $buffer . $footprint, apply_filters( 'rocket_gzencode_level_compression', 3 ) ) );
135
+ }
136
+
137
+ // Send headers with the last modified time of the cache file.
138
+ /*
139
+ if ( file_exists( $rocket_cache_filepath ) ) {
140
+ header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', filemtime( $rocket_cache_filepath ) ) . ' GMT' );
141
+ }
142
+ */
143
+
144
+ return $buffer;
145
+
146
+ }
147
 
148
  }
149
 
{conflicts → compatibility}/wp-simple-firewall.php RENAMED
@@ -1,6 +1,10 @@
1
  <?php
2
 
3
-
 
 
 
 
4
  class WPH_conflict_handle_wp_simple_firewall
5
  {
6
 
@@ -18,8 +22,13 @@
18
 
19
  static public function custom_login_check()
20
  {
21
- if( ! self::is_plugin_active())
 
 
22
  return FALSE;
 
 
 
23
 
24
  add_action('plugins_loaded', array( 'WPH_conflict_handle_wp_simple_firewall', 'on_plugins_loaded' ), 5);
25
 
@@ -29,11 +38,11 @@
29
  static public function on_plugins_loaded()
30
  {
31
 
 
32
  $oICWP_Wpsf_Controller = ICWP_WPSF_Plugin_Controller::GetInstance( WP_PLUGIN_DIR . '/wp-simple-firewall/icwp-wpsf.php' );
33
- //$oICWP_Wpsf = ICWP_WPSF_Shield_Security::GetInstance( $oICWP_Wpsf_Controller );
34
 
35
  //check if custom login is active
36
- if( ! $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect->getIsCustomLoginPathEnabled())
37
  return FALSE;
38
 
39
  global $wph;
@@ -57,15 +66,13 @@
57
  $wph->functions->remove_anonymous_object_filter('site_url', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
58
  $wph->functions->remove_anonymous_object_filter('network_site_url', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
59
  $wph->functions->remove_anonymous_object_filter('wp_redirect', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
 
60
  $wph->functions->remove_anonymous_object_filter('et_anticipate_exceptions', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fAddToEtMaintenanceExceptions');
61
-
62
- //remove this filter too
63
- remove_action( 'init', array( 'WPH_conflict_handle_wp_simple_firewall', '_on_filter_init' ), -1);
64
 
65
  //add an admin notice to inform about the conflict
66
- add_action('admin_notices', array( 'WPH_conflict_handle_wp_simple_firewall', 'admin_notice' ));
67
- add_action( 'wp_ajax_wph_notice_ignore_wp_simple_firewall', array( 'WPH_conflict_handle_wp_simple_firewall','ajax_calls' ));
68
- add_action( 'admin_print_scripts', array( 'WPH_conflict_handle_wp_simple_firewall', 'admin_print_scripts' ) );
69
  }
70
 
71
  }
@@ -124,7 +131,7 @@
124
 
125
  static function admin_print_scripts()
126
  {
127
- wp_enqueue_script( 'WPH_conflict_handle_wp_simple_firewall', WPH_URL . '/conflicts/js/wp_simple_firewall.js', array( 'jquery' ), '1.0', true );
128
  }
129
 
130
  }
1
  <?php
2
 
3
+ /**
4
+ * Compatibility for Plugin Name: Shield Security
5
+ * Compatibility checked on Version: 6.10.9
6
+ */
7
+
8
  class WPH_conflict_handle_wp_simple_firewall
9
  {
10
 
22
 
23
  static public function custom_login_check()
24
  {
25
+ global $wph;
26
+
27
+ if( ! self::is_plugin_active() || defined('WPH_conflict_handle_wp_simple_firewall') )
28
  return FALSE;
29
+
30
+ //mark as being loaded
31
+ define('WPH_conflict_handle_wp_simple_firewall', TRUE );
32
 
33
  add_action('plugins_loaded', array( 'WPH_conflict_handle_wp_simple_firewall', 'on_plugins_loaded' ), 5);
34
 
38
  static public function on_plugins_loaded()
39
  {
40
 
41
+
42
  $oICWP_Wpsf_Controller = ICWP_WPSF_Plugin_Controller::GetInstance( WP_PLUGIN_DIR . '/wp-simple-firewall/icwp-wpsf.php' );
 
43
 
44
  //check if custom login is active
45
+ if( ! $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect->isCustomLoginPathEnabled())
46
  return FALSE;
47
 
48
  global $wph;
66
  $wph->functions->remove_anonymous_object_filter('site_url', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
67
  $wph->functions->remove_anonymous_object_filter('network_site_url', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
68
  $wph->functions->remove_anonymous_object_filter('wp_redirect', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fCheckForLoginPhp');
69
+ $wph->functions->remove_anonymous_object_filter('wp_redirect', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fProtectUnauthorizedLoginRedirect');
70
  $wph->functions->remove_anonymous_object_filter('et_anticipate_exceptions', 'ICWP_WPSF_Processor_LoginProtect_WpLogin', 'fAddToEtMaintenanceExceptions');
 
 
 
71
 
72
  //add an admin notice to inform about the conflict
73
+ add_action('admin_notices', array( 'WPH_conflict_handle_wp_simple_firewall', 'admin_notice' ));
74
+ add_action( 'wp_ajax_wph_notice_ignore_wp_simple_firewall', array( 'WPH_conflict_handle_wp_simple_firewall','ajax_calls' ));
75
+ add_action( 'admin_print_scripts', array( 'WPH_conflict_handle_wp_simple_firewall', 'admin_print_scripts' ) );
76
  }
77
 
78
  }
131
 
132
  static function admin_print_scripts()
133
  {
134
+ wp_enqueue_script( 'WPH_conflict_handle_wp_simple_firewall', WPH_URL . '/compatibility/js/wp_simple_firewall.js', array( 'jquery' ), '1.0', true );
135
  }
136
 
137
  }
{conflicts → compatibility}/wpml.php RENAMED
File without changes
include/class.compatibility.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class WPH_Compatibility
6
+ {
7
+
8
+ var $wph = '';
9
+ var $functions = '';
10
+
11
+ function __construct()
12
+ {
13
+ global $wph;
14
+
15
+ $this->wph = $wph;
16
+ $this->functions = new WPH_functions();
17
+
18
+ $this->init();
19
+
20
+ }
21
+
22
+
23
+
24
+ function init()
25
+ {
26
+
27
+ /**
28
+ * General
29
+ */
30
+ include_once(WPH_PATH . 'compatibility/general.php');
31
+
32
+
33
+ //w3-cache compatibility handle
34
+ include_once(WPH_PATH . 'compatibility/w3-cache.php');
35
+ WPH_conflict_handle_w3_cache::init();
36
+
37
+ //super-cache compatibility handle
38
+ include_once(WPH_PATH . 'compatibility/super-cache.php');
39
+ WPH_conflict_handle_super_cache::init();
40
+
41
+ //BuddyPress handle
42
+ include_once(WPH_PATH . 'compatibility/buddypress.php');
43
+ WPH_conflict_handle_BuddyPress::init();
44
+
45
+
46
+ //WP Fastest Cache handle
47
+ include_once(WPH_PATH . 'compatibility/wp-fastest-cache.php');
48
+ WPH_conflict_handle_wp_fastest_cache::init();
49
+
50
+ //WP Rocket
51
+ include_once(WPH_PATH . 'compatibility/wp-rocket.php');
52
+ WPH_conflict_handle_wp_rocket::init();
53
+
54
+ //WooCommerce
55
+ include_once(WPH_PATH . 'compatibility/woocommerce.php');
56
+ WPH_conflict_handle_woocommerce::init();
57
+
58
+ //WPML
59
+ include_once(WPH_PATH . 'compatibility/wpml.php');
60
+ WPH_conflict_handle_wpml::init();
61
+
62
+ //WooGlobalCart
63
+ include_once(WPH_PATH . 'compatibility/woo-global-cart.php');
64
+ WPH_conflict_handle_wgc::init();
65
+
66
+ /**
67
+ * Themes
68
+ */
69
+
70
+ $theme = wp_get_theme();
71
+
72
+ if( ! $theme instanceof WP_Theme )
73
+ return FALSE;
74
+
75
+ $compatibility_themes = array(
76
+ 'avada' => 'avada.php',
77
+ 'divi' => 'divi.php',
78
+ );
79
+
80
+ if (isset( $theme->template ) )
81
+ {
82
+
83
+ foreach ( $compatibility_themes as $theme_slug => $compatibility_file )
84
+ {
85
+ if ( strtolower( $theme->template ) == $theme_slug )
86
+ {
87
+ include_once(WPH_PATH . 'compatibility/themes/' . $compatibility_file );
88
+ }
89
+ }
90
+
91
+ }
92
+
93
+
94
+ do_action('wph/compatibility/init');
95
+
96
+ }
97
+
98
+
99
+
100
+ }
101
+
102
+
103
+
104
+
105
+ ?>
include/functions.class.php CHANGED
@@ -2388,47 +2388,6 @@
2388
  return $url;
2389
 
2390
  }
2391
-
2392
-
2393
-
2394
- /**
2395
- * Process the upload_dir data
2396
- *
2397
- * @param mixed $data
2398
- */
2399
- function upload_dir($data)
2400
- {
2401
-
2402
- $new_upload_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_upload_path') );
2403
- $new_content_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_content_path') );
2404
-
2405
- if ( empty ( $new_upload_path ) && empty ( $new_content_path ) )
2406
- return $data;
2407
-
2408
- if ( ! empty ( $new_upload_path ) )
2409
- $new_url = trailingslashit( home_url() ) . $new_upload_path;
2410
- else
2411
- {
2412
- $new_url = str_replace( '/wp-content/' , '/' . $new_content_path . '/', $this->wph->default_variables['upload_url'] );
2413
- }
2414
-
2415
- $data['url'] = str_replace($data['baseurl'], $new_url, $data['url']);
2416
- $data['baseurl'] = $new_url;
2417
-
2418
- //add replacement
2419
- if(! ($this->wph->functions->replacement_exists( $this->wph->default_variables['upload_url'] )))
2420
- {
2421
- //prevent media images from being replaced on admin, as when plugin disable the links will not work anymore
2422
- $block_upload_url = $this->wph->functions->get_module_item_setting('block_upload_url');
2423
- if(!is_admin() || (is_admin() && !empty($block_upload_url) && $block_upload_url != 'no'))
2424
- {
2425
- $this->wph->functions->add_replacement($this->wph->default_variables['upload_url'], $new_url);
2426
- }
2427
- }
2428
-
2429
- return $data;
2430
- }
2431
-
2432
 
2433
 
2434
  /**
2388
  return $url;
2389
 
2390
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2391
 
2392
 
2393
  /**
include/wph.class.php CHANGED
@@ -28,8 +28,6 @@
28
  var $uninstall = FALSE;
29
 
30
  var $is_initialised = FALSE;
31
-
32
- var $conflicts = array();
33
 
34
  function __construct()
35
  {
@@ -94,8 +92,8 @@
94
  //check for plugin update
95
  $this->update();
96
 
97
- //handle the conflicts
98
- $this->plugin_conflicts();
99
 
100
  $this->_load_modules();
101
 
@@ -151,8 +149,8 @@
151
  add_action( 'admin_notices', array(&$this, 'admin_notices'));
152
  add_action( 'network_admin_notices', array(&$this, 'admin_notices'));
153
 
154
- //adjust the uplod_data
155
- add_filter('upload_dir', array($this->functions, 'upload_dir' ), 999);
156
 
157
  //restart the buffering if already outputed. This is usefull for plugin / theme update iframe
158
  add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'), -1);
@@ -1273,44 +1271,50 @@
1273
 
1274
 
1275
  /**
1276
- * General Plugins Conflicts Handle
1277
  *
1278
  */
1279
- function plugin_conflicts()
1280
  {
1281
 
1282
- //w3-cache conflicts handle
1283
- include_once(WPH_PATH . 'conflicts/w3-cache.php');
1284
- WPH_conflict_handle_w3_cache::init();
1285
-
1286
- //super-cache conflicts handle
1287
- include_once(WPH_PATH . 'conflicts/super-cache.php');
1288
- WPH_conflict_handle_super_cache::init();
1289
-
1290
- //BuddyPress handle
1291
- include_once(WPH_PATH . 'conflicts/buddypress.php');
1292
- WPH_conflict_handle_BuddyPress::init();
1293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1294
 
1295
- //WP Fastest Cache handle
1296
- include_once(WPH_PATH . 'conflicts/wp-fastest-cache.php');
1297
- WPH_conflict_handle_wp_fastest_cache::init();
1298
-
1299
- //WP Rocket
1300
- include_once(WPH_PATH . 'conflicts/wp-rocket.php');
1301
- WPH_conflict_handle_wp_rocket::init();
1302
 
1303
- //Theme Avada
1304
- include_once(WPH_PATH . 'conflicts/theme-avada.php');
1305
- WPH_conflict_theme_avada::init();
1306
 
1307
- //WooCommerce
1308
- include_once(WPH_PATH . 'conflicts/woocommerce.php');
1309
- WPH_conflict_handle_woocommerce::init();
1310
 
1311
- //WPML
1312
- include_once(WPH_PATH . 'conflicts/wpml.php');
1313
- WPH_conflict_handle_wpml::init();
 
 
 
 
 
1314
 
1315
  }
1316
 
28
  var $uninstall = FALSE;
29
 
30
  var $is_initialised = FALSE;
 
 
31
 
32
  function __construct()
33
  {
92
  //check for plugin update
93
  $this->update();
94
 
95
+ //handle the compatibility
96
+ $this->plugins_themes_compatibility();
97
 
98
  $this->_load_modules();
99
 
149
  add_action( 'admin_notices', array(&$this, 'admin_notices'));
150
  add_action( 'network_admin_notices', array(&$this, 'admin_notices'));
151
 
152
+ //ensure the media urls are being saved using default WordPress urls
153
+ add_action( 'save_post', array($this, 'save_post'), 999 );
154
 
155
  //restart the buffering if already outputed. This is usefull for plugin / theme update iframe
156
  add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'), -1);
1271
 
1272
 
1273
  /**
1274
+ * General Plugins and Themes compatibility Handle
1275
  *
1276
  */
1277
+ function plugins_themes_compatibility()
1278
  {
1279
 
1280
+ include_once( WPH_PATH . '/include/class.compatibility.php' );
1281
+ $compatibility_handler = new WPH_Compatibility();
 
 
 
 
 
 
 
 
 
1282
 
1283
+ }
1284
+
1285
+
1286
+
1287
+ /**
1288
+ * Revert back the files urls to default WordPress
1289
+ *
1290
+ * @param mixed $post_id
1291
+ */
1292
+ function save_post( $post_id )
1293
+ {
1294
+ if ( wp_is_post_revision( $post_id ) )
1295
+ return;
1296
+
1297
+ global $wpdb;
1298
 
1299
+ //raw retrieve the post data
1300
+ $mysql_query = $wpdb->prepare( "SELECT * FROM " . $wpdb->posts . " WHERE ID = %d", $post_id );
1301
+ $post_data = $wpdb->get_row( $mysql_query );
 
 
 
 
1302
 
1303
+ $replacement_list = $this->functions->get_replacement_list();
1304
+ //reverse the list
1305
+ $replacement_list = array_flip($replacement_list);
1306
 
1307
+ //replace the urls
1308
+ $post_content = $this->functions->content_urls_replacement($post_data->post_content, $replacement_list );
 
1309
 
1310
+ //if there's a difference, update
1311
+ if ( $post_content != $post_data->post_content )
1312
+ {
1313
+ $mysql_query = $wpdb->prepare( " UPDATE " . $wpdb->posts . "
1314
+ SET post_content = %s
1315
+ WHERE ID = %d", $post_content, $post_id);
1316
+ $result = $wpdb->get_results( $mysql_query );
1317
+ }
1318
 
1319
  }
1320
 
languages/wp-hide-security-enhancer.mo CHANGED
Binary file
languages/wp-hide-security-enhancer.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Hide & Security Enhancer\n"
4
- "POT-Creation-Date: 2018-12-11 15:09+0200\n"
5
- "PO-Revision-Date: 2018-12-11 15:09+0200\n"
6
  "Last-Translator: NspCode <contact@nsp-code.com>\n"
7
  "Language-Team: Nsp Code\n"
8
  "Language: en\n"
@@ -15,7 +15,7 @@ msgstr ""
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
- #: conflicts/wp-simple-firewall.php:93
19
  msgid ""
20
  "<b>Conflict notice</b>: The Security Firewall - Login Protection use the "
21
  "Rename WP Login Page functionality which is the same as WP Hide - Admin "
@@ -87,80 +87,80 @@ msgid ""
87
  "link to development site"
88
  msgstr ""
89
 
90
- #: include/wph.class.php:318
91
  msgid ""
92
  "Are you sure to reset all settings? All options will be removed. Manual "
93
  "remove of rewrite lines is required if no access from php"
94
  msgstr ""
95
 
96
- #: include/wph.class.php:355
97
  msgid ""
98
  "Your server run on WPEngine which works on Nginx rewrite rules, please check "
99
  "with WP Hide PRO version at."
100
  msgstr ""
101
 
102
- #: include/wph.class.php:360
103
  msgid ""
104
  "This plugin version can't handle MultiSite environment, please check with WP "
105
  "Hide PRO version at"
106
  msgstr ""
107
 
108
- #: include/wph.class.php:365
109
  msgid ""
110
  "Unable to launch WP Hide through mu-plugins/wp-hide-loader.php<br /> Please "
111
  "make sure this location is writable so the plugin create the required file."
112
  msgstr ""
113
 
114
- #: include/wph.class.php:371
115
  msgid ""
116
  "Permalink is required to be turned ON for WP Hide & Security Enhancer to work"
117
  msgstr ""
118
 
119
- #: include/wph.class.php:376
120
  msgid ""
121
  "<b>WP Hide</b> This plugin version can't handle this server type, please "
122
  "check with PRO version at"
123
  msgstr ""
124
 
125
- #: include/wph.class.php:387
126
  msgid ""
127
  "Unable to write custom rules to your .htaccess. Is this file writable? <br /"
128
  ">No changes are being applied."
129
  msgstr ""
130
 
131
- #: include/wph.class.php:390
132
  msgid ""
133
  "Unable to write custom rules to your web.config. Is this file writable? <br /"
134
  ">No changes are being applied."
135
  msgstr ""
136
 
137
- #: include/wph.class.php:398
138
  msgid ""
139
  "Unable to create cache folder. Is the wp-content writable? <br />No cache "
140
  "data will be available."
141
  msgstr ""
142
 
143
- #: include/wph.class.php:403
144
  msgid "All Settings where restored to default"
145
  msgstr ""
146
 
147
- #: include/wph.class.php:432
148
  msgid "Settings saved"
149
  msgstr ""
150
 
151
- #: include/wph.class.php:474
152
  msgid "Cache cleared"
153
  msgstr ""
154
 
155
- #: include/wph.class.php:789
156
  msgid "Unable to create environment static file. Is "
157
  msgstr ""
158
 
159
- #: include/wph.class.php:789
160
  msgid "writable"
161
  msgstr ""
162
 
163
- #: include/wph.class.php:789
164
  msgid "will not work correctly, so where turned off."
165
  msgstr ""
166
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Hide & Security Enhancer\n"
4
+ "POT-Creation-Date: 2018-12-28 11:39+0200\n"
5
+ "PO-Revision-Date: 2018-12-28 11:39+0200\n"
6
  "Last-Translator: NspCode <contact@nsp-code.com>\n"
7
  "Language-Team: Nsp Code\n"
8
  "Language: en\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
+ #: compatibility/wp-simple-firewall.php:99
19
  msgid ""
20
  "<b>Conflict notice</b>: The Security Firewall - Login Protection use the "
21
  "Rename WP Login Page functionality which is the same as WP Hide - Admin "
87
  "link to development site"
88
  msgstr ""
89
 
90
+ #: include/wph.class.php:316
91
  msgid ""
92
  "Are you sure to reset all settings? All options will be removed. Manual "
93
  "remove of rewrite lines is required if no access from php"
94
  msgstr ""
95
 
96
+ #: include/wph.class.php:353
97
  msgid ""
98
  "Your server run on WPEngine which works on Nginx rewrite rules, please check "
99
  "with WP Hide PRO version at."
100
  msgstr ""
101
 
102
+ #: include/wph.class.php:358
103
  msgid ""
104
  "This plugin version can't handle MultiSite environment, please check with WP "
105
  "Hide PRO version at"
106
  msgstr ""
107
 
108
+ #: include/wph.class.php:363
109
  msgid ""
110
  "Unable to launch WP Hide through mu-plugins/wp-hide-loader.php<br /> Please "
111
  "make sure this location is writable so the plugin create the required file."
112
  msgstr ""
113
 
114
+ #: include/wph.class.php:369
115
  msgid ""
116
  "Permalink is required to be turned ON for WP Hide & Security Enhancer to work"
117
  msgstr ""
118
 
119
+ #: include/wph.class.php:374
120
  msgid ""
121
  "<b>WP Hide</b> This plugin version can't handle this server type, please "
122
  "check with PRO version at"
123
  msgstr ""
124
 
125
+ #: include/wph.class.php:385
126
  msgid ""
127
  "Unable to write custom rules to your .htaccess. Is this file writable? <br /"
128
  ">No changes are being applied."
129
  msgstr ""
130
 
131
+ #: include/wph.class.php:388
132
  msgid ""
133
  "Unable to write custom rules to your web.config. Is this file writable? <br /"
134
  ">No changes are being applied."
135
  msgstr ""
136
 
137
+ #: include/wph.class.php:396
138
  msgid ""
139
  "Unable to create cache folder. Is the wp-content writable? <br />No cache "
140
  "data will be available."
141
  msgstr ""
142
 
143
+ #: include/wph.class.php:401
144
  msgid "All Settings where restored to default"
145
  msgstr ""
146
 
147
+ #: include/wph.class.php:430
148
  msgid "Settings saved"
149
  msgstr ""
150
 
151
+ #: include/wph.class.php:472
152
  msgid "Cache cleared"
153
  msgstr ""
154
 
155
+ #: include/wph.class.php:787
156
  msgid "Unable to create environment static file. Is "
157
  msgstr ""
158
 
159
+ #: include/wph.class.php:787
160
  msgid "writable"
161
  msgstr ""
162
 
163
+ #: include/wph.class.php:787
164
  msgid "will not work correctly, so where turned off."
165
  msgstr ""
166
 
modules/components/admin-admin_url.php CHANGED
@@ -66,7 +66,7 @@
66
  remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
67
 
68
  //conflict handle with other plugins
69
- include_once(WPH_PATH . 'conflicts/wp-simple-firewall.php');
70
  WPH_conflict_handle_wp_simple_firewall::custom_login_check();
71
 
72
  $this->wph->functions->add_replacement( trailingslashit( site_url() ) . 'wp-admin' , trailingslashit( home_url() ) . $saved_field_data );
66
  remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
67
 
68
  //conflict handle with other plugins
69
+ include_once(WPH_PATH . 'compatibility/wp-simple-firewall.php');
70
  WPH_conflict_handle_wp_simple_firewall::custom_login_check();
71
 
72
  $this->wph->functions->add_replacement( trailingslashit( site_url() ) . 'wp-admin' , trailingslashit( home_url() ) . $saved_field_data );
modules/components/admin-new_wp_login_php.php CHANGED
@@ -57,7 +57,7 @@
57
 
58
 
59
  //conflict handle with other plugins
60
- include_once(WPH_PATH . 'conflicts/wp-simple-firewall.php');
61
  WPH_conflict_handle_wp_simple_firewall::custom_login_check();
62
 
63
 
57
 
58
 
59
  //conflict handle with other plugins
60
+ include_once(WPH_PATH . 'compatibility/wp-simple-firewall.php');
61
  WPH_conflict_handle_wp_simple_firewall::custom_login_check();
62
 
63
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.0
7
- Stable tag: 1.5.3.1
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress site instance using smart techniques. No files are changed on your server.
@@ -271,6 +271,14 @@ Please get in touch with us and we'll do our best to include it for a next versi
271
 
272
  == Changelog ==
273
 
 
 
 
 
 
 
 
 
274
  = 1.5.3.1 =
275
  * Fix JSON encoded urls when using SSL
276
 
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.0
7
+ Stable tag: 1.5.4
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress site instance using smart techniques. No files are changed on your server.
271
 
272
  == Changelog ==
273
 
274
+ = 1.5.4 =
275
+ * Compatibility re-structure, use a general module
276
+ * Compatibility fix for Shield Security wp-simple-firewall
277
+ * Removed the upload_dir filtering as produce some issues on specific environment, possible incompatibilities will be post-processed within General compatibility module
278
+ * Filter the post content on save_post action, to reverse any custom slugs like media urls, to preserve backward compatibility, in case plugin disable
279
+ * Ensure wp-simple-firewall run once when called from multiple components
280
+ * Update for Rewrite Slash component, use a rewrite conditional to ensure the code is not trigger for POST method
281
+
282
  = 1.5.3.1 =
283
  * Fix JSON encoded urls when using SSL
284
 
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.5.3.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.5.4
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */