Version Description
- New component: Rewrite Author
- New component: Rewrite Search
- Show recovery link on top of page to ensure everyone can save the link to use if something goe wrong.
- Send recovery code to site admin e-mail
- Minor Code adjustments
- Send new login url to site admin e-mail, to ensure user can recover access to dashboard if forget new slug
- Removed unused methods within WPH_module_rewrite_new_include_path component
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4.2 to 1.5.5
- css/wph.css +7 -2
- include/admin-interface.class.php +16 -6
- include/functions.class.php +63 -39
- include/wph.class.php +68 -23
- js/wph.js +23 -3
- modules/components/admin-admin_url.php +2 -28
- modules/components/admin-new_wp_login_php.php +27 -3
- modules/components/rewrite-author.php +97 -0
- modules/components/rewrite-new_include_path.php +1 -55
- modules/components/rewrite-search.php +97 -0
- modules/module-rewrite.php +6 -0
- readme.txt +20 -1
- router/environment.php +1 -1
- wp-hide.php +1 -1
css/wph.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#wph h2.nav-tab-wrapper{padding-left: 10px}
|
2 |
#wph h2 .nav-tab {font-size: 12px; font-weight: bold; padding: 2px 10px 3px; margin-right: 0;}
|
3 |
#wph h2 #reset_settings{font-size: 11px; height: auto; line-height: 20px; padding: 1px 5px;}
|
4 |
#wph .ajax_loading {display: none}
|
@@ -7,7 +7,7 @@
|
|
7 |
#wph .postbox {margin-bottom: 0px}
|
8 |
#wph .wph_input fieldset label {padding-bottom: 5px; display: block;}
|
9 |
#wph #reset_settings_form .reset_settings { margin-top: -31px;}
|
10 |
-
#wph h2 #reset_settings, #wph #reset_settings_form .reset_settings {
|
11 |
#wph span.wph-pro {background-color: #f04d46; color:#FFF; font-weight: bold;display: inline-block; padding: 2px 4px;}
|
12 |
|
13 |
table.wph_input { border: 0 none; background: #fff;}
|
@@ -55,6 +55,11 @@ table.wph_input input[type=text]:focus,table.wph_input textarea:focus,table.wph_
|
|
55 |
|
56 |
.postbox h3 span {display: inline-block; vertical-align: middle}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
58 |
#info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin: 10px 0 20px 0;-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
|
59 |
#info_box a {text-decoration: none}
|
60 |
#info_box #p_right {float: right; background-color:#f5f5f5; border: 1px dashed #6aadcc; padding: 0px 10px; margin-top: 10px}
|
1 |
+
#wph h2.nav-tab-wrapper{padding-left: 10px;margin-right: 140px;}
|
2 |
#wph h2 .nav-tab {font-size: 12px; font-weight: bold; padding: 2px 10px 3px; margin-right: 0;}
|
3 |
#wph h2 #reset_settings{font-size: 11px; height: auto; line-height: 20px; padding: 1px 5px;}
|
4 |
#wph .ajax_loading {display: none}
|
7 |
#wph .postbox {margin-bottom: 0px}
|
8 |
#wph .wph_input fieldset label {padding-bottom: 5px; display: block;}
|
9 |
#wph #reset_settings_form .reset_settings { margin-top: -31px;}
|
10 |
+
#wph h2 #reset_settings, #wph #reset_settings_form .reset_settings { }
|
11 |
#wph span.wph-pro {background-color: #f04d46; color:#FFF; font-weight: bold;display: inline-block; padding: 2px 4px;}
|
12 |
|
13 |
table.wph_input { border: 0 none; background: #fff;}
|
55 |
|
56 |
.postbox h3 span {display: inline-block; vertical-align: middle}
|
57 |
|
58 |
+
.wph-notice {background-color: #fff; border-left: 3px solid #0073aa; margin-bottom: 15px}
|
59 |
+
.wph-notice p .dashicons { color: #d54e21; float: left; padding: 2px 10px;}
|
60 |
+
.wph-notice p {display: inline-block }
|
61 |
+
.wph-notice p span {font-weight: bold; cursor: text}
|
62 |
+
|
63 |
#info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin: 10px 0 20px 0;-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
|
64 |
#info_box a {text-decoration: none}
|
65 |
#info_box #p_right {float: right; background-color:#f5f5f5; border: 1px dashed #6aadcc; padding: 0px 10px; margin-top: 10px}
|
include/admin-interface.class.php
CHANGED
@@ -22,11 +22,7 @@
|
|
22 |
$this->functions = new WPH_functions();
|
23 |
|
24 |
}
|
25 |
-
|
26 |
-
function __destruct()
|
27 |
-
{
|
28 |
-
|
29 |
-
}
|
30 |
|
31 |
function _render($interface_name)
|
32 |
{
|
@@ -75,6 +71,8 @@
|
|
75 |
|
76 |
echo $this->functions->get_ad_banner();
|
77 |
|
|
|
|
|
78 |
if($this->module->use_tabs === TRUE)
|
79 |
$this->_generate_interface_tabs();
|
80 |
|
@@ -184,7 +182,7 @@
|
|
184 |
<?php
|
185 |
|
186 |
$option_name = $module_setting['id'];
|
187 |
-
$value = $this->wph->get_setting_value( $option_name, $module_setting
|
188 |
|
189 |
switch($module_setting['input_type'])
|
190 |
{
|
@@ -224,6 +222,18 @@
|
|
224 |
<?php
|
225 |
|
226 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
|
229 |
function _generate_interface_tabs()
|
22 |
$this->functions = new WPH_functions();
|
23 |
|
24 |
}
|
25 |
+
|
|
|
|
|
|
|
|
|
26 |
|
27 |
function _render($interface_name)
|
28 |
{
|
71 |
|
72 |
echo $this->functions->get_ad_banner();
|
73 |
|
74 |
+
$this->show_recovery();
|
75 |
+
|
76 |
if($this->module->use_tabs === TRUE)
|
77 |
$this->_generate_interface_tabs();
|
78 |
|
182 |
<?php
|
183 |
|
184 |
$option_name = $module_setting['id'];
|
185 |
+
$value = $this->wph->get_setting_value( $option_name, $module_setting );
|
186 |
|
187 |
switch($module_setting['input_type'])
|
188 |
{
|
222 |
<?php
|
223 |
|
224 |
}
|
225 |
+
|
226 |
+
|
227 |
+
function show_recovery()
|
228 |
+
{
|
229 |
+
?>
|
230 |
+
<div class="wph-notice">
|
231 |
+
<p class="important"><span class="dashicons dashicons-warning important" alt="f534"></span><?php _e('Copy the following link to a safe place, which you can use to reset all options, if something go wrong.', 'wp-hide-security-enhancer') ?> <span id="wph-recovery-link" onClick="WPH.selectText( 'wph-recovery-link' )"><?php echo site_url() ?>?wph-recovery=<?php echo $this->functions->get_recovery_code() ?></span></p>
|
232 |
+
</div>
|
233 |
+
<?php
|
234 |
+
|
235 |
+
|
236 |
+
}
|
237 |
|
238 |
|
239 |
function _generate_interface_tabs()
|
include/functions.class.php
CHANGED
@@ -73,7 +73,7 @@
|
|
73 |
}
|
74 |
|
75 |
|
76 |
-
function
|
77 |
{
|
78 |
|
79 |
$nonce = $_POST['_wpnonce'];
|
@@ -84,33 +84,15 @@
|
|
84 |
If ( ! current_user_can ( 'manage_options' ) )
|
85 |
return FALSE;
|
86 |
|
87 |
-
$
|
88 |
-
|
89 |
-
foreach($this->wph->modules as $module)
|
90 |
-
{
|
91 |
-
//proces the fields
|
92 |
-
$module_settings = $this->filter_settings( $module->get_module_settings(), TRUE );
|
93 |
-
|
94 |
-
foreach($module_settings as $module_setting)
|
95 |
-
{
|
96 |
-
if(isset($module_setting['type']) && $module_setting['type'] == 'split')
|
97 |
-
continue;
|
98 |
-
|
99 |
-
$field_name = $module_setting['id'];
|
100 |
-
|
101 |
-
$value = isset($module_setting['default_value']) ? $module_setting['default_value'] : '';
|
102 |
-
|
103 |
-
//save the value
|
104 |
-
$this->wph->settings['module_settings'][ $field_name ] = $value;
|
105 |
-
}
|
106 |
-
|
107 |
-
}
|
108 |
|
|
|
|
|
109 |
//eset the write string
|
110 |
-
$
|
111 |
|
112 |
//update the settings
|
113 |
-
$this->update_settings($
|
114 |
|
115 |
//trigger the settings changed action
|
116 |
do_action('wph/settings_changed', null, null);
|
@@ -124,7 +106,7 @@
|
|
124 |
|
125 |
$new_location .= '&reset_settings=true';
|
126 |
|
127 |
-
wp_redirect($new_location);
|
128 |
die();
|
129 |
|
130 |
}
|
@@ -735,12 +717,7 @@
|
|
735 |
if(empty($_write_check_string) || $_write_check_string != $this->wph->settings['write_check_string'])
|
736 |
$status = FALSE;
|
737 |
}
|
738 |
-
|
739 |
-
{
|
740 |
-
//disable, as settings never being saved or came from old version
|
741 |
-
$status = FALSE;
|
742 |
-
}
|
743 |
-
|
744 |
return $status;
|
745 |
}
|
746 |
|
@@ -1553,44 +1530,91 @@
|
|
1553 |
|
1554 |
$settings = $this->get_settings();
|
1555 |
|
1556 |
-
$recovery_code = md5(rand(1,9999) . microtime());
|
1557 |
|
1558 |
$settings['recovery_code'] = $recovery_code;
|
1559 |
|
1560 |
$this->update_settings($settings);
|
1561 |
|
|
|
|
|
|
|
1562 |
return $recovery_code;
|
1563 |
}
|
1564 |
|
1565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1566 |
/**
|
1567 |
* Trigger the recovery actions
|
1568 |
*
|
1569 |
*/
|
1570 |
function do_recovery()
|
1571 |
{
|
|
|
|
|
|
|
1572 |
//feetch a new set of settings
|
1573 |
-
$settings
|
1574 |
|
1575 |
$wph_recovery = isset($_GET['wph-recovery']) ? sanitize_text_field($_GET['wph-recovery']) : '';
|
1576 |
if(empty($wph_recovery) || $wph_recovery != $this->wph->settings['recovery_code'])
|
1577 |
return;
|
1578 |
-
|
1579 |
-
|
1580 |
-
$this->wph->settings['module_settings']['new_wp_login_php'] = '';
|
1581 |
-
$this->wph->settings['module_settings']['admin_url'] = '';
|
1582 |
|
1583 |
//update the settings
|
1584 |
-
$this->update_settings($
|
1585 |
|
1586 |
//available for mu-plugins
|
1587 |
do_action('wph/do_recovery');
|
1588 |
|
1589 |
-
|
1590 |
//add filter for rewriting the rules
|
1591 |
add_action('wp_loaded', array($this, 'wp_loaded_trigger_do_recovery'));
|
1592 |
|
1593 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1594 |
|
1595 |
|
1596 |
function wp_loaded_trigger_do_recovery()
|
73 |
}
|
74 |
|
75 |
|
76 |
+
function do_reset_settings()
|
77 |
{
|
78 |
|
79 |
$nonce = $_POST['_wpnonce'];
|
84 |
If ( ! current_user_can ( 'manage_options' ) )
|
85 |
return FALSE;
|
86 |
|
87 |
+
$settings = $this->get_settings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
+
$settings['module_settings'] = $this->reset_settings();
|
90 |
+
|
91 |
//eset the write string
|
92 |
+
$settings['write_check_string'] = '';
|
93 |
|
94 |
//update the settings
|
95 |
+
$this->update_settings( $settings );
|
96 |
|
97 |
//trigger the settings changed action
|
98 |
do_action('wph/settings_changed', null, null);
|
106 |
|
107 |
$new_location .= '&reset_settings=true';
|
108 |
|
109 |
+
wp_redirect( $new_location );
|
110 |
die();
|
111 |
|
112 |
}
|
717 |
if(empty($_write_check_string) || $_write_check_string != $this->wph->settings['write_check_string'])
|
718 |
$status = FALSE;
|
719 |
}
|
720 |
+
|
|
|
|
|
|
|
|
|
|
|
721 |
return $status;
|
722 |
}
|
723 |
|
1530 |
|
1531 |
$settings = $this->get_settings();
|
1532 |
|
1533 |
+
$recovery_code = substr( md5(rand(1,9999) . microtime()), 0, 10 );
|
1534 |
|
1535 |
$settings['recovery_code'] = $recovery_code;
|
1536 |
|
1537 |
$this->update_settings($settings);
|
1538 |
|
1539 |
+
//send the link to admin
|
1540 |
+
$this->send_recovery_email();
|
1541 |
+
|
1542 |
return $recovery_code;
|
1543 |
}
|
1544 |
|
1545 |
|
1546 |
+
function send_recovery_email( )
|
1547 |
+
{
|
1548 |
+
|
1549 |
+
$to = get_option('admin_email');
|
1550 |
+
$subject = get_option('blogname') . ' - WP Hide Recovery Link';
|
1551 |
+
$message = __('Hello', 'wp-hide-security-enhancer') . ", \n\n"
|
1552 |
+
. __('This is an automated message to inform that you can always use a recovery link if something go wrong', 'wp-hide-security-enhancer') . ": " . site_url() . '?wph-recovery='. $this->wph->functions->get_recovery_code() . "\n\n"
|
1553 |
+
. __('Please keep this url to a safe place.', 'wp-hide-security-enhancer') . ".";
|
1554 |
+
$headers = 'From: '. get_option('blogname') .' <'. get_option('admin_email') .'>' . "\r\n";
|
1555 |
+
$this->wph->functions->wp_mail( $to, $subject, $message, $headers );
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
|
1559 |
/**
|
1560 |
* Trigger the recovery actions
|
1561 |
*
|
1562 |
*/
|
1563 |
function do_recovery()
|
1564 |
{
|
1565 |
+
//prevent hammering
|
1566 |
+
//sleep(5);
|
1567 |
+
|
1568 |
//feetch a new set of settings
|
1569 |
+
$settings = $this->get_settings();
|
1570 |
|
1571 |
$wph_recovery = isset($_GET['wph-recovery']) ? sanitize_text_field($_GET['wph-recovery']) : '';
|
1572 |
if(empty($wph_recovery) || $wph_recovery != $this->wph->settings['recovery_code'])
|
1573 |
return;
|
1574 |
+
|
1575 |
+
$settings['module_settings'] = $this->reset_settings();
|
|
|
|
|
1576 |
|
1577 |
//update the settings
|
1578 |
+
$this->update_settings( $settings );
|
1579 |
|
1580 |
//available for mu-plugins
|
1581 |
do_action('wph/do_recovery');
|
1582 |
|
|
|
1583 |
//add filter for rewriting the rules
|
1584 |
add_action('wp_loaded', array($this, 'wp_loaded_trigger_do_recovery'));
|
1585 |
|
1586 |
}
|
1587 |
+
|
1588 |
+
|
1589 |
+
|
1590 |
+
function reset_settings()
|
1591 |
+
{
|
1592 |
+
|
1593 |
+
$settings = array();
|
1594 |
+
|
1595 |
+
foreach($this->wph->modules as $module)
|
1596 |
+
{
|
1597 |
+
//proces the fields
|
1598 |
+
$module_settings = $this->filter_settings( $module->get_module_settings(), TRUE );
|
1599 |
+
|
1600 |
+
foreach($module_settings as $module_setting)
|
1601 |
+
{
|
1602 |
+
if(isset($module_setting['type']) && $module_setting['type'] == 'split')
|
1603 |
+
continue;
|
1604 |
+
|
1605 |
+
$field_name = $module_setting['id'];
|
1606 |
+
|
1607 |
+
$value = isset($module_setting['default_value']) ? $module_setting['default_value'] : '';
|
1608 |
+
|
1609 |
+
//save the value
|
1610 |
+
$settings[ $field_name ] = $value;
|
1611 |
+
}
|
1612 |
+
|
1613 |
+
}
|
1614 |
+
|
1615 |
+
return $settings;
|
1616 |
+
|
1617 |
+
}
|
1618 |
|
1619 |
|
1620 |
function wp_loaded_trigger_do_recovery()
|
include/wph.class.php
CHANGED
@@ -62,24 +62,13 @@
|
|
62 |
if($this->server_htaccess_config === FALSE && $this->server_web_config === FALSE)
|
63 |
$this->functions->force_server_rewrite_type_detect();
|
64 |
|
65 |
-
//check for recovery link run
|
66 |
-
if(isset($_GET['wph-recovery']))
|
67 |
-
$this->functions->do_recovery();
|
68 |
-
|
69 |
//check for interface submit
|
70 |
if(is_admin() && isset($_POST['wph-interface-nonce']))
|
71 |
{
|
72 |
$this->doing_interface_save = TRUE;
|
73 |
-
$this->disable_filters = TRUE;
|
74 |
-
}
|
75 |
-
|
76 |
-
//check for reset setings
|
77 |
-
if(is_admin() && isset($_POST['reset-settings']))
|
78 |
-
{
|
79 |
-
$this->doing_reset_settings = TRUE;
|
80 |
-
$this->disable_filters = TRUE;
|
81 |
}
|
82 |
|
|
|
83 |
//check if WPEngine
|
84 |
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
85 |
$this->disable_filters = TRUE;
|
@@ -89,16 +78,34 @@
|
|
89 |
|
90 |
$this->get_default_variables();
|
91 |
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
//handle the compatibility
|
96 |
$this->plugins_themes_compatibility();
|
97 |
|
98 |
-
$this->_load_modules();
|
99 |
-
|
100 |
$this->add_default_replacements();
|
101 |
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Filters
|
104 |
*/
|
@@ -155,7 +162,6 @@
|
|
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);
|
157 |
|
158 |
-
$this->is_initialised = TRUE;
|
159 |
}
|
160 |
|
161 |
|
@@ -205,8 +211,6 @@
|
|
205 |
//sort the modules array
|
206 |
ksort($this->modules);
|
207 |
|
208 |
-
$this->_modules_components_run();
|
209 |
-
|
210 |
//filter available for mu-plugins
|
211 |
$this->modules = apply_filters('wp-hide/loaded_modules', $this->modules);
|
212 |
|
@@ -282,7 +286,7 @@
|
|
282 |
//check for settings reset
|
283 |
if($this->doing_reset_settings === TRUE)
|
284 |
{
|
285 |
-
$this->functions->
|
286 |
}
|
287 |
|
288 |
//check for interface submit
|
@@ -688,9 +692,15 @@
|
|
688 |
|
689 |
}
|
690 |
|
691 |
-
function get_setting_value($setting_name, $
|
692 |
{
|
693 |
-
$setting_value = isset($this->settings['module_settings'][$setting_name]) ? $this->settings['module_settings'][$setting_name] : $default_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
|
695 |
return $setting_value;
|
696 |
}
|
@@ -700,6 +710,41 @@
|
|
700 |
{
|
701 |
//allow rewrite
|
702 |
flush_rewrite_rules();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
}
|
704 |
|
705 |
|
@@ -814,7 +859,7 @@
|
|
814 |
if($this->uninstall === TRUE)
|
815 |
return $rules;
|
816 |
|
817 |
-
$write_check_string = $this->settings['write_check_string'];
|
818 |
|
819 |
if ( empty ( $write_check_string ) )
|
820 |
return $rules;
|
62 |
if($this->server_htaccess_config === FALSE && $this->server_web_config === FALSE)
|
63 |
$this->functions->force_server_rewrite_type_detect();
|
64 |
|
|
|
|
|
|
|
|
|
65 |
//check for interface submit
|
66 |
if(is_admin() && isset($_POST['wph-interface-nonce']))
|
67 |
{
|
68 |
$this->doing_interface_save = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
+
|
72 |
//check if WPEngine
|
73 |
if ( getenv('IS_WPE') == "1" || getenv('IS_WPE_SNAPSHOT') == "1" )
|
74 |
$this->disable_filters = TRUE;
|
78 |
|
79 |
$this->get_default_variables();
|
80 |
|
81 |
+
$this->_load_modules();
|
82 |
+
|
83 |
+
$this->is_initialised = TRUE;
|
84 |
+
do_action('wp-hide/is_initialised');
|
85 |
+
|
86 |
+
|
87 |
+
//check for recovery link run
|
88 |
+
if(isset($_GET['wph-recovery']))
|
89 |
+
$this->functions->do_recovery();
|
90 |
+
|
91 |
+
//check for reset setings
|
92 |
+
if(is_admin() && isset($_POST['reset-settings']))
|
93 |
+
{
|
94 |
+
$this->doing_reset_settings = TRUE;
|
95 |
+
$this->disable_filters = TRUE;
|
96 |
+
}
|
97 |
+
|
98 |
+
$this->_modules_components_run();
|
99 |
|
100 |
//handle the compatibility
|
101 |
$this->plugins_themes_compatibility();
|
102 |
|
|
|
|
|
103 |
$this->add_default_replacements();
|
104 |
|
105 |
+
//check for plugin update
|
106 |
+
$this->update();
|
107 |
+
|
108 |
+
|
109 |
/**
|
110 |
* Filters
|
111 |
*/
|
162 |
//restart the buffering if already outputed. This is usefull for plugin / theme update iframe
|
163 |
add_action('admin_print_footer_scripts', array($this, 'admin_print_footer_scripts'), -1);
|
164 |
|
|
|
165 |
}
|
166 |
|
167 |
|
211 |
//sort the modules array
|
212 |
ksort($this->modules);
|
213 |
|
|
|
|
|
214 |
//filter available for mu-plugins
|
215 |
$this->modules = apply_filters('wp-hide/loaded_modules', $this->modules);
|
216 |
|
286 |
//check for settings reset
|
287 |
if($this->doing_reset_settings === TRUE)
|
288 |
{
|
289 |
+
$this->functions->do_reset_settings();
|
290 |
}
|
291 |
|
292 |
//check for interface submit
|
692 |
|
693 |
}
|
694 |
|
695 |
+
function get_setting_value($setting_name, $module_setting )
|
696 |
{
|
697 |
+
$setting_value = isset($this->settings['module_settings'][$setting_name]) ? $this->settings['module_settings'][$setting_name] : $module_setting['default_value'];
|
698 |
+
|
699 |
+
//if radio input and value is empty, use default
|
700 |
+
if ( empty ( $setting_value ) && $module_setting['input_type'] == 'radio' )
|
701 |
+
{
|
702 |
+
$setting_value = $module_setting['default_value'];
|
703 |
+
}
|
704 |
|
705 |
return $setting_value;
|
706 |
}
|
710 |
{
|
711 |
//allow rewrite
|
712 |
flush_rewrite_rules();
|
713 |
+
|
714 |
+
/**
|
715 |
+
* Clear any cache plugins
|
716 |
+
*/
|
717 |
+
if (function_exists('wp_cache_clear_cache'))
|
718 |
+
wp_cache_clear_cache();
|
719 |
+
|
720 |
+
if (function_exists('w3tc_flush_all'))
|
721 |
+
w3tc_flush_all();
|
722 |
+
|
723 |
+
if (function_exists('opcache_reset'))
|
724 |
+
opcache_reset();
|
725 |
+
|
726 |
+
if ( function_exists( 'rocket_clean_domain' ) )
|
727 |
+
rocket_clean_domain();
|
728 |
+
|
729 |
+
global $wp_fastest_cache;
|
730 |
+
if ( method_exists( 'WpFastestCache', 'deleteCache' ) && !empty( $wp_fastest_cache ) )
|
731 |
+
$wp_fastest_cache->deleteCache();
|
732 |
+
|
733 |
+
//If your host has installed APC cache this plugin allows you to clear the cache from within WordPress
|
734 |
+
if (function_exists('apc_clear_cache'))
|
735 |
+
apc_clear_cache();
|
736 |
+
|
737 |
+
//WPEngine
|
738 |
+
if ( class_exists( 'WpeCommon' ) )
|
739 |
+
{
|
740 |
+
if ( method_exists( 'WpeCommon', 'purge_memcached' ) )
|
741 |
+
WpeCommon::purge_memcached();
|
742 |
+
if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) )
|
743 |
+
WpeCommon::clear_maxcdn_cache();
|
744 |
+
if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) )
|
745 |
+
WpeCommon::purge_varnish_cache();
|
746 |
+
}
|
747 |
+
|
748 |
}
|
749 |
|
750 |
|
859 |
if($this->uninstall === TRUE)
|
860 |
return $rules;
|
861 |
|
862 |
+
$write_check_string = isset($this->settings['write_check_string']) ? $this->settings['write_check_string'] : '';
|
863 |
|
864 |
if ( empty ( $write_check_string ) )
|
865 |
return $rules;
|
js/wph.js
CHANGED
@@ -1,7 +1,27 @@
|
|
1 |
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
}
|
|
|
|
1 |
|
2 |
|
3 |
+
class WPH_Class {
|
4 |
|
5 |
+
selectText(node)
|
6 |
+
{
|
7 |
+
|
8 |
+
node = document.getElementById(node);
|
9 |
+
|
10 |
+
if (document.body.createTextRange) {
|
11 |
+
const range = document.body.createTextRange();
|
12 |
+
range.moveToElementText(node);
|
13 |
+
range.select();
|
14 |
+
} else if (window.getSelection) {
|
15 |
+
const selection = window.getSelection();
|
16 |
+
const range = document.createRange();
|
17 |
+
range.selectNodeContents(node);
|
18 |
+
selection.removeAllRanges();
|
19 |
+
selection.addRange(range);
|
20 |
+
} else {
|
21 |
+
console.warn("Could not select text in node: Unsupported browser.");
|
22 |
+
}
|
23 |
+
}
|
24 |
|
25 |
+
}
|
26 |
+
|
27 |
+
var WPH = new WPH_Class();
|
modules/components/admin-admin_url.php
CHANGED
@@ -16,9 +16,7 @@
|
|
16 |
'label' => __('New Admin Url', 'wp-hide-security-enhancer'),
|
17 |
'description' => array(
|
18 |
__('Create a new admin url instead default /wp-admin and /login.', 'wp-hide-security-enhancer') . '<br />'
|
19 |
-
. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.wp-hide.com/documentation/admin-change-wp-admin/" target="_blank">Link</a>'
|
20 |
-
'<div class="notice-error"><div class="dashicons dashicons-warning important" alt="f534">'. __('warning', 'wp-hide-security-enhancer') .'</div> <span class="important">' . __('Write down your new admin url, or if lost, will not be able to log-in.', 'wp-hide-security-enhancer') . " " . __('An e-mail will be sent to', 'wp-hide-security-enhancer') . " " . get_option('admin_email') . " " . __('with the new Login URL', 'wp-hide-security-enhancer') . '</span></div>',
|
21 |
-
'<div class="notice-error"><div class="dashicons dashicons-warning important" alt="f534">'. __('warning', 'wp-hide-security-enhancer') .'</div> <span class="important">' . __('If unable to access the login / admin section anymore, use the Recovery Link which reset links to default: ', 'wp-hide-security-enhancer') . '<br /><b class="pointer">' . site_url() . '?wph-recovery='. $this->wph->functions->get_recovery_code() .'</b></div>'
|
22 |
),
|
23 |
'input_type' => 'text',
|
24 |
|
@@ -52,14 +50,7 @@
|
|
52 |
|
53 |
function _init_admin_url($saved_field_data)
|
54 |
{
|
55 |
-
|
56 |
-
$previous_url = get_option('wph-previous-admin-url');
|
57 |
-
if($saved_field_data != $previous_url)
|
58 |
-
{
|
59 |
-
$this->new_url_email_nottice($saved_field_data);
|
60 |
-
update_option('wph-previous-admin-url', $saved_field_data);
|
61 |
-
}
|
62 |
-
|
63 |
if(empty($saved_field_data))
|
64 |
return FALSE;
|
65 |
|
@@ -175,23 +166,6 @@
|
|
175 |
}
|
176 |
|
177 |
|
178 |
-
function new_url_email_nottice($new_url)
|
179 |
-
{
|
180 |
-
if(empty($new_url))
|
181 |
-
$new_url = 'wp-admin';
|
182 |
-
|
183 |
-
$to = get_option('admin_email');
|
184 |
-
$subject = 'New Login Url for your WordPress - ' .get_option('blogname');
|
185 |
-
$message = __('Hello', 'wp-hide-security-enhancer') . ", \n\n"
|
186 |
-
. __('This is an automated message to inform that your login url has been changed at', 'wp-hide-security-enhancer') . " " . trailingslashit(site_url()) . "\n"
|
187 |
-
. __('The new login url is', 'wp-hide-security-enhancer') . ": " . trailingslashit( trailingslashit(site_url()) . $new_url) . "\n\n"
|
188 |
-
. __('Additionality you can use this to recover the old login / admin links ', 'wp-hide-security-enhancer') . ": " . site_url() . '?wph-recovery='. $this->wph->functions->get_recovery_code() . "\n\n"
|
189 |
-
. __('Please keep this url safe for recover, if forgot', 'wp-hide-security-enhancer') . ".";
|
190 |
-
$headers = 'From: '. get_option('blogname') .' <'. get_option('admin_email') .'>' . "\r\n";
|
191 |
-
$this->wph->functions->wp_mail( $to, $subject, $message, $headers );
|
192 |
-
}
|
193 |
-
|
194 |
-
|
195 |
function _init_block_default_admin_url($saved_field_data)
|
196 |
{
|
197 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
16 |
'label' => __('New Admin Url', 'wp-hide-security-enhancer'),
|
17 |
'description' => array(
|
18 |
__('Create a new admin url instead default /wp-admin and /login.', 'wp-hide-security-enhancer') . '<br />'
|
19 |
+
. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.wp-hide.com/documentation/admin-change-wp-admin/" target="_blank">Link</a>'
|
|
|
|
|
20 |
),
|
21 |
'input_type' => 'text',
|
22 |
|
50 |
|
51 |
function _init_admin_url($saved_field_data)
|
52 |
{
|
53 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if(empty($saved_field_data))
|
55 |
return FALSE;
|
56 |
|
166 |
}
|
167 |
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
function _init_block_default_admin_url($saved_field_data)
|
170 |
{
|
171 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
modules/components/admin-new_wp_login_php.php
CHANGED
@@ -17,8 +17,8 @@
|
|
17 |
'description' => array(
|
18 |
__('Map a new wp-login.php instead default. This also need to include <i>.php</i> extension.', 'wp-hide-security-enhancer') . '<br />'
|
19 |
. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.wp-hide.com/documentation/admin-change-wp-login-php/" target="_blank">Link</a>',
|
20 |
-
'<div class="notice-error"><div class="dashicons dashicons-warning important" alt="f534">'. __('warning', 'wp-hide-security-enhancer') .'</div> <span class="important">' . __('Make sure your log-in url is not already modified by another plugin or theme. In such case, you should disable other code and take advantage of these features. More details at ', 'wp-hide-security-enhancer') . '<a target="_blank" href="http://www.wp-hide.com/login-conflicts/">'. __('Login Conflicts', 'wp-hide-security-enhancer') .'</a></span></div>'
|
21 |
-
|
22 |
),
|
23 |
'input_type' => 'text',
|
24 |
|
@@ -52,9 +52,16 @@
|
|
52 |
|
53 |
function _init_new_wp_login_php($saved_field_data)
|
54 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
56 |
return FALSE;
|
57 |
-
|
58 |
|
59 |
//conflict handle with other plugins
|
60 |
include_once(WPH_PATH . 'compatibility/wp-simple-firewall.php');
|
@@ -67,6 +74,23 @@
|
|
67 |
$this->wph->functions->add_replacement( trailingslashit( site_url() ) . 'wp-login.php', trailingslashit( home_url() ) . $saved_field_data );
|
68 |
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
function login_url($login_url, $redirect, $force_reauth)
|
17 |
'description' => array(
|
18 |
__('Map a new wp-login.php instead default. This also need to include <i>.php</i> extension.', 'wp-hide-security-enhancer') . '<br />'
|
19 |
. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.wp-hide.com/documentation/admin-change-wp-login-php/" target="_blank">Link</a>',
|
20 |
+
'<div class="notice-error"><div class="dashicons dashicons-warning important" alt="f534">'. __('warning', 'wp-hide-security-enhancer') .'</div> <span class="important">' . __('Make sure your log-in url is not already modified by another plugin or theme. In such case, you should disable other code and take advantage of these features. More details at ', 'wp-hide-security-enhancer') . '<a target="_blank" href="http://www.wp-hide.com/login-conflicts/">'. __('Login Conflicts', 'wp-hide-security-enhancer') .'</a></span></div>'
|
21 |
+
|
22 |
),
|
23 |
'input_type' => 'text',
|
24 |
|
52 |
|
53 |
function _init_new_wp_login_php($saved_field_data)
|
54 |
{
|
55 |
+
//check if the value has changed, e-mail the new url to site administrator
|
56 |
+
$previous_url = get_option('wph-previous-login-url');
|
57 |
+
if($saved_field_data != $previous_url)
|
58 |
+
{
|
59 |
+
$this->new_login_email_notice($saved_field_data);
|
60 |
+
update_option('wph-previous-login-url', $saved_field_data);
|
61 |
+
}
|
62 |
+
|
63 |
if(empty($saved_field_data) || $saved_field_data == 'no')
|
64 |
return FALSE;
|
|
|
65 |
|
66 |
//conflict handle with other plugins
|
67 |
include_once(WPH_PATH . 'compatibility/wp-simple-firewall.php');
|
74 |
$this->wph->functions->add_replacement( trailingslashit( site_url() ) . 'wp-login.php', trailingslashit( home_url() ) . $saved_field_data );
|
75 |
|
76 |
}
|
77 |
+
|
78 |
+
|
79 |
+
function new_login_email_notice( $new_login_url )
|
80 |
+
{
|
81 |
+
if(empty( $new_login_url ))
|
82 |
+
$new_login_url = 'wp-admin';
|
83 |
+
|
84 |
+
$to = get_option('admin_email');
|
85 |
+
$subject = get_option('blogname') . ' - WP Hide New Login Url for your WordPress';
|
86 |
+
$message = __('Hello', 'wp-hide-security-enhancer') . ", \n\n"
|
87 |
+
. __('This is an automated message to inform that your login url has been changed at site ', 'wp-hide-security-enhancer') . " " . trailingslashit(site_url()) . "\n"
|
88 |
+
. __('The new login url is', 'wp-hide-security-enhancer') . ": " . trailingslashit( trailingslashit(site_url()) . $new_login_url ) . "\n\n"
|
89 |
+
. __('Additionality you can use the following link to reset all options ', 'wp-hide-security-enhancer') . ": " . site_url() . '?wph-recovery='. $this->wph->functions->get_recovery_code() . "\n\n"
|
90 |
+
. __('Please keep this url to a safe place.', 'wp-hide-security-enhancer');
|
91 |
+
$headers = 'From: '. get_option('blogname') .' <'. get_option('admin_email') .'>' . "\r\n";
|
92 |
+
$this->wph->functions->wp_mail( $to, $subject, $message, $headers );
|
93 |
+
}
|
94 |
|
95 |
|
96 |
function login_url($login_url, $redirect, $force_reauth)
|
modules/components/rewrite-author.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
4 |
+
|
5 |
+
class WPH_module_rewrite_author extends WPH_module_component
|
6 |
+
{
|
7 |
+
|
8 |
+
function get_component_title()
|
9 |
+
{
|
10 |
+
return "Author";
|
11 |
+
}
|
12 |
+
|
13 |
+
function get_module_settings()
|
14 |
+
{
|
15 |
+
$this->module_settings[] = array(
|
16 |
+
'id' => 'author',
|
17 |
+
'label' => __('New Author Path', 'wp-hide-security-enhancer'),
|
18 |
+
'description' => __('The default path is set to /author/', 'wp-hide-security-enhancer'),
|
19 |
+
|
20 |
+
'value_description' => 'e.g. profile',
|
21 |
+
'input_type' => 'text',
|
22 |
+
|
23 |
+
'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
|
24 |
+
'processing_order' => 60
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->module_settings[] = array(
|
28 |
+
'id' => 'author_block_default',
|
29 |
+
'label' => __('Block default', 'wp-hide-security-enhancer'),
|
30 |
+
'description' => __('Block default /author/ when using custom one.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New Author Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
|
31 |
+
|
32 |
+
'input_type' => 'radio',
|
33 |
+
'options' => array(
|
34 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
35 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
36 |
+
),
|
37 |
+
'default_value' => 'no',
|
38 |
+
|
39 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
40 |
+
'processing_order' => 61
|
41 |
+
|
42 |
+
);
|
43 |
+
|
44 |
+
return $this->module_settings;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
function _init_author( $saved_field_data )
|
50 |
+
{
|
51 |
+
add_filter('author_rewrite_rules', array( $this, 'author_rewrite_rules'), 999);
|
52 |
+
|
53 |
+
if(empty($saved_field_data))
|
54 |
+
return FALSE;
|
55 |
+
|
56 |
+
//add default plugin path replacement
|
57 |
+
$url = trailingslashit( site_url() ) . 'author';
|
58 |
+
$replacement = trailingslashit( home_url() ) . $saved_field_data;
|
59 |
+
$this->wph->functions->add_replacement( $url , $replacement );
|
60 |
+
|
61 |
+
return TRUE;
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Rewrite the default Author url
|
67 |
+
*
|
68 |
+
* @param mixed $author_rewrite
|
69 |
+
*/
|
70 |
+
function author_rewrite_rules( $author_rewrite )
|
71 |
+
{
|
72 |
+
|
73 |
+
$new_author_path = $this->wph->functions->get_module_item_setting('author');
|
74 |
+
|
75 |
+
if( empty( $new_author_path ) )
|
76 |
+
return $author_rewrite;
|
77 |
+
|
78 |
+
$author_block_default = $this->wph->functions->get_module_item_setting('author_block_default');
|
79 |
+
|
80 |
+
$new_rules = array();
|
81 |
+
foreach ( $author_rewrite as $key => $value )
|
82 |
+
{
|
83 |
+
$new_rules[ str_replace( 'author/', $new_author_path .'/' , $key ) ] = $value;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( $author_block_default == 'yes')
|
87 |
+
$author_rewrite = $new_rules;
|
88 |
+
else
|
89 |
+
$author_rewrite = array_merge ( $author_rewrite, $new_rules );
|
90 |
+
|
91 |
+
return $author_rewrite;
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
}
|
97 |
+
?>
|
modules/components/rewrite-new_include_path.php
CHANGED
@@ -88,61 +88,7 @@
|
|
88 |
|
89 |
return $processing_response;
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
function includes_url($url, $path)
|
95 |
-
{
|
96 |
-
if ( $this->wph->disable_filters )
|
97 |
-
return $url;
|
98 |
-
|
99 |
-
$new_include_path = $this->wph->functions->get_module_item_setting('new_include_path');
|
100 |
-
|
101 |
-
$new_url = str_replace('/wp-includes/', '/' . $new_include_path . '/', $url);
|
102 |
-
|
103 |
-
return $new_url;
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
function script_loader_src($src, $handle)
|
108 |
-
{
|
109 |
-
if ( $this->wph->disable_filters )
|
110 |
-
return $src;
|
111 |
-
|
112 |
-
$new_include_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_include_path'), "/"), "/");
|
113 |
-
|
114 |
-
$current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
|
115 |
-
$new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
|
116 |
-
$src = str_replace( $current_include_url , $new_include_url , $src);
|
117 |
-
|
118 |
-
return $src;
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
function style_loader_src($src, $handle)
|
123 |
-
{
|
124 |
-
if ( $this->wph->disable_filters )
|
125 |
-
return $src;
|
126 |
-
|
127 |
-
$new_include_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_include_path'), "/"), "/");
|
128 |
-
|
129 |
-
$current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
|
130 |
-
$new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
|
131 |
-
$src = str_replace( $current_include_url , $new_include_url , $src);
|
132 |
-
|
133 |
-
return $src;
|
134 |
-
}
|
135 |
-
|
136 |
-
function wp_default_scripts($scripts)
|
137 |
-
{
|
138 |
-
//check if custom admin url is set
|
139 |
-
$include_path = $this->wph->functions->get_module_item_setting('new_include_path');
|
140 |
-
if (empty( $include_path ))
|
141 |
-
return;
|
142 |
-
|
143 |
-
$scripts = $this->wph->functions->default_scripts_styles_replace($scripts, array('wp-includes' => $include_path));
|
144 |
-
}
|
145 |
-
|
146 |
|
147 |
function _callback_saved_block_wpinclude_url($saved_field_data)
|
148 |
{
|
88 |
|
89 |
return $processing_response;
|
90 |
}
|
91 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
function _callback_saved_block_wpinclude_url($saved_field_data)
|
94 |
{
|
modules/components/rewrite-search.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
4 |
+
|
5 |
+
class WPH_module_rewrite_search extends WPH_module_component
|
6 |
+
{
|
7 |
+
|
8 |
+
function get_component_title()
|
9 |
+
{
|
10 |
+
return "Search";
|
11 |
+
}
|
12 |
+
|
13 |
+
function get_module_settings()
|
14 |
+
{
|
15 |
+
$this->module_settings[] = array(
|
16 |
+
'id' => 'search',
|
17 |
+
'label' => __('New Search Path', 'wp-hide-security-enhancer'),
|
18 |
+
'description' => __('The default path is set to /search/', 'wp-hide-security-enhancer'),
|
19 |
+
|
20 |
+
'value_description' => 'e.g. find',
|
21 |
+
'input_type' => 'text',
|
22 |
+
|
23 |
+
'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
|
24 |
+
'processing_order' => 60
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->module_settings[] = array(
|
28 |
+
'id' => 'search_block_default',
|
29 |
+
'label' => __('Block default', 'wp-hide-security-enhancer'),
|
30 |
+
'description' => __('Block default /search/ when using custom one.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New Search Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
|
31 |
+
|
32 |
+
'input_type' => 'radio',
|
33 |
+
'options' => array(
|
34 |
+
'yes' => __('Yes', 'wp-hide-security-enhancer'),
|
35 |
+
'no' => __('No', 'wp-hide-security-enhancer'),
|
36 |
+
),
|
37 |
+
'default_value' => 'no',
|
38 |
+
|
39 |
+
'sanitize_type' => array('sanitize_title', 'strtolower'),
|
40 |
+
'processing_order' => 61
|
41 |
+
|
42 |
+
);
|
43 |
+
|
44 |
+
return $this->module_settings;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
function _init_search( $saved_field_data )
|
50 |
+
{
|
51 |
+
add_filter('search_rewrite_rules', array( $this, 'search_rewrite_rules'), 999);
|
52 |
+
|
53 |
+
if(empty($saved_field_data))
|
54 |
+
return FALSE;
|
55 |
+
|
56 |
+
//add default plugin path replacement
|
57 |
+
$url = trailingslashit( site_url() ) . 'search';
|
58 |
+
$replacement = trailingslashit( home_url() ) . $saved_field_data;
|
59 |
+
$this->wph->functions->add_replacement( $url , $replacement );
|
60 |
+
|
61 |
+
return TRUE;
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Rewrite the default Search url
|
67 |
+
*
|
68 |
+
* @param mixed $search_rewrite
|
69 |
+
*/
|
70 |
+
function search_rewrite_rules( $search_rewrite )
|
71 |
+
{
|
72 |
+
|
73 |
+
$new_search_path = $this->wph->functions->get_module_item_setting('search');
|
74 |
+
|
75 |
+
if( empty( $new_search_path ) )
|
76 |
+
return $search_rewrite;
|
77 |
+
|
78 |
+
$search_block_default = $this->wph->functions->get_module_item_setting('search_block_default');
|
79 |
+
|
80 |
+
$new_rules = array();
|
81 |
+
foreach ( $search_rewrite as $key => $value )
|
82 |
+
{
|
83 |
+
$new_rules[ str_replace( 'search/', $new_search_path .'/' , $key ) ] = $value;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( $search_block_default == 'yes')
|
87 |
+
$search_rewrite = $new_rules;
|
88 |
+
else
|
89 |
+
$search_rewrite = array_merge ( $search_rewrite, $new_rules );
|
90 |
+
|
91 |
+
return $search_rewrite;
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
}
|
97 |
+
?>
|
modules/module-rewrite.php
CHANGED
@@ -30,6 +30,12 @@
|
|
30 |
include(WPH_PATH . "/modules/components/rewrite-comments.php");
|
31 |
$this->components[] = new WPH_module_rewrite_comments();
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
include(WPH_PATH . "/modules/components/rewrite-new_xml-rpc-path.php");
|
34 |
$this->components[] = new WPH_module_rewrite_new_xml_rpc_path();
|
35 |
|
30 |
include(WPH_PATH . "/modules/components/rewrite-comments.php");
|
31 |
$this->components[] = new WPH_module_rewrite_comments();
|
32 |
|
33 |
+
include(WPH_PATH . "/modules/components/rewrite-author.php");
|
34 |
+
$this->components[] = new WPH_module_rewrite_author();
|
35 |
+
|
36 |
+
include(WPH_PATH . "/modules/components/rewrite-search.php");
|
37 |
+
$this->components[] = new WPH_module_rewrite_search();
|
38 |
+
|
39 |
include(WPH_PATH . "/modules/components/rewrite-new_xml-rpc-path.php");
|
40 |
$this->components[] = new WPH_module_rewrite_new_xml_rpc_path();
|
41 |
|
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.3
|
7 |
-
Stable tag: 1.5.
|
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.
|
@@ -117,6 +117,16 @@ Since version 1.2 Change individual plugin urls which make them unrecognizable,
|
|
117 |
* New wp-comments-post.php Path
|
118 |
* Block wp-comments-post.php
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
**Rewrite > XML-RPC**
|
121 |
|
122 |
* New XML-RPC Path - Change default XML-RPC path / url
|
@@ -271,6 +281,15 @@ 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.4.2 =
|
275 |
* Fix: Undefined method for WooCommerce compatibility module
|
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.3
|
7 |
+
Stable tag: 1.5.5
|
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.
|
117 |
* New wp-comments-post.php Path
|
118 |
* Block wp-comments-post.php
|
119 |
|
120 |
+
**Rewrite > Author**
|
121 |
+
|
122 |
+
* New Author Path
|
123 |
+
* Block default path
|
124 |
+
|
125 |
+
**Rewrite > Search**
|
126 |
+
|
127 |
+
* New Search Path
|
128 |
+
* Block default path
|
129 |
+
|
130 |
**Rewrite > XML-RPC**
|
131 |
|
132 |
* New XML-RPC Path - Change default XML-RPC path / url
|
281 |
|
282 |
== Changelog ==
|
283 |
|
284 |
+
= 1.5.5 =
|
285 |
+
* New component: Rewrite Author
|
286 |
+
* New component: Rewrite Search
|
287 |
+
* Show recovery link on top of page to ensure everyone can save the link to use if something goe wrong.
|
288 |
+
* Send recovery code to site admin e-mail
|
289 |
+
* Minor Code adjustments
|
290 |
+
* Send new login url to site admin e-mail, to ensure user can recover access to dashboard if forget new slug
|
291 |
+
* Removed unused methods within WPH_module_rewrite_new_include_path component
|
292 |
+
|
293 |
= 1.5.4.2 =
|
294 |
* Fix: Undefined method for WooCommerce compatibility module
|
295 |
|
router/environment.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
2 |
-
$environment_variable = '{"theme":{"folder_name":"twentysixteen","mapped_name":"
|
1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
2 |
+
$environment_variable = '{"theme":{"folder_name":"twentysixteen","mapped_name":""},"allowed_paths":["F:\/htdocs\/wp-hide.dev\/wp-content\/themes"],"cache_path":"F:\/htdocs\/wp-hide.dev\/wp-content\/cache\/wph\/","wordpress_directory":"","site_relative_path":"\/"}' ?>
|
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.
|
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.5
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|