PluginProbe
Loginizer / 2.0.2
Loginizer v2.0.2
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 1.3.3 1.3.4 All 74 releases
← All changes | functions.php +44 -10 2.0.02.0.2 View file →
@@ -491,9 +491,9 @@
491 491 }
492 492
493 493 // ------ HTML STARTS HERE -------- //
494 494
495 - $style = 'full';
495 + $style = 'icon';
496 496 $shape = 'square';
497 497 $position = 'below';
498 498 if(!empty($loginizer['social_settings'])){
499 499 $social_settings = $loginizer['social_settings'];
@@ -498,10 +498,10 @@
498 498 if(!empty($loginizer['social_settings'])){
499 499 $social_settings = $loginizer['social_settings'];
500 500
501 501 // Setting Button Style
502 - if(!empty($social_settings[$page_type]['button_style']) && $social_settings[$page_type]['button_style'] === 'icon'){
503 - $style = 'icon';
502 + if(!empty($social_settings[$page_type]['button_style']) && $social_settings[$page_type]['button_style'] === 'full'){
503 + $style = 'full';
504 504 }
505 505
506 506 // Setting Button Shape
507 507 if(!empty($social_settings[$page_type]['button_shape']) && $social_settings[$page_type]['button_shape'] !== 'square'){
@@ -513,8 +513,11 @@
513 513 $position = $social_settings[$page_type]['button_position'];
514 514 }
515 515 }
516 516
517 + $container_alignment = isset($loginizer['social_settings'][$page_type]['alignment']) ? $loginizer['social_settings'][$page_type]['alignment'] : 'auto';
518 + $button_alignment = isset($loginizer['social_settings'][$page_type]['button_alignment']) ? $loginizer['social_settings'][$page_type]['button_alignment'] : 'center';
519 +
517 520 // Shortcode style
518 521 if(!empty($short_atts['type'])){
519 522 $style = esc_html($short_atts['type']);
520 523 }
@@ -522,8 +525,18 @@
522 525 // Shortcode Shape square or circle
523 526 if(!empty($short_atts['shape'])){
524 527 $shape = esc_html($short_atts['shape']);
525 528 }
529 +
530 + // Shortcode for Container alignment
531 + if(!empty($short_atts['container_alignment'])){
532 + $container_alignment = esc_html($short_atts['container_alignment']);
533 + }
534 +
535 + // Shortcode for Button alignment
536 + if(!empty($short_atts['button_alignment'])){
537 + $button_alignment = esc_html($short_atts['button_alignment']);
538 + }
526 539
527 540 // Setting divider position
528 541 $divider_pos = '';
529 542 if(!empty($short_atts['divider']) && $short_atts['divider'] == 'above'){
@@ -542,9 +555,9 @@
542 555 'above' => 'bottom',
543 556 'below' => 'top'
544 557 ];
545 558
546 - $social_buttons = '<div id="lz-social-login-btns" class="'.($style == 'icon' ? 'lz-social-login-btns-icon' : 'lz-social-login-btns-full').' '.($position == 'above' || $position == 'below' ? 'lz-social-'.$padding[$position].'-padding' : '').'">';
559 + $social_buttons = '<div id="lz-social-login-btns" class="'.($style == 'icon' ? 'lz-social-login-btns-icon' : 'lz-social-login-btns-full').' '.($position == 'above' || $position == 'below' ? 'lz-social-'.$padding[$position].'-padding' : '').'" style="justify-self:'.esc_attr($container_alignment).'; justify-content:'.esc_attr($button_alignment).';">';
547 560
548 561 // HTML of the divider in case the buttons are below the login fields
549 562 if(!empty($divider_pos) && $divider_pos == 'above'){
550 563 $social_buttons .= '<div class="loginizer-social-divider">OR</div><br>';
@@ -579,9 +592,9 @@
579 592 $img_url = LOGINIZER_URL .'/assets/images/social/'.$provider.'-'.$btn_style.'.png';
580 593 }
581 594 }
582 595
583 - $social_buttons .= '<div class="loginizer-social-button '.($style == 'icon' ? 'lz-social-button-icon' : 'lz-social-button-btn').' '.($shape == 'circle' ? 'lz-social-button-icon-circle' : 'lz-social-button-icon-square').'" onclick="loginizer_auth_popup(\''.esc_js($provider).'\')" style="'.((!empty($loginizer_login_providers[$provider]['styles']) && !empty($loginizer_login_providers[$provider]['styles'][$btn_style])) ? esc_attr($loginizer_login_providers[$provider]['styles'][$btn_style]) : esc_attr('background-color:'. esc_attr($color)). '; color:#FFF;') .'">
596 + $social_buttons .= '<div class="loginizer-social-button '.($style == 'icon' ? 'lz-social-button-icon' : 'lz-social-button-btn').' '.($shape == 'circle' ? 'lz-social-button-icon-circle' : 'lz-social-button-icon-square').'" onclick="loginizer_auth_popup(\''.esc_js($provider).'\', '.esc_js(!empty($settings['loginizer_social_key']) ? true : 0).')" style="'.((!empty($loginizer_login_providers[$provider]['styles']) && !empty($loginizer_login_providers[$provider]['styles'][$btn_style])) ? esc_attr($loginizer_login_providers[$provider]['styles'][$btn_style]) : esc_attr('background-color:'. esc_attr($color)). '; color:#FFF;') .'">
584 597 <div class="loginizer-social-btn-logo">
585 598 <img src="'.esc_url($img_url).'" height="24" alt="'.esc_attr($name).' Icon"/>
586 599 </div>';
587 600
@@ -592,9 +605,9 @@
592 605 }
593 606
594 607 $social_buttons .= '</div>';
595 608 }
596 -
609 +
597 610 if(empty($social_buttons)){
598 611 $social_buttons .= esc_html__('No Auth Provider configured', 'loginizer');
599 612 }
600 613
@@ -641,14 +654,24 @@
641 654
642 655 wp_register_script('loginizer-social-js', '', ['jquery'], LOGINIZER_VERSION, ['strategy' => false, 'in_footer' => true]);
643 656 wp_enqueue_script('loginizer-social-js');
644 657 wp_add_inline_script('loginizer-social-js', '
658 +
659 +
645 660
646 661 let lz_form = document.querySelectorAll("#loginform, #registerform, .woocommerce-form-login, .woocommerce-form-register, #front-login-form, #setupform"),
647 662 lz_social_btns = document.querySelectorAll("#lz-social-login-btns"),
648 663 lz_target_window = "'.esc_html($target_window).'",
649 664 lz_is_interim = "'.(!empty($_GET['interim-login']) ? '&interim-login=0' : '').'"; // as for interim it should only open a popup
665 +
666 + if(lz_target_window == "same"){
667 + let loader = "<style>#loginizer-social-loader-wrap{display:none; align-items:center; justify-content:center; position:fixed; top:0; left:0; width:100%; height:100vh; background-color:rgba(0, 0, 0, 0.2);} .loginizer-social-loader{width:48px;height:48px;border:5px solid #fff;border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:1s linear infinite rotation}@keyframes rotation{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style>";
668 + loader += "<div id=\"loginizer-social-loader-wrap\"><div class=\"loginizer-social-loader\"></div></div>";
650 669
670 + jQuery("body").append(loader);
671 + }
672 +
673 +
651 674 lz_social_btns.forEach((btns) => {
652 675 btns.style.display="flex";
653 676 });
654 677
@@ -660,11 +683,22 @@
660 683 }
661 684 });
662 685 }
663 686
664 - function loginizer_auth_popup(provider) {
687 + function loginizer_auth_popup(provider, isAPI) {
688 + let target_url = "'.esc_url(wp_login_url()).'?social_security='.esc_html($social_nonce).'&lz_social_provider=" + provider+lz_is_interim;
689 +
690 + if(isAPI){
691 + target_url += "&lz_api=1";
692 + }
693 +
694 + target_url += "&ref='.esc_url((is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']).'"
695 +
665 696 if(lz_target_window == "same"){
666 - window.location.href = "'.esc_url(wp_login_url()).'?social_security='.esc_html($social_nonce).'&lz_social_provider="+ provider +"&ref='.esc_url($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']).'";
697 + jQuery("#loginizer-social-loader-wrap").css("display", "flex");
698 +
699 + window.location.href = target_url;
700 +
667 701 return;
668 702 }
669 703
670 704 let screen_x = window.screenX !== undefined ? window.screenX : window.screenLeft,
@@ -686,9 +720,9 @@
686 720 attributes.push("left=" + left);
687 721 attributes.push("top=" + right);
688 722 attributes.push("scrollbars=1");
689 723
690 - var auth_window = window.open("'.esc_url(wp_login_url()).'?social_security='.esc_html($social_nonce).'&lz_social_provider=" + provider+lz_is_interim+"&ref='.esc_url($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']).'", "authWindow", attributes.join(","));
724 + var auth_window = window.open(target_url, "authWindow", attributes.join(","));
691 725
692 726 if(window.focus){
693 727 auth_window.focus();
694 728 }
@@ -729,5 +763,5 @@
729 763
730 764 // Cleaning the error data
731 765 delete_site_transient($error_identifier); // Deleting the data
732 766 //setcookie('lz_social_error', '', time() - 300, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true); // have to delete
733 -}
767 +}