Example #1
0
/**
 * Social Login page of plugin in WP admin.
 */
function the_champ_social_login_page()
{
    // social login options
    global $theChampLoginOptions, $theChampFacebookOptions, $theChampIsBpActive;
    // message on saving options
    echo the_champ_settings_saved_notification();
    echo the_champ_login_notifications($theChampLoginOptions);
    require 'admin/social_login.php';
}
/**
 * Render Social Login icons HTML.
 */
function the_champ_login_button($widget = false)
{
    if (!is_user_logged_in() && the_champ_social_login_enabled()) {
        global $theChampLoginOptions;
        $html = '';
        $customInterface = apply_filters('the_champ_login_interface_filter', '', $theChampLoginOptions, $widget);
        if ($customInterface != '') {
            $html = $customInterface;
        } elseif (isset($theChampLoginOptions['providers']) && is_array($theChampLoginOptions['providers']) && count($theChampLoginOptions['providers']) > 0) {
            $html = the_champ_login_notifications($theChampLoginOptions);
            if (!$widget) {
                $html .= '<div class="the_champ_outer_login_container">';
                if (isset($theChampLoginOptions['title']) && $theChampLoginOptions['title'] != '') {
                    $html .= '<div class="the_champ_social_login_title">' . $theChampLoginOptions['title'] . '</div>';
                }
            }
            $html .= '<div class="the_champ_login_container"><ul class="the_champ_login_ul">';
            if (isset($theChampLoginOptions['providers']) && is_array($theChampLoginOptions['providers']) && count($theChampLoginOptions['providers']) > 0) {
                foreach ($theChampLoginOptions['providers'] as $provider) {
                    $html .= '<li><i ';
                    // id
                    if ($provider == 'google') {
                        $html .= 'id="theChamp' . ucfirst($provider) . 'Button" ';
                    }
                    // class
                    $html .= 'class="theChampLogin theChamp' . ucfirst($provider) . 'Background theChamp' . ucfirst($provider) . 'Login" ';
                    $html .= 'alt="Login with ';
                    $html .= ucfirst($provider);
                    $html .= '" title="Login with ';
                    if ($provider == 'live') {
                        $html .= 'Windows Live';
                    } else {
                        $html .= ucfirst($provider);
                    }
                    if (current_filter() == 'comment_form_top' || current_filter() == 'comment_form_must_log_in_after') {
                        $html .= '" onclick="theChampCommentFormLogin = true; theChampInitiateLogin(this)" >';
                    } else {
                        $html .= '" onclick="theChampInitiateLogin(this)" >';
                    }
                    $html .= '<ss style="display:block" class="theChampLoginSvg theChamp' . ucfirst($provider) . 'LoginSvg"></ss></i></li>';
                }
            }
            $html .= '</ul></div>';
            if (!$widget) {
                $html .= '</div><div style="clear:both; margin-bottom: 6px"></div>';
            }
        }
        if (!$widget) {
            echo $html;
        } else {
            return $html;
        }
    }
}