Protect Your Admin - Version 2.2

Version Description

  • Tested with new wordpress version 4.5.3
    • Optmized plugin code
Download this release

Release Info

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

Code changes from version 2.1 to 2.2

Files changed (2) hide show
  1. protect-wp-admin.php +19 -23
  2. readme.txt +7 -4
protect-wp-admin.php CHANGED
@@ -5,7 +5,7 @@ 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.1
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
@@ -55,43 +55,37 @@ endif;
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>';
59
  return $links;
60
  }
61
  endif;
62
- /** Check Permalink enable or not*/
63
- if(!function_exists('get_pwa_setting_optionsa')):
64
- function get_pwa_setting_optionsa() {
65
- global $wpdb;
66
- $pwaOptions1 = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name = 'rewrite_rules'");
67
-
68
- foreach ($pwaOptions1 as $option) {
69
- $pwaOptions1[$option->option_name] = $option->option_value;
70
- }
71
- return $pwaOptions1;
72
-
73
- }
74
- endif;
75
 
76
  /** Options Form HTML for "Protect WP-Admin" plugin */
77
  if(!function_exists('init_pwa_admin_option_page')):
78
  function init_pwa_admin_option_page(){
79
- $tt=get_pwa_setting_optionsa();
80
  ?>
81
  <div style="width: 80%; padding: 10px; margin: 10px;">
82
 
83
  <h1>Protect WP-Admin Settings</h1>
84
  <!-- Start Options Form -->
85
  <form action="options.php" method="post" id="pwa-settings-form-admin">
86
- <input type="hidden" id="check_permalink" value="<?php echo count($tt);?>">
87
  <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>
88
-
89
  <div class="pwa-setting">
90
  <!-- General Setting -->
91
  <div class="first pwa-tab" id="div-pwa-general">
92
  <h2>General Settings</h2>
93
  <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>
94
  <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>
 
 
 
 
 
 
 
 
95
  </div>
96
 
97
  <!-- Admin Style -->
@@ -142,7 +136,8 @@ function init_pwa_admin_option_page(){
142
 
143
  </div>
144
  <span class="submit-btn"><?php echo get_submit_button('Save Settings','button-primary','submit','','');?></span>
145
- <div ><strong style="color:red;" >Important!:</strong> Please update permalinks before activate the plugin. Permalinks option should not be set to default.</div>
 
146
 
147
  <?php settings_fields('pwa_setting_options'); ?>
148
  </form>
@@ -224,9 +219,9 @@ echo $script='<script type="text/javascript">
224
  var htaccessWriteable ="'.$htaccessWriteable.'";
225
  var hostIP ="'.$localHostIP.'";
226
  // alert(hostIP);
227
- if(seoUrlVal==0)
228
  {
229
- alert("Please update permalinks before activate the plugin. Permalinks option should not be default");
230
  document.location.href="'.admin_url('options-permalink.php').'";
231
  return false;
232
  }
@@ -273,6 +268,7 @@ endif;
273
  /** register_uninstall_hook */
274
  /** Delete exits options during disable the plugins */
275
  if( function_exists('register_uninstall_hook') ){
 
276
  register_uninstall_hook(__FILE__,'init_uninstall_pwa_plugins');
277
  }
278
 
@@ -293,7 +289,7 @@ require dirname(__FILE__).'/pwa-class.php';
293
  /** register_deactivation_hook */
294
  /** Delete exits options during deactivation the plugins */
295
  if( function_exists('register_deactivation_hook') ){
296
- register_deactivation_hook(__FILE__,'init_deactivation_pwa_plugins');
297
  }
298
 
299
  //Delete all options after uninstall the plugin
@@ -308,7 +304,7 @@ endif;
308
  /** register_activation_hook */
309
  /** Delete exits options during disable the plugins */
310
  if( function_exists('register_activation_hook') ){
311
- register_activation_hook(__FILE__,'init_activation_pwa_plugins');
312
  }
313
  //Delete all options after uninstall the plugin
314
  if(!function_exists('init_activation_pwa_plugins')):
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.2
9
  */
10
 
11
  /*** Protect WP-Admin Copyright 2014 Raghunath (email : raghunath.0087@gmail.com)
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;
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
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">
78
  <h2>General Settings</h2>
79
  <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>
80
  <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>
81
+
82
+ <?php
83
+ $getPwaOptions=get_pwa_setting_options();
84
+ if((isset($getPwaOptions['pwa_active']) && '1'==$getPwaOptions['pwa_active']) && (isset($getPwaOptions['pwa_rewrite_text']) && $getPwaOptions['pwa_rewrite_text']!='')){
85
+ echo "<p><strong>Your New Admin URL : </strong><a href='".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."' target='_blank'>".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."</a></p><p><strong><blink><a href='".home_url('/'.$getPwaOptions['pwa_rewrite_text'])."' target='_blank'>CLICK HERE</a></blink></strong> for preivew new admin URL.</p>";
86
+
87
+ }
88
+ ?>
89
  </div>
90
 
91
  <!-- Admin Style -->
136
 
137
  </div>
138
  <span class="submit-btn"><?php echo get_submit_button('Save Settings','button-primary','submit','','');?></span>
139
+
140
+ <p ><strong style="color:red;" >Important!:</strong> Don't forget to preview new admin url after update new admin slug.</p>
141
 
142
  <?php settings_fields('pwa_setting_options'); ?>
143
  </form>
219
  var htaccessWriteable ="'.$htaccessWriteable.'";
220
  var hostIP ="'.$localHostIP.'";
221
  // alert(hostIP);
222
+ if(seoUrlVal=="no")
223
  {
224
+ alert("Please update permalinks before activate the plugin. permalinks option should not be default!.");
225
  document.location.href="'.admin_url('options-permalink.php').'";
226
  return false;
227
  }
268
  /** register_uninstall_hook */
269
  /** Delete exits options during disable the plugins */
270
  if( function_exists('register_uninstall_hook') ){
271
+ register_uninstall_hook(__FILE__,'flush_rewrite_rules');
272
  register_uninstall_hook(__FILE__,'init_uninstall_pwa_plugins');
273
  }
274
 
289
  /** register_deactivation_hook */
290
  /** Delete exits options during deactivation the plugins */
291
  if( function_exists('register_deactivation_hook') ){
292
+ register_deactivation_hook(__FILE__,'init_deactivation_pwa_plugins');
293
  }
294
 
295
  //Delete all options after uninstall the plugin
304
  /** register_activation_hook */
305
  /** Delete exits options during disable the plugins */
306
  if( function_exists('register_activation_hook') ){
307
+ register_activation_hook(__FILE__,'init_activation_pwa_plugins');
308
  }
309
  //Delete all options after uninstall the plugin
310
  if(!function_exists('init_activation_pwa_plugins')):
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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: 3.6
6
- Tested up to: 4.5.2
7
- Stable tag: 2.1
8
 
9
  1.) Protect Your Website Admin Against Hackers
10
  2.) Modify Login Page Design
