Protect Your Admin - Version 3.0

Version Description

  • Tested with new wordpress version 4.9.7
    • Optimized code of the plugin
Download this release

Release Info

Developer india-web-developer
Plugin Icon 128x128 Protect Your Admin
Version 3.0
Comparing to
See all releases

Code changes from version 2.9 to 3.0

Files changed (5) hide show
  1. css/pwa-admin-min.css +1 -1
  2. lib/hooks.php +36 -0
  3. protect-wp-admin.php +32 -13
  4. pwa-class.php +35 -2
  5. readme.txt +7 -2
css/pwa-admin-min.css CHANGED
@@ -2,4 +2,4 @@
2
  * Protect WP-Admin (C)
3
  * @MR Web Solution
4
  * */
5
- #pwa-tab-menu {width:80%; padding:1%;background: none repeat scroll 0 0 #ccc;}#pwa-tab-menu a {background: none repeat scroll 0 0 #DCA808; border: 0 none;color: #FFFFFF;display: inline-block;font-size: 14px;font-weight: bold;padding: 12px 20px;opacity:0.5;}#pwa-tab-menu a:hover{cursor:pointer;background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-tab-menu a.active{ background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-settings-form-admin .submit-btn {width: 100%; display: inline-block; padding-top: 10px; margin-top: 10px; border-top: 1px dashed #DCA808;}#pwa-settings-form-admin .submit-btn .button-primary{cursor:pointer;height:35px;}#pwa-settings-form-admin .csbwfs-setting p label {min-width:75px;display:inline-block;}#div-pwa-support img {width:50%px; height:auto;}#pwa-settings-form-admin ul {list-style:inside}#pwa-settings-form-admin #div-pwa-support .contact-author{ background: none repeat scroll 0 0 #DC22FF;border: 0 none;color: #FFFFFF;display: inline-block;font-size: 12px; font-weight: bold;padding: 2px 5px;text-decoration: none;}
2
  * Protect WP-Admin (C)
3
  * @MR Web Solution
4
  * */
5
+ #pwa-tab-menu {width:auto; padding:1%;}#pwa-tab-menu a {background: none repeat scroll 0 0 #DCA808; border: 0 none;color: #FFFFFF;display: inline-block;font-size: 14px;font-weight: bold;padding: 12px 20px;opacity:0.5;}#pwa-tab-menu a:hover{cursor:pointer;background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-tab-menu a.active{ background: none repeat scroll 0 0 #DCA808;opacity:1;}#pwa-settings-form-admin .submit-btn {width: 100%; display: inline-block; padding-top: 10px; margin-top: 10px; border-top: 1px dashed #DCA808;}#pwa-settings-form-admin .submit-btn .button-primary{cursor:pointer;height:35px;}#pwa-settings-form-admin .csbwfs-setting p label {min-width:75px;display:inline-block;}#div-pwa-support img {width:50%px; height:auto;}#pwa-settings-form-admin ul {list-style:inside}#pwa-settings-form-admin #div-pwa-support .contact-author{ background: none repeat scroll 0 0 #DC22FF;border: 0 none;color: #FFFFFF;display: inline-block;font-size: 12px; font-weight: bold;padding: 2px 5px;text-decoration: none;}
lib/hooks.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Protect WP-Admin (C)
4
+ * define all hooks
5
+ * */
6
+ /************************************
7
+ * Hooks to overide option value before save it into database
8
+ * ************************************/
9
+ function pwa_update_field_rewrite_text( $new_value, $old_value ) {
10
+ $new_value = str_replace('/','-',trim(stripslashes(strip_tags($old_value))));
11
+ return $new_value;
12
+ }
13
+ add_filter( 'pre_update_option_pwa_rewrite_text', 'pwa_update_field_rewrite_text', 10, 2 );
14
+ add_filter( 'login_url', 'my_login_page', 10, 2 );
15
+ function my_login_page( $login_url, $redirect ) {
16
+ $enable = get_option('pwa_active');
17
+ $newurl = get_option('pwa_rewrite_text');
18
+ if($enable && $newurl!='')
19
+ {
20
+ $login_url = str_replace("wp-login.php",$newurl,$login_url);
21
+ }
22
+ return $login_url;
23
+ }
24
+
25
+ add_action( 'login_form', 'replace_login_submit_form',1);
26
+ function replace_login_submit_form() {
27
+ $enable = get_option('pwa_active');
28
+ $newurl = get_option('pwa_rewrite_text');
29
+ if($enable && $newurl!='')
30
+ {
31
+ $your_content = ob_get_contents();
32
+ $your_content = str_replace("wp-login.php",$newurl,$your_content);
33
+ ob_get_clean();
34
+ echo $your_content;
35
+ }
36
+ }
protect-wp-admin.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.mrwebsolution.in/
5
  Description: The "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide an options to change wp-admin url and make the login page private(directly user can't access the login page).
