/** * * @param string $url * * @return SCurl */ static function init($url) { if (self::$instance == null) { self::$instance = new SCurl($url); } return self::$instance->setUrl($url); }
/** * Creating directory * * @param string $name Directory name * * @return array */ public function createDirectory($name) { $headers = array_merge(array("Content-Type: application/directory"), $this->token); $info = SCurl::init($this->url . $name)->setHeaders($headers)->request("PUT")->getInfo(); return $info; }
/** * Set X-Account-Meta-Temp-URL-Key for temp file download link generation. Run it once and use key forever. * * @param string $key * * @return integer */ public function setAccountMetaTempURLKey($key) { $url = $this->url; $headers = array_merge($this->token, array("X-Account-Meta-Temp-URL-Key: " . $key)); $res = SCurl::init($url)->setHeaders($headers)->request("POST")->getHeaders(); if (!in_array($res["HTTP-Code"], array(204))) { return $this->error($res["HTTP-Code"], __METHOD__); } return $res["HTTP-Code"]; }