@@ -24,7 +24,7 @@ All queries for the classic "/wp-admin/" and "wp-login.php" files will be redire
24
  The plugin also comes with some access filters, allowing webmasters to restrict guest and registered users access to wp-admin, just in case you want some of your editors to log in the classic way.
25
 
26
  **NOTE :Back up your database before beginning the activate plugin.**
27
- 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.
28
 
29
 
30
 
@@ -115,6 +115,9 @@ Don not forgot to update the "newadmin" slug with your new admin slug (that you
115
 
116
 
117
  == Changelog ==
 
 
 
118
  = 2.1 =
119
  * Tested with new wordpress version 4.5.2
120
 
2
  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: 3.8
6
+ Tested up to: 4.5.3
7
+ Stable tag: 2.2
8
 
9
  1.) Protect Your Website Admin Against Hackers
10
  2.) Modify Login Page Design
24
  The plugin also comes with some access filters, allowing webmasters to restrict guest and registered users access to wp-admin, just in case you want some of your editors to log in the classic way.
25
 
26
  **NOTE :Back up your database before beginning the activate plugin.**
27
+ 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.
28
 
29
 
30
 
115
 
116
 
117
  == Changelog ==
118
+ = 2.2 =
119
+ * Tested with new wordpress version 4.5.3
120
+ * Optmized plugin code
121
  = 2.1 =
122
  * Tested with new wordpress version 4.5.2
123