PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 3.2.1
Wp Social Login and Register Social Counter v3.2.1
3.2.1 trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / inc / admin-social-button.php
wp-social / inc Last commit date
elementor 3 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 1 week ago admin-custom-function.php 1 week ago admin-rest-api.php 1 week ago admin-settings.php 2 years ago admin-social-button.php 1 week ago admin-social-enque-script.php 5 years ago counter-widget.php 1 week ago counter.php 1 week ago custom-function.php 5 years ago login-widget.php 3 years ago login.php 5 years ago share-widget.php 1 week ago share.php 1 week ago
admin-social-button.php
516 lines
1 <?php
2
3 defined('ABSPATH') || exit;
4
5 /**
6 * Class Name : xs_button_in_login_page;
7 * Class Details : this class for showing login button in login and register page for wp, woocommerce, buddyPress and others
8 *
9 * @params : void
10 * @return : void
11 *
12 * @since : 1.0
13 */
14 class xs_button_in_login_page {
15
16 /**
17 * Method Name : xs_addLoginButton
18 * Method Details : added social button with hide Current URL
19 *
20 * @params : void
21 * @return : void
22 *
23 * @since : 1.0
24 */
25 public static function xs_addLoginButton() {
26 echo xs_social_login_shortcode_widget(['all'], '', 'hide'); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- ignoring due to shortcode
27 }
28
29 /**
30 * Method Name : xs_addLoginButton_on
31 * Method Details : added social button with Show Current URL
32 *
33 * @params : void
34 * @return : void
35 *
36 * @since : 1.0
37 */
38 public static function xs_addLoginButton_on() {
39 echo xs_social_login_shortcode_widget(['all'], '', 'show'); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- ignoring due to shortcode
40 }
41
42 /**
43 * Method Name : xs_login_form_login_wp
44 * Method Details : For added social button in wp-login page
45 *
46 * @params : String $type.
47 * @return : void
48 *
49 * @since : 1.0
50 */
51 public static function xs_login_form_login_wp($type = 'login_form') {
52
53 add_action('login_enqueue_scripts', 'xs_my_global_stylesheet');
54
55 switch($type):
56 case 'login_form':
57 add_action('login_enqueue_scripts', 'xs_my_login_stylesheet');
58 add_filter('login_form', 'xs_button_in_login_page::xs_addLoginButton');
59 break;
60 case 'login_footer':
61 add_filter('login_footer', 'xs_button_in_login_page::xs_addLoginButton');
62 break;
63 case 'login_head_top':
64 //add_action( 'login_enqueue_scripts', 'xs_my_login_stylesheet' );
65 add_filter('login_head', 'xs_button_in_login_page::xs_addLoginButton');
66 break;
67 case 'login_form_middle':
68 add_filter('login_form_middle', 'xs_button_in_login_page::xs_addLoginButton');
69 break;
70 case 'login_form_bottom':
71 add_filter('login_form_bottom', 'xs_button_in_login_page::xs_addLoginButton');
72 break;
73 case 'login_head':
74 add_filter('login_head', 'xs_button_in_login_page::xs_addLoginButton');
75 break;
76 case 'login_message':
77 add_filter('login_message', 'xs_button_in_login_page::xs_addLoginButton');
78 break;
79 default:
80 add_action('login_enqueue_scripts', 'xs_my_login_stylesheet');
81 add_filter('login_form', 'xs_button_in_login_page::xs_addLoginButton');
82 break;
83 endswitch;
84
85 }
86
87 /**
88 * Method Name : xs_login_form_register_wp
89 * Method Details : For added social button in wp-register page
90 *
91 * @params : String $type.
92 * @return : void
93 *
94 * @since : 1.0
95 */
96 public static function xs_login_form_register_wp($type = 'register_form') {
97
98 add_action('login_enqueue_scripts', 'xs_my_global_stylesheet');
99
100 switch($type):
101 case 'register_form':
102 add_filter('register_form', 'xs_button_in_login_page::xs_addLoginButton');
103 break;
104 case 'register_head':
105 add_action('login_enqueue_scripts', 'xs_my_login_stylesheet');
106 add_filter('register_form', 'xs_button_in_login_page::xs_addLoginButton');
107 break;
108 case 'register_footer':
109 add_filter('login_footer', 'xs_button_in_login_page::xs_addLoginButton');
110 break;
111 default:
112 add_filter('register_form', 'xs_button_in_login_page::xs_addLoginButton');
113 break;
114 endswitch;
115
116 }
117
118 /**
119 * Method Name : xs_login_form_login_wp
120 * Method Details : For added social button in wp-login page
121 *
122 * @params : String $type.
123 * @return : void
124 *
125 * @since : 1.0
126 */
127 public static function wfp_login_form_login_wp($type = 'wfp_login_form_end') {
128 add_action('login_enqueue_scripts', 'xs_my_global_stylesheet');
129 switch($type):
130 case 'wfp_login_form_before_outer':
131 //add_action( 'login_enqueue_scripts', 'xs_my_login_stylesheet' );
132 add_action('wfp_login_form_before_outer', 'xs_button_in_login_page::xs_addLoginButton');
133 break;
134 case 'wfp_login_form_after_outer':
135 //add_action( 'login_enqueue_scripts', 'xs_my_login_stylesheet' );
136 add_action('wfp_login_form_after_outer', 'xs_button_in_login_page::xs_addLoginButton');
137 break;
138 case 'wfp_login_form_before_inner':
139 //add_action( 'login_enqueue_scripts', 'xs_my_login_stylesheet' );
140 add_action('wfp_login_form_before_inner', 'xs_button_in_login_page::xs_addLoginButton');
141 break;
142 case 'wfp_login_form_after_inner':
143 add_action('wfp_login_form_after_inner', 'xs_button_in_login_page::xs_addLoginButton');
144 break;
145 case 'wfp_login_form_start':
146 add_action('wfp_login_form_start', 'xs_button_in_login_page::xs_addLoginButton');
147 break;
148 case 'wfp_login_form_end':
149 add_action('wfp_login_form_end', 'xs_button_in_login_page::xs_addLoginButton');
150 break;
151 case 'wfp_login_form_button_before':
152 add_action('wfp_login_form_button_before', 'xs_button_in_login_page::xs_addLoginButton');
153 break;
154 case 'wfp_login_form_button_after':
155 add_action('wfp_login_form_button_after', 'xs_button_in_login_page::xs_addLoginButton');
156 break;
157 case 'wfp_login_form_message':
158 add_action('wfp_login_form_message', 'xs_button_in_login_page::xs_addLoginButton');
159 break;
160 default:
161 //add_action( 'login_enqueue_scripts', 'xs_my_login_stylesheet' );
162 add_filter('wfp_login_form_button_after', 'xs_button_in_login_page::xs_addLoginButton');
163 break;
164 endswitch;
165
166 }
167
168 /**
169 * Method Name : xs_login_form_comment_wp
170 * Method Details : For added social button in wp-comment page
171 *
172 * @params : String $type.
173 * @return : void
174 *
175 * @since : 1.0
176 */
177 public static function xs_login_form_comment_wp($type = 'comment_form_top') {
178
179 switch($type):
180 case 'comment_form_top':
181 add_filter('comment_form_top', 'xs_button_in_login_page::xs_addLoginButton_on');
182 break;
183 case 'comment_form_must_log_in_after':
184 add_filter('comment_form_must_log_in_after', 'xs_button_in_login_page::xs_addLoginButton_on');
185 break;
186
187 default:
188 add_filter('comment_form_top', 'xs_button_in_login_page::xs_addLoginButton_on');
189 break;
190
191 endswitch;
192
193
194 }
195
196
197 /**
198 * Method Name : xs_login_form_login_woo
199 * Method Details : For added social button in woocommerce login form page
200 *
201 * @params : String $type.
202 * @return : void
203 *
204 * @since : 1.0
205 */
206 public static function xs_login_form_login_woo($type = 'woocommerce_login_form') {
207
208 switch($type):
209 case 'woocommerce_register_form':
210 add_filter('woocommerce_register_form', 'xs_button_in_login_page::xs_addLoginButton_on');
211 break;
212 case 'woocommerce_register_form_start':
213 add_filter('woocommerce_register_form_start', 'xs_button_in_login_page::xs_addLoginButton_on');
214 break;
215 case 'woocommerce_register_form_end':
216 add_filter('woocommerce_register_form_end', 'xs_button_in_login_page::xs_addLoginButton_on');
217 break;
218 case 'woocommerce_login_form':
219 add_filter('woocommerce_login_form', 'xs_button_in_login_page::xs_addLoginButton_on');
220 break;
221 case 'woocommerce_login_form_start':
222 add_filter('woocommerce_login_form_start', 'xs_button_in_login_page::xs_addLoginButton_on');
223 break;
224 case 'woocommerce_login_form_end':
225 add_filter('woocommerce_login_form_end', 'xs_button_in_login_page::xs_addLoginButton_on');
226 break;
227 case 'woocommerce_before_checkout_billing_form':
228 add_filter('woocommerce_before_checkout_billing_form', 'xs_button_in_login_page::xs_addLoginButton_on');
229 break;
230 case 'woocommerce_after_checkout_billing_form':
231 add_filter('woocommerce_after_checkout_billing_form', 'xs_button_in_login_page::xs_addLoginButton_on');
232 break;
233 default :
234 add_filter('woocommerce_login_form', 'xs_button_in_login_page::xs_addLoginButton_on');
235 break;
236 endswitch;
237
238 }
239
240
241 /**
242 * Method Name : xs_login_form_login_buddy
243 * Method Details : For added social button in BuddyPress form page
244 *
245 * @params : String $type.
246 * @return : void
247 *
248 * @since : 1.0
249 */
250 public static function xs_login_form_login_buddy($type = 'bp_before_register_page') {
251
252 switch($type):
253 case 'bp_before_register_page':
254 add_filter('bp_before_register_page', 'xs_button_in_login_page::xs_addLoginButton');
255 break;
256 case 'bp_before_account_details_fields':
257 add_filter('bp_before_account_details_fields', 'xs_button_in_login_page::xs_addLoginButton');
258 break;
259 case 'bp_after_register_page':
260 add_filter('bp_after_register_page', 'xs_button_in_login_page::xs_addLoginButton');
261 break;
262 default:
263 add_filter('bp_before_register_page', 'xs_button_in_login_page::xs_addLoginButton');
264 break;
265
266 endswitch;
267
268
269 }
270
271 /**
272 * Method Name : xs_add_elementskit_login_button
273 * Method Details : Callback for ElementsKit login form render action
274 *
275 * @params : array $settings ElementsKit widget settings
276 * @params : string $widget_id ElementsKit widget ID
277 * @return : void
278 *
279 * @since : 4.0
280 */
281 public static function xs_add_elementskit_login_button($settings, $widget_id) {
282 // Check if social login is enabled in widget settings
283 if ( isset( $settings['ekit_login_wp_social_login'] ) && 'yes' === $settings['ekit_login_wp_social_login'] ) {
284 // Render social login buttons for ElementsKit
285 self::xs_render_elementskit_social_buttons();
286 }
287 }
288
289 /**
290 * Method Name : xs_add_elementskit_register_button
291 * Method Details : Callback for ElementsKit register form render action
292 *
293 * @params : array $settings ElementsKit widget settings
294 * @params : string $widget_id ElementsKit widget ID
295 * @return : void
296 *
297 * @since : 4.0
298 */
299 public static function xs_add_elementskit_register_button($settings, $widget_id) {
300 // Check if social login is enabled in widget settings
301 if ( isset( $settings['ekit_register_wp_social_login'] ) && 'yes' === $settings['ekit_register_wp_social_login'] ) {
302 // Render social login buttons for ElementsKit
303 self::xs_render_elementskit_social_buttons();
304 }
305 }
306
307 /**
308 * Method Name : xs_render_elementskit_social_buttons
309 * Method Details : Render social buttons for ElementsKit forms (bypass login/logout checks)
310 *
311 * @params : void
312 * @return : void
313 *
314 * @since : 4.0
315 */
316 public static function xs_render_elementskit_social_buttons() {
317
318 $provider_data = \WP_Social\App\Settings::get_login_settings_data();
319 $style_data = get_option('xs_style_setting_data', []);
320 $currentStyle = isset($style_data['login_button_style']) ? $style_data['login_button_style'] : 'style-1';
321 $className = 'xs-login xs-login--' . $currentStyle;
322
323 $core_provider = \WP_Social\App\Providers::get_core_providers_login();
324 $enabled_providers = \WP_Social\App\Settings::get_enabled_provider_conf_login();
325
326 ?>
327 <div id="xs-social-login-container">
328 <div class="<?php echo esc_attr($className); ?>">
329 <?php
330 // Loop through all providers and show only enabled ones
331 foreach($core_provider AS $keyType => $valueType):
332 if(!empty($enabled_providers[$keyType]['enable'])):
333 $args = [
334 'label' => isset($provider_data[$keyType]['login_label']) ? $provider_data[$keyType]['login_label'] : 'Login with <b>' . $valueType . '</b>',
335 'icon' => '<i class="met-social met-social-' . $keyType . '"></i>',
336 'clrClass' => 'wslu-color-scheme--' . $keyType,
337 'url' => get_home_url() . '/wp-json/wslu-social-login/type/' . $keyType,
338 ];
339
340 $style_file_path = WSLU_LOGIN_PLUGIN . '/template/login/screens/default.php';
341 if(file_exists($style_file_path)) {
342 require($style_file_path);
343 }
344 endif;
345 endforeach;
346 ?>
347 </div>
348 </div>
349 <?php
350 }
351
352 /**
353 * Method Name : xs_login_form_elementskit
354 * Method Details : For added social button in ElementsKit login form widget
355 *
356 * @params : void
357 * @return : void
358 *
359 * @since : 4.0
360 */
361 public static function xs_login_form_elementskit() {
362
363 if (!function_exists('is_plugin_active')) {
364 require_once ABSPATH . 'wp-admin/includes/plugin.php';
365 }
366
367 if (is_plugin_active('elementskit/elementskit.php')) {
368 add_action('elementskit/login_form/render', 'xs_button_in_login_page::xs_add_elementskit_login_button', 10, 2);
369 }
370 }
371
372 /**
373 * Method Name : xs_register_form_elementskit
374 * Method Details : For added social button in ElementsKit register form widget
375 *
376 * @params : void
377 * @return : void
378 *
379 * @since : 4.0
380 */
381 public static function xs_register_form_elementskit() {
382
383 if (!function_exists('is_plugin_active')) {
384 require_once ABSPATH . 'wp-admin/includes/plugin.php';
385 }
386
387 if (is_plugin_active('elementskit/elementskit.php')) {
388 add_action('elementskit/register_form/render', 'xs_button_in_login_page::xs_add_elementskit_register_button', 10, 2);
389 }
390 }
391
392
393 }
394
395 if(class_exists('xs_button_in_login_page')) {
396
397 // action hooks for load global css file
398 add_action('wp_enqueue_scripts', 'xs_my_global_stylesheet');
399 /**
400 * Variable Name : $xs_login_admin_page
401 * Variable Type : Array
402 * @return : array() $xs_login_admin_page . Get array from socail global setting data "xs_global_setting_data"
403 *
404 * @since : 1.0
405 */
406 $xs_login_admin_page = get_option('xs_global_setting_data');
407
408 /**
409 * Variable Name : $enable_woocmarce_login
410 * Variable Type : int()
411 * @return : int $enable_woocmarce_login Enable 0,1
412 *
413 * @since : 1.0
414 */
415 $enable_woocmarce_login = isset($xs_login_admin_page['woocommerce_login_page']['enable']) ? $xs_login_admin_page['woocommerce_login_page']['enable'] : 0;
416 if($enable_woocmarce_login) {
417 $enable_woocmarce_login_type = isset($xs_login_admin_page['woocommerce_login_page']['data']) ? $xs_login_admin_page['woocommerce_login_page']['data'] : 'woocommerce_login_form_end';
418 xs_button_in_login_page::xs_login_form_login_woo($enable_woocmarce_login_type);
419 }
420 /**
421 * Variable Name : $enable_woocmarce_register
422 * Variable Type : int()
423 * @return : int $enable_woocmarce_register Enable 0,1
424 *
425 * @since : 1.0
426 */
427 $enable_woocmarce_register = isset($xs_login_admin_page['woocommerce_register_page']['enable']) ? $xs_login_admin_page['woocommerce_register_page']['enable'] : 0;
428 if($enable_woocmarce_register) {
429 $enable_woocmarce_register_type = isset($xs_login_admin_page['woocommerce_register_page']['data']) ? $xs_login_admin_page['woocommerce_register_page']['data'] : 'woocommerce_register_form_end';
430 xs_button_in_login_page::xs_login_form_login_woo($enable_woocmarce_register_type);
431 }
432 /**
433 * Variable Name : $enable_woocmarce_billing
434 * Variable Type : int()
435 * @return : int $enable_woocmarce_billing Enable 0,1
436 *
437 * @since : 1.0
438 */
439 $enable_woocmarce_billing = isset($xs_login_admin_page['woocommerce_billing_page']['enable']) ? $xs_login_admin_page['woocommerce_billing_page']['enable'] : 0;
440 if($enable_woocmarce_billing) {
441 $enable_woocmarce_billing_type = isset($xs_login_admin_page['woocommerce_billing_page']['data']) ? $xs_login_admin_page['woocommerce_billing_page']['data'] : 'woocommerce_after_checkout_billing_form';
442 xs_button_in_login_page::xs_login_form_login_woo($enable_woocmarce_billing_type);
443 }
444 /**
445 * Variable Name : $enable_wp_login
446 * Variable Type : int()
447 * @return : int $enable_wp_login Enable 0,1
448 *
449 * @since : 1.0
450 */
451 $enable_wp_login = isset($xs_login_admin_page['wp_login_page']['enable']) ? $xs_login_admin_page['wp_login_page']['enable'] : 0;
452 if($enable_wp_login) {
453 $enable_wp_login_type = isset($xs_login_admin_page['wp_login_page']['data']) ? $xs_login_admin_page['wp_login_page']['data'] : 'login_form';
454 xs_button_in_login_page::xs_login_form_login_wp($enable_wp_login_type);
455 }
456
457 /**
458 * Variable Name : $enable_wp_register
459 * Variable Type : int()
460 * @return : int $enable_wp_register Enable 0,1
461 *
462 * @since : 1.0
463 */
464 $enable_wp_register = isset($xs_login_admin_page['wp_register_page']['enable']) ? $xs_login_admin_page['wp_register_page']['enable'] : 0;
465 if($enable_wp_register) {
466 //xs_button_in_login_page::$showFilter = 'hide';
467 $enable_wp_register_type = isset($xs_login_admin_page['wp_register_page']['data']) ? $xs_login_admin_page['wp_register_page']['data'] : 'register_form';
468 xs_button_in_login_page::xs_login_form_register_wp($enable_wp_register_type);
469 }
470
471 /**
472 * Variable Name : $enable_wfp_login
473 * Variable Type : int()
474 * @return : int $enable_wp_register Enable 0,1
475 *
476 * @since : 1.0
477 */
478 $enable_wfp_login = isset($xs_login_admin_page['wfp_fund_login_page']['enable']) ? $xs_login_admin_page['wfp_fund_login_page']['enable'] : 0;
479 if($enable_wfp_login) {
480 $enable_wfp_login_type = isset($xs_login_admin_page['wfp_fund_login_page']['data']) ? $xs_login_admin_page['wfp_fund_login_page']['data'] : 'wfp_login_form_end';
481 xs_button_in_login_page::wfp_login_form_login_wp($enable_wfp_login_type);
482 }
483
484 /**
485 * Variable Name : $enable_wp_comment
486 * Variable Type : int()
487 * @return : int $enable_wp_comment Enable 0,1
488 *
489 * @since : 1.0
490 */
491 $enable_wp_comment = isset($xs_login_admin_page['wp_comment_page']['enable']) ? $xs_login_admin_page['wp_comment_page']['enable'] : 0;
492 if($enable_wp_comment) {
493 $enable_wp_comment_type = isset($xs_login_admin_page['wp_comment_page']['data']) ? $xs_login_admin_page['wp_comment_page']['data'] : 'comment_form_top';
494 xs_button_in_login_page::xs_login_form_comment_wp($enable_wp_comment_type);
495 }
496
497
498 /**
499 * Variable Name : $enable_buddyPress_register
500 * Variable Type : int()
501 * @return : int $enable_buddyPress_register Enable 0,1
502 *
503 * @since : 1.0
504 */
505 $enable_buddyPress_register = isset($xs_login_admin_page['buddypress_page']['enable']) ? $xs_login_admin_page['buddypress_page']['enable'] : 0;
506 if($enable_buddyPress_register) {
507 $enable_buddyPress_register_type = isset($xs_login_admin_page['buddypress_page']['data']) ? $xs_login_admin_page['buddypress_page']['data'] : 'bp_before_register_page';
508 xs_button_in_login_page::xs_login_form_login_buddy($enable_buddyPress_register_type);
509 }
510
511 // Enable ElementsKit integrations (independent of wp-login/register settings)
512 xs_button_in_login_page::xs_login_form_elementskit();
513 xs_button_in_login_page::xs_register_form_elementskit();
514
515 }
516