Admin Custom Login - Version 2.8.9

Version Description

  • Added separate settings for reCaptcha v3
Download this release

Release Info

Developer weblizar
Plugin Icon 128x128 Admin Custom Login
Version 2.8.9
Comparing to
See all releases

Code changes from version 2.8.8 to 2.8.9

acl-gcaptcha.php CHANGED
@@ -1,128 +1,117 @@
1
  <?php
2
- class ACL_gcaptcha_Login_Form {
3
-
4
- /** @type string private key|public key */
5
- private $public_key, $private_key;
6
-
7
- /** class constructor */
8
- public function __construct() {
9
- $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
10
- if(isset($g_page['site_key']) && isset($g_page['secret_key'])){
11
- $site_key = $g_page['site_key'];
12
- $secret_key = $g_page['secret_key'];
13
- $acl_gcaptcha_theme = $g_page['acl_gcaptcha_theme'];
14
- } else {
15
- $site_key = '';
16
- $secret_key = '';
17
- $acl_gcaptcha_theme ='yes';
18
- }
19
-
20
- $this->public_key = $site_key;
21
- $this->private_key = $secret_key;
22
- $this->acl_gcaptcha_theme = $acl_gcaptcha_theme;
23
 
24
- // adds the captcha to the login form
25
- add_action( 'login_form', array( $this, 'captcha_display' ) );
26
 
27
- // authenticate the captcha answer
28
- add_action( 'wp_authenticate_user', array( $this, 'validate_captcha_field' ), 10, 2 );
29
- }
30
 
31
- /** Output the ACL_gcaptcha form field. */
32
- public function captcha_display() {
33
- if($this->acl_gcaptcha_theme=="yes"){
34
- $acl_gcaptcha_theme="light";
35
- } else {
36
- $acl_gcaptcha_theme="dark";
37
- }
38
- ?>
39
- <script src="https://www.google.com/recaptcha/api.js?render=<?php echo $this->public_key ?>"></script>
40
- <input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response">
41
- <script>
42
- grecaptcha.ready(function() {
43
- grecaptcha.execute('<?php echo $this->public_key ; ?>', {action: 'login'}).then(function(token) {
44
- // pass the token to the backend script for verification
45
- document.getElementById("g-recaptcha-response").value = token;
46
- });
47
- });
48
- </script>
49
- <style type="text/css">
50
- .g-recaptchag-recaptcha{
51
- margin-bottom:20px;
52
- }
53
- .grecaptcha{
54
- width: 302px; height: 422px; position: relative;
55
- }
56
- .grecaptcha-kry{
57
- width: 302px; height: 422px; position: absolute;
58
- }
59
- .grecaptcha-kry iframe{
60
- width: 302px; height:422px; border-style: none;
61
- }
62
- .g-re-captcha{
63
- width: 300px; height: 60px; border-style: none;
64
- bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;
65
- background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;
66
- }
67
- .g-recaptcha-response{
68
- width: 250px; height: 40px; border: 1px solid #c1c1c1;
69
- margin: 10px 25px; padding: 0px; resize: none;
70
- }
71
- </style>
72
- <?php
73
  }
74
-
75
- /**
76
- * Verify the captcha answer
77
- *
78
- * @param $user string login username
79
- * @param $password string login password
80
- *
81
- * @return WP_Error|WP_user
82
- */
83
- public static function validate_captcha_field( $user, $password ) {
84
- if ( isset( $_POST['g-recaptcha-response'] ) || self::captcha_verification() ) {
85
- $response1=self::captcha_verification();
86
- if( $response1->success && $response1->score ){
87
- if($response1->success!=false && $response1->score < 0.5){
88
- //var_dump($response1);
89
- return new WP_Error( 'empty_captcha', '<strong>ERROR</strong>:You are a robot' );
90
- }else{
91
- return $user;
92
- }
93
- }else{
94
- return new WP_Error( 'empty_captcha', '<strong>ERROR</strong>: Please Enter the reCaptcha valid Key' );
95
- }
96
- }
97
-
98
  }
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
- /**
101
- * Send a GET request to verify captcha challenge
102
- *
103
- * @return bool
104
- */
105
- public static function captcha_verification() {
106
-
107
- $response = isset( $_POST['g-recaptcha-response'] ) ? esc_attr( $_POST['g-recaptcha-response'] ) : '';
108
- $remote_ip = $_SERVER["REMOTE_ADDR"];
109
-
110
- // make a GET request to the Google reCAPTCHA Server
111
- $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
112
- if(isset($g_page['site_key']) && isset($g_page['secret_key'])){
113
- $site_key = $g_page['site_key'];
114
- $secret_key = $g_page['secret_key'];
115
- } else {
116
- $site_key = '';
117
- $secret_key = '';
118
  }
119
- $request = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$response.'');
120
- // get the request response body
121
- echo('<script> console.log('.$secret_key.'); </script>');
122
- $return = json_decode( $request );
123
 
124
- return $return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
 
 
126
  }