6
  Author: MR Web Solution
7
  Author URI: http://www.mrwebsolution.in/
8
- Version: 2.9
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2017 (email : raghunath.0087@gmail.com)
@@ -59,7 +59,6 @@ function add_pwa_admin_style_script()
59
  wp_enqueue_style('thickbox');
60
  }
61
  endif;
62
-
63
  /** Add settings link to plugin list page in admin */
64
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pwa_action_links' );
65
  if(!function_exists('pwa_action_links')):
@@ -68,7 +67,6 @@ function pwa_action_links( $links ) {
68
  return $links;
69
  }
70
  endif;
71
-
72
  /** Options Form HTML for "Protect WP-Admin" plugin */
73
  if(!function_exists('init_pwa_admin_option_page')):
74
  function init_pwa_admin_option_page(){
@@ -84,26 +82,47 @@ function init_pwa_admin_option_page(){
84
  <form action="options.php" method="post" id="pwa-settings-form-admin">
85
  <input type="hidden" id="check_permalink" value="<?php echo $permalink_structure_val;?>">
86
  <div id="pwa-tab-menu"><a id="pwa-general" class="pwa-tab-links active" >General</a> <a id="pwa-admin-style" class="pwa-tab-links">Login Page Style</a> <a id="pwa-advance" class="pwa-tab-links">Advance Settings</a> <a id="pwa-gopro" class="pwa-tab-links">Go Pro</a> <a id="pwa-support" class="pwa-tab-links">Support</a> </div>
 
87
  <div class="pwa-setting">
88
  <!-- General Setting -->
89
  <div class="first pwa-tab" id="div-pwa-general">
90
  <h2>General Settings</h2>
 
 
 
 
91
  <p><label>Enable: </label><input type="checkbox" id="pwa_active" name="pwa_active" value='1' <?php if(get_option('pwa_active')!=''){ echo ' checked="checked"'; }?>/></p>
92
- <p id="adminurl"><label>Admin Slug: </label><input type="text" id="pwa_rewrite_text" name="pwa_rewrite_text" value="<?php echo esc_attr(get_option('pwa_rewrite_text')); ?>" placeholder="myadmin" size="30">(<i>Add New Secure Admin URL Slug ( i.e myadmin )</i>)</p>
93
-
94
  <?php
95
- $getPwaOptions=get_pwa_setting_options();
96
- if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) && (isset($getPwaOptions['pwa_rewrite_text']) && $getPwaOptions['pwa_rewrite_text']!='')){
97
- echo "<p><strong>Your New Admin URL : </strong>".home_url($getPwaOptions['pwa_rewrite_text'])." | <strong><blink><a href='".home_url($getPwaOptions['pwa_rewrite_text'].'?preview=1')."' target='_blank'>CLICK HERE</a></blink></strong> for preview new admin URL.</p>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
- }
100
- ?>
101
  </div>
102
  <!-- Admin Style -->
103
  <div class="last author pwa-tab" id="div-pwa-admin-style">
104
  <h2>Admin Login Page Style Settings</h2>
105
- <p id="adminurl"><label>Define Logo Path: </label><input type="text" id="pwa_logo_path" name="pwa_logo_path" value="<?php echo esc_attr(get_option('pwa_logo_path')); ?>" placeholder="Add Custom Logo Image Path" size="30"> <input data-id="pwa_logo_path" type="button" value="Upload Image" class="upload_image"/>(<i>Change WordPress Default Login Logo </i>)</p>
106
- <p id="adminurl"><label>Body Background Color: </label><input type="text" id="pwa_login_page_bg_color" name="pwa_login_page_bg_color" value="<?php echo esc_attr(get_option('pwa_login_page_bg_color')); ?>" size="30" data-default-color="#444444" class="color-field"></p>
107
  </div>
108
  <!-- Advance Setting -->
109
  <div class="pwa-tab" id="div-pwa-advance">
@@ -116,7 +135,7 @@ function init_pwa_admin_option_page(){
116
  <!-- go pro -->
117
  <div class="last author pwa-tab" id="div-pwa-gopro">
118
  <h2> Go Pro</h2>
119
- <a href="(https://rgaddons.wordpress.com/protect-wp-admin-pro/"> Click here</a> for update to pro version.
120
  <ol>
121
  <li>Login Attempt Counter</li>
122
  <li>An option to define login page logo URL</li>
5
  Description: The "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide an options to change wp-admin url and make the login page private(directly user can't access the login page).
6
  Author: MR Web Solution
7
  Author URI: http://www.mrwebsolution.in/
8
+ Version: 3.0
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2017 (email : raghunath.0087@gmail.com)
59
  wp_enqueue_style('thickbox');
60
  }
