WP Hide & Security Enhancer - Version 1.6.2

Version Description

  • Reverse URLs when saving a meta data field, to avoid custom urls to be writted within the database.
  • Trigger a system notice when deployed on MultiSite, as not being compatible.
  • Don't run _init_remove_html_new_lines when AJAX call to avoid front side processing errors.
  • WP Rocket compatibility file updates, to works with combined CSS assets
  • Shield Security compatibility update, to works with version 10 and up.
  • Prevent nottices and errors when attempt to rite on .htaccess file.
  • New filter wph/components/wp_oembed_add_discovery_links to allow disabling the Remove Oembed - wp_oembed_add_discovery_links
  • New filter wph/components/wp_oembed_add_host_js to allow disabling the Remove Oembed - wp_oembed_add_host_js
  • New compatibility file for wePOS plugin
  • New compatibility file for Asset CleanUp Pro Page Speed Booster plugin
Download this release

Release Info

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

Code changes from version 1.6.1.3 to 1.6.2

compatibility/wepos.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Compatibility for Plugin Name: wePOS
5
+ * Compatibility checked on Version: 1.1.1
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
+
10
+ class WPH_conflict_handle_wepos
11
+ {
12
+
13
+ var $wph;
14
+
15
+ function __construct()
16
+ {
17
+ if( ! $this->is_plugin_active())
18
+ return FALSE;
19
+
20
+ global $wph;
21
+
22
+ $this->wph = $wph;
23
+
24
+ add_filter( 'wp', array( $this , 'wp' ), 1 );
25
+ }
26
+
27
+ static function is_plugin_active()
28
+ {
29
+
30
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
31
+
32
+ if( is_plugin_active( 'wepos/wepos.php' ) )
33
+ return TRUE;
34
+ else
35
+ return FALSE;
36
+ }
37
+
38
+ function wp( )
39
+ {
40
+ if ( ! wepos_is_frontend() )
41
+ return;
42
+
43
+ add_filter ('wph/components/wp_oembed_add_discovery_links', '__return_false');
44
+ add_filter ('wph/components/wp_oembed_add_host_js', '__return_false');
45
+ }
46
+ }
47
+
48
+ new WPH_conflict_handle_wepos();
49
+
50
+
51
+ ?>
compatibility/wp-asset-clean-up.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Compatibility for Plugin Name: Asset CleanUp Pro: Page Speed Booster
6
+ * Compatibility checked on Version: 1.1.7.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
+
11
+ class WPH_conflict_handle_wpacu
12
+ {
13
+ var $wph;
14
+
15
+ function __construct()
16
+ {
17
+ if( ! $this->is_plugin_active() )
18
+ return FALSE;
19
+
20
+ global $wph;
21
+
22
+ $this->wph = $wph;
23
+
24
+ add_filter( 'wpacu_html_source_after_optimization', array( $this, 'process_buffer'), 999 );
25
+
26
+ }
27
+
28
+ function is_plugin_active()
29
+ {
30
+
31
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
32
+
33
+ if( is_plugin_active( 'wp-asset-clean-up-pro/wpacu.php' ) || is_plugin_active( 'wp-asset-clean-up/wpacu.php' ) )
34
+ return TRUE;
35
+ else
36
+ return FALSE;
37
+ }
38
+
39
+
40
+ function process_buffer( $buffer )
41
+ {
42
+
43
+
44
+ $buffer = $this->wph->ob_start_callback( $buffer );
45
+
46
+ return $buffer;
47
+
48
+ }
49
+
50
+ }
51
+
52
+
53
+ new WPH_conflict_handle_wpacu();
54
+
55
+ ?>
compatibility/wp-rocket.php CHANGED
@@ -10,6 +10,8 @@
10
  class WPH_conflict_handle_wp_rocket
