*/
class StatusNetOAuth extends TwitterOAuth
{
- function get_maxlength()
+ public function get_maxlength()
{
$config = $this->get($this->host . 'statusnet/config.json');
if (empty($config)) {
return $config->site->textlimit;
}
- function accessTokenURL()
+ public function accessTokenURL()
{
return $this->host . 'oauth/access_token';
}
- function authenticateURL()
+ public function authenticateURL()
{
return $this->host . 'oauth/authenticate';
}
- function authorizeURL()
+ public function authorizeURL()
{
return $this->host . 'oauth/authorize';
}
- function requestTokenURL()
+ public function requestTokenURL()
{
return $this->host . 'oauth/request_token';
}
- function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
+ public function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
{
parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
$this->host = $apipath;
*
* Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
*
- * @return array|object API results
+ * @return array|object|mixed API results
*/
- function http($url, $method, $postfields = NULL)
+ public function http($url, $method, $postfields = NULL)
{
$this->http_info = [];
$ci = curl_init();
public $http_header;
/**
* Contains the last HTTP request info
- * @var string
+ * @var array
*/
public $http_info;
- /** @var OAuthToken */
+ /** @var OAuthToken|null */
private $token;
/** @var OAuthConsumer */
private $consumer;
/**
* Set API URLS
*/
- function accessTokenURL()
+ public function accessTokenURL()
{
return 'https://api.twitter.com/oauth/access_token';
}
- function authenticateURL()
+ public function authenticateURL()
{
return 'https://twitter.com/oauth/authenticate';
}
- function authorizeURL()
+ public function authorizeURL()
{
return 'https://twitter.com/oauth/authorize';
}
- function requestTokenURL()
+ public function requestTokenURL()
{
return 'https://api.twitter.com/oauth/request_token';
}
- function __construct($consumer_key, $consumer_secret, $oauth_token = null, $oauth_token_secret = null)
+ public function __construct($consumer_key, $consumer_secret, $oauth_token = null, $oauth_token_secret = null)
{
$this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
* @param callable $oauth_callback
* @return array
*/
- function getRequestToken($oauth_callback = null)
+ public function getRequestToken($oauth_callback = null)
{
$parameters = [];
if (!empty($oauth_callback)) {
*
* @return string
*/
- function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
+ public function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
{
if (is_array($token)) {
$token = $token['oauth_token'];
* "user_id" => "9436992",
* "screen_name" => "abraham")
*/
- function getAccessToken($oauth_verifier = FALSE)
+ public function getAccessToken($oauth_verifier = FALSE)
{
$parameters = [];
if (!empty($oauth_verifier)) {
* "screen_name" => "abraham",
* "x_auth_expires" => "0")
*/
- function getXAuthToken($username, $password)
+ public function getXAuthToken($username, $password)
{
$parameters = [];
$parameters['x_auth_username'] = $username;
* @param array $parameters
* @return mixed|string
*/
- function get($url, $parameters = [])
+ public function get($url, $parameters = [])
{
$response = $this->oAuthRequest($url, 'GET', $parameters);
if ($this->format === 'json' && $this->decode_json) {
* @param array $parameters
* @return mixed|string
*/
- function post($url, $parameters = [])
+ public function post($url, $parameters = [])
{
$response = $this->oAuthRequest($url, 'POST', $parameters);
if ($this->format === 'json' && $this->decode_json) {
* @param array $parameters
* @return mixed|string
*/
- function delete($url, $parameters = [])
+ public function delete($url, $parameters = [])
{
$response = $this->oAuthRequest($url, 'DELETE', $parameters);
if ($this->format === 'json' && $this->decode_json) {
* @param array $parameters
* @return mixed|string
*/
- function oAuthRequest($url, $method, $parameters)
+ public function oAuthRequest($url, $method, $parameters)
{
if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
$url = "{$this->host}{$url}.{$this->format}";
* @param string $url
* @param string $method
* @param mixed $postfields
- * @return string API results
+ * @return string|bool|mixed API results
*/
- function http($url, $method, $postfields = null)
+ public function http($url, $method, $postfields = null)
{
$this->http_info = [];
$ci = curl_init();
* @param string $header
* @return int
*/
- function getHeader($ch, $header)
+ public function getHeader($ch, $header)
{
$i = strpos($header, ':');
if (!empty($i)) {