Version Description
- Improve Remove Generator Meta - Use DOMDocument to remove any meta generator tag
- New Component Item - Remove X-Pingback Header
- New functionality, Remove ID from Menu items, Remove class from Menu items
- Add short default replacement for wp-login.php
- Filter all email content (message argument) through wp_mail for any require replacements
- New action wp-hide/add_default_replacements
- New functionality - Remove ID attribute from all link tags which include a stylesheet.
- Separate tabs for Styles and Scripts
- Update engine improvements
- Fix for apache_mod_loaded function not being loaded on plugin update
- Replace spaces within paths for theme rewrite component
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.3.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.3
- include/functions.class.php +41 -4
- include/update.class.php +59 -37
- include/wph.class.php +88 -19
- modules/components/admin-new_wp_login_php.php +7 -1
- modules/components/general-headers.php +50 -0
- modules/components/general-html-comments.php +0 -60
- modules/components/general-html.php +138 -0
- modules/components/general-meta.php +36 -0
- modules/components/{general-remove_version.php → general-scripts.php} +5 -6
- modules/components/general-styles.php +121 -0
- modules/components/rewrite-new_theme_path.php +12 -0
- modules/module-general.php +7 -4
- readme.txt +31 -9
- wp-hide.php +19 -11
include/functions.class.php
CHANGED
@@ -308,13 +308,51 @@
|
|
308 |
$home_path = $this->get_home_path();
|
309 |
|
310 |
$htaccess_file = $home_path.'.htaccess';
|
311 |
-
|
312 |
-
if (apache_mod_loaded('mod_rewrite', true))
|
313 |
return TRUE;
|
314 |
-
|
315 |
return FALSE;
|
316 |
|
317 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
|
320 |
/**
|
@@ -334,7 +372,6 @@
|
|
334 |
|
335 |
}
|
336 |
|
337 |
-
|
338 |
/**
|
339 |
* return whatever server using the .htaccess config file
|
340 |
*
|
308 |
$home_path = $this->get_home_path();
|
309 |
|
310 |
$htaccess_file = $home_path.'.htaccess';
|
311 |
+
if ($this->apache_mod_loaded('mod_rewrite', true))
|
|
|
312 |
return TRUE;
|
313 |
+
|
314 |
return FALSE;
|
315 |
|
316 |
}
|
317 |
+
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Does the specified module exist in the Apache config?
|
321 |
+
*
|
322 |
+
* @since 2.5.0
|
323 |
+
*
|
324 |
+
* @global bool $is_apache
|
325 |
+
*
|
326 |
+
* @param string $mod The module, e.g. mod_rewrite.
|
327 |
+
* @param bool $default Optional. The default return value if the module is not found. Default false.
|
328 |
+
* @return bool Whether the specified module is loaded.
|
329 |
+
*/
|
330 |
+
function apache_mod_loaded($mod, $default = false)
|
331 |
+
{
|
332 |
+
|
333 |
+
if ( function_exists( 'apache_get_modules' ) )
|
334 |
+
{
|
335 |
+
$mods = apache_get_modules();
|
336 |
+
if ( in_array($mod, $mods) )
|
337 |
+
return true;
|
338 |
+
}
|
339 |
+
elseif (getenv('HTTP_MOD_REWRITE') !== FALSE)
|
340 |
+
{
|
341 |
+
$mod_found = getenv('HTTP_MOD_REWRITE') == 'On' ? true : false ;
|
342 |
+
return $mod_found;
|
343 |
+
}
|
344 |
+
elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
|
345 |
+
ob_start();
|
346 |
+
phpinfo(8);
|
347 |
+
$phpinfo = ob_get_clean();
|
348 |
+
if ( false !== strpos($phpinfo, $mod) )
|
349 |
+
return true;
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
return $default;
|
354 |
+
|
355 |
+
}
|
356 |
|
357 |
|
358 |
/**
|
372 |
|
373 |
}
|
374 |
|
|
|
375 |
/**
|
376 |
* return whatever server using the .htaccess config file
|
377 |
*
|
include/update.class.php
CHANGED
@@ -18,58 +18,80 @@
|
|
18 |
{
|
19 |
$version = isset($this->wph->settings['version']) ? $this->wph->settings['version'] : 1;
|
20 |
|
21 |
-
|
22 |
-
//This block will be removed in a later version
|
23 |
-
if( isset($this->wph->settings['module_settings']['rewrite_new_theme_path']) )
|
24 |
{
|
25 |
-
|
26 |
-
$
|
27 |
-
|
28 |
-
foreach($module_settings as $key => $value)
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
$
|
44 |
}
|
45 |
-
|
46 |
-
|
47 |
-
$this->wph->functions->update_settings($this->wph->settings);
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
if (version_compare(WPH_VERSION, $version, '>'))
|
52 |
-
{
|
53 |
-
|
54 |
if(version_compare($version, '1.3', '<'))
|
55 |
{
|
56 |
//flush rules
|
57 |
add_action('wp_loaded', array($this, 'flush_rules') , -1);
|
58 |
|
59 |
-
$
|
60 |
-
$this->wph->functions->update_settings($this->wph->settings);
|
61 |
}
|
62 |
-
|
|
|
63 |
{
|
64 |
//run update 2
|
|
|
|
|
65 |
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
|
|
72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
|
18 |
{
|
19 |
$version = isset($this->wph->settings['version']) ? $this->wph->settings['version'] : 1;
|
20 |
|
21 |
+
if (version_compare($version, WPH_VERSION, '<'))
|
|
|
|
|
22 |
{
|
23 |
+
|
24 |
+
if(version_compare($version, '1.1', '<'))
|
|
|
|
|
25 |
{
|
26 |
+
//structure and settings fields where changed since v1.1
|
27 |
+
if( isset($this->wph->settings['module_settings']['rewrite_new_theme_path']) )
|
28 |
+
{
|
29 |
+
$module_settings = $this->wph->settings['module_settings'];
|
30 |
+
$this->wph->settings['module_settings'] = array();
|
31 |
+
|
32 |
+
foreach($module_settings as $key => $value)
|
33 |
+
{
|
34 |
+
if(strpos($key, 'rewrite_') !== FALSE && strpos($key, 'rewrite_') == 0)
|
35 |
+
$key = substr($key, 8);
|
36 |
+
|
37 |
+
if(strpos($key, 'general_') !== FALSE && strpos($key, 'general_') == 0)
|
38 |
+
$key = substr($key, 8);
|
39 |
+
|
40 |
+
if(strpos($key, 'admin_') !== FALSE && strpos($key, 'admin_') == 0)
|
41 |
+
$key = substr($key, 6);
|
42 |
+
|
43 |
+
$key = trim($key);
|
44 |
+
if(empty($key))
|
45 |
+
continue;
|
46 |
+
|
47 |
+
$this->wph->settings['module_settings'][$key] = $value;
|
48 |
+
}
|
49 |
+
}
|
50 |
|
51 |
+
$version = '1.1';
|
52 |
}
|
53 |
+
|
54 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
if(version_compare($version, '1.3', '<'))
|
56 |
{
|
57 |
//flush rules
|
58 |
add_action('wp_loaded', array($this, 'flush_rules') , -1);
|
59 |
|
60 |
+
$version = '1.3';
|
|
|
61 |
}
|
62 |
+
|
63 |
+
if(version_compare($version, '1.3.1', '<'))
|
64 |
{
|
65 |
//run update 2
|
66 |
+
|
67 |
+
$version = '1.3.1';
|
68 |
}
|
69 |
+
|
70 |
+
if(version_compare($version, '1.3.2', '<'))
|
71 |
+
{
|
72 |
+
//flush rules
|
73 |
+
add_action('wp_loaded', array($this, 'flush_rules') , -1);
|
74 |
|
75 |
+
$version = '1.3.2';
|
76 |
}
|
77 |
+
|
78 |
+
if(version_compare($version, '1.3.2.2', '<'))
|
79 |
+
{
|
80 |
+
if(isset($this->wph->settings['module_settings']['remove_version']) && $this->wph->settings['module_settings']['remove_version'] == "yes")
|
81 |
+
{
|
82 |
+
$this->wph->settings['module_settings']['styles_remove_version'] = 'yes';
|
83 |
+
$this->wph->settings['module_settings']['scripts_remove_version'] = 'yes';
|
84 |
+
|
85 |
+
unset($this->wph->settings['module_settings']['remove_version']);
|
86 |
+
}
|
87 |
+
|
88 |
+
$version = '1.3.2.2';
|
89 |
+
}
|
90 |
+
|
91 |
+
//save the last code version
|
92 |
+
$this->wph->settings['version'] = WPH_VERSION;
|
93 |
+
$this->wph->functions->update_settings($this->wph->settings);
|
94 |
+
|
95 |
}
|
96 |
|
97 |
|
include/wph.class.php
CHANGED
@@ -45,6 +45,9 @@
|
|
45 |
|
46 |
$this->settings = $this->functions->get_settings();
|
47 |
|
|
|
|
|
|
|
48 |
//set whatever the server use htaccess or web.config configuration file
|
49 |
$this->server_htaccess_config = $this->functions->server_use_htaccess_config_file();
|
50 |
$this->server_web_config = $this->functions->server_use_web_config_file();
|
@@ -76,12 +79,18 @@
|
|
76 |
|
77 |
$this->add_default_replacements();
|
78 |
|
79 |
-
|
80 |
-
|
|
|
|
|
81 |
|
|
|
82 |
|
83 |
add_action('plugins_loaded', array($this, 'plugin_conflicts') , -1);
|
84 |
|
|
|
|
|
|
|
85 |
//process redirects
|
86 |
add_action('wp_redirect', array($this, 'wp_redirect') , 999, 2);
|
87 |
//hijack a redirect on permalink change
|
@@ -112,9 +121,23 @@
|
|
112 |
$this->is_initialised = TRUE;
|
113 |
}
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
function _load_modules()
|
117 |
{
|
|
|
118 |
$module_files = glob(WPH_PATH . "/modules/module-*.php");
|
119 |
|
120 |
foreach ($module_files as $filename)
|
@@ -134,13 +157,41 @@
|
|
134 |
$menu_position = $interface_menu_data['menu_position'];
|
135 |
|
136 |
$this->modules[$menu_position] = $module;
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
//process the module fields
|
139 |
$module_settings = $this->functions->filter_settings( $module->get_module_settings(), TRUE );
|
140 |
|
141 |
usort($module_settings, array($this->functions, 'array_sort_by_processing_order'));
|
|
|
142 |
|
143 |
-
if(
|
|
|
|
|
144 |
foreach($module_settings as $module_setting)
|
145 |
{
|
146 |
|
@@ -162,21 +213,13 @@
|
|
162 |
|
163 |
//action available for mu-plugins
|
164 |
do_action('wp-hide/module_settings_process', $field_id, $saved_field_value, $_class_instance, $module);
|
165 |
-
}
|
166 |
-
|
167 |
-
}
|
168 |
|
169 |
-
|
170 |
-
ksort($this->modules);
|
171 |
-
|
172 |
-
//filter available for mu-plugins
|
173 |
-
$this->modules = apply_filters('wp-hide/loaded_modules', $this->modules);
|
174 |
|
175 |
-
//sort the replacement urls
|
176 |
-
//$keys = array_map('strlen', array_keys($arr));
|
177 |
-
//array_multisort($keys, SORT_DESC, $arr);
|
178 |
-
|
179 |
}
|
|
|
|
|
180 |
|
181 |
/**
|
182 |
* run on admin_init action
|
@@ -254,7 +297,7 @@
|
|
254 |
$interface_menu_data = $module->get_interface_menu_data();
|
255 |
|
256 |
if(isset($_GET['page']) && $_GET['page'] == $interface_menu_data['menu_slug'])
|
257 |
-
echo "<div class='updated'><p>". __('Help us to improve this plugin by reporting any issues at ', 'wp-hide-security-enhancer') .'<a target="_blank" href="http://www.
|
258 |
}
|
259 |
|
260 |
|
@@ -464,7 +507,7 @@
|
|
464 |
$this->functions->update_settings($this->settings);
|
465 |
|
466 |
$new_rules = "RewriteRule ^index\.php$ - [L] \n\n#START - WP Hide & Security Enhancer\n#WriteCheckString:" . $write_check_string;
|
467 |
-
|
468 |
if(count($_rewrite_data) > 0)
|
469 |
{
|
470 |
foreach($_rewrite_data as $_htaccess_data_line)
|
@@ -768,6 +811,20 @@
|
|
768 |
|
769 |
}
|
770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
771 |
|
772 |
|
773 |
/**
|
@@ -777,7 +834,7 @@
|
|
777 |
function add_default_replacements()
|
778 |
{
|
779 |
|
780 |
-
|
781 |
}
|
782 |
|
783 |
|
@@ -846,6 +903,18 @@
|
|
846 |
|
847 |
|
848 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
|
850 |
|
851 |
}
|
45 |
|
46 |
$this->settings = $this->functions->get_settings();
|
47 |
|
48 |
+
//check for plugin update
|
49 |
+
$this->update();
|
50 |
+
|
51 |
//set whatever the server use htaccess or web.config configuration file
|
52 |
$this->server_htaccess_config = $this->functions->server_use_htaccess_config_file();
|
53 |
$this->server_web_config = $this->functions->server_use_web_config_file();
|
79 |
|
80 |
$this->add_default_replacements();
|
81 |
|
82 |
+
/**
|
83 |
+
* Filters
|
84 |
+
*/
|
85 |
+
add_action( 'activated_plugin', array($this, 'activated_plugin'), 999, 2 );
|
86 |
|
87 |
+
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
|
88 |
|
89 |
add_action('plugins_loaded', array($this, 'plugin_conflicts') , -1);
|
90 |
|
91 |
+
//change any links within email message
|
92 |
+
add_filter('wp_mail', array($this, 'apply_for_wp_mail') , 999);
|
93 |
+
|
94 |
//process redirects
|
95 |
add_action('wp_redirect', array($this, 'wp_redirect') , 999, 2);
|
96 |
//hijack a redirect on permalink change
|
121 |
$this->is_initialised = TRUE;
|
122 |
}
|
123 |
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Update wrapper
|
127 |
+
*
|
128 |
+
*/
|
129 |
+
function update()
|
130 |
+
{
|
131 |
+
|
132 |
+
//check for update from older version
|
133 |
+
include_once(WPH_PATH . '/include/update.class.php');
|
134 |
+
new WPH_update();
|
135 |
+
|
136 |
+
}
|
137 |
|
138 |
function _load_modules()
|
139 |
{
|
140 |
+
|
141 |
$module_files = glob(WPH_PATH . "/modules/module-*.php");
|
142 |
|
143 |
foreach ($module_files as $filename)
|
157 |
$menu_position = $interface_menu_data['menu_position'];
|
158 |
|
159 |
$this->modules[$menu_position] = $module;
|
160 |
+
|
161 |
+
}
|
162 |
+
|
163 |
+
//sort the modules array
|
164 |
+
ksort($this->modules);
|
165 |
+
|
166 |
+
$this->_modules_components_run();
|
167 |
+
|
168 |
+
//filter available for mu-plugins
|
169 |
+
$this->modules = apply_filters('wp-hide/loaded_modules', $this->modules);
|
170 |
+
|
171 |
+
//sort the replacement urls ?? by the length
|
172 |
+
//$keys = array_map('strlen', array_keys($arr));
|
173 |
+
//array_multisort($keys, SORT_DESC, $arr);
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Runt the components of loaded modules
|
180 |
+
*
|
181 |
+
*/
|
182 |
+
function _modules_components_run()
|
183 |
+
{
|
184 |
+
foreach($this->modules as $module)
|
185 |
+
{
|
186 |
//process the module fields
|
187 |
$module_settings = $this->functions->filter_settings( $module->get_module_settings(), TRUE );
|
188 |
|
189 |
usort($module_settings, array($this->functions, 'array_sort_by_processing_order'));
|
190 |
+
|
191 |
|
192 |
+
if($this->disable_filters || !is_array($module_settings) || count($module_settings) < 1)
|
193 |
+
continue;
|
194 |
+
|
195 |
foreach($module_settings as $module_setting)
|
196 |
{
|
197 |
|
213 |
|
214 |
//action available for mu-plugins
|
215 |
do_action('wp-hide/module_settings_process', $field_id, $saved_field_value, $_class_instance, $module);
|
216 |
+
}
|
|
|
|
|
217 |
|
218 |
+
}
|
|
|
|
|
|
|
|
|
219 |
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
+
|
222 |
+
|
223 |
|
224 |
/**
|
225 |
* run on admin_init action
|
297 |
$interface_menu_data = $module->get_interface_menu_data();
|
298 |
|
299 |
if(isset($_GET['page']) && $_GET['page'] == $interface_menu_data['menu_slug'])
|
300 |
+
echo "<div class='updated'><p>". __('Help us to improve this plugin by reporting any issues at ', 'wp-hide-security-enhancer') .'<a target="_blank" href="http://www.wp-hide.com/">www.wp-hide.com</a></p></div>';
|
301 |
}
|
302 |
|
303 |
|
507 |
$this->functions->update_settings($this->settings);
|
508 |
|
509 |
$new_rules = "RewriteRule ^index\.php$ - [L] \n\n#START - WP Hide & Security Enhancer\n#WriteCheckString:" . $write_check_string;
|
510 |
+
$new_rules .= "\nSetEnv HTTP_MOD_REWRITE On";
|
511 |
if(count($_rewrite_data) > 0)
|
512 |
{
|
513 |
foreach($_rewrite_data as $_htaccess_data_line)
|
811 |
|
812 |
}
|
813 |
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Apply new changes for e-mail content too
|
817 |
+
*
|
818 |
+
* @param mixed $atts
|
819 |
+
*/
|
820 |
+
function apply_for_wp_mail($atts)
|
821 |
+
{
|
822 |
+
|
823 |
+
$atts['message'] = $this->functions->text_urls_replacement($atts['message'], $this->urls_replacement);
|
824 |
+
|
825 |
+
return $atts;
|
826 |
+
|
827 |
+
}
|
828 |
|
829 |
|
830 |
/**
|
834 |
function add_default_replacements()
|
835 |
{
|
836 |
|
837 |
+
do_action('wp-hide/add_default_replacements', $this->urls_replacement);
|
838 |
}
|
839 |
|
840 |
|
903 |
|
904 |
|
905 |
}
|
906 |
+
|
907 |
+
|
908 |
+
|
909 |
+
function log_save($text)
|
910 |
+
{
|
911 |
+
|
912 |
+
$myfile = fopen(WPH_PATH . "/debug.txt", "a") or die("Unable to open file!");
|
913 |
+
$txt = $text . "\n";
|
914 |
+
fwrite($myfile, $txt);
|
915 |
+
fclose($myfile);
|
916 |
+
|
917 |
+
}
|
918 |
|
919 |
|
920 |
}
|
modules/components/admin-new_wp_login_php.php
CHANGED
@@ -65,7 +65,13 @@
|
|
65 |
if(!isset($this->wph->urls_replacement[$url]))
|
66 |
{
|
67 |
$this->wph->urls_replacement[ $url ] = trailingslashit( site_url() ) . $saved_field_data;
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
|
65 |
if(!isset($this->wph->urls_replacement[$url]))
|
66 |
{
|
67 |
$this->wph->urls_replacement[ $url ] = trailingslashit( site_url() ) . $saved_field_data;
|
68 |
+
}
|
69 |
+
//add relative too
|
70 |
+
if(!isset($this->wph->urls_replacement[ 'wp-login.php' ]))
|
71 |
+
{
|
72 |
+
$this->wph->urls_replacement[ 'wp-login.php' ] = $saved_field_data;
|
73 |
+
}
|
74 |
+
|
75 |
}
|
76 |
|
77 |
|
modules/components/general-headers.php
CHANGED
@@ -26,6 +26,23 @@
|
|
26 |
'processing_order' => 70
|
27 |
);
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
return $this->module_settings;
|
30 |
}
|
31 |
|
@@ -74,6 +91,39 @@
|
|
74 |
|
75 |
return $processing_response;
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
|
79 |
}
|
26 |
'processing_order' => 70
|
27 |
);
|
28 |
|
29 |
+
$this->module_settings[] = array(
|
30 |
+
'id' => 'remove_x_pingback',
|
31 |
+
'label' => 'Remove X-Pingback Header',
|
32 |
+
'description' => __('Remove X-Pingback Header if being set.', 'wp-hide-security-enhancer') . ' ' .
|
33 |
+
__('More details at ', 'wp-hide-security-enhancer') . '<a target="_blank" href="http://www.wp-hide.com/request-headers/">Request Headers</a>',
|
34 |
+
|
35 |
+
'input_type' => 'radio',
|
36 |
+
'options' => array(
|
37 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
38 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
39 |
+
),
|
40 |
+
'default_value' => 'no',
|
41 |
+
|
42 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
43 |
+
'processing_order' => 70
|
44 |
+
);
|
45 |
+
|
46 |
return $this->module_settings;
|
47 |
}
|
48 |
|
91 |
|
92 |
return $processing_response;
|
93 |
}
|
94 |
+
|
95 |
+
|
96 |
+
function _init_remove_x_pingback($saved_field_data)
|
97 |
+
{
|
98 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
99 |
+
return FALSE;
|
100 |
+
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
function _callback_saved_remove_x_pingback($saved_field_data)
|
105 |
+
{
|
106 |
+
$processing_response = array();
|
107 |
+
|
108 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
109 |
+
return FALSE;
|
110 |
+
|
111 |
+
if($this->wph->server_htaccess_config === TRUE)
|
112 |
+
$processing_response['rewrite'] = '
|
113 |
+
<FilesMatch "">
|
114 |
+
<IfModule mod_headers.c>
|
115 |
+
Header unset X-Pingback
|
116 |
+
</IfModule>
|
117 |
+
</FilesMatch>';
|
118 |
+
|
119 |
+
if($this->wph->server_web_config === TRUE)
|
120 |
+
{
|
121 |
+
|
122 |
+
$processing_response['rewrite'] = '';
|
123 |
+
}
|
124 |
+
|
125 |
+
return $processing_response;
|
126 |
+
}
|
127 |
|
128 |
|
129 |
}
|
modules/components/general-html-comments.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WPH_module_general_html_comments extends WPH_module_component
|
4 |
-
{
|
5 |
-
function get_component_title()
|
6 |
-
{
|
7 |
-
return "HTML Comments";
|
8 |
-
}
|
9 |
-
|
10 |
-
function get_module_settings()
|
11 |
-
{
|
12 |
-
$this->module_settings[] = array(
|
13 |
-
'id' => 'remove_html_comments',
|
14 |
-
'label' => 'Remove HTML Comments',
|
15 |
-
'description' => __('Remove all HTML Comments which usualy specify Plugins Name and Versio. Any Internet Exploreer conditional tags are preserved.', 'wp-hide-security-enhancer'),
|
16 |
-
|
17 |
-
'input_type' => 'radio',
|
18 |
-
'options' => array(
|
19 |
-
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
20 |
-
'no' => __('No', 'wp-hide-security-enhancer'),
|
21 |
-
),
|
22 |
-
'default_value' => 'no',
|
23 |
-
|
24 |
-
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
25 |
-
'processing_order' => 80
|
26 |
-
);
|
27 |
-
|
28 |
-
return $this->module_settings;
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
function _init_remove_html_comments($saved_field_data)
|
34 |
-
{
|
35 |
-
if(empty($saved_field_data) || $saved_field_data == 'no')
|
36 |
-
return FALSE;
|
37 |
-
|
38 |
-
|
39 |
-
add_filter('wph/ob_start_callback', array($this, 'remove_html_comments'));
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
function remove_html_comments($buffer)
|
45 |
-
{
|
46 |
-
//do not run when within admin
|
47 |
-
if(defined('WP_ADMIN'))
|
48 |
-
return $buffer;
|
49 |
-
|
50 |
-
//replace any comments
|
51 |
-
$buffer = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->/sm', "" , $buffer);
|
52 |
-
|
53 |
-
return $buffer;
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
}
|
60 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/components/general-html.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPH_module_general_html extends WPH_module_component
|
4 |
+
{
|
5 |
+
function get_component_title()
|
6 |
+
{
|
7 |
+
return "HTML";
|
8 |
+
}
|
9 |
+
|
10 |
+
function get_module_settings()
|
11 |
+
{
|
12 |
+
$this->module_settings[] = array(
|
13 |
+
'id' => 'remove_html_comments',
|
14 |
+
'label' => 'Remove HTML Comments',
|
15 |
+
'description' => __('Remove all HTML Comments which usualy specify Plugins Name and Versio. Any Internet Exploreer conditional tags are preserved.', 'wp-hide-security-enhancer'),
|
16 |
+
|
17 |
+
'input_type' => 'radio',
|
18 |
+
'options' => array(
|
19 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
20 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
21 |
+
),
|
22 |
+
'default_value' => 'no',
|
23 |
+
|
24 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
25 |
+
'processing_order' => 80
|
26 |
+
);
|
27 |
+
|
28 |
+
$this->module_settings[] = array(
|
29 |
+
'id' => 'clean_menu_items_id',
|
30 |
+
'label' => 'Remove ID from Menu items',
|
31 |
+
'description' => __('Remove ID attribute from all menu items.', 'wp-hide-security-enhancer'),
|
32 |
+
|
33 |
+
'input_type' => 'radio',
|
34 |
+
'options' => array(
|
35 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
36 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
37 |
+
),
|
38 |
+
'default_value' => 'no',
|
39 |
+
|
40 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
41 |
+
'processing_order' => 81
|
42 |
+
);
|
43 |
+
|
44 |
+
$this->module_settings[] = array(
|
45 |
+
'id' => 'clean_menu_items_classes',
|
46 |
+
'label' => 'Remove class from Menu items',
|
47 |
+
'description' => __('Remove class attribute from all menu items. Any classes which include a "current" prefix or contain "has-children" will be preserved.', 'wp-hide-security-enhancer'),
|
48 |
+
|
49 |
+
'input_type' => 'radio',
|
50 |
+
'options' => array(
|
51 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
52 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
53 |
+
),
|
54 |
+
'default_value' => 'no',
|
55 |
+
|
56 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
57 |
+
'processing_order' => 81
|
58 |
+
);
|
59 |
+
|
60 |
+
return $this->module_settings;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
function _init_remove_html_comments($saved_field_data)
|
66 |
+
{
|
67 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
68 |
+
return FALSE;
|
69 |
+
|
70 |
+
|
71 |
+
add_filter('wph/ob_start_callback', array($this, 'remove_html_comments'));
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
function remove_html_comments($buffer)
|
77 |
+
{
|
78 |
+
//do not run when within admin
|
79 |
+
if(defined('WP_ADMIN'))
|
80 |
+
return $buffer;
|
81 |
+
|
82 |
+
//replace any comments
|
83 |
+
$buffer = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->/sm', "" , $buffer);
|
84 |
+
|
85 |
+
return $buffer;
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
function _init_clean_menu_items_id( $saved_field_data )
|
91 |
+
{
|
92 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
93 |
+
return FALSE;
|
94 |
+
|
95 |
+
add_filter('nav_menu_item_id', array(&$this, 'nav_menu_item_id'), 999);
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
function nav_menu_item_id($item_id)
|
101 |
+
{
|
102 |
+
$item_id = '';
|
103 |
+
|
104 |
+
return $item_id;
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
function _init_clean_menu_items_classes( $saved_field_data )
|
110 |
+
{
|
111 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
112 |
+
return FALSE;
|
113 |
+
|
114 |
+
add_filter('nav_menu_css_class', array(&$this, 'nav_menu_css_class'), 999);
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
function nav_menu_css_class( $classes )
|
120 |
+
{
|
121 |
+
foreach($classes as $key => $class_name)
|
122 |
+
{
|
123 |
+
if(strpos($class_name, 'current-') === 0 || strpos($class_name, 'current_') === 0 || strpos($class_name, 'has-children') !== FALSE)
|
124 |
+
continue;
|
125 |
+
|
126 |
+
unset($classes[$key]);
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
$classes = array_values($classes);
|
131 |
+
|
132 |
+
|
133 |
+
return $classes;
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
}
|
138 |
+
?>
|
modules/components/general-meta.php
CHANGED
@@ -137,6 +137,42 @@
|
|
137 |
|
138 |
add_filter('the_generator', create_function('', 'return "";'));
|
139 |
remove_action( 'wp_head', 'wp_generator' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
|
142 |
|
137 |
|
138 |
add_filter('the_generator', create_function('', 'return "";'));
|
139 |
remove_action( 'wp_head', 'wp_generator' );
|
140 |
+
|
141 |
+
//remove other generator links
|
142 |
+
add_filter( 'wph/ob_start_callback', array(&$this, 'ob_start_callback_remove_generator_meta'));
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
function ob_start_callback_remove_generator_meta( $buffer )
|
147 |
+
{
|
148 |
+
|
149 |
+
if ( ! class_exists( 'DOMDocument', false ) )
|
150 |
+
return $buffer;
|
151 |
+
|
152 |
+
$doc = new DOMDocument();
|
153 |
+
$doc->preserveWhiteSpace = true;
|
154 |
+
|
155 |
+
if ( @$doc->loadHTML($buffer) === false )
|
156 |
+
return $buffer;
|
157 |
+
|
158 |
+
$doc->formatOutput = true;
|
159 |
+
|
160 |
+
$xpath = new DOMXPath($doc);
|
161 |
+
|
162 |
+
$nodes = $xpath->query('//meta[@name="generator"]');
|
163 |
+
if($nodes->length < 1)
|
164 |
+
return $buffer;
|
165 |
+
|
166 |
+
foreach ($nodes as $node)
|
167 |
+
{
|
168 |
+
$parent = $node->parentNode;
|
169 |
+
$parent->removeChild($node);
|
170 |
+
}
|
171 |
+
|
172 |
+
$buffer = $doc->saveHTML();
|
173 |
+
|
174 |
+
return $buffer;
|
175 |
+
|
176 |
}
|
177 |
|
178 |
|
modules/components/{general-remove_version.php → general-scripts.php}
RENAMED
@@ -1,18 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
function get_component_title()
|
6 |
{
|
7 |
-
return "
|
8 |
}
|
9 |
|
10 |
function get_module_settings()
|
11 |
{
|
12 |
$this->module_settings[] = array(
|
13 |
-
'id' => '
|
14 |
'label' => 'Remove Version',
|
15 |
-
'description' => __('Remove version number from enqueued
|
16 |
|
17 |
'input_type' => 'radio',
|
18 |
'options' => array(
|
@@ -30,12 +30,11 @@
|
|
30 |
|
31 |
|
32 |
|
33 |
-
function
|
34 |
{
|
35 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
36 |
return FALSE;
|
37 |
|
38 |
-
add_filter( 'style_loader_src', array(&$this, 'remove_file_version'), 999 );
|
39 |
add_filter( 'script_loader_src', array(&$this, 'remove_file_version'), 999 );
|
40 |
|
41 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class WPH_module_general_scripts extends WPH_module_component
|
4 |
{
|
5 |
function get_component_title()
|
6 |
{
|
7 |
+
return "Scripts";
|
8 |
}
|
9 |
|
10 |
function get_module_settings()
|
11 |
{
|
12 |
$this->module_settings[] = array(
|
13 |
+
'id' => 'scripts_remove_version',
|
14 |
'label' => 'Remove Version',
|
15 |
+
'description' => __('Remove version number from enqueued script files.', 'wp-hide-security-enhancer'),
|
16 |
|
17 |
'input_type' => 'radio',
|
18 |
'options' => array(
|
30 |
|
31 |
|
32 |
|
33 |
+
function _init_scripts_remove_version($saved_field_data)
|
34 |
{
|
35 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
36 |
return FALSE;
|
37 |
|
|
|
38 |
add_filter( 'script_loader_src', array(&$this, 'remove_file_version'), 999 );
|
39 |
|
40 |
}
|
modules/components/general-styles.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPH_module_general_styles extends WPH_module_component
|
4 |
+
{
|
5 |
+
function get_component_title()
|
6 |
+
{
|
7 |
+
return "Styles";
|
8 |
+
}
|
9 |
+
|
10 |
+
function get_module_settings()
|
11 |
+
{
|
12 |
+
$this->module_settings[] = array(
|
13 |
+
'id' => 'styles_remove_version',
|
14 |
+
'label' => 'Remove Version',
|
15 |
+
'description' => __('Remove version number from enqueued style files.', 'wp-hide-security-enhancer'),
|
16 |
+
|
17 |
+
'input_type' => 'radio',
|
18 |
+
'options' => array(
|
19 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
20 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
21 |
+
),
|
22 |
+
'default_value' => 'no',
|
23 |
+
|
24 |
+
'sanitize_type' => array('sanitize_title', 'strtolower')
|
25 |
+
|
26 |
+
);
|
27 |
+
|
28 |
+
$this->module_settings[] = array(
|
29 |
+
'id' => 'styles_remove_id_attribute',
|
30 |
+
'label' => 'Remove ID from link tags',
|
31 |
+
'description' => __('Remove ID attribute from all link tags which include a stylesheet.', 'wp-hide-security-enhancer'),
|
32 |
+
|
33 |
+
'input_type' => 'radio',
|
34 |
+
'options' => array(
|
35 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
36 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
37 |
+
),
|
38 |
+
'default_value' => 'no',
|
39 |
+
|
40 |
+
'sanitize_type' => array('sanitize_title', 'strtolower')
|
41 |
+
|
42 |
+
);
|
43 |
+
|
44 |
+
return $this->module_settings;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
function _init_styles_remove_version($saved_field_data)
|
50 |
+
{
|
51 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
52 |
+
return FALSE;
|
53 |
+
|
54 |
+
add_filter( 'style_loader_src', array(&$this, 'remove_file_version'), 999 );
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
function remove_file_version($src)
|
59 |
+
{
|
60 |
+
|
61 |
+
$src = remove_query_arg( 'ver', $src );
|
62 |
+
|
63 |
+
return $src;
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
function _init_styles_remove_id_attribute($saved_field_data)
|
69 |
+
{
|
70 |
+
if(empty($saved_field_data) || $saved_field_data == 'no')
|
71 |
+
return FALSE;
|
72 |
+
|
73 |
+
//run only on front syde
|
74 |
+
if(is_admin())
|
75 |
+
return FALSE;
|
76 |
+
|
77 |
+
add_filter( 'wph/ob_start_callback', array(&$this, 'ob_start_callback_remove_id'));
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Replace all ID's attribute for link tags
|
84 |
+
*
|
85 |
+
* @param mixed $buffer
|
86 |
+
*/
|
87 |
+
function ob_start_callback_remove_id($buffer)
|
88 |
+
{
|
89 |
+
if ( ! class_exists( 'DOMDocument', false ) )
|
90 |
+
return $buffer;
|
91 |
+
|
92 |
+
$doc = new DOMDocument();
|
93 |
+
$doc->preserveWhiteSpace = true;
|
94 |
+
|
95 |
+
if ( @$doc->loadHTML($buffer) === false )
|
96 |
+
return $buffer;
|
97 |
+
|
98 |
+
$doc->formatOutput = true;
|
99 |
+
|
100 |
+
$xpath = new DOMXPath($doc);
|
101 |
+
|
102 |
+
$nodes = $xpath->query('//link[@id]');
|
103 |
+
if($nodes->length < 1)
|
104 |
+
return $buffer;
|
105 |
+
|
106 |
+
foreach ($nodes as $node)
|
107 |
+
{
|
108 |
+
$node->removeAttribute('id');
|
109 |
+
}
|
110 |
+
|
111 |
+
$buffer = $doc->saveHTML();
|
112 |
+
|
113 |
+
return $buffer;
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
}
|
121 |
+
?>
|
modules/components/rewrite-new_theme_path.php
CHANGED
@@ -178,6 +178,8 @@
|
|
178 |
if(!empty($this->wph->default_variables['wordpress_directory']))
|
179 |
$path = trailingslashit($this->wph->default_variables['wordpress_directory']);
|
180 |
$path .= trailingslashit( $saved_field_data );
|
|
|
|
|
181 |
|
182 |
if($this->wph->server_htaccess_config === TRUE)
|
183 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
|
@@ -293,6 +295,9 @@
|
|
293 |
$path = trailingslashit($this->wph->default_variables['wordpress_directory']);
|
294 |
$path .= trailingslashit( $saved_field_data );
|
295 |
|
|
|
|
|
|
|
296 |
if($this->wph->server_htaccess_config === TRUE)
|
297 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
|
298 |
|
@@ -371,6 +376,8 @@
|
|
371 |
$template_relative_url = $this->wph->functions->get_url_path_relative_to_domain_root($this->wph->default_variables['template_url']);
|
372 |
$path .= trailingslashit($template_relative_url) . $saved_field_data;
|
373 |
}
|
|
|
|
|
374 |
|
375 |
if($this->wph->server_htaccess_config === TRUE)
|
376 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
|
@@ -457,6 +464,8 @@
|
|
457 |
$file_processor = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
|
458 |
$file_processor = trailingslashit( $file_processor ) . 'wp-hide-security-enhancer/router/file-process.php';
|
459 |
|
|
|
|
|
460 |
if($this->wph->server_htaccess_config === TRUE)
|
461 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $file_processor . '?action=style-clean&file_path=' . $current_stylesheet_uri .' [L,QSA]';
|
462 |
|
@@ -540,6 +549,8 @@
|
|
540 |
$path .= trailingslashit($template_relative_url) . $saved_field_data;
|
541 |
}
|
542 |
|
|
|
|
|
543 |
if($this->wph->server_htaccess_config === TRUE)
|
544 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
|
545 |
|
@@ -623,6 +634,7 @@
|
|
623 |
$file_processor = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
|
624 |
$file_processor = trailingslashit( $file_processor ) . 'wp-hide-security-enhancer/router/file-process.php';
|
625 |
|
|
|
626 |
|
627 |
if($this->wph->server_htaccess_config === TRUE)
|
628 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $file_processor . '?action=style-clean&file_path=' . $current_stylesheet_uri .' [L,QSA]';
|
178 |
if(!empty($this->wph->default_variables['wordpress_directory']))
|
179 |
$path = trailingslashit($this->wph->default_variables['wordpress_directory']);
|
180 |
$path .= trailingslashit( $saved_field_data );
|
181 |
+
|
182 |
+
$theme_path = str_replace(' ', '%20', $theme_path);
|
183 |
|
184 |
if($this->wph->server_htaccess_config === TRUE)
|
185 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
|
295 |
$path = trailingslashit($this->wph->default_variables['wordpress_directory']);
|
296 |
$path .= trailingslashit( $saved_field_data );
|
297 |
|
298 |
+
|
299 |
+
$theme_path = str_replace(' ', '%20', $theme_path);
|
300 |
+
|
301 |
if($this->wph->server_htaccess_config === TRUE)
|
302 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
|
303 |
|
376 |
$template_relative_url = $this->wph->functions->get_url_path_relative_to_domain_root($this->wph->default_variables['template_url']);
|
377 |
$path .= trailingslashit($template_relative_url) . $saved_field_data;
|
378 |
}
|
379 |
+
|
380 |
+
$current_stylesheet_uri = str_replace(' ', '%20', $current_stylesheet_uri);
|
381 |
|
382 |
if($this->wph->server_htaccess_config === TRUE)
|
383 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
|
464 |
$file_processor = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
|
465 |
$file_processor = trailingslashit( $file_processor ) . 'wp-hide-security-enhancer/router/file-process.php';
|
466 |
|
467 |
+
$current_stylesheet_uri = str_replace(' ', '%20', $current_stylesheet_uri);
|
468 |
+
|
469 |
if($this->wph->server_htaccess_config === TRUE)
|
470 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $file_processor . '?action=style-clean&file_path=' . $current_stylesheet_uri .' [L,QSA]';
|
471 |
|
549 |
$path .= trailingslashit($template_relative_url) . $saved_field_data;
|
550 |
}
|
551 |
|
552 |
+
$current_stylesheet_uri = str_replace(' ', '%20', $current_stylesheet_uri);
|
553 |
+
|
554 |
if($this->wph->server_htaccess_config === TRUE)
|
555 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
|
556 |
|
634 |
$file_processor = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
|
635 |
$file_processor = trailingslashit( $file_processor ) . 'wp-hide-security-enhancer/router/file-process.php';
|
636 |
|
637 |
+
$current_stylesheet_uri = str_replace(' ', '%20', $current_stylesheet_uri);
|
638 |
|
639 |
if($this->wph->server_htaccess_config === TRUE)
|
640 |
$processing_response['rewrite'] = "\nRewriteRule ^" . $path . ' '. $file_processor . '?action=style-clean&file_path=' . $current_stylesheet_uri .' [L,QSA]';
|
modules/module-general.php
CHANGED
@@ -14,14 +14,17 @@
|
|
14 |
include(WPH_PATH . "/modules/components/general-wpemoji.php");
|
15 |
$this->components[] = new WPH_module_general_wpemoji();
|
16 |
|
17 |
-
include(WPH_PATH . "/modules/components/general-
|
18 |
-
$this->components[] = new
|
|
|
|
|
|
|
19 |
|
20 |
include(WPH_PATH . "/modules/components/general-headers.php");
|
21 |
$this->components[] = new WPH_module_general_headers();
|
22 |
|
23 |
-
include(WPH_PATH . "/modules/components/general-html
|
24 |
-
$this->components[] = new
|
25 |
|
26 |
//action available for mu-plugins
|
27 |
do_action('wp-hide/module_load_components', $this);
|
14 |
include(WPH_PATH . "/modules/components/general-wpemoji.php");
|
15 |
$this->components[] = new WPH_module_general_wpemoji();
|
16 |
|
17 |
+
include(WPH_PATH . "/modules/components/general-styles.php");
|
18 |
+
$this->components[] = new WPH_module_general_styles();
|
19 |
+
|
20 |
+
include(WPH_PATH . "/modules/components/general-scripts.php");
|
21 |
+
$this->components[] = new WPH_module_general_scripts();
|
22 |
|
23 |
include(WPH_PATH . "/modules/components/general-headers.php");
|
24 |
$this->components[] = new WPH_module_general_headers();
|
25 |
|
26 |
+
include(WPH_PATH . "/modules/components/general-html.php");
|
27 |
+
$this->components[] = new WPH_module_general_html();
|
28 |
|
29 |
//action available for mu-plugins
|
30 |
do_action('wp-hide/module_load_components', $this);
|
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: nsp-code
|
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
Tags: hide, security, improve security, hacking, wp hide, wordpress hide, custom login url, wp-loging.php, ap-admin
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 4.5.
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
The **easy way to completely hide your WordPress** core files path from being show on front side. This is a huge improvement over Site Security, no one will know you actually run a WordPress. Provide a simple way to clean up html by removing all WordPress fingerprints.
|
14 |
|
15 |
Change the default WordPress login urls from wp-admin and wp-login.php to something totally arbitrary. No one will ever know where to try to guess a login and hack into your site. Totally invisible !!
|
16 |
|
@@ -20,7 +20,7 @@ Over 99,9% of hacked WordPress websites are target of automated malware scripts,
|
|
20 |
|
21 |
Works fine with custom WordPress directory structures e.g. custom plugins, themes, uplaods folder.
|
22 |
|
23 |
-
Once configured, you need to **clear server cache data and
|
24 |
|
25 |
**Main plugin functionality:**
|
26 |
|
@@ -35,7 +35,7 @@ Once configured, you need to **clear server cache data and / or any cache plugin
|
|
35 |
* Adjustable theme url
|
36 |
* New child Theme url
|
37 |
* Change theme style file name
|
38 |
-
* Clean any headers for
|
39 |
* Custom wp-include
|
40 |
* Block default wp-include paths
|
41 |
* Block defalt wp-content
|
@@ -103,6 +103,7 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
103 |
* Remove pingback - Remove pingback link tag from theme
|
104 |
|
105 |
**Rewrite > Root Files**
|
|
|
106 |
* New wp-comments-post.php Path
|
107 |
* Block wp-comments-post.php
|
108 |
* Block license.txt - Block access to license.txt root file
|
@@ -112,7 +113,7 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
112 |
* Block wp-signup.php - Block default wp-signup.php file
|
113 |
* Block other wp-*.php files - Block other wp-*.php files within WordPress Root
|
114 |
|
115 |
-
**Rewrite >
|
116 |
|
117 |
* URL's add Slash - Add a slash to any links without. This disguise any existing uppon a file, folder or a wrong url, they all be all slashed.
|
118 |
|
@@ -132,17 +133,25 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
132 |
* Disable Emoji
|
133 |
* Disable TinyMC Emoji
|
134 |
|
135 |
-
**General / Html >
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
* Remove Version
|
138 |
|
139 |
**General / Html > Headers**
|
140 |
|
141 |
* Remove X-Powered-By Header
|
|
|
142 |
|
143 |
-
**General / Html > HTML
|
144 |
|
145 |
* Remove HTML Comments
|
|
|
|
|
146 |
|
147 |
**Admin > wp-login.php**
|
148 |
|
@@ -197,6 +206,19 @@ Please get in touch with us and we'll do our best to include it for a next versi
|
|
197 |
|
198 |
== Changelog ==
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
= 1.3.1 =
|
201 |
* Moved the Disable XML-RPC authentication within Rewrite -> XML-RPC
|
202 |
* HTML Comments strip out will trigger only on front side, no need for admin
|
@@ -316,4 +338,4 @@ Always keep plugin up to date.
|
|
316 |
== Localization ==
|
317 |
Please help and translate this plugin to your language at https://translate.wordpress.org/projects/wp-plugins/wp-hide-security-enhancer
|
318 |
|
319 |
-
Please help by promoting this plugin with an article on your site or any other place. If this code helped
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
Tags: hide, security, improve security, hacking, wp hide, wordpress hide, custom login url, wp-loging.php, ap-admin
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 4.5.3
|
7 |
+
Stable tag: 1.3.3
|
8 |
|
9 |
Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The **easy way to completely hide your WordPress** core files, theme and plugins path from being show on front side. This is a huge improvement over Site Security, no one will know you actually run a WordPress. Provide a simple way to clean up html by removing all WordPress fingerprints.
|
14 |
|
15 |
Change the default WordPress login urls from wp-admin and wp-login.php to something totally arbitrary. No one will ever know where to try to guess a login and hack into your site. Totally invisible !!
|
16 |
|
20 |
|
21 |
Works fine with custom WordPress directory structures e.g. custom plugins, themes, uplaods folder.
|
22 |
|
23 |
+
Once configured, you need to **clear server cache data and/or any cache plugins** (e.g. W3 Cache), for a new html data to be created. If use CDN this should be cache clear as well.
|
24 |
|
25 |
**Main plugin functionality:**
|
26 |
|
35 |
* Adjustable theme url
|
36 |
* New child Theme url
|
37 |
* Change theme style file name
|
38 |
+
* Clean any headers for theme style file
|
39 |
* Custom wp-include
|
40 |
* Block default wp-include paths
|
41 |
* Block defalt wp-content
|
103 |
* Remove pingback - Remove pingback link tag from theme
|
104 |
|
105 |
**Rewrite > Root Files**
|
106 |
+
|
107 |
* New wp-comments-post.php Path
|
108 |
* Block wp-comments-post.php
|
109 |
* Block license.txt - Block access to license.txt root file
|
113 |
* Block wp-signup.php - Block default wp-signup.php file
|
114 |
* Block other wp-*.php files - Block other wp-*.php files within WordPress Root
|
115 |
|
116 |
+
**Rewrite > URL Slash**
|
117 |
|
118 |
* URL's add Slash - Add a slash to any links without. This disguise any existing uppon a file, folder or a wrong url, they all be all slashed.
|
119 |
|
133 |
* Disable Emoji
|
134 |
* Disable TinyMC Emoji
|
135 |
|
136 |
+
**General / Html > Styles**
|
137 |
+
|
138 |
+
* Remove Version
|
139 |
+
* Remove ID from link tags
|
140 |
+
|
141 |
+
**General / Html > Scripts**
|
142 |
|
143 |
* Remove Version
|
144 |
|
145 |
**General / Html > Headers**
|
146 |
|
147 |
* Remove X-Powered-By Header
|
148 |
+
* Remove X-Pingback Header
|
149 |
|
150 |
+
**General / Html > HTML**
|
151 |
|
152 |
* Remove HTML Comments
|
153 |
+
* Remove ID from Menu items
|
154 |
+
* Remove class from Menu items
|
155 |
|
156 |
**Admin > wp-login.php**
|
157 |
|
206 |
|
207 |
== Changelog ==
|
208 |
|
209 |
+
= 1.3.3 =
|
210 |
+
* Improve Remove Generator Meta - Use DOMDocument to remove any meta generator tag
|
211 |
+
* New Component Item - Remove X-Pingback Header
|
212 |
+
* New functionality, Remove ID from Menu items, Remove class from Menu items
|
213 |
+
* Add short default replacement for wp-login.php
|
214 |
+
* Filter all email content (message argument) through wp_mail for any require replacements
|
215 |
+
* New action wp-hide/add_default_replacements
|
216 |
+
* New functionality - Remove ID attribute from all link tags which include a stylesheet.
|
217 |
+
* Separate tabs for Styles and Scripts
|
218 |
+
* Update engine improvements
|
219 |
+
* Fix for apache_mod_loaded function not being loaded on plugin update
|
220 |
+
* Replace spaces within paths for theme rewrite component
|
221 |
+
|
222 |
= 1.3.1 =
|
223 |
* Moved the Disable XML-RPC authentication within Rewrite -> XML-RPC
|
224 |
* HTML Comments strip out will trigger only on front side, no need for admin
|
338 |
== Localization ==
|
339 |
Please help and translate this plugin to your language at https://translate.wordpress.org/projects/wp-plugins/wp-hide-security-enhancer
|
340 |
|
341 |
+
Please help by promoting this plugin with an article on your site or any other place. If you liked this code or helped on your your project, consider to leave a 5 star review on this board.
|
wp-hide.php
CHANGED
@@ -5,14 +5,14 @@ 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.3.
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
12 |
-
|
13 |
|
14 |
define('WPH_PATH', plugin_dir_path(__FILE__));
|
15 |
-
define('WPH_VERSION', '1.3.
|
16 |
|
17 |
//load language files
|
18 |
add_action( 'plugins_loaded', 'WPH_load_textdomain');
|
@@ -33,7 +33,19 @@ Domain Path: /languages/
|
|
33 |
function WPH_activated($network_wide)
|
34 |
{
|
35 |
|
36 |
-
flush_rewrite_rules();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
function WPH_deactivated()
|
@@ -45,7 +57,8 @@ Domain Path: /languages/
|
|
45 |
|
46 |
//redirect to old url
|
47 |
}
|
48 |
-
|
|
|
49 |
global $wph;
|
50 |
$wph = new WPH();
|
51 |
$wph->init();
|
@@ -56,13 +69,8 @@ Domain Path: /languages/
|
|
56 |
*/
|
57 |
ob_start(array($wph, 'ob_start_callback'));
|
58 |
|
59 |
-
|
60 |
-
include_once(WPH_PATH . '/include/update.class.php');
|
61 |
-
new WPH_update();
|
62 |
-
|
63 |
define('WPH_URL', plugins_url('', __FILE__));
|
64 |
|
65 |
-
add_action( 'activated_plugin', array($wph, 'activated_plugin'), 999, 2 );
|
66 |
-
|
67 |
|
68 |
?>
|
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.3.3
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
12 |
+
|
13 |
|
14 |
define('WPH_PATH', plugin_dir_path(__FILE__));
|
15 |
+
define('WPH_VERSION', '1.3.3');
|
16 |
|
17 |
//load language files
|
18 |
add_action( 'plugins_loaded', 'WPH_load_textdomain');
|
33 |
function WPH_activated($network_wide)
|
34 |
{
|
35 |
|
36 |
+
flush_rewrite_rules();
|
37 |
+
|
38 |
+
global $wph;
|
39 |
+
|
40 |
+
//check if permalinks where saved
|
41 |
+
$wph->permalinks_not_applied = ! $wph->functions->rewrite_rules_applied();
|
42 |
+
|
43 |
+
//reprocess components if the permalinks where applied
|
44 |
+
if($wph->permalinks_not_applied !== TRUE)
|
45 |
+
{
|
46 |
+
$wph->_modules_components_run();
|
47 |
+
}
|
48 |
+
|
49 |
}
|
50 |
|
51 |
function WPH_deactivated()
|
57 |
|
58 |
//redirect to old url
|
59 |
}
|
60 |
+
|
61 |
+
|
62 |
global $wph;
|
63 |
$wph = new WPH();
|
64 |
$wph->init();
|
69 |
*/
|
70 |
ob_start(array($wph, 'ob_start_callback'));
|
71 |
|
72 |
+
|
|
|
|
|
|
|
73 |
define('WPH_URL', plugins_url('', __FILE__));
|
74 |
|
|
|
|
|
75 |
|
76 |
?>
|