コード例 #1
0
  public function __construct($providerUrl, osapiStorage $storage, osapiHttpProvider $httpProvider = null) {
    $this->providerUrl = $providerUrl;
    $this->providerName = $this->providerUrl;
    if ($httpProvider) {
      $this->httpProvider = $httpProvider;
    } else {
      $this->httpProvider = new osapiCurlProvider();
    }
    // See if we have any cached XRDS info so we can skip the http request. Cache time is currently hard-coded to 1 day
    if (($xrds = $storage->get($this->providerUrl.":xrds", 24 * 60 * 60)) !== false) {
      list($requestTokenUrl, $authorizeUrl, $accessTokenUrl, $restEndpoint, $rpcEndpoint, $this->providerName, $isOpenSocial) = $xrds;
    } else {
      // Start XRDS discovery

      $xrds = XrdsSimpleParser::doOAuthDiscovery($this->providerUrl, true, $this->httpProvider);

      // OAuth end-points
      $requestTokenUrl = $xrds['requestUrl'];
      $authorizeUrl = $xrds['authorizeUrl'];
      $accessTokenUrl = $xrds['accessUrl'];
      if (empty($requestTokenUrl) || empty($authorizeUrl) || empty($accessTokenUrl)) {
        throw new osapiException("Could not discover the required OAuth end-points");
      }
      
      $rddXml = $xrds['rdd'];

      // PortableContacts end-point, optional
      $pocoUrl = XrdsSimpleParser::getServiceByType($rddXml, 'http://portablecontacts.net/spec/1.0');
      if (empty($pocoUrl)) $pocoUrl = null;

      // These are not official end-point names, only partuza supports them currently, a proposal has been send to the spec list
      $restEndpoint = XrdsSimpleParser::getServiceByType($rddXml, 'http://ns.opensocial.org/rest/0.8');
      $rpcEndpoint = XrdsSimpleParser::getServiceByType($rddXml, 'http://ns.opensocial.org/rpc/0.8');
      if (empty($restEndpoint) && empty($rpcEndpoint)) {
        // no experimental simple end points found, try to find the rest base based on the people end-point
        $peopleEndpoint = XrdsSimpleParser::getServiceByType($rddXml, 'http://ns.opensocial.org/people/0.8');
        $restEndpoint = str_replace('/people', '', $peopleEndpoint);
      }
      $isOpenSocial = true;
      if (empty($restEndpoint) && empty($rpcEndpoint) && empty($pocoUrl)) {
        throw new osapiException("No supported social end-points found");
      } elseif (empty($restEndpoint) && empty($rpcEndpoint) && !empty($pocoUrl)) {
        $isOpenSocial = false;
        $restEndpoint = $pocoUrl;
        $rpcEndpoint = null;
      }

      // Store the results in cache so we can skip it next time
      $storage->set($this->providerUrl.":xrds", array((string)$requestTokenUrl, (string)$authorizeUrl, (string)$accessTokenUrl, (string)$restEndpoint, (string)$rpcEndpoint, (string)$this->providerName, (int)$isOpenSocial));
    }
    // Construct our selves based on the XRDS discovered end-points
    parent::__construct($requestTokenUrl, $authorizeUrl, $accessTokenUrl, $restEndpoint, $rpcEndpoint, $this->providerName, $isOpenSocial);
  }
コード例 #2
0
 public function __construct()
 {
     parent::__construct("http://www.plaxo.com/oauth/request", "http://www.plaxo.com/oauth/authorize", "http://www.plaxo.com/oauth/activate", "http://www.plaxo.com/pdata/contacts", null, "Plaxo", false);
 }
コード例 #3
0
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct("http://api.myspace.com/request_token", 
   	"http://api.myspace.com/authorize", 
   	"http://api.myspace.com/access_token", 
   	"http://opensocial.myspace.com/roa/09", null, "MySpace", true, $httpProvider);
 }
コード例 #4
0
 /**
  * Specifies the appropriate data for an orkut request.
  * @param osapiHttpProvider httpProvider The HTTP request provider to use.
  */
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct('https://www.google.com/accounts/OAuthGetRequestToken', 'https://www.google.com/accounts/OAuthAuthorizeToken', 'https://www.google.com/accounts/OAuthGetAccessToken', 'http://www-opensocial.googleusercontent.com/api/', 'http://www-opensocial.googleusercontent.com/api/rpc', "Google", true, $httpProvider);
 }
コード例 #5
0
 public function __construct(osapiHttpProvider $httpProvider = null)
 {
     parent::__construct("http://partuza/oauth/request_token", "http://partuza/oauth/authorize", "http://partuza/oauth/access_token", "http://shindig/social/rest", "http://shindig/social/rpc", "LocalPartuza", true);
 }
コード例 #6
0
 /**
  * Creates a new MockProvider
  *
  * @param osapiHttpProvider $httpProvider Provider to use.  For unit testing
  *     this is best set as an osapiLocalHttpProvider.
  */
 public function __construct($httpProvider)
 {
     parent::__construct('http://example.com/OAuthGetRequestToken', 'http://example.com/OAuthAuthorizeToken', 'http://example.com/OAuthGetAccessToken', 'http://example.com/api/', 'http://example.com/api/rpc', "Example", true, $httpProvider);
 }
コード例 #7
0
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct('https://api.login.yahoo.com/oauth/v2/get_request_token', 'https://api.login.yahoo.com/oauth/v2/request_auth', 'https://api.login.yahoo.com/oauth/v2/get_token', 'http://appstore.apps.yahooapis.com/social/rest', null, 'Yahoo!', true, $httpProvider);
 }
