function social_login_init()
 {
     if (isset($_GET['hsl_login'])) {
         // && !is_user_logged_in()){
         switch ($_GET['hsl_login']) {
             case 'naver':
                 if (!class_exists('NaverOAuth')) {
                     require_once dirname(__FILE__) . '/class.naveroauth.php';
                 }
                 session_start();
                 $connection = new NaverOAuth($consumer_key, $consumer_secret);
                 $connection->set_state();
                 $request_token_info = $connection->getRequestToken($callback_url);
                 $_SESSION['oauth_token'] = $token = $request_token_info['oauth_token'];
                 $_SESSION['oauth_token_secret'] = $request_token_info['oauth_token_secret'];
                 header('Location:' . $connection->authorizeURL() . '&oauth_token=' . $request_token_info['oauth_token']);
                 //header('Location:'.$connection->authorizeURL().'&client_id='.$consumer_key);
                 die;
                 break;
             case 'facebook':
                 if (!class_exists('Facebook')) {
                     require_once dirname(__FILE__) . '/facebook/facebook.php';
                 }
                 $hotpack_social_login = get_option('hotpack_social_login');
                 $facebook = new Facebook(array('appId' => $hotpack_social_login['facebook']['consumer_key'], 'secret' => $hotpack_social_login['facebook']['consumer_secret']));
                 $parameters = array('scope' => 'email, public_profile, user_friends', 'redirect_uri' => home_url('?hsl_callback=facebook'), 'display' => 'page');
                 $loginUrl = $facebook->getLoginUrl($parameters);
                 header('Location:' . $loginUrl);
                 die;
                 break;
             case 'twitter':
                 if (!class_exists('TwitterOAuth')) {
                     require_once dirname(__FILE__) . '/class.twitteroauth.php';
                 }
                 session_start();
                 $twitter = new TwitterOAuth($consumer_key, $consumer_secret);
                 $tokens = $twitter->requestToken();
                 $_SESSION['oauth_token'] = $token = $tokens['oauth_token'];
                 $_SESSION['oauth_token_secret'] = $tokens['oauth_token_secret'];
                 header('Location:' . $twitter->authorizeUrl($tokens));
                 die;
                 break;
             case 'google':
                 if (!class_exists('GoogleOAuth')) {
                     require_once dirname(__FILE__) . '/class.googleoauth.php';
                 }
                 session_start();
                 $google = new GoogleOAuth($consumer_key, $consumer_secret, home_url('?hsl_callback=google'));
                 $parameters = array('scope' => 'profile https://www.googleapis.com/auth/plus.profile.emails.read', 'access_type' => 'offline');
                 $loginUrl = $google->authorizeUrl($parameters);
                 header('Location:' . $loginUrl);
                 die;
                 break;
         }
     }
 }