Esempio n. 1
0
 /**
  * The constructor constructs, but only for itself
  */
 private final function __construct($token = null, $config_file = null)
 {
     // Use the custom config file
     \Instaphp\Config::Instance($config_file);
     $this->Users = new Users($token);
     $this->Media = new Media($token);
     $this->Tags = new Tags($token);
     $this->Locations = new Locations($token);
 }
Esempio n. 2
0
 private final function __construct()
 {
     $this->_config = Config::Instance();
     $cache = $this->_config->xpath("//Cache[@Engine='File']");
     if (empty($cache) || count($cache) == 0 || !$cache[0]["Enabled"]) {
         return false;
     }
     $this->_defaultTtl = strtotime("+2 minutes");
     $this->_path = dirname(dirname(__FILE__)) . "/tmp/cache/";
     if (!is_dir($this->_path)) {
         mkdir($this->_path, 0755, true);
     }
     $this->Gc();
 }
Esempio n. 3
0
 /**
  * Constructor. 
  * If you inherit from this class, you must call the parent constructor
  * @access public
  */
 public function __construct($token = null, $config_file = null)
 {
     $this->config = Config::Instance($config_file);
     $this->default_params['client_id'] = $this->config->Instagram->ClientId;
     if (!empty($token)) {
         $this->default_params['access_token'] = $token;
     }
     $this->request = new Request();
 }
Esempio n. 4
0
 /**
  * Constructor is private final. Can only be instantiated via WebRequest::Instance()
  * @access private
  * @final
  */
 private final function __construct()
 {
     $this->mh = curl_multi_init();
     if (isset(Config::Instance()->Endpoint['timeout'])) {
         $this->_options[CURLOPT_TIMEOUT] = Config::Instance()->Endpoint['timeout'];
     }
     $this->_options[CURLOPT_USERAGENT] = 'Instaphp/v' . INSTAPHP_VERSION;
     //-- this is an interesting hack to make curl+ssl+windows follow redirects
     //-- without skipping verification. For some reason, the version of libcurl/curl
     //-- included with ZendServer CE doesn't use the systems CA bundle, so, we specify
     //-- the path to the cert here (via config setting)
     if (isset(Config::Instance()->Instaphp->CACertBundlePath) && !empty(Config::Instance()->Instaphp->CACertBundlePath)) {
         $this->_options[CURLOPT_SSL_VERIFYPEER] = true;
         $this->_options[CURLOPT_SSL_VERIFYHOST] = 2;
         $this->_options[CURLOPT_SSLVERSION] = 3;
         $this->_options[CURLOPT_CAINFO] = Config::Instance()->Instaphp->CACertBundlePath;
     }
     $this->_options[CURLOPT_HTTPHEADER] = array("Connection: keep-alive", "Keep-Alive: 300", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Language: en-us,en;q=0.5");
     $this->_requests = array();
     $this->_responses = array();
 }
Esempio n. 5
0
 /**
  * The constructor contructs
  * @param string $url A URL in which to create a new request (optional)
  * @param Array $params An associated array of key/value pairs to pass to said URL (optional)
  */
 public function __construct($url = null, $params = array())
 {
     if (isset(Config::Instance()->Endpoint['timeout'])) {
         $this->curl_opts[CURLOPT_TIMEOUT] = (int) Config::Instance()->Endpoint['timeout'];
     }
     $this->curl_opts[CURLOPT_USERAGENT] = 'Instaphp/v' . INSTAPHP_VERSION;
     //-- this is an interesting hack to make curl+ssl+windows follow redirects
     //-- without skipping verification. For some reason, the version of libcurl/curl
     //-- included with ZendServer CE doesn't use the systems CA bundle, so, we specify
     //-- the path to the cert here (via config setting)
     if (isset(Config::Instance()->Instaphp->CACertBundlePath) && !empty(Config::Instance()->Instaphp->CACertBundlePath)) {
         $this->curl_opts[CURLOPT_SSL_VERIFYPEER] = true;
         $this->curl_opts[CURLOPT_SSL_VERIFYHOST] = 2;
         $this->curl_opts[CURLOPT_SSLVERSION] = 3;
         $this->curl_opts[CURLOPT_CAINFO] = Config::Instance()->Instaphp->CACertBundlePath;
     }
     $this->useCurl = self::HasCurl();
     $this->parameters = $params;
     $this->url = $url;
 }