11
  {
12
  var $wph;
 
 
13
 
14
  function __construct()
15
  {
@@ -22,7 +24,7 @@
22
 
23
  add_filter( 'rocket_js_url', array( $this, 'rocket_js_url'), 999 );
24
 
25
- add_filter( 'rocket_css_content', array( $this, 'rocket_css_content'), 999 );
26
  /**
27
  *
28
  * STILL THEY ARE MISSING A FILTER FOR JS Content !!!!!! ....
@@ -73,12 +75,77 @@
73
  *
74
  * @param mixed $content
75
  */
76
- function rocket_css_content( $buffer )
77
  {
 
 
 
 
 
 
 
 
 
 
 
 
78
  $buffer = $this->wph->functions->content_urls_replacement( $buffer, $this->wph->functions->get_replacement_list() );
79
 
80
  return $buffer ;
81
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  }
84
 
10
  class WPH_conflict_handle_wp_rocket
11
  {
12
  var $wph;
13
+
14
+ var $internals = array();
15
 
16
  function __construct()
17
  {
24
 
25
  add_filter( 'rocket_js_url', array( $this, 'rocket_js_url'), 999 );
26
 
27
+ add_filter( 'rocket_css_content', array( $this, 'rocket_css_content'), 999, 3 );
28
  /**
29
  *
30
  * STILL THEY ARE MISSING A FILTER FOR JS Content !!!!!! ....
75
  *
76
  * @param mixed $content
77
  */
78
+ function rocket_css_content( $buffer, $source = FALSE , $target = FALSE )
79
  {
80
+
81
+ if ( $target !== FALSE )
82
+ {
83
+ $target_url = FALSE;
84
+ $_target = str_replace ( $_SERVER['DOCUMENT_ROOT'], '', wp_normalize_path ( $target ) );
85
+ if ( $_target != $target )
86
+ $target_url = trailingslashit ( site_url() ) . ltrim( $_target , '/' );
87
+
88
+
89
+ $buffer = $this->_convert_relative_urls ( $buffer, $target_url );
90
+ }
91
+
92
  $buffer = $this->wph->functions->content_urls_replacement( $buffer, $this->wph->functions->get_replacement_list() );
93
 
94
  return $buffer ;
95
  }
96
+
97
+
98
+
99
+
100
+ function _convert_relative_urls( $local_file_content, $resource_path = FALSE )
101
+ {
102
+ if ( ! empty ( $resource_path ) )
103
+ $this->internals['resource_url_path'] = dirname( $resource_path );
104
+ $this->internals['site_url_parsed'] = parse_url ( site_url() );
105
+
106
+ $local_file_content = preg_replace_callback( '/(?:url\s?\(\s?)(?![\'\"]?(?:data:|\/\/|http))[\'\"]?([^\'\"\)\s]+)/im' ,array($this, '_convert_relative_urls_callback') , $local_file_content );
107
+
108
+ $this->internals['resource_url_path'] = '';
109
+
110
+ return $local_file_content;
111
+ }
112
+
113
+
114
+ /**
115
+ * Convert relative urls to absolute
116
+ * e.g. ../images/image.jpg
117
+ * or /wp-contnet/themes/default/image.jpg
118
+ *
119
+ * @param mixed $match
120
+ */
121
+ function _convert_relative_urls_callback( $match )
122
+ {
123
+ $match_block = $match[0];
124
+
125
+ //check if relative to domain
126
+ if ( strpos ( $match[1], '/' ) === 0 )
127
+ $address = '//' . trailingslashit( $this->internals['site_url_parsed']['host'] ) . ltrim( $match[1], '/' );
128
+ else
129
+ {
130
+ //if there is no path specified, then return as is
131
+ if ( empty ( $this->internals['resource_url_path'] ) )
132
+ return $match_block;
133
+ $address = trailingslashit( $this->internals['resource_url_path'] ) . ltrim( $match[1], '/' );
134
+ }
135
+
136
+ $address = explode('/', $address);
137
+ $keys = array_keys($address, '..');
138
+
139
+ foreach($keys as $keypos => $key)
140
+ array_splice($address, $key - ($keypos * 2 + 1), 2);
141
+
142
+ $address = implode('/', $address);
143
+ $address = str_replace('./', '', $address);
144
+
145
+ $match_block = str_replace( $match[1], $address, $match_block );
146
+
147
+ return $match_block;
148
+ }
149
 
150
  }
151
 
compatibility/wp-simple-firewall.php CHANGED
@@ -47,7 +47,11 @@
47
  $oICWP_Wpsf_Controller = Shield\Controller\Controller::GetInstance( WP_PLUGIN_DIR . '/wp-simple-firewall/src/login_protect.php' );
48
 
49
  //check if custom login is active
50
- if( ! $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect->isCustomLoginPathEnabled())
 
 
 
 
51
  return FALSE;
52
 
53
  global $wph;
47
  $oICWP_Wpsf_Controller = Shield\Controller\Controller::GetInstance( WP_PLUGIN_DIR . '/wp-simple-firewall/src/login_protect.php' );
48
 
49
  //check if custom login is active
50
+ if( method_exists( $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect, 'isCustomLoginPathEnabled') && $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect->isCustomLoginPathEnabled())
51
+ return FALSE;
52
+ else
53
+ //version 10.0.3 and later
54
+ if( method_exists( $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect, 'getCustomLoginPath') && $oICWP_Wpsf_Controller->oFeatureHandlerLoginProtect->getCustomLoginPath() != '' )
55
  return FALSE;
56
 
57
  global $wph;
include/admin-interfaces/setup.class.php CHANGED
@@ -156,6 +156,19 @@
156
  }
157
 
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  if( $this->wph->functions->is_litespeed() === TRUE )
160
  {
161
  ?>
156
  }
157
 
158
 
159
+ if ( is_multisite() )
160
+ {
161
+ ?>
162
+ <div class="start-container title warning">
163
+ <h2><?php _e( "System notice !", 'wp-hide-security-enhancer' ) ?></h2>
164
+ </div>
165
+ <div class="container-description">
166
+ <p><?php _e("This plugin version can't handle MultiSite environment and will fail to provide specific features, please check with WP Hide PRO at", 'wp-hide-security-enhancer') ?> <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p>
167
+ </div>
168
+ <?php
169
+ }
170
+
171
+
172
  if( $this->wph->functions->is_litespeed() === TRUE )
173
  {
174
  ?>
include/class.compatibility.php CHANGED
@@ -130,6 +130,10 @@
130
  //Hyper Cache
131
  include_once(WPH_PATH . 'compatibility/hyper-cache.php');
132
 
 
 
 
 
133
  /**
134
  * Themes
135
  */
130
  //Hyper Cache
131
  include_once(WPH_PATH . 'compatibility/hyper-cache.php');
132
 
133
+ include_once(WPH_PATH . 'compatibility/wp-asset-clean-up.php');
134
+
135
+ include_once(WPH_PATH . 'compatibility/wepos.php');
136
+
137
  /**
138
  * Themes
139
  */
include/update.class.php CHANGED
@@ -35,7 +35,9 @@
35
  if (version_compare($version, WPH_CORE_VERSION, '<'))
36
  {
37
 
38
- $_trigger_flush_rules = FALSE;
 
 
39
 
40
  if(version_compare($version, '1.1', '<'))
41
  {
@@ -248,14 +250,18 @@
248
  }
249
 
250
 
 
 
 
 
251
 
252
- //Always generate the environment file
253
- $this->wph->set_static_environment_file();
254
 
255
  //clear teh site cache
256
- $this->wph->functions->site_cache_clear();
257
-
258
-
 
 
259
  //save the last code version
260
  $this->wph->settings['version'] = WPH_CORE_VERSION;
261
  $this->wph->functions->update_settings($this->wph->settings);
35
  if (version_compare($version, WPH_CORE_VERSION, '<'))
36
  {
37
 
38
+ $_trigger_flush_rules = FALSE;
39
+ $_set_static_environment_file = FALSE;
40
+ $_trigger_site_cache_flush = FALSE;
41
 
42
  if(version_compare($version, '1.1', '<'))
43
  {
250
  }
251
 
252
 
253
+ if ( $_set_static_environment_file === TRUE )
254
+ {
255
+ $this->wph->set_static_environment_file();
256
+ }
257
 
 
 
258
 
259
  //clear teh site cache
260
+ if ( $_trigger_site_cache_flush === TRUE )
261
+ {
262
+ $this->wph->functions->site_cache_clear();
263
+ }
264
+
265
  //save the last code version
266
  $this->wph->settings['version'] = WPH_CORE_VERSION;
267
  $this->wph->functions->update_settings($this->wph->settings);
include/wph.class.php CHANGED
@@ -143,29 +143,32 @@
143
  //create the static file which contain different environment variables which will be used on router
144
  add_action('admin_init', array($this, 'environment_check'), 999);
145
 
146
- add_action('admin_init', array($this, 'mu_loader_check'), 999);
147
 
148
  //apache
149
  //add_filter('mod_rewrite_rules', array($this, 'mod_rewrite_rules'), 999);
150
 
151
  if($this->server_htaccess_config === TRUE)
152
- add_filter('flush_rewrite_rules_hard', array($this, 'flush_rewrite_rules_hard'), 999);
153
 
154
  //IIS7 server
155
- add_filter('iis7_url_rewrite_rules', array($this, 'iis7_url_rewrite_rules'), 999);
156
 
157
  //on switch theme
158
- add_action('switch_theme', array($this, 'switch_theme'));
159
 
160
  //admin notices
161
- add_action( 'admin_notices', array(&$this, 'admin_notices'));
162
- add_action( 'network_admin_notices', array(&$this, 'admin_notices'));
163
 
164
  //ensure the media urls are being saved using default WordPress urls
165
- add_action( 'save_post', array($this, 'save_post'), 999 );
 
 
 
166
 
167
  //restart the buffering if already outputed. This is usefull for plugin / theme update iframe
168
- add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'), -1);
169
 
170
  //prevent the buffer processing if not filterable available
171
  add_filter( 'wp-hide/ignore_ob_start_callback', array($this, 'ignore_ob_start_callback'), 999 );
@@ -349,17 +352,24 @@
349
 
350
  $this->admin_interface = new WPH_interface();
351
 
 
 
 
 
 
 
352
  $first_view = get_option('wph-first-view');
353
  if ( isset ( $_GET['page'] ) && $_GET['page'] == 'wp-hide' )
354
  $first_view = 'false';
355
 
356
  $menu_title = 'WP Hide';
357
- if ( empty ( $first_view ) )
358
  $menu_title .= ' <span class="update-plugins count-1"><span class="plugin-count">!</span></span>';
359
  $hookID = add_menu_page('WP Hide', $menu_title, 'manage_options', 'wp-hide');
360
 
 
361
  $menu_title = 'Setup';
362
- if ( empty ( $first_view ) )
363
  $menu_title .= ' <span class="update-plugins count-1"><span class="plugin-count">!</span></span>';
364
 
365
  $setup_interface = new WPH_setup_interface();
@@ -389,12 +399,12 @@
389
 
390
  if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
391
  {
392
- echo "<div class='error'><p><b>WP Hide</b> ". __("Your server run on WPEngine which works on Nginx rewrite rules, please check with WP Hide PRO version at", 'wp-hide-security-enhancer') .' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
393
  }
394
 
395
  if ( is_multisite() )
396
  {
397
- echo "<div class='error'><p><b>WP Hide</b> ". __("This plugin version can't handle MultiSite environment, please check with WP Hide PRO version at", 'wp-hide-security-enhancer') . ' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
398
  }
399
 
400
  if(! $this->functions->is_muloader())
@@ -617,7 +627,7 @@
617
  $headers_content_type = array();
618
  if ( ! is_null ( $this->functions ) )
619
  $headers_content_type = $this->functions->get_headers_list_content_type();
620
- if ( in_array( $headers_content_type , array( 'text/xml' ) ) && ! is_null ( $this->functions ) )
621
  {
622
 
623
  //do only url replacements
@@ -1023,11 +1033,14 @@
1023
  $rules = $this->get_rewrite_rules();
1024
 
1025
  //check if there's a # BEGIN WordPress and # END WordPress markers or create those to ensude plugin rules are put on top of Wordpress ones
1026
- $file_content = file( $htaccess_file );
1027
-
1028
- if( count( preg_grep("/.*# BEGIN WordPress.*/i", $file_content) ) < 1 && count( preg_grep("/.*# END WordPress.*/i", $file_content) ) < 1 )
1029
- {
1030
- $this->functions->insert_with_markers_on_top( $htaccess_file, 'WordPress', '' );
 
 
 
1031
  }
1032
 
1033
 
@@ -1461,6 +1474,158 @@
1461
 
1462
  }
1463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1464
 
1465
  /**
1466
  * Restart the bufering if turned off already
143
  //create the static file which contain different environment variables which will be used on router
144
  add_action('admin_init', array($this, 'environment_check'), 999);
145
 
146
+ add_action('admin_init', array($this, 'mu_loader_check'), 999);
147
 
148
  //apache
149
  //add_filter('mod_rewrite_rules', array($this, 'mod_rewrite_rules'), 999);
150
 
151
  if($this->server_htaccess_config === TRUE)
152
+ add_filter('flush_rewrite_rules_hard', array($this, 'flush_rewrite_rules_hard'), 999);
153
 
154
  //IIS7 server
155
+ add_filter('iis7_url_rewrite_rules', array($this, 'iis7_url_rewrite_rules'), 999);
156
 
157
  //on switch theme
158
+ add_action('switch_theme', array($this, 'switch_theme'));
159
 
160
  //admin notices
161
+ add_action( 'admin_notices', array(&$this, 'admin_notices'));
162
+ add_action( 'network_admin_notices', array(&$this, 'admin_notices'));
163
 
164
  //ensure the media urls are being saved using default WordPress urls
165
+ add_action( 'save_post', array($this, 'save_post'), 999 );
166
+
167
+ //ensure meta data is being saved using default WordPress urls
168
+ add_action( 'update_post_metadata', array($this, 'update_post_metadata'), 999, 5 );
169
 
170
  //restart the buffering if already outputed. This is usefull for plugin / theme update iframe
171
+ add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'), -1);
172
 
173
  //prevent the buffer processing if not filterable available
174
  add_filter( 'wp-hide/ignore_ob_start_callback', array($this, 'ignore_ob_start_callback'), 999 );
352
 
353
  $this->admin_interface = new WPH_interface();
354
 
355
+ $system_warning = FALSE;
356
+ if( ( $this->server_htaccess_config === FALSE && $this->server_web_config === FALSE)
357
+ || is_multisite()
358
+ )
359
+ $system_warning = TRUE;
360
+
361
  $first_view = get_option('wph-first-view');
362
  if ( isset ( $_GET['page'] ) && $_GET['page'] == 'wp-hide' )
363
  $first_view = 'false';
364
 
365
  $menu_title = 'WP Hide';
366
+ if ( empty ( $first_view ) || $system_warning )
367
  $menu_title .= ' <span class="update-plugins count-1"><span class="plugin-count">!</span></span>';
368
  $hookID = add_menu_page('WP Hide', $menu_title, 'manage_options', 'wp-hide');
369
 
370
+
371
  $menu_title = 'Setup';
372
+ if ( empty ( $first_view ) || $system_warning )
373
  $menu_title .= ' <span class="update-plugins count-1"><span class="plugin-count">!</span></span>';
374
 
375
  $setup_interface = new WPH_setup_interface();
399
 
400
  if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
401
  {
402
+ echo "<div class='error'><p><b>WP Hide</b> ". __("Your server run on WPEngine which works on Nginx rewrite rules, please check with WP Hide PRO at", 'wp-hide-security-enhancer') .' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
403
  }
404
 
405
  if ( is_multisite() )
406
  {
407
+ echo "<div class='error'><p><b>WP Hide</b> ". __("This plugin version can't handle MultiSite environment and will fail to provide specific features, please check with WP Hide PRO version at", 'wp-hide-security-enhancer') . ' <a target="_blank" href="https://www.wp-hide.com/wp-hide-pro-now-available/">WP-Hide PRO</a></p></div>';
408
  }
409
 
410
  if(! $this->functions->is_muloader())
627
  $headers_content_type = array();
628
  if ( ! is_null ( $this->functions ) )
629
  $headers_content_type = $this->functions->get_headers_list_content_type();
630
+ if ( in_array( $headers_content_type , array( 'text/xml', 'application/rss+xml' ) ) && ! is_null ( $this->functions ) )
631
  {
632
 
633
  //do only url replacements
1033
  $rules = $this->get_rewrite_rules();
1034
 
1035
  //check if there's a # BEGIN WordPress and # END WordPress markers or create those to ensude plugin rules are put on top of Wordpress ones
1036
+ $file_content = @file( $htaccess_file );
1037
+
1038
+ if ( $file_content )
1039
+ {
1040
+ if( count( preg_grep("/.*# BEGIN WordPress.*/i", $file_content) ) < 1 && count( preg_grep("/.*# END WordPress.*/i", $file_content) ) < 1 )
1041
+ {
1042
+ $this->functions->insert_with_markers_on_top( $htaccess_file, 'WordPress', '' );
1043
+ }
1044
  }
1045
 
1046
 
1474
 
1475
  }
1476
 
1477
+
1478
+
1479
+ /**
1480
+ * Revert back the files urls to default WordPress
1481
+ *
1482
+ * @param mixed $check
1483
+ * @param mixed $object_id
1484
+ * @param mixed $meta_key
1485
+ * @param mixed $meta_value
1486
+ * @param mixed $prev_value
1487
+ */
1488
+ function update_post_metadata ( $check, $object_id, $meta_key, $meta_value, $prev_value)
1489
+ {
1490
+ global $wpdb;
1491
+
1492
+ $meta_type = 'post';
1493
+
1494
+ $table = _get_meta_table( $meta_type );
1495
+ $column = sanitize_key( $meta_type . '_id' );
1496
+ $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
1497
+
1498
+ $_meta_value = $meta_value;
1499
+
1500
+ $replacement_list = $this->functions->get_replacement_list();
1501
+ //reverse the list
1502
+ $replacement_list = array_flip($replacement_list);
1503
+ //replace the urls
1504
+ if ( is_array ( $meta_value ) )
1505
+ {
1506
+ if ( count ( $meta_value ) > 0 )
1507
+ {
1508
+ foreach ( $meta_value as $key => $value )
1509
+ {
1510
+ $meta_value[$key] = $this->functions->content_urls_replacement( $value, $replacement_list );
1511
+ }
1512
+ }
1513
+ }
1514
+ else
1515
+ {
1516
+ $meta_value = $this->functions->content_urls_replacement( $meta_value, $replacement_list );
1517
+ }
1518
+
1519
+ $raw_meta_key = $meta_key;
1520
+ $passed_value = wp_slash($meta_value);
1521
+
1522
+ // Compare existing value to new value if no prev value given and the key exists only once.
1523
+ if ( empty( $prev_value ) ) {
1524
+ $old_value = get_metadata( $meta_type, $object_id, $meta_key );
1525
+ if ( count( $old_value ) == 1 ) {
1526
+ if ( $old_value[0] === $meta_value ) {
1527
+ return false;
1528
+ }
1529
+ }
1530
+ }
1531
+
1532
+
1533
+ $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
1534
+ if ( empty( $meta_ids ) ) {
1535
+ return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
1536
+ }
1537
+
1538
+
1539
+ $_meta_value = $meta_value;
1540
+ $meta_value = maybe_serialize( $meta_value );
1541
+
1542
+ $data = compact( 'meta_value' );
1543
+ $where = array(
1544
+ $column => $object_id,
1545
+ 'meta_key' => $meta_key,
1546
+ );
1547
+
1548
+ if ( ! empty( $prev_value ) ) {
1549
+ $prev_value = maybe_serialize( $prev_value );
1550
+ $where['meta_value'] = $prev_value;
1551
+ }
1552
+
1553
+ foreach ( $meta_ids as $meta_id ) {
1554
+ /**
1555
+ * Fires immediately before updating metadata of a specific type.
1556
+ *
1557
+ * The dynamic portion of the hook, `$meta_type`, refers to the meta
1558
+ * object type (comment, post, term, or user).
1559
+ *
1560
+ * @since 2.9.0
1561
+ *
1562
+ * @param int $meta_id ID of the metadata entry to update.
1563
+ * @param int $object_id Object ID.
1564
+ * @param string $meta_key Meta key.
1565
+ * @param mixed $_meta_value Meta value.
1566
+ */
1567
+ do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
1568
+
1569
+ if ( 'post' == $meta_type ) {
1570
+ /**
1571
+ * Fires immediately before updating a post's metadata.
1572
+ *
1573
+ * @since 2.9.0
1574
+ *
1575
+ * @param int $meta_id ID of metadata entry to update.
1576
+ * @param int $object_id Post ID.
1577
+ * @param string $meta_key Meta key.
1578
+ * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
1579
+ * the value is an array, an object, or itself a PHP-serialized string.
1580
+ */
1581
+ do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
1582
+ }
1583
+ }
1584
+
1585
+ $result = $wpdb->update( $table, $data, $where );
1586
+ if ( ! $result ) {
1587
+ return false;
1588
+ }
1589
+
1590
+ wp_cache_delete( $object_id, $meta_type . '_meta' );
1591
+
1592
+ foreach ( $meta_ids as $meta_id ) {
1593
+ /**
1594
+ * Fires immediately after updating metadata of a specific type.
1595
+ *
1596
+ * The dynamic portion of the hook, `$meta_type`, refers to the meta
1597
+ * object type (comment, post, term, or user).
1598
+ *
1599
+ * @since 2.9.0
1600
+ *
1601
+ * @param int $meta_id ID of updated metadata entry.
1602
+ * @param int $object_id Object ID.
1603
+ * @param string $meta_key Meta key.
1604
+ * @param mixed $_meta_value Meta value.
1605
+ */
1606
+ do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
1607
+
1608
+ if ( 'post' == $meta_type ) {
1609
+ /**
1610
+ * Fires immediately after updating a post's metadata.
1611
+ *
1612
+ * @since 2.9.0
1613
+ *
1614
+ * @param int $meta_id ID of updated metadata entry.
1615
+ * @param int $object_id Post ID.
1616
+ * @param string $meta_key Meta key.
1617
+ * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
1618
+ * the value is an array, an object, or itself a PHP-serialized string.
1619
+ */
1620
+ do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
1621
+ }
1622
+ }
1623
+
1624
+ return true;
1625
+
1626
+ }
1627
+
1628
+
1629
 
1630
  /**
1631
  * Restart the bufering if turned off already
modules/components/general-html.php CHANGED
@@ -225,7 +225,7 @@
225
  }
226
 
227
 
228
- function remove_html_comments($buffer)
229
  {
230
  //do not run when within admin
231
  if(defined('WP_ADMIN'))
@@ -246,12 +246,15 @@
246
  }
247
 
248
 
249
- function _init_remove_html_new_lines($saved_field_data)
250
  {
251
  if(empty($saved_field_data) || $saved_field_data == 'no')
252
  return FALSE;
253
 
254
-
 
 
 
255
  add_filter('wp-hide/ob_start_callback', array($this, 'remove_html_new_lines'));
256
 
257
  }
225
  }
226
 
227
 
228
+ static public function remove_html_comments($buffer)
229
  {
230
  //do not run when within admin
231
  if(defined('WP_ADMIN'))
246
  }
247
 
248
 
249
+ function _init_remove_html_new_lines ( $saved_field_data )
250
  {
251
  if(empty($saved_field_data) || $saved_field_data == 'no')
252
  return FALSE;
253
 
254
+ //do not run when within admin or AJAX
255
+ if( defined('WP_ADMIN') && ( !defined('DOING_AJAX') || ( defined('DOING_AJAX') && DOING_AJAX === TRUE )) && ! apply_filters('wph/components/force_run_on_admin', FALSE, 'remove_html_new_lines' ) )
256
+ return;
257
+
258
  add_filter('wp-hide/ob_start_callback', array($this, 'remove_html_new_lines'));
259
 
260
  }
modules/components/general-oembed.php CHANGED
@@ -34,16 +34,26 @@
34
 
35
  return $this->module_settings;
36
  }
 
37
 
38
  function _init_remove_oembed($saved_field_data)
39
  {
40
  if(empty($saved_field_data) || $saved_field_data == 'no')
41
  return FALSE;
42
 
43
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
44
- remove_action( 'wp_head', 'wp_oembed_add_host_js' );
45
 
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
  ?>
34
 
35
  return $this->module_settings;
36
  }
37
+
38
 
39
  function _init_remove_oembed($saved_field_data)
40
  {
41
  if(empty($saved_field_data) || $saved_field_data == 'no')
42
  return FALSE;
43
 
44
+ add_filter('wp' , array ( $this, '_run' ) );
 
45
 
46
  }
47
 
48
+
49
+ function _run()
50
+ {
51
+ if ( apply_filters ('wph/components/wp_oembed_add_discovery_links', TRUE ) !== FALSE )
52
+ remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
53
+
54
+ if ( apply_filters ('wph/components/wp_oembed_add_host_js', TRUE ) !== FALSE )
55
+ remove_action( 'wp_head', 'wp_oembed_add_host_js' );
56
+ }
57
+
58
  }
59
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nsp-code, tdgu
3
  Donate link: https://www.nsp-code.com/
4
  Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
5
  Requires at least: 2.8
6
- Tested up to: 5.5.1
7
- Stable tag: 1.6.1.3
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress site using smart techniques. No files are changed on your server. Change default admin and wp-login urls
@@ -267,6 +267,10 @@ There's no requirements on php knowledge. All plugin features and functionality
267
 
268
  A demo instance can be found at <a target="_blank" href="https://demo.wp-hide.com/">https://demo.wp-hide.com/</a> or our own website <a target="_blank" href="https://www.wp-hide.com/">WP Hide and Security Enhancer</a>
269
 
 
 
 
 
270
  = Can I still update WordPress, my plugins and themes? =
271
 
272
  Everything works as before, no functionality is being broken. You can run updates at any time.
@@ -345,6 +349,19 @@ Please get in touch with us and we'll do our best to include it for a next versi
345
 
346
  == Changelog ==
347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  = 1.6.1.3 =
349
  * Compatibility with Hyper Cache
350
  * Update JSON REST service disable, remove the json_enabled as being deprecated, rely on rest_authentication_errors filter
3
  Donate link: https://www.nsp-code.com/
4
  Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
5
  Requires at least: 2.8
6
+ Tested up to: 5.5.3
7
+ Stable tag: 1.6.2
8
  License: GPLv2 or later
9
 
10
  Hide and increase Security for your WordPress site using smart techniques. No files are changed on your server. Change default admin and wp-login urls
267
 
268
  A demo instance can be found at <a target="_blank" href="https://demo.wp-hide.com/">https://demo.wp-hide.com/</a> or our own website <a target="_blank" href="https://www.wp-hide.com/">WP Hide and Security Enhancer</a>
269
 
270
+ = Can I use the plugin on my Nginx server ? =
271
+
272
+ The free plugin can't generate Nginx rewrite rules. It works with Apache, LiteSpeed, IIS and compatible.
273
+
274
  = Can I still update WordPress, my plugins and themes? =
275
 
276
  Everything works as before, no functionality is being broken. You can run updates at any time.
349
 
350
  == Changelog ==
351
 
352
+ = 1.6.2 =
353
+ * Reverse URLs when saving a meta data field, to avoid custom urls to be writted within the database.
354
+ * Trigger a system notice when deployed on MultiSite, as not being compatible.
355
+ * Don't run _init_remove_html_new_lines when AJAX call to avoid front side processing errors.
356
+ * WP Rocket compatibility file updates, to works with combined CSS assets
357
+ * Shield Security compatibility update, to works with version 10 and up.
358
+ * Prevent nottices and errors when attempt to rite on .htaccess file.
359
+ * New filter wph/components/wp_oembed_add_discovery_links to allow disabling the Remove Oembed - wp_oembed_add_discovery_links
360
+ * New filter wph/components/wp_oembed_add_host_js to allow disabling the Remove Oembed - wp_oembed_add_host_js
361
+ * New compatibility file for wePOS plugin
362
+ * New compatibility file for Asset CleanUp Pro Page Speed Booster plugin
363
+
364
+
365
  = 1.6.1.3 =
366
  * Compatibility with Hyper Cache
367
  * Update JSON REST service disable, remove the json_enabled as being deprecated, rely on rest_authentication_errors filter
wp-hide.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.wp-hide.com/
5
  Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.6.1.3
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */
5
  Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.6.2
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */