Protect Your Admin - Version 2.7

Version Description

  • Tested with new wordpress version 4.8.1
    • Added upload image lighbox and color picker
Download this release

Release Info

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

Code changes from version 2.6 to 2.7

css/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nothing to see here.
4
+ */
images/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nothing to see here.
4
+ */
index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nothing to see here.
4
+ */
js/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nothing to see here.
4
+ */
js/pwa.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* admin js*/
2
+ jQuery(document).ready(function(){
3
+ /* add image upload image button */
4
+ jQuery(".upload_image").click(function() {
5
+ inputfieldId = jQuery(this).attr("data-id");
6
+ formfield = jQuery("#"+inputfieldId).attr("name");
7
+ tb_show( "", "media-upload.php?type=image&amp;TB_iframe=true" );
8
+ return false;
9
+ });
10
+ window.send_to_editor = function(html) {
11
+ imgurl = jQuery(html).attr('href');
12
+ if(imgurl==undefined){ imgurl = jQuery(html).attr('src');}
13
+ jQuery("#"+inputfieldId).val(imgurl);
14
+ tb_remove();
15
+ }
16
+ // Add Color Picker to all inputs that have 'color-field' class
17
+ jQuery('.color-field').wpColorPicker();
18
+ });
lib/index.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nothing to see here.
4
+ */
lib/pwa-deactivate.php CHANGED
@@ -6,14 +6,14 @@
6
  ?>
7
  <?php
8
  if ( ! defined( 'ABSPATH' ) && !isset($_GET['disable_pwa']) ) exit; // Exit if accessed directly
9
-
10
  if(isset($_GET['disable_pwa']))
11
  {
12
  require_once('../../../../wp-load.php' );
13
  $array = get_option('active_plugins');
14
  $array_without_strawberries = array_diff($array, array('protect-wp-admin/protect-wp-admin.php'));
15
  update_option( 'active_plugins', $array_without_strawberries );
 
 
 
16
  }
17
-
18
-
19
  ?>
6
  ?>
7
  <?php
8
  if ( ! defined( 'ABSPATH' ) && !isset($_GET['disable_pwa']) ) exit; // Exit if accessed directly
 
9
  if(isset($_GET['disable_pwa']))
10
  {
11
  require_once('../../../../wp-load.php' );
12
  $array = get_option('active_plugins');
13
  $array_without_strawberries = array_diff($array, array('protect-wp-admin/protect-wp-admin.php'));
14
  update_option( 'active_plugins', $array_without_strawberries );
15
+ echo "<strong>protect-wp-admin</strong> plugin has been disabled";
16
+ flush_rewrite_rules();
17
+ wp_die();
18
  }
 
 
19
  ?>
protect-wp-admin.php CHANGED
@@ -5,10 +5,10 @@ Plugin URI: http://www.mrwebsolution.in/
5
  Description: "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide the options for change the 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.6
9
  */
10
 
11
- /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
@@ -32,9 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
32
  add_action('admin_menu','init_pwa_admin_menu');
33
  if(!function_exists('init_pwa_admin_menu')):
34
  function init_pwa_admin_menu(){
35
-
36
  add_options_page('Protect WP-Admin','Protect WP-Admin','manage_options','pwa-settings','init_pwa_admin_option_page');
37
-
38
  }
39
  endif;
40
  /** Define Action to register "Protect WP-Admin" Options */
@@ -51,11 +49,22 @@ function init_pwa_options_fields(){
51
  register_setting('pwa_setting_options','pwa_login_page_bg_color');
52
  }
53
  endif;
 
 
 
 
 
 
 
 
 
 
 
54
  /** Add settings link to plugin list page in admin */
55
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'pwa_action_links' );
56
  if(!function_exists('pwa_action_links')):
57
  function pwa_action_links( $links ) {
58
- $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=pwa-settings') .'">Settings</a> | <a href="https://rgaddons.wordpress.com/wp-importer-pro/">GO PRO</a>';
59
  return $links;
60
  }
61
  endif;
@@ -63,15 +72,18 @@ endif;
63
  /** Options Form HTML for "Protect WP-Admin" plugin */
64
  if(!function_exists('init_pwa_admin_option_page')):
