PluginProbe
Loginizer / 1.9.6
Loginizer v1.9.6
2.1.2 2.1.1 2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 All 76 releases
loginizer / main / settings / social_login.php

social_login.php in Loginizer 1.9.6, at main/settings/social_login.php

568 lines 32.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH')){
4 die('HACKING ATTEMPT!');
5 }
6
7 function loginizer_social_login(){
8
9 if(!current_user_can('manage_options')){
10 wp_die('Sorry, but you do not have permissions to change settings.');
11 }
12
13 if(defined('LOGINIZER_PREMIUM') && file_exists(LOGINIZER_PRO_DIR . '/main/settings/social_login.php')){
14 include_once LOGINIZER_PRO_DIR . '/main/settings/social_login.php';
15 }
16
17 $script_data = [
18 'nonce' => wp_create_nonce('loginizer_social_nonce'),
19 'ajax_url' => admin_url('admin-ajax.php')
20 ];
21
22 wp_localize_script('loginizer_social_script', 'loginizer_social', $script_data);
23
24 loginizer_page_header('Social Login Settings');
25
26 echo '<div class="tabs-wrapper" style="margin-bottom:10px; width:100%;">
27 <nav class="nav-tab-wrapper">
28 <a href="?page=loginizer_social_login" class="nav-tab '.(isset($_GET['settings']) ? '' : 'nav-tab-active').'">Provider</a>
29 <a href="?page=loginizer_social_login&settings=global" class="nav-tab '.(isset($_GET['settings']) ? 'nav-tab-active' : '').'">Settings</a>
30 </nav>
31 </div>';
32
33 // Handling Settings Page
34 if(!empty($_GET['settings'])){
35 loginizer_general_settings();
36
37 return;
38 }
39
40 // Contains the list of all the providers
41 include_once LOGINIZER_DIR . '/main/login-providers.php';
42
43 if(empty($loginizer_login_providers)){
44 echo '<p>' . esc_html__('Something went wrong can\'t load social App details', 'loginizer') . '</p>';
45 return;
46 }
47
48 // Handling Provider settings.
49 if(!empty($_GET['provider'])){
50 $provider_page = sanitize_text_field($_GET['provider']);
51 loginizer_provider_settings($provider_page, $loginizer_login_providers);
52
53 return;
54 }
55
56 $provider_settings = get_option('loginizer_provider_settings', []);
57 $provider_order = get_option('loginizer_social_order', []);
58
59 $providers = [];
60
61 // Sorting according to the saved order of the providers.
62 if(!empty($provider_order)){
63 foreach($provider_order as $key => $num){
64 if(!empty($loginizer_login_providers[$key])){
65 $providers[$key] = $loginizer_login_providers[$key];
66 }
67 }
68
69 // TODO:: There is some issue here.
70 // To check if something new was added and will be added at the last.
71 $remaining = array_diff(array_keys($loginizer_login_providers), array_keys($providers));
72
73 if(!empty($remaining)){
74 foreach($remaining as $new_social){
75 $providers[$new_social] = $loginizer_login_providers[$new_social];
76 }
77 }
78
79 } else {
80 $providers = $loginizer_login_providers;
81 }
82
83 // ------ HTML STARTS HERE -------- //
84
85 echo '<div class="loginizer-social-wrapper">';
86
87 // Image used here is supposed to be same as the key in png format.
88 foreach($providers as $key => $provider){
89
90 $action_class = '';
91 $action_text = __('Get Started');
92 if(array_key_exists($key, $provider_settings)){
93 $action_text = __('Settings');
94 }
95
96 $action_to = admin_url('admin.php?page=loginizer_social_login&provider='.$key);
97 if(!empty($provider['premium']) && !defined('LOGINIZER_PREMIUM')){
98 $action_text = __('Upgrade to Pro');
99 $action_class = ' button-primary'; // Have added space here at the start of the string
100 $action_to = 'https://loginizer.com/pricing';
101 }
102
103 echo '<div class="loginizer-social-provider" data-provider="'.esc_attr($key).'">
104 <div class="loginizer-social-logo" style="background-color:'.esc_attr($provider['color']).';">
105 <div class="loginizer-social-grip">
106 <svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 100" fill="#d3d3d3" width="12" height="25"><path d="m12.5 27c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5zm0 25c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5zm0 28c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5zm25-53c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5zm0 25c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5zm0 28c-4.7 0-8.5-3.8-8.5-8.5 0-4.7 3.8-8.5 8.5-8.5 4.7 0 8.5 3.8 8.5 8.5 0 4.7-3.8 8.5-8.5 8.5z"/></svg>
107 </div>';
108 if(array_key_exists($key, $provider_settings) && loginizer_show_social_status($loginizer_login_providers[$key])){
109 if(!empty($provider_settings[$key]['enabled']) && !empty($provider_settings[$key]['tested'])){
110 echo '<div class="loginizer-social-provider-state loginizer-social-provider-state-enabled">Enabled</div>';
111 } elseif(!empty($provider_settings[$key]['enabled']) && empty($provider_settings[$key]['tested'])){
112 echo '<div class="loginizer-social-provider-state loginizer-social-provider-state-pending">Pending</div>';
113 } else {
114 echo '<div class="loginizer-social-provider-state loginizer-social-provider-state-disabled">Disabled</div>';
115 }
116 }
117
118 echo '<div class="loginizer-social-saving-order">'.esc_html__('Saving Order', 'loginizer').'...</div>
119 <img src="'.esc_url(LOGINIZER_URL . '/assets/images/social/'.$key.'.png').'" height="60" alt="'.esc_attr($provider['name']).'" style="'.(($provider['name'] === 'Google') ? 'background-color:white; padding:3px;' : '').'"/>
120 </div>
121 <div class="loginizer-social-provider-action"><h2>'.esc_html($provider['name']).'</h2><a href="'.esc_url($action_to).'" class="button'.esc_attr($action_class).'">'.esc_html($action_text).'</a></div>
122 </div>';
123 }
124
125 echo '</div>';
126
127 loginizer_page_footer();
128 }
129
130 // Settings page for every Social Provider.
131 function loginizer_provider_settings($provider, $provider_defaults){
132
133 $provider_settings = get_option('loginizer_provider_settings', []);
134
135 if(empty($provider_settings)){
136 update_option('loginizer_social_login_url', wp_login_url());
137 }
138
139 if(!empty($_GET['test'])){
140 $provider_settings[$provider]['tested'] = true;
141 update_option('loginizer_provider_settings', $provider_settings);
142 }
143
144 // Checking for the Pro version for the specific Provider
145 if(!defined('LOGINIZER_PREMIUM') && (empty($provider_defaults[$provider]) || !empty($provider_defaults[$provider]['premium']))){
146 loginizer_feature_available($provider_defaults[$provider]['name'] . ' Social Login Provider');
147 loginizer_page_footer();
148 return;
149 }
150
151 if(!empty($_POST['client_id'])){
152 if(!check_admin_referer('loginizer_social_nonce', 'security')){
153 $error[] = __('Security Check failed', 'loginizer');
154 } else {
155
156 if(empty($provider_settings[$provider])){
157 $provider_settings[$provider] = []; // initializing
158 $provider_settings[$provider]['tested'] = false;
159 }
160
161 // Need to make the user to test the login again if the key gets changed, if keys gets dirty
162 if((isset($provider_settings[$provider]['client_id']) && $provider_settings[$provider]['client_id'] != sanitize_text_field(wp_unslash($_POST['client_id'])))
163 || (isset($provider_settings[$provider]['client_secret']) && $provider_settings[$provider]['client_secret'] != sanitize_text_field(wp_unslash($_POST['client_secret'])))){
164 $provider_settings[$provider]['tested'] = false;
165 }
166
167 $provider_settings[$provider]['client_id'] = !empty($_POST['client_id']) ? sanitize_text_field(wp_unslash($_POST['client_id'])) : '';
168 $provider_settings[$provider]['client_secret'] = !empty($_POST['client_secret']) ? sanitize_text_field(wp_unslash($_POST['client_secret'])) : '';
169 $provider_settings[$provider]['enabled'] = !empty($_POST['provider_enabled']) ? true : false;
170 $provider_settings[$provider]['button_style'] = !empty($_POST['button_style']) ? lz_optpost('button_style') : 'default';
171
172 update_option('loginizer_provider_settings', $provider_settings);
173
174 $saved = true;
175 }
176
177 if(!empty($error)){
178 lz_report_error($error);
179 }
180
181 if(!empty($saved)){
182 echo '<div id="message" class="updated"><p>'
183 . esc_html__('The settings were saved successfully', 'loginizer')
184 . '</p></div><br />';
185 }
186 }
187
188 if(!empty($provider_settings[$provider]) && !empty($provider_settings[$provider]['enabled']) && empty($provider_settings[$provider]['tested'])){
189 $social_nonce = wp_create_nonce('loginizer_social_check');
190
191 wp_register_script('loginizer-social-test', '', ['jquery'], LOGINIZER_VERSION, ['strategy' => false, 'in_footer' => true]);
192 wp_enqueue_script('loginizer-social-test');
193 wp_add_inline_script('loginizer-social-test', '
194 function loginizer_auth_test_popup() {
195 let screenX = window.screenX !== undefined ? window.screenX : window.screenLeft,
196 screenY = window.screenY !== undefined ? window.screenY : window.screenTop,
197 outer_width = window.outerWidth !== undefined ? window.outerWidth : document.documentElement.clientWidth,
198 outer_height = window.outerHeight !== undefined ? window.outerHeight : document.documentElement.clientHeight - 22,
199 target_width = 600,
200 target_height = 600,
201 right = parseInt(screenY + (outer_height - target_height) / 2.5, 10),
202 left = parseInt(screenX + (outer_width - target_width) / 2, 10),
203 attributes = [];
204
205 if (target_width !== null) {
206 attributes.push("width=" + target_width);
207 }
208 if (target_height !== null) {
209 attributes.push("height=" + target_height);
210 }
211 attributes.push("left=" + left);
212 attributes.push("top=" + right);
213 attributes.push("scrollbars=1");
214
215 var social_window = window.open("'.esc_url(wp_login_url()).'?lz_social_provider='.esc_html($provider).'&test=true&social_security='.esc_html($social_nonce).'&ref='.esc_url($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']).'", "socialWindow", attributes.join(","));
216
217 if(window.focus){
218 social_window.focus();
219 }
220 return false;
221 }'
222 );
223 }
224
225 echo '<a href="'.esc_url(admin_url('admin.php?page=loginizer_social_login')).'">&#8592; '.esc_html__('Go Back', 'loginizer').'</a>';
226
227 if(!empty($provider_settings[$provider]) && !empty($provider_settings[$provider]['enabled']) && empty($provider_settings[$provider]['tested'])){
228 echo '<div class="loginizer-social-test-alert">
229 <h3>'.sprintf(esc_html__('Test %s to be able to use it', 'loginizer'), esc_html($provider_defaults[$provider]['name'])).'</h3>
230 <p>'.esc_html__('You have added/updated the keys of this provider so you will need to test it to be able to use it.', 'loginizer').'</p>
231 <p>'.esc_html__('Please use the same email with which you have created this account.', 'loginizer').'</p>
232 <button class="button button-primary" id="loginizer-test-provider-btn" onClick="loginizer_auth_test_popup()">'.esc_html__('Test Now', 'loginizer').'</button>
233 </div>';
234 }
235
236 echo '<div style="display:flex; justify-content:space-between;">
237 <div style="width:"50%;">
238 <h3>'.esc_html($provider_defaults[$provider]['name']).' Settings</h3>
239
240 <form method="POST">
241 <table class="form-table">
242 <tr>
243 <th scope="row"><label for="provider_enabled">Enable</label></th>
244 <td><input type="checkbox" name="provider_enabled" id="provider_enabled" '.(!empty($provider_settings[$provider]['enabled']) ? 'checked' : '').' value="1"/></td>
245 </tr>
246 <tr>
247 <th scope="row"><label for="client_id">Client ID</label></th>
248 <td><input type="text" name="client_id" id="client_id" value="'.(!empty($provider_settings[$provider]['client_id']) ? esc_attr($provider_settings[$provider]['client_id']) : '').'"/></td>
249 </tr>
250 <tr>
251 <th scope="row"><label for="client_secret">Client Secret</label></th>
252 <td><input type="text" name="client_secret" id="client_secret" value="'.(!empty($provider_settings[$provider]['client_secret']) ? esc_attr($provider_settings[$provider]['client_secret']) : '').'"/></td>
253 </tr>
254 <tr>
255 <th scope="row"><label for="button_style_default">Button Style</label></th>
256 <td>';
257 $styles = $provider_defaults[$provider]['styles'];
258
259 foreach($styles as $style => $style_css){
260 echo '<label style="padding:20px 20px 20px 0"><input type="radio" name="button_style" id="button_style_'.esc_attr($style).'" value="'.esc_attr($style).'" '.((empty($provider_settings[$provider]['button_style'])) ? 'checked' : checked($provider_settings[$provider]['button_style'], $style, false)).'/>'.esc_attr(ucfirst($style)).'</label>';
261 }
262 echo '</td>
263 </tr>
264 </table>';
265 wp_nonce_field('loginizer_social_nonce', 'security');
266 echo '<button class="button button-primary">Save Settings</button>
267 </form>
268 </div>
269 <div class="loginizer-provider-docs" style="width:46%;">';
270 if(function_exists('loginizer_how_to_'.$provider)){
271 call_user_func('loginizer_how_to_'.$provider);
272 } else {
273 echo '<p>No Documentation Present</p>';
274 }
275 echo '</div>
276 </div>
277 ';
278
279 loginizer_page_footer();
280 }
281
282 // General Settings Page
283 function loginizer_general_settings(){
284
285 $social_settings = get_option('loginizer_social_settings', []);
286
287 if(!empty($_POST['security'])){
288 if(!check_admin_referer('loginizer_social_nonce', 'security')){
289 $error[] = __('Security Check failed', 'loginizer');
290 } else if(isset($_POST['general_settings'])){
291 $social_settings['general']['target_window'] = !empty($_POST['target_window']) ? lz_optpost('target_window') : false;
292
293 } else if(isset($_POST['login_settings'])){
294 $social_settings['login']['login_form'] = lz_optpost('login_form');
295 $social_settings['login']['button_style'] = lz_optpost('button_style');
296 $social_settings['login']['button_shape'] = lz_optpost('button_shape');
297 $social_settings['login']['button_position'] = lz_optpost('button_position');
298 }
299
300 $social_settings = apply_filters('loginizer_social_general_settings', $social_settings);
301 $social_settings = map_deep($social_settings, 'sanitize_text_field');
302
303 update_option('loginizer_social_settings', $social_settings);
304 }
305
306 echo '
307 <div class="loginizer-social-login-settings">
308 <div class="loginizer-v-tab">
309 <label><input type="radio" name="lz-social-setting-type" value="general" checked/>'.esc_html__('General', 'loginizer').'</label>
310 <label><input type="radio" name="lz-social-setting-type" value="login"/>'.esc_html__('Login Form', 'loginizer').'</label>
311 <label><input type="radio" name="lz-social-setting-type" value="woocommerce"/>'.esc_html__('WooCommerce', 'loginizer').(!defined('LOGINIZER_PREMIUM') ? '<span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span>' : ''). '</label>
312 <label><input type="radio" name="lz-social-setting-type" value="comment"/>'.esc_html__('Comment', 'loginizer').(!defined('LOGINIZER_PREMIUM') ? '<span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span>' : '').'</label>
313 </div>
314
315 <div class="lz-v-tab-content">
316 <div id="lz-social-general-settings">
317 <h2>General Settings</h2>
318 <form method="POST">
319 <table class="form-table">
320 <tr>
321 <th scope="row"><label for="save_avatar">Target Window</label></th>
322 <td class="loginizer-general-settings">
323 <label><input type="radio" name="target_window" id="target_window" value="same" '.(!empty($social_settings['general']['target_window']) && $social_settings['general']['target_window'] == 'same' ? 'checked' : (empty($social_settings['general']['target_window']) ? 'checked' : '')).'/>'.esc_html__('Prefer Same window', 'loginizer').'</label>
324 <label><input type="radio" name="target_window" id="target_window" value="popup" '.(!empty($social_settings['general']['target_window']) && $social_settings['general']['target_window'] == 'popup' ? 'checked' : '').'/>'.esc_html__('Prefer Popup', 'loginizer').'</label>
325 <p class="description">'.esc_html__('Where you want the App Authentication to be visible in', 'loginizer').'</p>
326 </td>
327 </tr>';
328
329 if(defined('LOGINIZER_PREMIUM')){
330 echo '<tr>
331 <th scope="row"><label for="save_avatar">Save Avatar</label></th>
332 <td class="loginizer-general-settings">
333 <input type="checkbox" name="save_avatar" id="save_avatar" '.(!empty($social_settings['general']['save_avatar']) ? 'checked' : '').'/>
334 <p class="description">'.esc_html__('On registration save and update user avatar, if possible', 'loginizer').'</p>
335 </td>
336 </tr>
337 <tr>
338 <th scope="row"><label for="register_new">Create User</label></th>
339 <td class="loginizer-general-settings">
340 <input type="checkbox" name="register_new" id="register_new" '.(!empty($social_settings['general']['register_new']) ? 'checked' : '').'/>
341 <p>'.esc_html__('If the user is not present then should loginizer create new user?', 'loginizer').'</p>
342 </td>
343 </tr>
344 <tr>
345 <th scope="row"><label for="default_role">New User Role</label></th>
346 <td class="loginizer-general-settings">
347 <select name="default_role" id="default_role">';
348 wp_dropdown_roles(!empty($social_settings['general']['default_role']) ? $social_settings['general']['default_role'] : 'subscriber');
349 echo '</select>
350 <p>'.esc_html__('What role you want to assign to the user created through social login?', 'loginizer').'</p>
351 </td>
352 </tr>
353 <tr>
354 <th scope="row"><label for="admin_bar">'.esc_html__('Hide Admin Bar', 'loginizer').'</label></th>
355 <td class="loginizer-general-settings">
356 <input type="checkbox" name="admin_bar" id="admin_bar" '.(!empty($social_settings['general']['admin_bar']) ? 'checked' : '').'/>
357 <p>'.esc_html__('Do you want the new user to see the Admin Bar in the Front end? Checked means you want to hide it.', 'loginizer'). '</p>
358 </td>
359 </tr>';
360 } else {
361 echo '<tr>
362 <th scope="row"><label>Save Avatar <span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span></label></th>
363 <td class="loginizer-general-settings">
364 <input type="checkbox" disabled/>
365 <p class="description">'.esc_html__('On registration save and update user avatar, if possible', 'loginizer').'</p>
366 </td>
367 </tr>
368 <tr>
369 <th scope="row"><label>Create User <span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span></label></th>
370 <td class="loginizer-general-settings">
371 <input type="checkbox" disabled>
372 <p>'.esc_html__('If the user is not present then should loginizer create new user?', 'loginizer').'</p>
373 </td>
374 </tr>
375 <tr>
376 <th scope="row"><label>New User Role <span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span></label></th>
377 <td class="loginizer-general-settings">
378 <select disabled>
379 <option>Subscriber</option>
380 </select>
381 <p>'.esc_html__('What role you want to assign to the user created through social login?', 'loginizer').'</p>
382 </td>
383 </tr>
384 <tr>
385 <th scope="row"><label>'.esc_html__('Hide Admin Bar', 'loginizer').' <span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span></label></th>
386 <td class="loginizer-general-settings">
387 <input type="checkbox" disabled/>
388 <p>'.esc_html__('Do you want the new user to see the Admin Bar in the Front end? Checked means you want to hide it.', 'loginizer'). '</p>
389 </td>
390 </tr>';
391
392 }
393 echo '</table>';
394 wp_nonce_field('loginizer_social_nonce', 'security');
395 echo '<input type="submit" class="button button-primary" name="general_settings" value="Save Settings"/>
396 </form>
397 </div>
398 <div id="lz-social-login-settings">
399 <h2>Login Form</h2>
400 <form method="POST">
401 <table class="form-table">
402 <tr>
403 <th scope="row"><label for="button_style_full">'.esc_html__('Login Form', 'loginizer').'</label></th>
404 <td class="loginizer-general-settings">
405 <label><input type="checkbox" name="login_form" id="login_form" value="yes" '.(!empty($social_settings['login']['login_form']) ? 'checked' : '').'/></label>
406 <p>'.esc_html__('Do you want to show social buttons on WordPress login form.', 'loginizer'). '</p>
407 </td>
408 </tr>';
409
410 if(defined('LOGINIZER_PREMIUM')){
411 echo '<tr>
412 <th scope="row"><label for="registration_form">'.esc_html__('Registration Form', 'loginizer').'</label></th>
413 <td class="loginizer-general-settings">
414 <label><input type="checkbox" name="registration_form" id="registration_form" value="yes" '.(!empty($social_settings['login']['registration_form']) ? 'checked' : '').'/></label>
415 <p>'.esc_html__('Do you want to show social login on the WordPress registration form.', 'loginizer'). '</p>
416 </td>
417 </tr>';
418 } else {
419 echo '<tr>
420 <th scope="row"><label>'.esc_html__('Registration Form', 'loginizer').'<span class="dashicons dashicons-lock" style="color:#f69d2e;" title="Available in Premium version"></span></label></th>
421 <td class="loginizer-general-settings">
422 <label><input type="checkbox" disabled/></label>
423 <p class="disabled">'.esc_html__('Do you want to show social login on the WordPress registration form.', 'loginizer'). '</p>
424 </td>
425 </tr>';
426 }
427
428 echo '<tr>
429 <th scope="row"><label for="button_style_full">'.esc_html__('Button Style', 'loginizer').'</label></th>
430 <td class="loginizer-general-settings">
431 <label><input type="radio" name="button_style" id="button_style_full" value="full" '.(empty($social_settings['login']['button_style']) ? 'checked' : checked($social_settings['login']['button_style'], 'full', false)).'/>Full Length</label>
432 <label><input type="radio" name="button_style" value="icon" '.(!empty($social_settings['login']['button_style']) ? checked($social_settings['login']['button_style'], 'icon', false) : '').'/>Icon</label>
433 </td>
434 </tr>
435 <tr>
436 <th scope="row"><label for="button_shape_square">'.esc_html__('Button Shape', 'loginizer').'</label></th>
437 <td class="loginizer-general-settings">
438 <label><input type="radio" name="button_shape" id="button_shape_square" value="square" '.(empty($social_settings['login']['button_shape']) ? 'checked' : checked($social_settings['login']['button_shape'], 'square', false)).'>'.esc_html__('Square', 'loginizer').'</label>
439 <label><input type="radio" name="button_shape" value="circle" '.(!empty($social_settings['login']['button_shape']) ? checked($social_settings['login']['button_shape'], 'circle', false) : '').'>'.esc_html__('Pill/Circle', 'loginizer').'</label>
440 </td>
441 </tr>
442 <tr>
443 <th scope="row"><label for="button_position">Button Position</label></th>
444 <td class="loginizer-general-settings">
445 <label><input type="radio" name="button_position" id="button_position" value="below" '.(empty($social_settings['login']['button_position']) ? 'checked' : checked($social_settings['login']['button_position'], 'below', false)).'>Below</label>
446 <label><input type="radio" name="button_position" value="below_plus" '.(!empty($social_settings['login']['button_position']) ? checked($social_settings['login']['button_position'], 'below_plus', false) : '').'>'.esc_html__('Below with Seperator', 'loginizer').'</label>
447 <label><input type="radio" name="button_position" value="above" '.(!empty($social_settings['login']['button_position']) ? checked($social_settings['login']['button_position'], 'above', false) : '').'>'.esc_html__('Above', 'loginizer').'</label>
448 <label><input type="radio" name="button_position" value="above_plus" '.(!empty($social_settings['login']['button_position']) ? checked($social_settings['login']['button_position'], 'above_plus', false) : '').'>'.esc_html__('Above with Seperator', 'loginizer').'</label>
449 </td>
450 </tr>
451 </table>';
452 wp_nonce_field('loginizer_social_nonce', 'security');
453 echo '<input type="submit" class="button button-primary" name="login_settings" value="'.esc_html__('Save Settings', 'loginizer').'">
454 </form>
455 </div>
456 <div id="lz-social-woocommerce-settings">
457 <h2>WooCommerce Settings</h2>';
458 loginizer_feature_available('Social login for WooCommerce');
459 echo '<form method="POST" loginizer-premium-only="1">
460 <table class="form-table">
461 <tr>
462 <th scope="row"><label for="button_style_full">'.esc_html__('Login Form', 'loginizer').'</label></th>
463 <td class="loginizer-general-settings">
464 <label><input type="checkbox" name="login_form" id="login_form" value="login" '.(!empty($social_settings['woocommerce']['login_form']) ? 'checked' : '').'/></label>
465 <p>'.esc_html__('Do you want to show social buttons on WooCommerce login form.', 'loginizer'). '</p>
466 </td>
467 </tr>
468 <tr>
469 <th scope="row"><label for="button_style_full">'.esc_html__('Registration Form', 'loginizer').'</label></th>
470 <td class="loginizer-general-settings">
471 <label><input type="checkbox" name="registration_form" id="registration_form" value="reg" '.(!empty($social_settings['woocommerce']['registration_form']) ? 'checked' : '').'/></label>
472 <p>'.esc_html__('Do you want to show social login on the WooCommerce registration form.', 'loginizer'). '</p>
473 </td>
474 </tr>
475 <tr>
476 <th scope="row"><label for="button_style_full">'.esc_html__('Button Style', 'loginizer').'</label></th>
477 <td class="loginizer-general-settings">
478 <label><input type="radio" name="button_style" id="button_style_full" value="full" '.(empty($social_settings['woocommerce']['button_style']) ? 'checked' : checked($social_settings['woocommerce']['button_style'], 'full', false)).'/>'.esc_html__('Full Length', 'loginizer').'</label>
479 <label><input type="radio" name="button_style" value="icon" '.(!empty($social_settings['woocommerce']['button_style']) ? checked($social_settings['woocommerce']['button_style'], 'icon', false) : '').'/>'.esc_html__('Icon', 'loginizer').'</label>
480 </td>
481 </tr>
482 <tr>
483 <th scope="row"><label for="button_shape_square">'.esc_html__('Button Shape', 'loginizer').'</label></th>
484 <td class="loginizer-general-settings">
485 <label><input type="radio" name="button_shape" id="button_shape_square" value="square" '.(empty($social_settings['woocommerce']['button_shape']) ? 'checked' : checked($social_settings['woocommerce']['button_shape'], 'square', false)).'>'.esc_html__('Square', 'loginizer').'</label>
486 <label><input type="radio" name="button_shape" value="circle" '.(!empty($social_settings['woocommerce']['button_shape']) ? checked($social_settings['woocommerce']['button_shape'], 'circle', false) : '').'>'.esc_html__('Pill/Circle', 'loginizer').'</label>
487 </td>
488 </tr>
489 <tr>
490 <th scope="row"><label for="button_position">'.esc_html__('Button Position', 'loginizer').'</label></th>
491 <td class="loginizer-general-settings">
492 <label><input type="radio" name="button_position" id="button_position" value="below" '.(empty($social_settings['woocommerce']['button_position']) ? 'checked' : checked($social_settings['woocommerce']['button_position'], 'below', false)).'>'.esc_html__('Below', 'loginizer').'</label>
493 <label><input type="radio" name="button_position" value="below_plus" '.(!empty($social_settings['woocommerce']['button_position']) ? checked($social_settings['woocommerce']['button_position'], 'below_plus', false) : '').'>'.esc_html__('Below with Seperator', 'loginizer').'</label>
494 <label><input type="radio" name="button_position" value="above" '.(!empty($social_settings['woocommerce']['button_position']) ? checked($social_settings['woocommerce']['button_position'], 'above', false) : '').'>'.esc_html__('Above', 'loginizer').'</label>
495 <label><input type="radio" name="button_position" value="above_plus" '.(!empty($social_settings['woocommerce']['button_position']) ? checked($social_settings['woocommerce']['button_position'], 'above_plus', false) : '').'>'.esc_html__('Above with Seperator', 'loginizer').'</label>
496 </td>
497 </tr>
498 </table>';
499 wp_nonce_field('loginizer_social_nonce', 'security');
500 echo '<input type="submit" class="button button-primary" name="woocommerce_settings" value="'.esc_html__('Save Settings', 'loginizer').'">
501 </form>
502 </div>
503 <div id="lz-social-comment-settings">
504 <h2>Comment Settings</h2>';
505 loginizer_feature_available('Social Login for comment');
506 echo '<form method="POST" loginizer-premium-only="1">
507 <table class="form-table">
508 <tr>
509 <th scope="row"><label for="button_style_full">'.esc_html__('Show buttons', 'loginizer').'</label></th>
510 <td class="loginizer-general-settings">
511 <label><input type="checkbox" name="enable_buttons" id="enable_buttons" value="yes" '.(!empty($social_settings['comment']['enable_buttons']) ? 'checked' : '').'/></label>
512 <p>'.esc_html__('Do you want to show social buttons on Comments.', 'loginizer'). '</p>
513 </td>
514 </tr>
515 <tr>
516 <th scope="row"><label for="button_style_full">'.esc_html__('Button Style', 'loginizer').'</label></th>
517 <td class="loginizer-general-settings">
518 <label><input type="radio" name="button_style" id="button_style_full" value="full" '.(empty($social_settings['comment']['button_style']) ? 'checked' : checked($social_settings['comment']['button_style'], 'full', false)).'/>'.esc_html__('Full Length', 'loginizer').'</label>
519 <label><input type="radio" name="button_style" value="icon" '.(!empty($social_settings['comment']['button_style']) ? checked($social_settings['comment']['button_style'], 'icon', false) : '').'/>'.esc_html__('Icon', 'loginizer').'</label>
520 </td>
521 </tr>
522 <tr>
523 <th scope="row"><label for="button_shape_square">'.esc_html__('Button Shape', 'loginizer').'</label></th>
524 <td class="loginizer-general-settings">
525 <label><input type="radio" name="button_shape" id="button_shape_square" value="square" '.(empty($social_settings['comment']['button_shape']) ? 'checked' : checked($social_settings['comment']['button_shape'], 'square', false)).'>'.esc_html__('Square', 'loginizer').'</label>
526 <label><input type="radio" name="button_shape" value="circle" '.(!empty($social_settings['comment']['button_shape']) ? checked($social_settings['comment']['button_shape'], 'circle', false) : '').'>'.esc_html__('Pill/Circle', 'loginizer').'</label>
527 </td>
528 </tr>
529 </table>';
530 wp_nonce_field('loginizer_social_nonce', 'security');
531 echo '<input type="submit" class="button button-primary" name="comment_settings" value="'.esc_html__('Save Settings', 'loginizer').'"/>
532 </form>
533 </div>
534 </div>';
535
536 loginizer_page_footer();
537 }
538
539 // Checks if we can show the Status of the Social App.
540 // As if Premium verison is disabled then the status should not be visible.
541 function loginizer_show_social_status($provider){
542 if(!empty($provider['premium']) && !defined('LOGINIZER_PREMIUM')){
543 return false;
544 }
545
546 return true;
547 }
548
549 function loginizer_how_to_linkedinopenid(){
550
551 // NOTE: update the date of last updated of this doc if you make any change.
552 echo '<div>
553 <h2>'.esc_html__('Create LinkedIn App', 'loginizer').'</h2>
554 <span><b>'.esc_html__('Last Updated','loginizer').':</b> 24th June 2024</span>
555 <p>'.esc_html__('To allow your users to be able to login through their LinkedIn Account, you first need to create a LinkedIn App. For that follow the Project creation steps below.', 'loginizer').'</p>
556 <ol>
557 <li>'.esc_html__('Go to LinkedIn Apps page for that','loginizer').' <a href="https://www.linkedin.com/developers/apps" target="_blank">Navigate to https://www.linkedin.com/developers/apps</a></li>
558 <li>'.esc_html__('Once you open the Apps page, click on Create App button, which will take you to fill a form.', 'loginizer').'</li>
559 <li>'.esc_html__('On that form fill the App Name and LinkedIn page, if you dont have a linked in page then create once as its required to create a App.','loginizer').' <a href="https://www.linkedin.com/company/setup/new/" target="_blank">https://www.linkedin.com/company/setup/new/</a></li>
560 <li>'.esc_html__('After you have filled the LinkedIn page details, upload your logo and read terms and conditions and check the field which say I have read and agreed to these terms and then click on Create App','loginizer').'</li>
561 <li>'.esc_html__('You will be redirect to your App page in Product Tab, there look for "Sign In with LinkedIn using OpenID Connect" and click on Request Access, now go to the Auth tab as we need to access Oauth 2.0','loginizer').'</li>
562 <li>'.esc_html__('On the Auth tab copy the Client ID and Client Secret and place those keys in Client ID and CLient Secret of the Loginizer LinkedIn Social provider respectively and enable it and save it','loginizer').'</li>
563 <li>'.esc_html__('Now on LinkedIn Auth page you will need to add Redirect URL, for that add this URL there', 'loginizer').'<code>'.esc_url(wp_login_url()).'?lz_social_provider=LinkedInOpenID</code></li>
564 <li>'.esc_html__('After that you can test in the Loginizer dashboard to see if it is working without any issue', 'loginizer').'</li>
565 </ol>
566 </div>';
567 }
568