Пример #1
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-google-analytics-api", "Google Analytics API", "org.bigtreecms.api.analytics.google", $cache);
     $this->Settings["key"] = $this->ClientID;
     $this->Settings["secret"] = $this->ClientSecret;
     $this->ReturnURL = "urn:ietf:wg:oauth:2.0:oob";
 }
Пример #2
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-facebook-api", "Facebook API", "org.bigtreecms.api.facebook", $cache);
     // Set OAuth Return URL
     $this->ReturnURL = ADMIN_ROOT . "developer/services/facebook/return/";
     // Set access scope
     $this->Scope = $this->Settings["scope"];
 }
Пример #3
0
 function callUncached($endpoint, $params = array(), $method = "GET", $headers = array())
 {
     $response = parent::callUncached($endpoint, $params, $method, $headers);
     if (isset($response->meta->error_message)) {
         $this->Errors[] = $response->meta->error_message;
         return false;
     }
     return $response;
 }
Пример #4
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-googleplus-api", "Google+ API", "org.bigtreecms.api.googleplus", $cache);
     // Set OAuth Return URL
     $this->ReturnURL = ADMIN_ROOT . "developer/services/googleplus/return/";
     // Just send the request with the secret.
     $this->RequestParameters = array();
     $this->RequestParameters["access_token"] =& $this->Settings["token"];
     $this->RequestParameters["api_key"] =& $this->Settings["key"];
     $this->RequestParameters["api_secret"] =& $this->Settings["secret"];
 }
Пример #5
0
 function callUncached($endpoint, $params = array(), $method = "GET", $headers = array())
 {
     $params["method"] = $endpoint;
     $params["format"] = "json";
     $params["nojsoncallback"] = true;
     $r = parent::callUncached("", $params, $method, $headers);
     if ($r->stat == "fail") {
         $this->Errors[] = $r->message;
         return false;
     }
     return $r;
 }
Пример #6
0
 function __construct($service = false)
 {
     parent::__construct("bigtree-internal-cloud-storage", "Cloud Storage", "org.bigtreecms.api.cloud-storage", false);
     $this->Service = $service ? $service : $this->Settings["service"];
     // Set OAuth Return URL for Google Cloud Storage
     $this->ReturnURL = ADMIN_ROOT . "developer/cloud-storage/google/return/";
     // Retrieve a fresh token for Rackspace Cloud Files
     if ($this->Service == "rackspace") {
         if (!isset($this->Settings["rackspace"]["token_expiration"]) || $this->Settings["rackspace"]["token_expiration"] < time()) {
             $this->_getRackspaceToken();
         }
         $this->RackspaceAPIEndpoint = $this->Settings["rackspace"]["endpoints"][$this->Settings["rackspace"]["region"]];
         $this->RackspaceCDNEndpoint = $this->Settings["rackspace"]["cdn_endpoints"][$this->Settings["rackspace"]["region"]];
     }
 }
Пример #7
0
 function callUncached($endpoint, $params = array(), $method = "GET", $headers = array())
 {
     $response = parent::callUncached($endpoint, $params, $method, $headers);
     if ($response->code != 0) {
         $this->Errors[] = $response->response;
         return false;
     }
     if (isset($response->cursor)) {
         $r = new stdClass();
         $cursor = new stdClass();
         $response->cursor->next ? $cursor->Next = $response->cursor->next : false;
         $response->cursor->prev ? $cursor->Previous = $response->cursor->prev : false;
         $response->cursor->total ? $cursor->Total = $response->cursor->total : false;
         $r->Cursor = $cursor;
         $r->Results = $response->response;
         return $r;
     }
     return $response->response;
 }
Пример #8
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-salesforce-api", "Salesforce API", "org.bigtreecms.api.salesforce", $cache);
     // Set OAuth Return URL
     $this->ReturnURL = ADMIN_ROOT . "developer/services/salesforce/return/";
     // Change things if we're in the test environment.
     if ($this->Settings["test_environment"]) {
         $this->AuthorizeURL = str_ireplace("login.", "test.", $this->AuthorizeURL);
         $this->TokenURL = str_replace("login.", "test.", $this->TokenURL);
     }
     // Get a new access token for this session.
     $this->Connected = false;
     if ($this->Settings["refresh_token"]) {
         $response = json_decode(BigTree::cURL($this->TokenURL, array("grant_type" => "refresh_token", "client_id" => $this->Settings["key"], "client_secret" => $this->Settings["secret"], "refresh_token" => $this->Settings["refresh_token"])), true);
         if ($response["access_token"]) {
             $this->InstanceURL = $response["instance_url"];
             $this->EndpointURL = $this->InstanceURL . "/services/data/v28.0/";
             $this->Settings["token"] = $response["access_token"];
             $this->Connected = true;
         }
     }
 }
Пример #9
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-yahoo-boss-api", "Yahoo BOSS API", "org.bigtreecms.api.yahooboss", $cache);
     // Set OAuth Return URL
     $this->ReturnURL = ADMIN_ROOT . "developer/geocoding/yahoo-boss/return/";
 }
Пример #10
0
 function __construct($cache = true)
 {
     parent::__construct("bigtree-internal-youtube-api", "YouTube API", "org.bigtreecms.api.youtube", $cache);
     // Set OAuth Return URL
     $this->ReturnURL = ADMIN_ROOT . "developer/services/youtube/return/";
 }