本文整理汇总了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;
}
示例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;