Source for file stream.php
Documentation is available at stream.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
defined('JPATH_PLATFORM') or die();
* Linkedin API Social Stream class for the Joomla Platform.
* @package Joomla.Platform
* Method to add a new share. Note: post must contain comment and/or (title and url).
* @param string $visibility One of anyone: all members or connections-only: connections only.
* @param string $comment Text of member's comment.
* @param string $title Title of shared document.
* @param string $url URL for shared content.
* @param string $image URL for image of shared content.
* @param string $description Description of shared content.
* @param boolean $twitter True to have LinkedIn pass the status message along to a member's tethered Twitter account.
* @return array The decoded JSON response
* @throws RuntimeException
public function share($visibility, $comment =
null, $title =
null, $url =
null, $image =
null, $description =
null, $twitter =
false)
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Set the success response code.
$this->oauth->setOption('success_code', 201);
$base =
'/v1/people/~/shares';
// Check if twitter is true.
$base .=
'?twitter-post=true';
<code>' .
$visibility .
'</code>
// Check if comment specified.
$xml .=
'<comment>' .
$comment .
'</comment>';
// Check if title and url are specified.
<title>' .
$title .
'</title>
<submitted-url>' .
$url .
'</submitted-url>';
// Check if image is specified.
$xml .=
'<submitted-image-url>' .
$image .
'</submitted-image-url>';
// Check if descrption id specified.
$xml .=
'<description>' .
$description .
'</description>';
throw
new RuntimeException('Post must contain comment and/or (title and url).');
// Build the request path.
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
* Method to reshare an existing share.
* @param string $visibility One of anyone: all members or connections-only: connections only.
* @param string $id The unique identifier for a share.
* @param string $comment Text of member's comment.
* @param boolean $twitter True to have LinkedIn pass the status message along to a member's tethered Twitter account.
* @return array The decoded JSON response
* @throws RuntimeException
public function reshare($visibility, $id, $comment =
null, $twitter =
false)
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Set the success response code.
$this->oauth->setOption('success_code', 201);
$base =
'/v1/people/~/shares';
// Check if twitter is true.
$base .=
'?twitter-post=true';
<code>' .
$visibility .
'</code>
// Check if comment specified.
$xml .=
'<comment>' .
$comment .
'</comment>';
// Build the request path.
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
* Method to get a particular member's current share.
* @param string $id Member id of the profile you want.
* @param string $url The public profile URL.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Check if a member id is specified.
// Check if profile url is specified.
$base .=
'url=' .
$this->oauth->safeEncode($url);
$base .=
':(current-share)';
// Set request parameters.
$data['format'] =
'json';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to get a particular member's current share.
* @param string $id Member id of the profile you want.
* @param string $url The public profile URL.
* @param boolean $self Used to return member's feed. Omitted to return aggregated network feed.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Check if a member id is specified.
// Check if profile url is specified.
$base .=
'url=' .
$this->oauth->safeEncode($url);
// Set request parameters.
$data['format'] =
'json';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to get the users network updates.
* @param string $id Member id.
* @param boolean $self Used to return member's feed. Omitted to return aggregated network feed.
* @param mixed $type String containing any valid Network Update Type from the table or an array of strings
* to specify more than one Network Update type.
* @param integer $count Number of updates to return, with a maximum of 250.
* @param integer $start The offset by which to start Network Update pagination.
* @param string $after Timestamp after which to retrieve updates.
* @param string $before Timestamp before which to retrieve updates.
* @param boolean $hidden Whether to display updates from people the member has chosen to "hide" from their update stream.
* @return array The decoded JSON response
public function getNetworkUpdates($id =
null, $self =
true, $type =
null, $count =
0, $start =
0, $after =
null, $before =
null,
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Check if a member id is specified.
$base .=
'/network/updates';
// Set request parameters.
$data['format'] =
'json';
// Check if self is true.
// Check if type is specified.
// Check if count is specified.
// Check if start is specified.
// Check if after is specified.
// Check if before is specified.
$data['before'] =
$before;
// Check if hidden is true.
$data['hidden'] =
$hidden;
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to get information about the current member's network.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'/v1/people/~/network/network-stats';
// Set request parameters.
$data['format'] =
'json';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to get the users network updates.
* @param string $body The actual content of the update. You can use HTML to include links to the user name and the content the user
* created. Other HTML tags are not supported. All body text should be HTML entity escaped and UTF-8 compliant.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Set the success response code.
$this->oauth->setOption('success_code', 201);
$base =
'/v1/people/~/person-activities';
$xml =
'<activity locale="en_US">
<content-type>linkedin-html</content-type>
<body>' .
$body .
'</body>
$header['Content-Type'] =
'text/xml';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
* Method to retrieve all comments for a given network update.
* @param string $key update/update-key representing an update.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'/v1/people/~/network/updates/key=' .
$key .
'/update-comments';
// Set request parameters.
$data['format'] =
'json';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to post a new comment to an existing update.
* @param string $key update/update-key representing an update.
* @param string $comment Maximum length of 700 characters
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Set the success response code.
$this->oauth->setOption('success_code', 201);
$base =
'/v1/people/~/network/updates/key=' .
$key .
'/update-comments';
<comment>' .
$comment .
'</comment>
$header['Content-Type'] =
'text/xml';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);
* Method to retrieve the complete list of people who liked an update.
* @param string $key update/update-key representing an update.
* @return array The decoded JSON response
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
$base =
'/v1/people/~/network/updates/key=' .
$key .
'/likes';
// Set request parameters.
$data['format'] =
'json';
// Build the request path.
$response =
$this->oauth->oauthRequest($path, 'GET', $parameters, $data);
* Method to like or unlike an update.
* @param string $key Update/update-key representing an update.
* @param boolean $like True to like update, false otherwise.
* @return array The decoded JSON response
private function _likeUnlike($key, $like)
$token =
$this->oauth->getToken();
'oauth_token' =>
$token['key']
// Set the success response code.
$this->oauth->setOption('success_code', 204);
$base =
'/v1/people/~/network/updates/key=' .
$key .
'/is-liked';
// Build the request path.
$header['Content-Type'] =
'text/xml';
$response =
$this->oauth->oauthRequest($path, 'PUT', $parameters, $xml, $header);
* Method used to like an update.
* @param string $key Update/update-key representing an update.
* @return array The decoded JSON response
public function like($key)
return $this->_likeUnlike($key, true);
* Method used to unlike an update.
* @param string $key Update/update-key representing an update.
* @return array The decoded JSON response
return $this->_likeUnlike($key, false);
Documentation generated on Tue, 19 Nov 2013 15:14:30 +0100 by phpDocumentor 1.4.3