65
  function init_pwa_admin_option_page(){
 
 
 
 
66
  if (get_option('permalink_structure') ){ $permalink_structure_val='yes'; }else{$permalink_structure_val='no';}
67
  ?>
68
  <div style="width: 80%; padding: 10px; margin: 10px;">
69
-
70
  <h1>Protect WP-Admin Settings</h1>
71
  <!-- Start Options Form -->
72
  <form action="options.php" method="post" id="pwa-settings-form-admin">
73
  <input type="hidden" id="check_permalink" value="<?php echo $permalink_structure_val;?>">
74
- <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">LoginPage Style</a> <a id="pwa-advance" class="pwa-tab-links">Advance Settings</a> <a id="pwa-support" class="pwa-tab-links">Support</a> </div>
75
  <div class="pwa-setting">
76
  <!-- General Setting -->
77
  <div class="first pwa-tab" id="div-pwa-general">
@@ -87,14 +99,12 @@ function init_pwa_admin_option_page(){
87
  }
88
  ?>
89
  </div>
90
-
91
  <!-- Admin Style -->
92
  <div class="last author pwa-tab" id="div-pwa-admin-style">
93
  <h2>Admin Login Page Style Settings</h2>
94
- <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">(<i>Change WordPress Default Login Logo </i>)</p>
95
- <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')); ?>" placeholder="#444444" size="30"></p>
96
  </div>
97
-
98
  <!-- Advance Setting -->
99
  <div class="pwa-tab" id="div-pwa-advance">
100
  <h2>Advance Settings</h2>
@@ -102,10 +112,22 @@ function init_pwa_admin_option_page(){
102
  <p><input type="checkbox" id="pwa_restrict" name="pwa_restrict" value='1' <?php if(get_option('pwa_restrict')!=''){ echo ' checked="checked"'; }?>/> <label>Restrict registered non-admin users from wp-admin :</label></p>
103
  <p><input type="checkbox" id="pwa_logout" name="pwa_logout" value='1' <?php if(get_option('pwa_logout')==''){ echo ''; }else{echo 'checked="checked"';}?>/> <label>Logout Admin After Add/Update New Admin URL(Optional) :</label> (This is only for security purpose)</p>
104
  <p><label>Allow access to non-admin users:</label><input type="text" id="pwa_allow_custom_users" name="pwa_allow_custom_users" value="<?php echo esc_attr(get_option('pwa_allow_custom_users')); ?>" placeholder="1,2,3"> (<i>Add comma seprated ids</i>)</p>
105
-
106
  </div>
107
-
108
-
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  <!-- Support -->
110
  <div class="last author pwa-tab" id="div-pwa-support">
111
  <h2>Plugin Support</h2>
@@ -160,6 +182,7 @@ endif;
160
  // better use get_current_screen(); or the global $current_screen
161
  if (isset($_GET['page']) && $_GET['page'] == 'pwa-settings') {
162
  add_action('admin_footer','init_pwa_admin_scripts');
 
163
  }
164
  if(!function_exists('init_pwa_admin_scripts')):
165
  function init_pwa_admin_scripts()
@@ -275,7 +298,6 @@ if( function_exists('register_uninstall_hook') ){
275
  register_uninstall_hook(__FILE__,'flush_rewrite_rules');
276
  register_uninstall_hook(__FILE__,'init_uninstall_pwa_plugins');
277
  }
278
-
279
  //Delete all options after uninstall the plugin
280
  if(!function_exists('init_uninstall_pwa_plugins')):
281
  function init_uninstall_pwa_plugins(){
@@ -289,7 +311,6 @@ function init_uninstall_pwa_plugins(){
289
  }
290
  endif;
291
  require dirname(__FILE__).'/pwa-class.php';
292
-
293
  /** register_deactivation_hook */
294
  /** Delete exits options during deactivation the plugins */
295
  if( function_exists('register_deactivation_hook') ){
@@ -323,10 +344,8 @@ add_action('admin_init','pwa_flush_rewrite_rules');
323
  if(!function_exists('pwa_flush_rewrite_rules')):
324
  function pwa_flush_rewrite_rules(){
325
  if(isset($_POST['option_page']) && $_POST['option_page']=='pwa_setting_options' && $_POST['pwa_active']==''){
326
- flush_rewrite_rules();flush_rewrite_rules();
327
  }
328
-
329
  }
330
  endif;
331
-
332
  ?>
5
  Description: "protect-wp-admin" is a very help full plugin to make wordpress admin more secure. Protect WP-Admin plugin is provide the options for change the 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.7
9
  */
10
 
11
+ /*** Protect WP-Admin Copyright 2017 (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
32
  add_action('admin_menu','init_pwa_admin_menu');
33
  if(!function_exists('init_pwa_admin_menu')):
34
  function init_pwa_admin_menu(){
 
35
  add_options_page('Protect WP-Admin','Protect WP-Admin','manage_options','pwa-settings','init_pwa_admin_option_page');
 
36
  }
37
  endif;
38
  /** Define Action to register "Protect WP-Admin" Options */
49
  register_setting('pwa_setting_options','pwa_login_page_bg_color');
50
  }
51
  endif;
52
+
53
+ if(!function_exists('add_pwa_admin_style_script')):
54
+ function add_pwa_admin_style_script()
55
+ {
56
+ wp_register_script('pwa-image-upload', plugins_url('/js/pwa.js',__FILE__ ), array('jquery','media-upload','thickbox','wp-color-picker'));
57
+ wp_enqueue_script('pwa-image-upload');
58
+ wp_enqueue_style( 'wp-color-picker' );
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')):
66
  function pwa_action_links( $links ) {
67
+ $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=pwa-settings') .'">Settings</a> | <a href="https://rgaddons.wordpress.com/protect-wp-admin-pro/">GO PRO</a>';
68
  return $links;
69
  }
70
  endif;
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(){
75
+ if(!current_user_can('manage_options'))
76
+ {
77
+ wp_die(__('You do not have sufficient permissions to access this page.'));
78
+ }
79
  if (get_option('permalink_structure') ){ $permalink_structure_val='yes'; }else{$permalink_structure_val='no';}
80
  ?>
81
  <div style="width: 80%; padding: 10px; margin: 10px;">
 
82
  <h1>Protect WP-Admin Settings</h1>
83
  <!-- Start Options Form -->
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">
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">
110
  <h2>Advance Settings</h2>
112
  <p><input type="checkbox" id="pwa_restrict" name="pwa_restrict" value='1' <?php if(get_option('pwa_restrict')!=''){ echo ' checked="checked"'; }?>/> <label>Restrict registered non-admin users from wp-admin :</label></p>
113
  <p><input type="checkbox" id="pwa_logout" name="pwa_logout" value='1' <?php if(get_option('pwa_logout')==''){ echo ''; }else{echo 'checked="checked"';}?>/> <label>Logout Admin After Add/Update New Admin URL(Optional) :</label> (This is only for security purpose)</p>
114
  <p><label>Allow access to non-admin users:</label><input type="text" id="pwa_allow_custom_users" name="pwa_allow_custom_users" value="<?php echo esc_attr(get_option('pwa_allow_custom_users')); ?>" placeholder="1,2,3"> (<i>Add comma seprated ids</i>)</p>
 
115
  </div>
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>
123
+ <li>An option to manage login page CSS from admin</li>
124
+ <li>An option to change username of any user</li>
125
+ <li>An option to define custom redirect url for defalut wp-admin url</li>
126
+ <li>Faster support</li>
127
+ </ol>
128
+ <strong>PRO Features:</strong>
129
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/Vbk8QX2HWic" frameborder="0" allowfullscreen></iframe>
130
+ </div>
131
  <!-- Support -->
132
  <div class="last author pwa-tab" id="div-pwa-support">
133
  <h2>Plugin Support</h2>
182
  // better use get_current_screen(); or the global $current_screen
183
  if (isset($_GET['page']) && $_GET['page'] == 'pwa-settings') {
184
  add_action('admin_footer','init_pwa_admin_scripts');
185
+ add_action('admin_head','add_pwa_admin_style_script');
186
  }
187
  if(!function_exists('init_pwa_admin_scripts')):
188
  function init_pwa_admin_scripts()
298
  register_uninstall_hook(__FILE__,'flush_rewrite_rules');
299
  register_uninstall_hook(__FILE__,'init_uninstall_pwa_plugins');
300
  }
 
301
  //Delete all options after uninstall the plugin
302
  if(!function_exists('init_uninstall_pwa_plugins')):
303
  function init_uninstall_pwa_plugins(){
311
  }
312
  endif;
313
  require dirname(__FILE__).'/pwa-class.php';
 
314
  /** register_deactivation_hook */
315
  /** Delete exits options during deactivation the plugins */
316
  if( function_exists('register_deactivation_hook') ){
344
  if(!function_exists('pwa_flush_rewrite_rules')):
345
  function pwa_flush_rewrite_rules(){
346
  if(isset($_POST['option_page']) && $_POST['option_page']=='pwa_setting_options' && $_POST['pwa_active']==''){
347
+ flush_rewrite_rules();
348
  }
 
349
  }
350
  endif;
 
351
  ?>
pwa-class.php CHANGED
@@ -167,7 +167,8 @@ function pwa_admin_url_redirect_conditions()
167
  //print_r($pwaActualURLAry); echo $newUrl[0];exit;
168
  if(! is_user_logged_in() && in_array($newUrl[0],$pwaActualURLAry) )
169
  {
170
-
 
171
  /** is forgot password link */
172
  if( isset($_GET['login']) && isset($_GET['action']) && $_GET['action']=='rp' && $_GET['login']!='')
173
  {
167
  //print_r($pwaActualURLAry); echo $newUrl[0];exit;
168
  if(! is_user_logged_in() && in_array($newUrl[0],$pwaActualURLAry) )
169
  {
170
+ if(DOING_AJAX && $newUrl[0]==home_url('/wp-admin/admin-ajax.php'))
171
+ return true;
172
  /** is forgot password link */
173
  if( isset($_GET['login']) && isset($_GET['action']) && $_GET['action']=='rp' && $_GET['login']!='')
174
  {
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.8
7
- Stable tag: 2.6
8
 
9
  Protect Your Website Admin Against Hackers & Modify Login Page Design
10
 
@@ -26,6 +26,7 @@ The plugin also comes with some access filters, allowing webmasters to restrict
26
  It is extremely important to back up your database before beginning the activate plugin. If, for some reason, you find it necessary to restore your database from these backups. Plugin will not work for IIS.
27
 
28
 
 
29
 
30
  **[ Upgrade to Pro Version ](https://rgaddons.wordpress.com/protect-wp-admin-pro/)**
31
 
@@ -55,6 +56,10 @@ We have also released an add-on for Protect-WP-Admin which not only demonstrates
55
 
56
 
57
  **[ Upgrade to Pro Version](https://rgaddons.wordpress.com/protect-wp-admin-pro/)**
 
 
 
 
58
 
59
 
60
  == Installation ==
@@ -118,6 +123,10 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
118
 
119
  == Changelog ==
120
 
 
 
 
 
121
  = 2.6 =
122
  * Tested with new wordpress version 4.8
123
 
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.8.2
7
+ Stable tag: 2.7
8
 
9
  Protect Your Website Admin Against Hackers & Modify Login Page Design
10
 
26
  It is extremely important to back up your database before beginning the activate plugin. If, for some reason, you find it necessary to restore your database from these backups. Plugin will not work for IIS.
27
 
28
 
29
+ https://www.youtube.com/watch?v=D4j6LS0uKuY
30
 
31
  **[ Upgrade to Pro Version ](https://rgaddons.wordpress.com/protect-wp-admin-pro/)**
32
 
56
 
57
 
58
  **[ Upgrade to Pro Version](https://rgaddons.wordpress.com/protect-wp-admin-pro/)**
59
+
60
+ PRO FEATURES
61
+
62
+ https://www.youtube.com/watch?v=Vbk8QX2HWic
63
 
64
 
65
  == Installation ==
123
 
124
  == Changelog ==
125
 
126
+ = 2.7 =
127
+ * Tested with new wordpress version 4.8.1
128
+ * Added upload image lighbox and color picker
129
+
130
  = 2.6 =
131
  * Tested with new wordpress version 4.8
132