コード例 #8
0
 /**
  * Specifies the appropriate data for an orkut request.
  * @param osapiHttpProvider httpProvider The HTTP request provider to use.
  */
 public function __construct(osapiHttpProvider $httpProvider = null)
 {
     parent::__construct(null, null, null, 'http://sandbox.orkut.com/social/rest/', 'http://sandbox.orkut.com/social/rpc', "Orkut", true, $httpProvider);
 }
コード例 #9
0
 public function __construct()
 {
     parent::__construct(null, null, null, 'http://sandbox.orkut.com/social/rest/', 'http://sandbox.orkut.com/social/rpc', "Orkut", true);
 }
コード例 #10
0
 public function __construct()
 {
     parent::__construct("https://www.google.com/accounts/OAuthGetRequestToken", "https://www.google.com/accounts/OAuthAuthorizeToken", "https://www.google.com/accounts/OAuthGetAccessToken", "http://sandbox.gmodules.com/api", null, "Google", true);
 }
コード例 #11
0
 public function __construct(osapiHttpProvider $httpProvider = NULL, array $config = array())
 {
     parent::__construct($config["requestTokenUrl"], $config["authorizeUrl"], $config["accessTokenUrl"], $config["restEndpoint"], $config["rpcEndpoint"], $config["providerName"], true, $httpProvider);
 }
コード例 #12
0
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct("http://www.plaxo.com/oauth/request", "http://www.plaxo.com/oauth/authorize", "http://www.plaxo.com/oauth/activate", "http://www.plaxo.com/pdata/contacts", null, "Plaxo", false, $httpProvider);
 }
コード例 #13
0
 public function __construct()
 {
     parent::__construct("http://api.myspace.com/request_token", "http://api.myspace.com/authorize", "http://api.myspace.com/access_token", "http://api.myspace.com/v2", null, "MySpace", true);
 }
コード例 #14
0
 /**
  * 
  * @param  $baseURL the url of iwiw, can be sandbox.iwiw.hu, approval.iwiw.hu or iwiw.hu
  * @param osapiHttpProvider $httpProvider custom provider if neeeded
  */
 public function __construct($baseURL = 'http://iwiw.hu', $baseApiURL = 'http://api.iwiw.hu', osapiHttpProvider $httpProvider = null)
 {
     parent::__construct($baseApiURL . '/social/oauth/requestToken', $baseURL . '/pages/auth/authorize.jsp', $baseApiURL . '/social/oauth/accessToken', $baseApiURL . '/social/connect/rest', '', 'IWIW', true, $httpProvider);
 }
コード例 #15
0
 /**
  * Specifies the appropriate data for an orkut request.
  * @param osapiHttpProvider httpProvider The HTTP request provider to use.
  */
 public function __construct(osapiHttpProvider $httpProvider = null)
 {
     parent::__construct(null, null, null, 'http://www-opensocial-sandbox.googleusercontent.com/api/', 'http://www-opensocial-sandbox.googleusercontent.com/api/rpc', "Google", true, $httpProvider);
 }
コード例 #16
0
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct("https://api.hi5.com/oauth/requestToken", "https://login.hi5.com/oauth/authorize", "https://api.hi5.com/oauth/accessToken", "http://api.hi5.com/social/rest/", "http://api.hi5.com/social/rpc", "Hi5", true, $httpProvider);
 }
コード例 #17
0
 public function __construct(osapiHttpProvider $httpProvider = null) {
   parent::__construct("http://www.partuza.nl/oauth/request_token", "http://www.partuza.nl/oauth/authorize", "http://www.partuza.nl/oauth/access_token", "http://modules.partuza.nl/social/rest", "http://modules.partuza.nl/social/rpc", "Partuza", true, $httpProvider);
 }
コード例 #18
0
 public function __construct(osapiHttpProvider $httpProvider = null)
 {
     parent::__construct(null, null, null, "http://www.google.com/friendconnect/api", "http://www.google.com/friendconnect/api/rpc", "FriendConnect", true, $httpProvider);
 }
コード例 #19
0
 public function __construct(osapiHttpProvider $httpProvider = null)
 {
     parent::__construct("http://en.netlog.com/oauth/request_token", "http://en.netlog.com/oauth/authorize", "http://en.netlog.com/oauth/access_token", "http://en.api.netlog.com/opensocial/social/rest", "http://en.api.netlog.com/opensocial/social/rpc", "Netlog", true, $httpProvider);
 }
コード例 #20
0
 public function __construct($network = osapiVzOAuthProvider::STUDIVZ, osapiHttpProvider $httpProvider = null)
 {
     $platform = 'www.' . $network . '.net';
     $shindig = $network . '.gadgets.apivz.net';
     parent::__construct("http://" . $platform . "/OAuth/RequestToken/", "http://" . $platform . "/OAuth/Authorize/", "http://" . $platform . "/OAuth/AccessToken/", "http://" . $shindig . "/social/rest/", "http://" . $shindig . "/rpc/", "Vz", true, $httpProvider);
 }
コード例 #21
0
 public function __construct($network = osapiVzOAuth2Provider::STUDIVZ, osapiHttpProvider $httpProvider = null)
 {
     $platform = 'secure.' . $network . '.net';
     $shindig = $network . '-opensocial.apivz.net';
     parent::__construct(null, "https://" . $platform . "/OAuth2/Authorize/", "https://" . $platform . "/OAuth2/AccessToken/", "https://" . $shindig . "/social/rest/", "https://" . $shindig . "/rpc/", "Vz", true, $httpProvider);
 }