127
- new ACL_gcaptcha_Login_Form();
128
  ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+ $g_page = unserialize( get_option( 'Admin_custome_login_gcaptcha' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ if ( isset( $g_page['login_enable_gcaptcha'] ) && ( 'yes' === $g_page['login_enable_gcaptcha'] ) && isset( $g_page['login_v_gcaptcha'] ) && ! empty( $g_page['login_v_gcaptcha'] ) ) {
 
8
 
9
+ $login_v_gcaptcha = esc_html( $g_page['login_v_gcaptcha'] );
 
 
10
 
11
+ if ( 'v3' === $login_v_gcaptcha ) {
12
+ add_action( 'login_form', 'acl_captcha3_form' );
13
+ add_action( 'login_enqueue_scripts', 'acl_captcha3_output' );
14
+ add_action( 'wp_authenticate_user', 'acl_validate_captcha3', 10, 2 );
15
+ } elseif ( 'v2' === $login_v_gcaptcha ) {
16
+ add_action( 'login_form', 'acl_captcha2_form' );
17
+ add_action( 'login_enqueue_scripts', 'acl_captcha2_output' );
18
+ add_action( 'wp_authenticate_user', 'acl_validate_captcha2', 10 ,2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
+ }
21
+
22
+ function acl_captcha2_form() {
23
+ $g_page = unserialize( get_option( 'Admin_custome_login_gcaptcha' ) );
24
+ $site_key = isset( $g_page['site_key'] ) ? $g_page['site_key'] : '';
25
+ $acl_gcaptcha_theme = isset( $g_page['acl_gcaptcha_theme'] ) ? $g_page['acl_gcaptcha_theme'] : 'light';
26
+ if ( 'yes' === $acl_gcaptcha_theme ) {
27
+ $acl_gcaptcha_theme = 'light';
28
+ } else {
29
+ $acl_gcaptcha_theme = 'dark';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
+ ?>
32
+ <div class="g-recaptcha" data-sitekey="<?php echo esc_attr( $site_key ); ?>" data-theme="<?php echo esc_attr( $acl_gcaptcha_theme ); ?>"></div> <br>
33
+ <?php
34
+ }
35
+
36
+ function acl_captcha2_output() {
37
+ wp_enqueue_script( 'acl-recaptcha-api-js', "https://www.google.com/recaptcha/api.js" );
38
+ }
39
+
40
+ function acl_validate_captcha2( $user, $password ) {
41
+ $g_page = unserialize( get_option( 'Admin_custome_login_gcaptcha' ) );
42
+ $secret_key = isset( $g_page['secret_key'] ) ? $g_page['secret_key'] : '';
43
 
44
+ if ( isset( $_POST['g-recaptcha-response'] ) ) {
45
+ $response = wp_remote_post(
46
+ 'https://www.google.com/recaptcha/api/siteverify',
47
+ array(
48
+ 'body' => array(
49
+ 'secret' => $secret_key,
50
+ 'response' => $_POST['g-recaptcha-response']
51
+ )
52
+ )
53
+ );
54
+
55
+ $data = wp_remote_retrieve_body( $response );
56
+ $data = json_decode($data);
57
+
58
+ if ( isset( $data->success ) && $data->success ) {
59
+ return $user;
 
 
60
  }
61
+ }
 
 
 
62
 
63
+ return new WP_Error( 'empty_captcha', '<strong>ERROR</strong>: Please confirm you are not a robot' );
64
+ }
65
+
66
+ function acl_captcha3_form() {
67
+ ?>
68
+ <input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response">
69
+ <?php
70
+ }
71
+
72
+ function acl_captcha3_output() {
73
+ $g_page = unserialize( get_option( 'Admin_custome_login_gcaptcha' ) );
74
+
75
+ $site_key_v3 = isset( $g_page['site_key_v3'] ) ? $g_page['site_key_v3'] : '';
76
+
77
+ wp_enqueue_script( 'acl-recaptcha-api-js', "https://www.google.com/recaptcha/api.js?render=$site_key_v3" );
78
+ wp_register_script( 'acl-recaptcha-v3-js', '', array( 'acl-recaptcha-api-js' ) );
79
+ wp_enqueue_script( 'acl-recaptcha-v3-js' );
80
+
81
+ $script = <<<EOT
82
+ grecaptcha.ready(function() {
83
+ grecaptcha.execute('$site_key_v3', {action: 'login'}).then(function(token) {
84
+ document.getElementById("g-recaptcha-response").value = token;
85
+ });
86
+ });
87
+ EOT;
88
+ wp_add_inline_script( 'acl-recaptcha-v3-js', $script );
89
+ }
90
+
91
+ function acl_validate_captcha3( $user, $password ) {
92
+ $g_page = unserialize( get_option( 'Admin_custome_login_gcaptcha' ) );
93
+
94
+ $secret_key_v3 = isset( $g_page['secret_key_v3'] ) ? $g_page['secret_key_v3'] : '';
95
+
96
+ if ( isset( $_POST['g-recaptcha-response'] ) ) {
97
+ $response = wp_remote_post(
98
+ 'https://www.google.com/recaptcha/api/siteverify',
99
+ array(
100
+ 'body' => array(
101
+ 'secret' => $secret_key_v3,
102
+ 'response' => $_POST['g-recaptcha-response']
103
+ )
104
+ )
105
+ );
106
+
107
+ $data = wp_remote_retrieve_body( $response );
108
+ $data = json_decode($data);
109
+
110
+ if ( isset( $data->success ) && $data->success && isset( $data->score ) && $data->score > 0 && isset( $data->action ) && 'login' === $data->action ) {
111
+ return $user;
112
+ }
113
  }
114
+
115
+ return new WP_Error( 'empty_captcha', '<strong>ERROR</strong>: Please confirm you are not a robot' );
116
  }
 
117
  ?>
admin-custom-login.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Admin Custom Login
4
- * Version: 2.8.8
5
  * Description: Customize Your WordPress Login Screen Amazingly - Add Own Logo, Add Social Profiles, Login Form Positions, Background Image Slide Show
6
  * Author: Weblizar
7
  * Author URI: https://weblizar.com/plugins/
@@ -9,8 +9,7 @@
9
  * Text Domain: admin-custom-login
10
  * Domain Path: /languages
11
  */
12
-
13
- // Exit if accessed directly
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
  define("WEBLIZAR_NALF_PLUGIN_URL", plugin_dir_url(__FILE__));
16
  define("WEBLIZAR_ACL_PLUGIN_DIR_PATH_FREE", plugin_dir_path(__FILE__));
@@ -36,17 +35,15 @@ final class WL_ACL_FREE {
36
  }
37
  WL_ACL_FREE::get_instance();
38
 
39
- /**
40
- * Admin Custom Login installation script
41
- */
42
  register_activation_hook( __FILE__, 'ACL_WeblizarDoInstallation' );
43
  function ACL_WeblizarDoInstallation() {
44
  require_once('installation.php');
45
  }
46
 
47
- // Add settings link on plugin page
48
  function acl_links($links) {
49
- $acl_pro_link = '<a style="font-weight:700; color:#e35400" href="https://weblizar.com/plugins/admin-custom-login-pro/" target="_blank">Go Pro</a>';
50
  $acl_settings_link = '<a href="admin.php?page=admin_custom_login">Settings</a>';
51
  array_unshift($links, $acl_settings_link);
52
  array_unshift($links, $acl_pro_link);
1
  <?php
2
  /**
3
  * Plugin Name: Admin Custom Login
4
+ * Version: 2.8.9
5
  * Description: Customize Your WordPress Login Screen Amazingly - Add Own Logo, Add Social Profiles, Login Form Positions, Background Image Slide Show
6
  * Author: Weblizar
7
  * Author URI: https://weblizar.com/plugins/
9
  * Text Domain: admin-custom-login
10
  * Domain Path: /languages
11
  */
12
+ /** Exit if accessed directly **/
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
  define("WEBLIZAR_NALF_PLUGIN_URL", plugin_dir_url(__FILE__));
15
  define("WEBLIZAR_ACL_PLUGIN_DIR_PATH_FREE", plugin_dir_path(__FILE__));
35
  }
36
  WL_ACL_FREE::get_instance();
37
 
38
+ /*** Admin Custom Login installation script **/
 
 
39
  register_activation_hook( __FILE__, 'ACL_WeblizarDoInstallation' );
40
  function ACL_WeblizarDoInstallation() {
41
  require_once('installation.php');
42
  }
43
 
44
+ /*** Add settings link on plugin page ***/
45
  function acl_links($links) {
46
+ $acl_pro_link = '<a href="https://weblizar.com/plugins/admin-custom-login-pro/" target="_blank">Go Pro</a>';
47
  $acl_settings_link = '<a href="admin.php?page=admin_custom_login">Settings</a>';
48
  array_unshift($links, $acl_settings_link);
49
  array_unshift($links, $acl_pro_link);
includes/get_value.php CHANGED
@@ -99,7 +99,12 @@ if ( ! defined( 'ABSPATH' ) ) exit;
99
  $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
100
  $site_key = $g_page['site_key'];
101
  $secret_key = $g_page['secret_key'];
 
 
102
  $login_enable_gcaptcha = $g_page['login_enable_gcaptcha'];
 
 
 
103
  if(isset($g_page['acl_gcaptcha_theme'])){ $acl_gcaptcha_theme = $g_page['acl_gcaptcha_theme']; } else { $acl_gcaptcha_theme="yes" ;}
104
 
105
  // Get value of Slidshow image
99
  $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
100
  $site_key = $g_page['site_key'];
101
  $secret_key = $g_page['secret_key'];
102
+ $site_key_v3 = isset( $g_page['site_key_v3'] ) ? $g_page['site_key_v3'] : '';
103
+ $secret_key_v3 = isset( $g_page['secret_key_v3'] ) ? $g_page['secret_key_v3'] : '';
104
  $login_enable_gcaptcha = $g_page['login_enable_gcaptcha'];
105
+
106
+ $login_v_gcaptcha = isset( $g_page['login_v_gcaptcha'] ) ? $g_page['login_v_gcaptcha'] : 'v2';
107
+
108
  if(isset($g_page['acl_gcaptcha_theme'])){ $acl_gcaptcha_theme = $g_page['acl_gcaptcha_theme']; } else { $acl_gcaptcha_theme="yes" ;}
109
 
110
  // Get value of Slidshow image
includes/googlecaptcha-settings/gcaptcha-settings.php CHANGED
@@ -1,4 +1,4 @@
1
- <!-- Dashboard Settings panel content --->
2
  <?php
3
  // Exit if accessed directly
4
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -50,56 +50,72 @@ if ( ! defined( 'ABSPATH' ) ) exit;
50
  <div class="panel-body">
51
  <table class="form-table">
52
  <tr>
53
- <th scope="row" ><?php _e('Google Captcha v3 Settings',WEBLIZAR_ACL)?></th>
54
- <td></td>
55
- </tr>
56
- <tr class="radio-span">
57
- <td>
58
- Need Help?<a href="http://www.weblizar.com" target="_blank"> Visit Help Center</a>
59
- <div class="acl_gcaptcha_sub_label">Authentication</div>
60
- <div class="acl_gcaptcha_info">Register your website with Google to get required API keys and enter them below. <a target="_blank" href="https://weblizar.com/blog/how-to-generate-recaptcha-keys-for-your-domain/">Get the API Keys</a></div>
61
- </td>
62
- </tr>
63
- <tr>
64
- <th scope="row" ><?php _e('Site Key',WEBLIZAR_ACL)?></th>
65
  <td></td>
66
  </tr>
67
  <tr class="radio-span">
68
  <td>
69
- <input type="text" class="pro_text" id="site-key" name="site-key" placeholder="<?php _e('Site Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $site_key; ?>"/>
 
 
 
 
 
 
70
  </td>
71
  </tr>
 
72
  <tr>
73
- <th scope="row" ><?php _e('Secret Key',WEBLIZAR_ACL)?></th>
74
  <td></td>
75
  </tr>
76
  <tr class="radio-span">
77
  <td>
78
- <input type="text" class="pro_text" id="secret-key" name="secret-key" placeholder="<?php _e('Secret Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $secret_key; ?>"/>
 
 
79
  </td>
80
  </tr>
81
 
82
  <tr>
83
- <th scope="row" ><?php _e('Captcha Display',WEBLIZAR_ACL)?></th>
84
  <td></td>
85
  </tr>
86
  <tr class="radio-span">
87
  <td>
88
  <span>
89
- <input type="radio" name="enable_gacptcha" value="yes" id="login_enable_gcaptcha1" <?php if($login_enable_gcaptcha=="yes")echo "checked"; ?> />&nbsp;<?php _e('Enable', WEBLIZAR_ACL)?><br>
90
  </span>
91
  <span>
92
- <input type="radio" name="enable_gacptcha" value="no" id="login_enable_gcaptcha2" <?php if($login_enable_gcaptcha=="no")echo "checked"; ?> />&nbsp;<?php _e('Disable', WEBLIZAR_ACL)?><br>
93
  </span>
94
- <div class="acl_gcaptcha_info"><strong>Note : </strong> After enable google captcha display please insert site key & secret key.</div>
95
  </td>
96
  </tr>
97
 
98
- <tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  <th scope="row" ><?php _e('Captcha Theme',WEBLIZAR_ACL)?></th>
100
  <td></td>
101
  </tr>
102
- <tr class="radio-span">
103
  <td>
104
  <span>
105
  <input type="radio" name="acl_gcaptcha_theme" value="yes" id="acl_gcaptcha_theme1" <?php if($acl_gcaptcha_theme=="yes")echo "checked"; ?> />&nbsp;<?php _e('Light', WEBLIZAR_ACL)?><br>
@@ -109,6 +125,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
109
  </span>
110
  </td>
111
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </table>
113
  </div>
114
  </div>
@@ -154,6 +190,28 @@ if ( ! defined( 'ABSPATH' ) ) exit;
154
  </div>
155
  <!-- /row -->
156
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  function Custom_gcaptcha(Action, id){
158
  if(Action == "googleSave") {
159
  (function(){
@@ -184,6 +242,13 @@ function Custom_gcaptcha(Action, id){
184
 
185
  var site_key = jQuery("#site-key").val();
186
  var secret_key = jQuery("#secret-key").val();
 
 
 
 
 
 
 
187
  if (document.getElementById('login_enable_gcaptcha1').checked) {
188
  var login_enable_gcaptcha = document.getElementById('login_enable_gcaptcha1').value;
189
  } else {
@@ -196,7 +261,7 @@ function Custom_gcaptcha(Action, id){
196
  var acl_gcaptcha_theme = document.getElementById('acl_gcaptcha_theme2').value;
197
  }
198
 
199
- var PostData = "Action=" + Action + "&site_key=" + site_key + "&secret_key=" + secret_key + "&login_enable_gcaptcha=" + login_enable_gcaptcha + "&acl_gcaptcha_theme=" + acl_gcaptcha_theme;
200
  jQuery.ajax({
201
  dataType : 'html',
202
  type: 'POST',
@@ -268,6 +333,8 @@ function Custom_gcaptcha(Action, id){
268
 
269
  document.getElementById("site-key").value ="";
270
  document.getElementById("secret-key").value ="";
 
 
271
  jQuery(document).ready( function() {
272
  jQuery('input[name=enable_gcaptcha]').val(['yes']);
273
  });
@@ -293,17 +360,21 @@ if(isset($_POST['Action'])) {
293
  if($Action == "googleSave") {
294
  $site_key = sanitize_text_field($_POST['site_key']);
295
  $secret_key = sanitize_text_field( $_POST['secret_key']);
 
 
 
296
  $login_enable_gcaptcha = sanitize_text_field( $_POST['login_enable_gcaptcha']);
297
  $acl_gcaptcha_theme = sanitize_text_field( $_POST['acl_gcaptcha_theme']);
298
-
299
 
300
  // save values in option table
301
  $g_page= serialize(array(
302
  'site_key' => $site_key,
303
  'secret_key'=> $secret_key,
 
 
 
304
  'login_enable_gcaptcha'=> $login_enable_gcaptcha,
305
  'acl_gcaptcha_theme'=>$acl_gcaptcha_theme,
306
-
307
  ));
308
  update_option('Admin_custome_login_gcaptcha', $g_page);
309
  }
@@ -314,6 +385,9 @@ if(isset($_POST['Action'])) {
314
 
315
  'site_key'=>'',
316
  'secret_key'=>'',
 
 
 
317
  'login_enable_gcaptcha'=>'no',
318
  'acl_gcaptcha_theme'=>'yes',
319
 
1
+ <!-- Dashboard Settings panel content -->
2
  <?php
3
  // Exit if accessed directly
4
  if ( ! defined( 'ABSPATH' ) ) exit;
50
  <div class="panel-body">
51
  <table class="form-table">
52
  <tr>
53
+ <th scope="row" ><?php _e('Captcha Display',WEBLIZAR_ACL)?></th>
 
 
 
 
 
 
 
 
 
 
 
54
  <td></td>
55
  </tr>
56
  <tr class="radio-span">
57
  <td>
58
+ <span>
59
+ <input type="radio" name="enable_gacptcha" value="yes" id="login_enable_gcaptcha1" <?php if($login_enable_gcaptcha=="yes")echo "checked"; ?> />&nbsp;<?php _e('Enable', WEBLIZAR_ACL)?><br>
60
+ </span>
61
+ <span>
62
+ <input type="radio" name="enable_gacptcha" value="no" id="login_enable_gcaptcha2" <?php if($login_enable_gcaptcha=="no")echo "checked"; ?> />&nbsp;<?php _e('Disable', WEBLIZAR_ACL)?><br>
63
+ </span>
64
+ <div class="acl_gcaptcha_info"><strong>Note : </strong> After enable google captcha display please insert site key & secret key.</div>
65
  </td>
66
  </tr>
67
+
68
  <tr>
69
+ <th scope="row" ><?php _e('Google Captcha v2 and v3 Settings',WEBLIZAR_ACL)?></th>
70
  <td></td>
71
  </tr>
72
  <tr class="radio-span">
73
  <td>
74
+ Need Help?<a href="http://www.weblizar.com" target="_blank"> Visit Help Center</a>
75
+ <div class="acl_gcaptcha_sub_label">Authentication</div>
76
+ <div class="acl_gcaptcha_info">Register your website with Google to get required API keys and enter them below. <a target="_blank" href="https://weblizar.com/blog/how-to-generate-recaptcha-keys-for-your-domain/">Get the API Keys</a></div>
77
  </td>
78
  </tr>
79
 
80
  <tr>
81
+ <th scope="row" ><?php _e('Choose Google Captcha Version',WEBLIZAR_ACL)?></th>
82
  <td></td>
83
  </tr>
84
  <tr class="radio-span">
85
  <td>
86
  <span>
87
+ <input type="radio" name="v_gacptcha" value="v2" id="login_v_gcaptcha1" <?php if($login_v_gcaptcha=="v2")echo "checked"; ?> />&nbsp;<?php _e('v2', WEBLIZAR_ACL)?><br>
88
  </span>
89
  <span>
90
+ <input type="radio" name="v_gacptcha" value="v3" id="login_v_gcaptcha2" <?php if($login_v_gcaptcha=="v3")echo "checked"; ?> />&nbsp;<?php _e('v3', WEBLIZAR_ACL)?><br>
91
  </span>
92
+ <div class="acl_gcaptcha_info"><strong>Note : </strong> After select google captcha version please insert site key & secret key.</div>
93
  </td>
94
  </tr>
95
 
96
+ <tr class="recaptcha_keys_v2">
97
+ <th scope="row" ><?php _e('Site Key',WEBLIZAR_ACL)?></th>
98
+ <td></td>
99
+ </tr>
100
+ <tr class="radio-span recaptcha_keys_v2">
101
+ <td>
102
+ <input type="text" class="pro_text" id="site-key" name="site-key" placeholder="<?php _e('Site Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $site_key; ?>"/>
103
+ </td>
104
+ </tr>
105
+ <tr class="recaptcha_keys_v2">
106
+ <th scope="row" ><?php _e('Secret Key',WEBLIZAR_ACL)?></th>
107
+ <td></td>
108
+ </tr>
109
+ <tr class="radio-span recaptcha_keys_v2">
110
+ <td>
111
+ <input type="text" class="pro_text" id="secret-key" name="secret-key" placeholder="<?php _e('Secret Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $secret_key; ?>"/>
112
+ </td>
113
+ </tr>
114
+ <tr class="recaptcha_keys_v2">
115
  <th scope="row" ><?php _e('Captcha Theme',WEBLIZAR_ACL)?></th>
116
  <td></td>
117
  </tr>
118
+ <tr class="radio-span recaptcha_keys_v2">
119
  <td>
120
  <span>
121
  <input type="radio" name="acl_gcaptcha_theme" value="yes" id="acl_gcaptcha_theme1" <?php if($acl_gcaptcha_theme=="yes")echo "checked"; ?> />&nbsp;<?php _e('Light', WEBLIZAR_ACL)?><br>
125
  </span>
126
  </td>
127
  </tr>
128
+
129
+ <tr class="recaptcha_keys_v3">
130
+ <th scope="row" ><?php _e('Site Key',WEBLIZAR_ACL)?></th>
131
+ <td></td>
132
+ </tr>
133
+ <tr class="radio-span recaptcha_keys_v3">
134
+ <td>
135
+ <input type="text" class="pro_text" id="site-key-v3" name="site-key-v3" placeholder="<?php _e('Site Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $site_key_v3; ?>"/>
136
+ </td>
137
+ </tr>
138
+ <tr class="recaptcha_keys_v3">
139
+ <th scope="row" ><?php _e('Secret Key',WEBLIZAR_ACL)?></th>
140
+ <td></td>
141
+ </tr>
142
+ <tr class="radio-span recaptcha_keys_v3">
143
+ <td>
144
+ <input type="text" class="pro_text" id="secret-key-v3" name="secret-key-v3" placeholder="<?php _e('Secret Key',WEBLIZAR_ACL)?>" size="56" value="<?php echo $secret_key_v3; ?>"/>
145
+ </td>
146
+ </tr>
147
+
148
  </table>
149
  </div>
150
  </div>
190
  </div>
191
  <!-- /row -->
192
  <script>
193
+
194
+ var recaptcha_keys_v2 = jQuery('.recaptcha_keys_v2');
195
+ var recaptcha_keys_v3 = jQuery('.recaptcha_keys_v3');
196
+
197
+ recaptcha_keys_v2.hide();
198
+ recaptcha_keys_v3.hide();
199
+
200
+ var current_recaptcha_v = '<?php echo $login_v_gcaptcha; ?>';
201
+ if('v2' == current_recaptcha_v) {
202
+ recaptcha_keys_v2.show();
203
+ } else {
204
+ recaptcha_keys_v3.show();
205
+ }
206
+ jQuery(document).on('change', 'input[name="v_gacptcha"]', function() {
207
+ if('v3' === this.value) {
208
+ recaptcha_keys_v2.hide();
209
+ recaptcha_keys_v3.show();
210
+ } else {
211
+ recaptcha_keys_v3.hide();
212
+ recaptcha_keys_v2.show();
213
+ }
214
+ });
215
  function Custom_gcaptcha(Action, id){
216
  if(Action == "googleSave") {
217
  (function(){
242
 
243
  var site_key = jQuery("#site-key").val();
244
  var secret_key = jQuery("#secret-key").val();
245
+ var site_key_v3 = jQuery("#site-key-v3").val();
246
+ var secret_key_v3 = jQuery("#secret-key-v3").val();
247
+ if (document.getElementById('login_v_gcaptcha1').checked) {
248
+ var login_v_gcaptcha = document.getElementById('login_v_gcaptcha1').value;
249
+ } else {
250
+ var login_v_gcaptcha = document.getElementById('login_v_gcaptcha2').value;
251
+ }
252
  if (document.getElementById('login_enable_gcaptcha1').checked) {
253
  var login_enable_gcaptcha = document.getElementById('login_enable_gcaptcha1').value;
254
  } else {
261
  var acl_gcaptcha_theme = document.getElementById('acl_gcaptcha_theme2').value;
262
  }
263
 
264
+ var PostData = "Action=" + Action + "&site_key=" + site_key + "&secret_key=" + secret_key + "&site_key_v3=" + site_key_v3 + "&secret_key_v3=" + secret_key_v3 + "&login_v_gcaptcha=" + login_v_gcaptcha + "&login_enable_gcaptcha=" + login_enable_gcaptcha + "&acl_gcaptcha_theme=" + acl_gcaptcha_theme;
265
  jQuery.ajax({
266
  dataType : 'html',
267
  type: 'POST',
333
 
334
  document.getElementById("site-key").value ="";
335
  document.getElementById("secret-key").value ="";
336
+ document.getElementById("site-key-v3").value ="";
337
+ document.getElementById("secret-key-v3").value ="";
338
  jQuery(document).ready( function() {
339
  jQuery('input[name=enable_gcaptcha]').val(['yes']);
340
  });
360
  if($Action == "googleSave") {
361
  $site_key = sanitize_text_field($_POST['site_key']);
362
  $secret_key = sanitize_text_field( $_POST['secret_key']);
363
+ $site_key_v3 = sanitize_text_field($_POST['site_key_v3']);
364
+ $secret_key_v3 = sanitize_text_field( $_POST['secret_key_v3']);
365
+ $login_v_gcaptcha = sanitize_text_field( $_POST['login_v_gcaptcha']);
366
  $login_enable_gcaptcha = sanitize_text_field( $_POST['login_enable_gcaptcha']);
367
  $acl_gcaptcha_theme = sanitize_text_field( $_POST['acl_gcaptcha_theme']);
 
368
 
369
  // save values in option table
370
  $g_page= serialize(array(
371
  'site_key' => $site_key,
372
  'secret_key'=> $secret_key,
373
+ 'site_key_v3' => $site_key_v3,
374
+ 'secret_key_v3'=> $secret_key_v3,
375
+ 'login_v_gcaptcha'=> $login_v_gcaptcha,
376
  'login_enable_gcaptcha'=> $login_enable_gcaptcha,
377
  'acl_gcaptcha_theme'=>$acl_gcaptcha_theme,
 
378
  ));
379
  update_option('Admin_custome_login_gcaptcha', $g_page);
380
  }
385
 
386
  'site_key'=>'',
387
  'secret_key'=>'',
388
+ 'site_key_v3' => '',
389
+ 'secret_key_v3'=> '',
390
+ 'login_v_gcaptcha'=> 'v2',
391
  'login_enable_gcaptcha'=>'no',
392
  'acl_gcaptcha_theme'=>'yes',
393
 
init.php CHANGED
@@ -1,30 +1,28 @@
1
  <?php
2
  $login_page = unserialize(get_option('Admin_custome_login_login'));
3
  if(isset($login_page['login_redirect_force'])){
4
- $login_redirect_force = $login_page['login_redirect_force'];
5
- }else{
6
- $login_redirect_force = "no";
7
- }
8
  if($login_redirect_force=="yes"){
9
- add_action( 'template_redirect', function(){
10
- // no non-authenticated users allowed
11
- if( ! is_user_logged_in() )
12
- {
13
- $login_page = unserialize(get_option('Admin_custome_login_login'));
14
- wp_redirect( $login_page['login_force_redirect_url'], 302 );
15
- exit();
16
- }
17
  });
18
  }
19
 
20
-
21
  $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
22
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
23
  if(isset($g_page['login_enable_gcaptcha'])){
24
  $login_enable_gcaptcha = $g_page['login_enable_gcaptcha'];
25
  $dashboard_status = $dashboard_page['dashboard_status'];
26
  if($login_enable_gcaptcha=="yes" && $dashboard_status=="enable"){
27
- // Gcaptcha code
28
  include('acl-gcaptcha.php');
29
  }
30
  }
@@ -40,19 +38,17 @@ if(isset($g_page['login_enable_gcaptcha'])){
40
  function ACL_login_redirect( $redirect_to, $request, $user ) {
41
  //is there a user to check?
42
  if ( isset( $user->roles ) && is_array( $user->roles ) ) {
43
-
44
- // get and load custom redirect option after user login
45
  $login_page = unserialize(get_option('Admin_custome_login_login'));
46
- $login_redirect_user = $login_page['login_redirect_user'];
47
-
48
- //check for admins
49
  if ( in_array( 'administrator', $user->roles ) ) {
50
  // redirect admin to the default place
51
  return $redirect_to;
52
  } else {
53
- // redirect users to another place
54
  if($login_redirect_user != "") {
55
- return $login_redirect_user;
56
  } else {
57
  return $redirect_to;
58
  }
@@ -62,37 +58,27 @@ function ACL_login_redirect( $redirect_to, $request, $user ) {
62
  }
63
  }
64
  add_filter( 'login_redirect', 'ACL_login_redirect', 10, 3 );
65
-
66
- // load plugin translation
67
  add_action('plugins_loaded', 'ACL_GetReadyTranslation');
68
  function ACL_GetReadyTranslation() {
69
  load_plugin_textdomain(WEBLIZAR_ACL, FALSE, dirname( plugin_basename(__FILE__)).'/languages/' );
70
  }
71
-
72
- /**
73
- * Admin Custom Login menu
74
- */
75
  require_once("login-form-screen.php");
76
  add_action('admin_menu','acl_weblizar_admin_custom_login_menu', 2);
77
  function acl_weblizar_admin_custom_login_menu() {
78
  if(current_user_can('administrator')){
79
  $wl_admin_menu = add_menu_page( __( 'Admin Custom Login', WEBLIZAR_ACL ), __( 'AC Login', WEBLIZAR_ACL ), 'manage_options', 'admin_custom_login', 'acl_admin_custom_login_content', 'dashicons-art', 10 );
80
  add_action( 'admin_print_styles-' . $wl_admin_menu, 'acl_admin_custom_login_css' );
81
-
82
- //plugin menu page under the settings page
83
- // $acl_menu = add_menu_page('Admin custom Login', 'Admin custom Login','administrator', 'admin_custom_login','acl_admin_custom_login_content');
84
- //$acl_menu = add_submenu_page( 'options-general.php','Admin Custom Login', 'Admin Custom Login','administrator', 'admin_custom_login','acl_admin_custom_login_content' );
85
  $acl_menu = add_submenu_page( 'admin_custom_login',__( 'Settings', WEBLIZAR_ACL ), __( 'Settings', WEBLIZAR_ACL ),'administrator', 'admin_custom_login','acl_admin_custom_login_content' );
86
  add_action( 'admin_print_styles-' . $acl_menu, 'acl_admin_custom_login_css' );
87
-
88
  $acl_menu = add_submenu_page( 'admin_custom_login',__( 'Get Pro', WEBLIZAR_ACL ), __( 'Get Pro', WEBLIZAR_ACL ),'administrator', 'admin-custom-login-main-menu',array( 'WL_ACL_FREE_Menu', 'admin_menu' ) );
89
  add_action( 'admin_print_styles-' . $acl_menu, array( 'WL_ACL_FREE_Menu', 'admin_menu_assets' ) );
90
  }
91
  }
92
-
93
  function acl_admin_custom_login_css() {
94
- // load CSS Files only With Admin Custom Login Menu Page
95
- if(strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], 'admin_custom_login') == true) {
96
  wp_enqueue_style('dashboard');
97
  wp_enqueue_style('wp-color-picker');
98
  wp_enqueue_style('thickbox');
@@ -116,9 +102,9 @@ function acl_admin_custom_login_css() {
116
  }
117
  }
118
 
 
119
  add_action( 'admin_print_scripts', 'acl_admin_custom_login_js' );
120
  function acl_admin_custom_login_js() {
121
- // load JS Files only With Admin Custom Login Menu Page
122
  if(strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], 'admin_custom_login') == true) {
123
  wp_enqueue_script('theme-preview');
124
  wp_enqueue_script('jquery');
@@ -151,14 +137,12 @@ function acl_advanced_login_form_plugin() {
151
  }
152
  add_action('login_enqueue_scripts', 'acl_advanced_login_form_plugin');
153
 
154
- /*To change the Login Button Text starts*/
155
  add_action( 'login_form', 'WACL_login_button_text' );
156
- function WACL_login_button_text()
157
- {
158
  add_filter( 'gettext', 'WACL_loginbutton_gettext', 10, 2 );
159
  }
160
  function WACL_loginbutton_gettext( $translation, $text ) {
161
-
162
  if(get_option('Admin_custome_login_login')){
163
  $label_login_button = unserialize(get_option('Admin_custome_login_login'));
164
  if(isset($label_login_button['label_loginButton'])) {
@@ -175,9 +159,7 @@ function WACL_loginbutton_gettext( $translation, $text ) {
175
  }
176
  return $translation;
177
  }
178
-
179
- /*To change the Login Button Text ends*/
180
-
181
  function acl_footer_func() {
182
  $text_and_color_page = unserialize(get_option('Admin_custome_login_text'));
183
  $user_input_icon = $text_and_color_page['user_input_icon'];
@@ -261,33 +243,29 @@ function acl_footer_func() {
261
  <?php
262
  }
263
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
264
- if($dashboard_page['dashboard_status'] == "enable") {
265
  add_action('login_head', 'acl_footer_func');
266
- }
267
 
268
- function acl_admin_custom_login_content() {
269
  require_once('includes/content.php');
270
  }
271
 
272
- /**
273
- * Process a settings export that generates a .json file of the shop settings
274
- */
275
  function acl_export_settings() {
276
-
277
  if( empty( $_POST['acl_action'] ) || 'export_settings' != $_POST['acl_action'] )
278
  return;
279
-
280
  if( ! wp_verify_nonce( $_POST['acl_export_nonce'], 'acl_export_nonce' ) )
281
  return;
282
-
283
  if( ! current_user_can( 'manage_options' ) )
284
  return;
285
 
286
- // Get value of Dashboard page
287
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
288
  $dashboard_status = $dashboard_page['dashboard_status'];
289
 
290
- // Get value of Top page
291
  $top_page = unserialize(get_option('Admin_custome_login_top'));
292
  $top_bg_type = $top_page['top_bg_type'];
293
  $top_color = $top_page['top_color'];
@@ -300,7 +278,7 @@ function acl_export_settings() {
300
  $top_slideshow_no = $top_page['top_slideshow_no'];
301
  $top_bg_slider_animation = $top_page['top_bg_slider_animation'];
302
 
303
- // Get value of Login page
304
  $login_page = unserialize(get_option('Admin_custome_login_login'));
305
  $login_form_position= $login_page['login_form_position'];
306
  $login_form_left = $login_page['login_form_left'];
@@ -335,7 +313,7 @@ function acl_export_settings() {
335
  $label_loginButton= $login_page['label_loginButton'];
336
 
337
 
338
- // Get value of Text and Color page
339
  $text_and_color_page = unserialize(get_option('Admin_custome_login_text'));
340
  $heading_font_color = $text_and_color_page['heading_font_color'];
341
  $input_font_color = $text_and_color_page['input_font_color'];
@@ -355,7 +333,7 @@ function acl_export_settings() {
355
  $user_input_icon = $text_and_color_page['user_input_icon'];
356
  $password_input_icon = $text_and_color_page['password_input_icon'];
357
 
358
- // Get value of Logo page
359
  $logo_page = unserialize(get_option('Admin_custome_login_logo'));
360
  $logo_image = $logo_page['logo_image'];
361
  $logo_width = $logo_page['logo_width'];
@@ -363,7 +341,7 @@ function acl_export_settings() {
363
  $logo_url = $logo_page['logo_url'];
364
  $logo_url_title = $logo_page['logo_url_title'];
365
 
366
- // Get value of Slidshow image
367
  $Slidshow_image = unserialize(get_option('Admin_custome_login_Slidshow'));
368
  $Slidshow_image_1 = $Slidshow_image['Slidshow_image_1'];
369
  $Slidshow_image_2 = $Slidshow_image['Slidshow_image_2'];
@@ -531,11 +509,8 @@ function acl_export_settings() {
531
  }
532
  add_action( 'admin_init', 'acl_export_settings' );
533
 
534
- /**
535
- * Process a settings import from a json file
536
- */
537
  function acl_import_settings() {
538
-
539
  if( empty( $_POST['acl_action'] ) || 'import_settings' != $_POST['acl_action'] )
540
  return;
541
 
@@ -546,8 +521,7 @@ function acl_import_settings() {
546
  return;
547
 
548
  list($oteher_extension, $extension) = explode(".", $_FILES['import_file']['name']);
549
- //$extension = end( explode( '.', $_FILES['import_file']['name'] ) );
550
-
551
  if( $extension != 'json' ) {
552
  wp_die( __( 'Please upload a valid .json file' ) );
553
  }
@@ -558,13 +532,10 @@ function acl_import_settings() {
558
  wp_die( __( 'Please upload a file to import' ) );
559
  }
560
 
561
- // Retrieve the settings from the file.
562
  $settings = json_decode( file_get_contents( $import_file ) );
563
-
564
  $ACL_Settings = unserialize($settings);
565
-
566
  $dashboard_status = $ACL_Settings['dashboard_status'];
567
-
568
  $top_bg_type = $ACL_Settings['top_bg_type'];
569
  $top_color = $ACL_Settings['top_color'];
570
  $top_image = $ACL_Settings['top_image'];
@@ -661,7 +632,6 @@ function acl_import_settings() {
661
  $social_youtube_link = $ACL_Settings['social_youtube_link'];
662
  $social_flickr_link = $ACL_Settings['social_flickr_link'];
663
  $social_tumblr_link = $ACL_Settings['social_tumblr_link'];
664
- // $social_vkontakte_link = $ACL_Settings['social_vkontakte_link'];
665
  $social_skype_link = $ACL_Settings['social_skype_link'];
666
  $social_instagram_link = $ACL_Settings['social_instagram_link'];
667
  $social_telegram_link = $ACL_Settings['social_telegram_link'];
@@ -675,7 +645,7 @@ function acl_import_settings() {
675
  $upload_dir = wp_upload_dir();
676
  $plugins_dir = plugins_url();
677
 
678
- // Top Background Image
679
  $data = $top_image;
680
  if (strpos($data,'uploads') == true) {
681
  list($oteher_path, $image_path) = explode("uploads", $data);
@@ -685,7 +655,7 @@ function acl_import_settings() {
685
  $top_image = $plugins_dir. $image_path;
686
  }
687
 
688
- // Login From Background Image
689
  $data1 = $login_bg_image;
690
  if (strpos($data1,'uploads') == true) {
691
  list($oteher_path1, $image_path1) = explode("uploads", $data1);
@@ -695,7 +665,7 @@ function acl_import_settings() {
695
  $login_bg_image = $plugins_dir. $image_path1;
696
  }
697
 
698
- // Login From Background Image
699
  $data2 = $logo_image;
700
  if (strpos($data2,'uploads') == true) {
701
  list($oteher_path2, $image_path2) = explode("uploads", $data2);
@@ -704,8 +674,8 @@ function acl_import_settings() {
704
  list($oteher_path2, $image_path2) = explode("plugins", $data2);
705
  $logo_image = $plugins_dir. $image_path2;
706
  }
707
-
708
- // Slider Image 1
709
  $Slidshow_image_url_1 = $Slidshow_image_1;
710
  if (strpos($Slidshow_image_url_1,'uploads') == true) {
711
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_1);
@@ -715,7 +685,7 @@ function acl_import_settings() {
715
  $Slidshow_image_1 = $plugins_dir. $image_path;
716
  }
717
 
718
- // Slider Image 2
719
  $Slidshow_image_url_2 = $Slidshow_image_2;
720
  if (strpos($Slidshow_image_url_2,'uploads') == true) {
721
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_2);
@@ -725,7 +695,7 @@ function acl_import_settings() {
725
  $Slidshow_image_2 = $plugins_dir. $image_path;
726
  }
727
 
728
- // Slider Image 3
729
  $Slidshow_image_url_3 = $Slidshow_image_3;
730
  if (strpos($Slidshow_image_url_3,'uploads') == true) {
731
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_3);
@@ -735,7 +705,7 @@ function acl_import_settings() {
735
  $Slidshow_image_3 = $plugins_dir. $image_path;
736
  }
737
 
738
- // Slider Image 4
739
  $Slidshow_image_url_4 = $Slidshow_image_4;
740
  if (strpos($Slidshow_image_url_4,'uploads') == true) {
741
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_4);
@@ -745,7 +715,7 @@ function acl_import_settings() {
745
  $Slidshow_image_4 = $plugins_dir. $image_path;
746
  }
747
 
748
- // Slider Image 5
749
  $Slidshow_image_url_5 = $Slidshow_image_5;
750
  if (strpos($Slidshow_image_url_5,'uploads') == true) {
751
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_5);
@@ -755,7 +725,7 @@ function acl_import_settings() {
755
  $Slidshow_image_5 = $plugins_dir. $image_path;
756
  }
757
 
758
- // Slider Image 6
759
  $Slidshow_image_url_6 = $Slidshow_image_6;
760
  if (strpos($Slidshow_image_url_6,'uploads') == true) {
761
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_6);
@@ -866,7 +836,7 @@ function acl_import_settings() {
866
  'social_youtube_link' => $social_youtube_link,
867
  'social_flickr_link' => $social_flickr_link,
868
  'social_tumblr_link' => $social_tumblr_link,
869
- // 'social_vkontakte_link' => $social_vkontakte_link,
870
  'social_skype_link' => $social_skype_link,
871
  'social_instagram_link' => $social_instagram_link,
872
  'social_telegram_link' => $social_telegram_link,
@@ -897,8 +867,6 @@ function acl_import_settings() {
897
  'acl_gcaptcha_theme' => $acl_gcaptcha_theme
898
  ));
899
  update_option('Admin_custome_login_gcaptcha', $g_page);
900
-
901
- //wp_safe_redirect( admin_url( 'options-general.php?page=admin_custom_login' ) ); exit;
902
  }
903
  add_action( 'admin_init', 'acl_import_settings' );
904
  ?>
1
  <?php
2
  $login_page = unserialize(get_option('Admin_custome_login_login'));
3
  if(isset($login_page['login_redirect_force'])){
4
+ $login_redirect_force = $login_page['login_redirect_force'];
5
+ } else {
6
+ $login_redirect_force = "no";
7
+ }
8
  if($login_redirect_force=="yes"){
9
+ add_action( 'template_redirect', function(){
10
+ /** no non-authenticated users allowed **/
11
+ if( ! is_user_logged_in() ){
12
+ $login_page = unserialize(get_option('Admin_custome_login_login'));
13
+ wp_redirect( $login_page['login_force_redirect_url'], 302 );
14
+ exit();
15
+ }
 
16
  });
17
  }
18
 
 
19
  $g_page = unserialize(get_option('Admin_custome_login_gcaptcha'));
20
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
21
  if(isset($g_page['login_enable_gcaptcha'])){
22
  $login_enable_gcaptcha = $g_page['login_enable_gcaptcha'];
23
  $dashboard_status = $dashboard_page['dashboard_status'];
24
  if($login_enable_gcaptcha=="yes" && $dashboard_status=="enable"){
25
+ /** Google gcaptcha code **/
26
  include('acl-gcaptcha.php');
27
  }
28
  }
38
  function ACL_login_redirect( $redirect_to, $request, $user ) {
39
  //is there a user to check?
40
  if ( isset( $user->roles ) && is_array( $user->roles ) ) {
41
+ /** get and load custom redirect option after user login **/
 
42
  $login_page = unserialize(get_option('Admin_custome_login_login'));
43
+ $login_redirect_user = $login_page['login_redirect_user'];
44
+ /** check for admins **/
 
45
  if ( in_array( 'administrator', $user->roles ) ) {
46
  // redirect admin to the default place
47
  return $redirect_to;
48
  } else {
49
+ /** redirect users to another place **/
50
  if($login_redirect_user != "") {
51
+ return $login_redirect_user;
52
  } else {
53
  return $redirect_to;
54
  }
58
  }
59
  }
60
  add_filter( 'login_redirect', 'ACL_login_redirect', 10, 3 );
61
+ /** load plugin translation **/
 
62
  add_action('plugins_loaded', 'ACL_GetReadyTranslation');
63
  function ACL_GetReadyTranslation() {
64
  load_plugin_textdomain(WEBLIZAR_ACL, FALSE, dirname( plugin_basename(__FILE__)).'/languages/' );
65
  }
66
+ /*** Admin Custom Login menu ***/
 
 
 
67
  require_once("login-form-screen.php");
68
  add_action('admin_menu','acl_weblizar_admin_custom_login_menu', 2);
69
  function acl_weblizar_admin_custom_login_menu() {
70
  if(current_user_can('administrator')){
71
  $wl_admin_menu = add_menu_page( __( 'Admin Custom Login', WEBLIZAR_ACL ), __( 'AC Login', WEBLIZAR_ACL ), 'manage_options', 'admin_custom_login', 'acl_admin_custom_login_content', 'dashicons-art', 10 );
72
  add_action( 'admin_print_styles-' . $wl_admin_menu, 'acl_admin_custom_login_css' );
 
 
 
 
73
  $acl_menu = add_submenu_page( 'admin_custom_login',__( 'Settings', WEBLIZAR_ACL ), __( 'Settings', WEBLIZAR_ACL ),'administrator', 'admin_custom_login','acl_admin_custom_login_content' );
74
  add_action( 'admin_print_styles-' . $acl_menu, 'acl_admin_custom_login_css' );
 
75
  $acl_menu = add_submenu_page( 'admin_custom_login',__( 'Get Pro', WEBLIZAR_ACL ), __( 'Get Pro', WEBLIZAR_ACL ),'administrator', 'admin-custom-login-main-menu',array( 'WL_ACL_FREE_Menu', 'admin_menu' ) );
76
  add_action( 'admin_print_styles-' . $acl_menu, array( 'WL_ACL_FREE_Menu', 'admin_menu_assets' ) );
77
  }
78
  }
79
+ /** load CSS Files only With Admin Custom Login Menu Page **/
80
  function acl_admin_custom_login_css() {
81
+ if(strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], 'admin_custom_login') == true) {
 
82
  wp_enqueue_style('dashboard');
83
  wp_enqueue_style('wp-color-picker');
84
  wp_enqueue_style('thickbox');
102
  }
103
  }
104
 
105
+ /** load JS Files only With Admin Custom Login Menu Page **/
106
  add_action( 'admin_print_scripts', 'acl_admin_custom_login_js' );
107
  function acl_admin_custom_login_js() {
 
108
  if(strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], 'admin_custom_login') == true) {
109
  wp_enqueue_script('theme-preview');
110
  wp_enqueue_script('jquery');
137
  }
138
  add_action('login_enqueue_scripts', 'acl_advanced_login_form_plugin');
139
 
140
+ /*** To change the Login Button Text starts ***/
141
  add_action( 'login_form', 'WACL_login_button_text' );
142
+ function WACL_login_button_text(){
 
143
  add_filter( 'gettext', 'WACL_loginbutton_gettext', 10, 2 );
144
  }
145
  function WACL_loginbutton_gettext( $translation, $text ) {
 
146
  if(get_option('Admin_custome_login_login')){
147
  $label_login_button = unserialize(get_option('Admin_custome_login_login'));
148
  if(isset($label_login_button['label_loginButton'])) {
159
  }
160
  return $translation;
161
  }
162
+ /*** To change the Login Button Text ends ***/
 
 
163
  function acl_footer_func() {
164
  $text_and_color_page = unserialize(get_option('Admin_custome_login_text'));
165
  $user_input_icon = $text_and_color_page['user_input_icon'];
243
  <?php
244
  }
245
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
246
+ if($dashboard_page['dashboard_status'] == "enable"){
247
  add_action('login_head', 'acl_footer_func');
248
+ }
249
 
250
+ function acl_admin_custom_login_content(){
251
  require_once('includes/content.php');
252
  }
253
 
254
+ /**** Process a settings export that generates a .json file of the shop settings ***/
 
 
255
  function acl_export_settings() {
 
256
  if( empty( $_POST['acl_action'] ) || 'export_settings' != $_POST['acl_action'] )
257
  return;
258
+
259
  if( ! wp_verify_nonce( $_POST['acl_export_nonce'], 'acl_export_nonce' ) )
260
  return;
 
261
  if( ! current_user_can( 'manage_options' ) )
262
  return;
263
 
264
+ /**** Get value of Dashboard page **/
265
  $dashboard_page = unserialize(get_option('Admin_custome_login_dashboard'));
266
  $dashboard_status = $dashboard_page['dashboard_status'];
267
 
268
+ /**** Get value of Top page **/
269
  $top_page = unserialize(get_option('Admin_custome_login_top'));
270
  $top_bg_type = $top_page['top_bg_type'];
271
  $top_color = $top_page['top_color'];
278
  $top_slideshow_no = $top_page['top_slideshow_no'];
279
  $top_bg_slider_animation = $top_page['top_bg_slider_animation'];
280
 
281
+ /**** Get value of Login page **/
282
  $login_page = unserialize(get_option('Admin_custome_login_login'));
283
  $login_form_position= $login_page['login_form_position'];
284
  $login_form_left = $login_page['login_form_left'];
313
  $label_loginButton= $login_page['label_loginButton'];
314
 
315
 
316
+ /**** Get value of Text and Color page **/
317
  $text_and_color_page = unserialize(get_option('Admin_custome_login_text'));
318
  $heading_font_color = $text_and_color_page['heading_font_color'];
319
  $input_font_color = $text_and_color_page['input_font_color'];
333
  $user_input_icon = $text_and_color_page['user_input_icon'];
334
  $password_input_icon = $text_and_color_page['password_input_icon'];
335
 
336
+ /**** Get value of Logo page **/
337
  $logo_page = unserialize(get_option('Admin_custome_login_logo'));
338
  $logo_image = $logo_page['logo_image'];
339
  $logo_width = $logo_page['logo_width'];
341
  $logo_url = $logo_page['logo_url'];
342
  $logo_url_title = $logo_page['logo_url_title'];
343
 
344
+ /**** Get value of Slidshow image **/
345
  $Slidshow_image = unserialize(get_option('Admin_custome_login_Slidshow'));
346
  $Slidshow_image_1 = $Slidshow_image['Slidshow_image_1'];
347
  $Slidshow_image_2 = $Slidshow_image['Slidshow_image_2'];
509
  }
510
  add_action( 'admin_init', 'acl_export_settings' );
511
 
512
+ /*** Process a settings import from a json file ***/
 
 
513
  function acl_import_settings() {
 
514
  if( empty( $_POST['acl_action'] ) || 'import_settings' != $_POST['acl_action'] )
515
  return;
516
 
521
  return;
522
 
523
  list($oteher_extension, $extension) = explode(".", $_FILES['import_file']['name']);
524
+
 
525
  if( $extension != 'json' ) {
526
  wp_die( __( 'Please upload a valid .json file' ) );
527
  }
532
  wp_die( __( 'Please upload a file to import' ) );
533
  }
534
 
535
+ /**** Retrieve the settings from the file. **/
536
  $settings = json_decode( file_get_contents( $import_file ) );
 
537
  $ACL_Settings = unserialize($settings);
 
538
  $dashboard_status = $ACL_Settings['dashboard_status'];
 
539
  $top_bg_type = $ACL_Settings['top_bg_type'];
540
  $top_color = $ACL_Settings['top_color'];
541
  $top_image = $ACL_Settings['top_image'];
632
  $social_youtube_link = $ACL_Settings['social_youtube_link'];
633
  $social_flickr_link = $ACL_Settings['social_flickr_link'];
634
  $social_tumblr_link = $ACL_Settings['social_tumblr_link'];
 
635
  $social_skype_link = $ACL_Settings['social_skype_link'];
636
  $social_instagram_link = $ACL_Settings['social_instagram_link'];
637
  $social_telegram_link = $ACL_Settings['social_telegram_link'];
645
  $upload_dir = wp_upload_dir();
646
  $plugins_dir = plugins_url();
647
 
648
+ /**** Top Background Image **/
649
  $data = $top_image;
650
  if (strpos($data,'uploads') == true) {
651
  list($oteher_path, $image_path) = explode("uploads", $data);
655
  $top_image = $plugins_dir. $image_path;
656
  }
657
 
658
+ /**** Login From Background Image **/
659
  $data1 = $login_bg_image;
660
  if (strpos($data1,'uploads') == true) {
661
  list($oteher_path1, $image_path1) = explode("uploads", $data1);
665
  $login_bg_image = $plugins_dir. $image_path1;
666
  }
667
 
668
+ /**** Login From Background Image **/
669
  $data2 = $logo_image;
670
  if (strpos($data2,'uploads') == true) {
671
  list($oteher_path2, $image_path2) = explode("uploads", $data2);
674
  list($oteher_path2, $image_path2) = explode("plugins", $data2);
675
  $logo_image = $plugins_dir. $image_path2;
676
  }
677
+
678
+ /**** Slider Image 1 **/
679
  $Slidshow_image_url_1 = $Slidshow_image_1;
680
  if (strpos($Slidshow_image_url_1,'uploads') == true) {
681
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_1);
685
  $Slidshow_image_1 = $plugins_dir. $image_path;
686
  }
687
 
688
+ /**** Slider Image 2 **/
689
  $Slidshow_image_url_2 = $Slidshow_image_2;
690
  if (strpos($Slidshow_image_url_2,'uploads') == true) {
691
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_2);
695
  $Slidshow_image_2 = $plugins_dir. $image_path;
696
  }
697
 
698
+ /**** Slider Image 3 ***/
699
  $Slidshow_image_url_3 = $Slidshow_image_3;
700
  if (strpos($Slidshow_image_url_3,'uploads') == true) {
701
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_3);
705
  $Slidshow_image_3 = $plugins_dir. $image_path;
706
  }
707
 
708
+ /**** Slider Image 4 ***/
709
  $Slidshow_image_url_4 = $Slidshow_image_4;
710
  if (strpos($Slidshow_image_url_4,'uploads') == true) {
711
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_4);
715
  $Slidshow_image_4 = $plugins_dir. $image_path;
716
  }
717
 
718
+ /****Slider Image 5 **/
719
  $Slidshow_image_url_5 = $Slidshow_image_5;
720
  if (strpos($Slidshow_image_url_5,'uploads') == true) {
721
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_5);
725
  $Slidshow_image_5 = $plugins_dir. $image_path;
726
  }
727
 
728
+ /**** Slider Image 6 ***/
729
  $Slidshow_image_url_6 = $Slidshow_image_6;
730
  if (strpos($Slidshow_image_url_6,'uploads') == true) {
731
  list($oteher_path, $image_path) = explode("uploads", $Slidshow_image_url_6);
836
  'social_youtube_link' => $social_youtube_link,
837
  'social_flickr_link' => $social_flickr_link,
838
  'social_tumblr_link' => $social_tumblr_link,
839
+ //'social_vkontakte_link' => $social_vkontakte_link,
840
  'social_skype_link' => $social_skype_link,
841
  'social_instagram_link' => $social_instagram_link,
842
  'social_telegram_link' => $social_telegram_link,
867
  'acl_gcaptcha_theme' => $acl_gcaptcha_theme
868
  ));
869
  update_option('Admin_custome_login_gcaptcha', $g_page);
 
 
870
  }
871
  add_action( 'admin_init', 'acl_import_settings' );
872
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.weblizar.com/
4
  Tags: custom login page, custom admin login, custom login, customize wordpress login page, design wordpress login
5
  Requires at least: 4.0
6
  Tested up to: 5.1.1
7
- Stable tag: 2.8.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -172,6 +172,8 @@ If you have any question contact us at here: [Plugin Support Forum ](http://word
172
 
173
  For more information, see [Weblizar](http://www.weblizar.com/)
174
 
 
 
175
 
176
  = 2.8.8 =
177
  * Google reCaptcha version3, minor issue fixed
4
  Tags: custom login page, custom admin login, custom login, customize wordpress login page, design wordpress login
5
  Requires at least: 4.0
6
  Tested up to: 5.1.1
7
+ Stable tag: 2.8.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
172
 
173
  For more information, see [Weblizar](http://www.weblizar.com/)
174
 
175
+ = 2.8.9 =
176
+ * Added separate settings for reCaptcha v3
177
 
178
  = 2.8.8 =
179
  * Google reCaptcha version3, minor issue fixed