예제 #1
0
 /**
  * Callback for Social Linking widget shortcode
  */
 public static function linking_widget_shortcode()
 {
     global $loginRadiusObject, $loginradius_api_settings, $lr_custom_interface_settings;
     if (!is_user_logged_in()) {
         return '';
     }
     $custom = false;
     if (isset($lr_custom_interface_settings['custom_interface']) && $lr_custom_interface_settings['custom_interface'] == '1') {
         $custom = true;
     }
     $html = LR_Common::check_linking_status_parameters();
     if (!($loginRadiusObject->loginradius_is_valid_guid(trim($loginradius_api_settings['LoginRadius_apikey'])) && $loginRadiusObject->loginradius_is_valid_guid(trim($loginradius_api_settings['LoginRadius_secret'])))) {
         $html .= '<div style="color:red">' . __('Your LoginRadius API key or secret is not valid, please correct it or contact LoginRadius support at <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b>', 'LoginRadius') . '</div>';
     }
     // function call
     LR_Common::link_account_if_possible();
     if (!($loginRadiusObject->loginradius_is_valid_guid(trim($loginradius_api_settings['LoginRadius_apikey'])) && $loginRadiusObject->loginradius_is_valid_guid(trim($loginradius_api_settings['LoginRadius_secret'])))) {
         $html .= '<div style="color:red">' . __('Your LoginRadius API key or secret is not valid, please correct it or contact LoginRadius support at <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b>', 'LoginRadius') . '</div>';
     }
     $html .= Login_Helper::get_loginradius_interface_container(true);
     $html .= '<table class="loginRadiusLinking">';
     $html .= LR_Common::get_connected_providers_list();
     $html .= '</table>';
     return $html;
 }
        /**
         * Displaying account linking on profile page
         */
        public static function account_linking_info_on_profile_page()
        {
            global $pagenow, $lr_custom_interface_settings;
            $user_Id = get_current_user_id();
            if (isset($loginRadiusSettings['LoginRadius_socialLinking']) && $loginRadiusSettings['LoginRadius_socialLinking'] == '1' || !$user_Id == '1') {
                return;
            }
            $custom = false;
            if (isset($lr_custom_interface_settings['custom_interface']) && $lr_custom_interface_settings['custom_interface'] == '1') {
                $custom = true;
            }
            if ($pagenow == 'profile.php') {
                if (!class_exists('LR_Raas_Install')) {
                    echo LR_Common::check_linking_status_parameters();
                    // If remove button clicked
                    if (isset($_GET['loginRadiusMap']) && !empty($_GET['loginRadiusMap']) && isset($_GET['loginRadiusMappingProvider']) && !empty($_GET['loginRadiusMappingProvider'])) {
                        Login_Helper::unlink_provider();
                    }
                    LR_Common::link_account_if_possible();
                    ?>
                    <div class="metabox-holder columns-2" id="post-body">
                        <div class="stuffbox wrap" style="padding-bottom:10px">
                            <h3><label><?php 
                    _e('Link your account', 'LoginRadius');
                    ?>
</label></h3>
                            <div class="inside" style='padding:0'>
                                <table  class="form-table editcomment">
                                    <tr>
                                        <td colspan="2"><?php 
                    _e('By adding another account, you can log in with the new account as well!', 'LoginRadius');
                    ?>
</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <?php 
                    if (!class_exists("Login_Helper")) {
                        require_once LOGINRADIUS_PLUGIN_DIR . 'public/inc/login/class-login-helper.php';
                    }
                    Login_Helper::get_loginradius_interface_container();
                    ?>
                                        </td>
                                    </tr>
                                    <?php 
                    echo LR_Common::get_connected_providers_list();
                    ?>
                                </table>
                            </div>
                        </div>
                    </div>
                    <?php 
                } else {
                    do_action('lr_raas_social_linking');
                }
            }
        }
 /**
  * Perform linking operation and return parameters if account mapped or not accordingly
  */
 public static function perform_linking_operation()
 {
     // Public function call.
     if (LR_Common::link_account_if_possible() === true) {
         $linked = 1;
     } else {
         $linked = 0;
     }
     $redirectionUrl = LR_Common::get_protocol() . htmlspecialchars($_SERVER['HTTP_HOST']) . remove_query_arg('lrlinked');
     if (strpos($redirectionUrl, '?') !== false) {
         $redirectionUrl .= '&lrlinked=' . $linked;
     } else {
         $redirectionUrl .= '?lrlinked=' . $linked;
     }
     wp_redirect($redirectionUrl);
     exit;
 }