本文整理汇总了PHP中LinkedIn::updates方法的典型用法代码示例。如果您正苦于以下问题:PHP LinkedIn::updates方法的具体用法?PHP LinkedIn::updates怎么用?PHP LinkedIn::updates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedIn
的用法示例。
在下文中一共展示了LinkedIn::updates方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserActivity
/**
* load the user latest activity
* - timeline : all the stream
* - me : the user activity only
* {@inheritdoc}
*/
function getUserActivity($stream)
{
try {
if ($stream == "me") {
$response = $this->api->updates('?type=SHAR&scope=self&count=25');
} else {
$response = $this->api->updates('?type=SHAR&count=25');
}
} catch (LinkedInException $e) {
throw new Exception("User activity stream request failed! {$this->providerId} returned an error: {$e}");
}
if (!$response || !$response['success']) {
return array();
}
$updates = new SimpleXMLElement($response['linkedin']);
$activities = array();
foreach ($updates->update as $update) {
$person = $update->{'update-content'}->person;
$share = $update->{'update-content'}->person->{'current-share'};
$ua = new Hybrid_User_Activity();
$ua->id = (string) $update->id;
$ua->date = (string) $update->timestamp;
$ua->text = (string) $share->{'comment'};
$ua->user->identifier = (string) $person->id;
$ua->user->displayName = (string) $person->{'first-name'} . ' ' . $person->{'last-name'};
$ua->user->profileURL = (string) $person->{'site-standard-profile-request'}->url;
$ua->user->photoURL = null;
$activities[] = $ua;
}
return $activities;
}
示例2: SimpleXMLElement
<input type="submit" value="Send Invitation" />
<p>(Note, any HTML in the subject or message bodies will be stripped by the LinkedIn->invite() method)</p>
</form>
<hr />
<h3 id="network_updates">Recent Connection Updates: (last <?php
echo UPDATE_COUNT;
?>
, shared content only)</h3>
<?php
$query = '?type=SHAR&count=' . UPDATE_COUNT;
$response = $OBJ_linkedin->updates($query);
if ($response['success'] === TRUE) {
$updates = new SimpleXMLElement($response['linkedin']);
if ((int) $updates['total'] > 0) {
foreach ($updates->update as $update) {
$person = $update->{'update-content'}->person;
$share = $update->{'update-content'}->person->{'current-share'};
?>
<div style=""><span style="font-weight: bold;"><a href="<?php
echo $person->{'site-standard-profile-request'}->url;
?>
"><?php
echo $person->{'first-name'} . ' ' . $person->{'last-name'} . '</a></span> ' . $share->comment;
?>
</div>
<?php
示例3: getLinkedinData
public function getLinkedinData($linkedinProfiles)
{
$mainframe = JFactory::getApplication();
$params = $mainframe->getparams();
$limit = $params->get('limit');
$linkedinDataList = array();
if (count($linkedinProfiles) > 0) {
$accessLinkedin = RedSocialStreamHelper::getLinkinAccessToken();
include_once JPATH_COMPONENT . '/helpers/twitter/statuses.php';
$twitterStatuses = new TwitterStatuses();
foreach ($linkedinProfiles as $twitterProfile) {
if (isset($accessLinkedin->access_token) && !empty($accessLinkedin->access_token)) {
$tweetList = $twitterStatuses->getUserTimeline($twitterProfile['title'], $accessLinkedin->access_token, $limit);
for ($i = 0; $i < count($tweetList); $i++) {
$tweet = $tweetList[$i];
$linkedinDataList[$twitterProfile['id']]['data'] = $tweet;
$linkedinDataList[$twitterProfile['id']]['profile_id'] = $twitterProfile['id'];
$linkedinDataList[$twitterProfile['id']]['title'] = '';
$linkedinDataList[$twitterProfile['id']]['type'] = TWITTER;
$linkedinDataList[$twitterProfile['id']]['group_id'] = $twitterProfile['group_id'];
$linkedinDataList[$twitterProfile['id']]['source_link'] = "https://twitter.com/" . $tweet->user->screen_name . "/status" . $tweet->id_str;
$linkedinDataList[$twitterProfile['id']]['thumb_uri'] = $tweet->user->profile_image_url;
if (isset($tweet->text)) {
$linkedinDataList[$twitterProfile['id']]['message'] = addslashes($tweet->text);
}
$linkedinDataList[$twitterProfile['id']]['ext_profile_id'] = $tweet->user->id;
$linkedinDataList[$twitterProfile['id']]['ext_post_id'] = $tweet->id_str;
$linkedinDataList[$twitterProfile['id']]['ext_post_name'] = $tweet->user->screen_name;
$linkedinDataList[$twitterProfile['id']]['duration'] = '';
$linkedinDataList[$twitterProfile['id']]['created_time'] = date("Y-m-d H:i:s", strtotime($tweet->created_at));
$linkedinDataList[$twitterProfile['id']]['published'] = 1;
}
}
}
}
return $linkedinDataList;
$api_key = $login['linked_api_key'];
// Linkedin Api key
$secret_key = $login['linked_secret_key'];
//Linkedin Secret key
$access_tokens = $this->getLinkedinAccessToken();
include JPATH_SITE . '/components/com_redsocialstream/helpers/linkedin/linkedin.php';
require_once JPATH_SITE . '/components/com_redsocialstream/helpers/twitter/OAuth.php';
$API_CONFIG = array('appKey' => $api_key, 'appSecret' => $secret_key, 'callbackUrl' => "");
$linkedin = new LinkedIn($API_CONFIG);
$access_token = $access_tokens[0]->linkedin_token;
$access_secret = $access_tokens[0]->linkedin_secret;
$token = array("oauth_token" => $access_token, "oauth_token_secret" => $access_secret);
$linkedin->setTokenAccess($token);
$query = '?type=SHAR&count=30';
$response = $linkedin->updates($query);
if ($response['success'] === TRUE) {
$updates = new SimpleXMLElement($response['linkedin']);
if ((int) $updates['total'] > 0) {
$i = 0;
foreach ($updates->update as $update) {
$person = $update->{'update-content'}->person;
$share = $update->{'update-content'}->person->{'current-share'};
$linkedinlist[$i]['data'] = $update;
$linkedinlist[$i]['created_time'] = date("Y-m-d", trim($share->timestamp));
$linkedinlist[$i]['type'] = 'linkedin';
$savedata[$i]['group_id'] = $linkedlistdata['group_id'];
$savedata[$i]['type'] = LINKEDIN;
$savedata[$i]['ext_profile_id'] = $person->{id};
$savedata[$i]['ext_post_id'] = $share->{id};
$savedata[$i]['ext_post_name'] = $person->{'first-name'} . ' ' . $person->{'last-name'};
if (isset($share->comment)) {
$savedata[$i]['message'] = addslashes($share->comment);
}
$savedata[$i]['title'] = '';
$savedata[$i]['source_link'] = $person->{'site-standard-profile-request'}->url;
$savedata[$i]['created_time'] = date("Y-m-d", trim($share->timestamp));
$savedata[$i]['duration'] = '';
$savedata[$i]['profile_id'] = $linkedlistdata['profile_id'];
$savedata[$i]['published'] = 1;
$savedata[$i]['thumb_uri'] = $person->{'picture-url'};
$i++;
}
}
}
if (isset($savedata)) {
$this->savePost($savedata);
}
return $linkedinlist;
}
示例4: getlinkedindata
function getlinkedindata($linkedlistdata)
{
$session = JFactory::getSession();
$redsocialhelper = new redsocialhelper();
$login = $redsocialhelper->getsettings();
global $mainframe;
$api_key = $login['linked_api_key'];
// Linkedin Api key
$secret_key = $login['linked_secret_key'];
//Linkedin Secret key
$access_tokens = $this->getLinkedinAccessToken();
include JPATH_SITE . '/components/com_redsocialstream/helpers/linkedin/linkedin.php';
require_once JPATH_SITE . '/components/com_redsocialstream/helpers/twitter/OAuth.php';
$API_CONFIG = array('appKey' => $api_key, 'appSecret' => $secret_key, 'callbackUrl' => "");
$linkedin = new LinkedIn($API_CONFIG);
$access_token = $access_tokens[0]->linkedin_token;
$access_secret = $access_tokens[0]->linkedin_secret;
$token = array("oauth_token" => $access_token, "oauth_token_secret" => $access_secret);
$linkedin->setTokenAccess($token);
$query = '?type=SHAR&count=30';
$response = $linkedin->updates($query);
if ($response['success'] === TRUE) {
$updates = new SimpleXMLElement($response['linkedin']);
if ((int) $updates['total'] > 0) {
$i = 0;
foreach ($updates->update as $update) {
$person = $update->{'update-content'}->person;
$share = $update->{'update-content'}->person->{'current-share'};
$linkedinlist[$i]['data'] = $update;
$linkedinlist[$i]['created_time'] = date("Y-m-d", trim($share->timestamp));
$linkedinlist[$i]['type'] = 'linkedin';
$savedata[$i]['group_id'] = $linkedlistdata['group_id'];
$savedata[$i]['type'] = LINKEDIN;
$savedata[$i]['ext_profile_id'] = $person->{id};
$savedata[$i]['ext_post_id'] = $share->{id};
$savedata[$i]['ext_post_name'] = $person->{'first-name'} . ' ' . $person->{'last-name'};
if (isset($share->comment)) {
$savedata[$i]['message'] = addslashes($share->comment);
}
$savedata[$i]['title'] = '';
$savedata[$i]['source_link'] = $person->{'site-standard-profile-request'}->url;
$savedata[$i]['created_time'] = date("Y-m-d", trim($share->timestamp));
$savedata[$i]['duration'] = '';
$savedata[$i]['profile_id'] = $linkedlistdata['profile_id'];
$savedata[$i]['published'] = 1;
$savedata[$i]['thumb_uri'] = $person->{'picture-url'};
$i++;
}
}
}
if (isset($savedata)) {
$this->savePost($savedata);
}
return $linkedinlist;
}