当前位置: 首页>>代码示例>>PHP>>正文


PHP Social::includeLinkedinLib方法代码示例

本文整理汇总了PHP中Social::includeLinkedinLib方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::includeLinkedinLib方法的具体用法?PHP Social::includeLinkedinLib怎么用?PHP Social::includeLinkedinLib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Social的用法示例。


在下文中一共展示了Social::includeLinkedinLib方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLinkedinUserInfo

 public function getLinkedinUserInfo($linkedin_key, $linkedin_secret, $user_linkedin_key = false, $user_linkedin_secret = false)
 {
     Social::includeLinkedinLib();
     $user_linkedin_key = !empty($user_linkedin_key) ? $user_linkedin_key : $_SESSION['user_linkedin_key'];
     $user_linkedin_secret = !empty($user_linkedin_secret) ? $user_linkedin_secret : $_SESSION['user_linkedin_secret'];
     $res = false;
     $base_url = "https://api.linkedin.com/v1/people/~";
     $url = $base_url . ':(id,first-name,last-name,current-status)';
     $signature = new OAuthSignatureMethod_HMAC_SHA1();
     $consumer = new OAuthConsumer($linkedin_key, $linkedin_secret, NULL);
     $token = new OAuthConsumer($user_linkedin_key, $user_linkedin_secret, 1);
     $request = OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $url);
     $request->sign_request($signature, $consumer, $token);
     $header = $request->to_header("https://api.linkedin.com");
     $response = $this->_linkedin_http_request($url, $header);
     parse_str($response);
     if (!strpos($response, '</error-code>') === FALSE) {
         $res = false;
     } else {
         // TODO: parse xml!
         preg_match('/<id>([^<]*)<\\/id>/i', $response, $fake_parse);
         $res = array('id' => $fake_parse[1]);
     }
     return $res;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:25,代码来源:lib.social.php

示例2: socialConnectLogin

                 socialConnectLogin($userInfo->screen_name, 'twitter');
                 return;
             }
         } else {
             // user is already logged in, so connect the account with user
             $social->connectAccount('twitter', $userInfo->screen_name);
             Util::jump_to('index.php?r=lms/elearning/show');
             die;
         }
     } else {
         Util::jump_to('index.php?access_fail=3');
     }
     break;
 case "linkedin_login":
     $social = new Social();
     $social->includeLinkedinLib();
     require_once _base_ . '/lib/lib.preference.php';
     $preference = new UserPreferences(getLogUserId());
     $conf = $social->getConfig();
     $user_pref = array();
     if (Docebo::user()->isAnonymous()) {
         $user_pref['linkedin_key'] = '';
         $user_pref['linkedin_secret'] = '';
     } else {
         $user_pref['linkedin_key'] = $preference->getPreference('social.linkedin_key');
         $user_pref['linkedin_secret'] = $preference->getPreference('social.linkedin_secret');
     }
     $already_auth = $social->checkLinkedinAuth($conf['linkedin_key'], $conf['linkedin_secret'], $user_pref['linkedin_key'], $user_pref['linkedin_secret']);
     $sign_in = false;
     if ($already_auth) {
         $sign_in = true;
开发者ID:abhinay100,项目名称:forma_app,代码行数:31,代码来源:login.php


注:本文中的Social::includeLinkedinLib方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。