61
  endif;
 
62
  /** Add settings link to plugin list page in admin */
63
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pwa_action_links' );
64
  if(!function_exists('pwa_action_links')):
67
  return $links;
68
  }
69
  endif;
 
70
  /** Options Form HTML for "Protect WP-Admin" plugin */
71
  if(!function_exists('init_pwa_admin_option_page')):
72
  function init_pwa_admin_option_page(){
82
  <form action="options.php" method="post" id="pwa-settings-form-admin">
83
  <input type="hidden" id="check_permalink" value="<?php echo $permalink_structure_val;?>">
84
  <div id="pwa-tab-menu"><a id="pwa-general" class="pwa-tab-links active" >General</a> <a id="pwa-admin-style" class="pwa-tab-links">Login Page Style</a> <a id="pwa-advance" class="pwa-tab-links">Advance Settings</a> <a id="pwa-gopro" class="pwa-tab-links">Go Pro</a> <a id="pwa-support" class="pwa-tab-links">Support</a> </div>
85
+ <hr>
86
  <div class="pwa-setting">
87
  <!-- General Setting -->
88
  <div class="first pwa-tab" id="div-pwa-general">
89
  <h2>General Settings</h2>
90
+ <table cellpadding="10">
91
+ <tr>
92
+ <td valign="top">
93
+
94
  <p><label>Enable: </label><input type="checkbox" id="pwa_active" name="pwa_active" value='1' <?php if(get_option('pwa_active')!=''){ echo ' checked="checked"'; }?>/></p>
95
+ <p id="adminurl"><label>New Slug: </label><br><input type="text" id="pwa_rewrite_text" size="20" name="pwa_rewrite_text" value="<?php echo esc_attr(get_option('pwa_rewrite_text')); ?>" placeholder="myadmin" size="30"><br><i>Add New Secure Admin URL Slug ( i.e myadmin )</i></p>
 
96
  <?php
97
+ $getPwaOptions=get_pwa_setting_options();
98
+ if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) && (isset($getPwaOptions['pwa_rewrite_text']) && $getPwaOptions['pwa_rewrite_text']!='')){
99
+ echo "<br><p><strong>Your New Admin URL : </strong><br>".home_url($getPwaOptions['pwa_rewrite_text'])." | <strong><blink><a href='".home_url($getPwaOptions['pwa_rewrite_text'].'?preview=1')."' target='_blank'>CLICK HERE</a></blink></strong> to preview new admin URL.</p>";
100
+
101
+ }
102
+ ?>
103
+ </td>
104
+ <td valign="top" style="border-left:2px solid #ccc; padding-left:10px;">
105
+ <h3>Pro Addon Features:</h3>
106
+ <ol>
107
+ <li>Login Attempt Counter</li>
108
+ <li>An option to define login page logo URL</li>
109
+ <li>An option to manage login page CSS from admin</li>
110
+ <li>An option to change username of any user</li>
111
+ <li>An option to define custom redirect url for defalut wp-admin url</li>
112
+ </ol>
113
+ <p style="font-size:16px;">Want to know about all features of addon? Watch given below video</p>
114
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/Vbk8QX2HWic?rel=1&autoplay=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
115
+ <h2><a href="https://rgaddons.wordpress.com/protect-wp-admin-pro/" target="_blank" class="contact-author"><strong>Click Here</strong></a> to download addon.</h2>
116
+ </td>
117
+ </tr>
118
+ </table>
119
 
 
 
120
  </div>
121
  <!-- Admin Style -->
122
  <div class="last author pwa-tab" id="div-pwa-admin-style">
123
  <h2>Admin Login Page Style Settings</h2>
124
+ <p id="adminurl"><label>Login Page Logo: </label><input type="text" id="pwa_logo_path" name="pwa_logo_path" value="<?php echo esc_attr(get_option('pwa_logo_path')); ?>" placeholder="Add Custom Logo Image Path" size="30"> <input data-id="pwa_logo_path" type="button" value="Upload Image" class="upload_image"/>(<i>Change WordPress Default Login Logo </i>)</p>
125
+ <p id="adminurl"><label>Body Background Color: </label><input type="text" id="pwa_login_page_bg_color" name="pwa_login_page_bg_color" value="<?php echo esc_attr(get_option('pwa_login_page_bg_color')); ?>" size="30" class="color-field"></p>
126
  </div>
