Exemplo n.º 1
0
 /**
  * Gets the Twitter service object for a token
  *
  * @param string|Zend_Oauth_Token_Access $token Access token object or access token string
  * @param null|string $secret Access token secret if token is provided as string
  *
  * @return Zend_Service_Twitter
  */
 public static function getService($token, $secret = null)
 {
     $options = XenForo_Application::getOptions();
     Zend_Oauth::setHttpClient(XenForo_Helper_Http::getClient('https://api.twitter.com/oauth'));
     if ($token instanceof Zend_Oauth_Token_Access) {
         $accessToken = $token;
     } else {
         $accessToken = new Zend_Oauth_Token_Access();
         $accessToken->setToken($token);
         $accessToken->setTokenSecret($secret);
     }
     return new Zend_Service_Twitter(array('accessToken' => $accessToken, 'oauthOptions' => array('consumerKey' => trim($options->twitterAppKey), 'consumerSecret' => trim($options->twitterAppSecret)), 'httpClientOptions' => XenForo_Helper_Http::getExtraHttpClientOptions('https://api.twitter.com/oauth')));
 }