Esempio n. 1
0
 public function __construct()
 {
     if (!function_exists('memcache_connect')) {
         throw new Exception("Memcache functions not available");
     }
     $this->host = Config::get('ioMemCacheCache_host');
     $this->port = Config::get('ioMemCacheCache_port');
     if (empty($this->host) || empty($this->port)) {
         throw new Exception("You need to supply a valid memcache host and port");
     }
 }
Esempio n. 2
0
 public function execute()
 {
     $body = '';
     /** @var HttpRequest $req */
     foreach ($this->requests as $key => $req) {
         $body .= "--{$this->boundary}\n";
         $body .= $req->toBatchString($key) . "\n";
     }
     $body = rtrim($body);
     $body .= "\n--{$this->boundary}--";
     $url = Config::get('basePath') . '/batch';
     $httpRequest = new HttpRequest($url, 'POST');
     $httpRequest->setRequestHeaders(array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary));
     $httpRequest->setPostBody($body);
     $response = Client::$io->makeRequest($httpRequest);
     $response = $this->parseResponse($response);
     return $response;
 }
Esempio n. 3
0
 /**
  * Instantiates the class, but does not initiate the login flow, leaving it
  * to the discretion of the caller (which is done by calling authenticate()).
  */
 public function __construct()
 {
     if (Config::has('developer_key')) {
         $this->developerKey = Config::get('developer_key');
     }
     if (Config::has('oauth2_client_id')) {
         $this->clientId = Config::get('oauth2_client_id');
     }
     if (Config::has('oauth2_client_secret')) {
         $this->clientSecret = Config::get('oauth2_client_secret');
     }
     if (Config::has('oauth2_redirect_uri')) {
         $this->redirectUri = Config::get('oauth2_redirect_uri');
     }
     if (Config::has('oauth2_access_type')) {
         $this->accessType = Config::get('oauth2_access_type');
     }
     if (Config::has('oauth2_approval_prompt')) {
         $this->approvalPrompt = Config::get('oauth2_approval_prompt');
     }
 }
Esempio n. 4
0
 /**
  * Instantiates the class, but does not initiate the login flow, leaving it
  * to the discretion of the caller (which is done by calling authenticate()).
  */
 public function __construct()
 {
     $apiConfig = Config::getAll();
     if (!empty($apiConfig['developer_key'])) {
         $this->developerKey = $apiConfig['developer_key'];
     }
     if (!empty($apiConfig['oauth2_client_id'])) {
         $this->clientId = $apiConfig['oauth2_client_id'];
     }
     if (!empty($apiConfig['oauth2_client_secret'])) {
         $this->clientSecret = $apiConfig['oauth2_client_secret'];
     }
     if (!empty($apiConfig['oauth2_redirect_uri'])) {
         $this->redirectUri = $apiConfig['oauth2_redirect_uri'];
     }
     if (!empty($apiConfig['oauth2_access_type'])) {
         $this->accessType = $apiConfig['oauth2_access_type'];
     }
     if (!empty($apiConfig['oauth2_approval_prompt'])) {
         $this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
     }
 }
 public function __construct()
 {
     $this->path = Config::get('ioFileCache_directory');
 }
Esempio n. 6
0
 /**
  * Declare if objects should be returned by the api service classes.
  *
  * @param boolean $useObjects True if objects should be returned by the service classes.
  * False if associative arrays should be returned (default behavior).
  * @experimental
  */
 public function setUseObjects($useObjects)
 {
     Config::set('use_objects', $useObjects);
 }
Esempio n. 7
0
 public function __construct()
 {
     if (Config::has('developer_key')) {
         $this->setDeveloperKey(Config::get('developer_key'));
     }
 }
Esempio n. 8
0
 protected function useObjects()
 {
     return Config::get('use_objects', false);
 }
 /**
  * @param string $url the url to set
  */
 public function setUrl($url)
 {
     if (substr($url, 0, 4) == 'http') {
         $this->url = $url;
     } else {
         // Force the path become relative.
         if (substr($url, 0, 1) !== '/') {
             $url = '/' . $url;
         }
         $this->url = Config::get('basePath') . $url;
     }
 }
 public function useObjects()
 {
     return Config::get('use_objects', false);
 }
Esempio n. 11
0
 /**
  * @param string $url the url to set
  */
 public function setUrl($url)
 {
     if (substr($url, 0, 4) == 'http') {
         $this->url = $url;
     } else {
         $this->url = Config::get('basePath') . $url;
     }
 }