127
  <!-- Advance Setting -->
128
  <div class="pwa-tab" id="div-pwa-advance">
135
  <!-- go pro -->
136
  <div class="last author pwa-tab" id="div-pwa-gopro">
137
  <h2> Go Pro</h2>
138
+ <a href="https://rgaddons.wordpress.com/protect-wp-admin-pro/"> Click here</a> for update to pro version.
139
  <ol>
140
  <li>Login Attempt Counter</li>
141
  <li>An option to define login page logo URL</li>
pwa-class.php CHANGED
@@ -286,10 +286,43 @@ if(!function_exists('pwa_update_login_page_logo')):
286
  }
287
 
288
  if(isset($getPwaOptions['pwa_login_page_bg_color']) && $getPwaOptions['pwa_login_page_bg_color']!='')
289
- echo ' body.login-action-login,html{ background:'.$getPwaOptions['pwa_login_page_bg_color'].' !important; height: 100% !important;}';
290
 
291
  echo '</style>';
292
 
293
  }
294
  endif;
295
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
287
 
288
  if(isset($getPwaOptions['pwa_login_page_bg_color']) && $getPwaOptions['pwa_login_page_bg_color']!='')
289
+ echo ' body.login-action-login,html{ background:'.$getPwaOptions['pwa_login_page_bg_color'].' !important; height: 100% !important;}.login .button-primary{background:'.$getPwaOptions['pwa_login_page_bg_color'].' !important;}';
290
 
291
  echo '</style>';
292
 
293
  }
294
  endif;
295
+ /*************************************************************
296
+ Hooks to overide option value before save it into database
297
+ * ************************************************************/
298
+ function pwa_update_field_rewrite_text( $new_value, $old_value ) {
299
+ $new_value = str_replace('/','-',trim(stripslashes(strip_tags($old_value))));
300
+ return $new_value;
301
+ }
302
+ add_filter( 'pre_update_option_pwa_rewrite_text', 'pwa_update_field_rewrite_text', 10, 2 );
303
+ /*************************************************************
304
+ Hooks to overide login page url
305
+ *************************************************************/
306
+ add_filter( 'login_url', 'pwa_hooks_login_page', 10, 2 );
307
+ function pwa_hooks_login_page( $login_url, $redirect ) {
308
+ $enable = get_option('pwa_active');
309
+ $newurl = get_option('pwa_rewrite_text');
310
+ if($enable && $newurl!='')
311
+ {
312
+ $login_url = str_replace("wp-login.php",$newurl,$login_url);
313
+ }
314
+ return $login_url;
315
+ }
316
+
317
+ add_action( 'login_form', 'pwa_hooks_replace_login_submit_form',1);
318
+ function pwa_hooks_replace_login_submit_form() {
319
+ $enable = get_option('pwa_active');
320
+ $newurl = get_option('pwa_rewrite_text');
321
+ if($enable && $newurl!='')
322
+ {
323
+ $your_content = ob_get_contents();
324
+ $your_content = str_replace("wp-login.php",$newurl,$your_content);
325
+ ob_get_clean();
326
+ echo $your_content;
327
+ }
328
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors:india-web-developer
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
4
  Tags: Protect WP-Admin,wp-admin,Protect wordpress admin,Secure Admin,Admin,Scure Wordpress Admin,Rename Admin URL, Rename Wordpress Admin URL,Change wp-admin url,Change Admin URL,Change Admin Path,Restrict wp-admin
5
  Requires at least: 4.0
6
- Tested up to: 4.9.4
7
- Stable tag: 2.9
8
 
9
  Protect Your Website Admin Against Hackers & Modify Login Page Design
10
 
@@ -122,6 +122,11 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
122
 
123
 
124
  == Changelog ==
 
 
 
 
 
125
  = 2.9 =
126
  * Tested with new wordpress version 4.9.4
127
  * Fixed getimagesize() function issue for HTTPS urls
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
4
  Tags: Protect WP-Admin,wp-admin,Protect wordpress admin,Secure Admin,Admin,Scure Wordpress Admin,Rename Admin URL, Rename Wordpress Admin URL,Change wp-admin url,Change Admin URL,Change Admin Path,Restrict wp-admin
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.7
7
+ Stable tag: 3.0
8
 
9
  Protect Your Website Admin Against Hackers & Modify Login Page Design
10
 
122
 
123
 
124
  == Changelog ==
125
+
126
+ = 3.0 =
127
+ * Tested with new wordpress version 4.9.7
128
+ * Optimized code of the plugin
129
+
130
  = 2.9 =
131
  * Tested with new wordpress version 4.9.4
132
  * Fixed getimagesize() function issue for HTTPS urls