oauth_token = $token['token']; $this->oauth_token_secret = $token['token_secret']; } else { $this->oauth_token = $token; $this->oauth_token_secret = $token_secret; } } /** * Returns the oauth request tokens as an associative array. * * The array will contain the elements 'token' and 'token_secret'. * * @return array */ public function getToken() { return array( 'token' => $this->oauth_token, 'token_secret' => $this->oauth_token_secret, ); } /** * Returns the authorization url * * @param string $callBack Specify a callback url to automatically redirect the user back * @return string */ public function getAuthorizeUrl($callBack = null) { // Building the redirect uri $token = $this->getToken(); $uri = self::URI_AUTHORIZE . '?oauth_token=' . $token['token']; if ($callBack) $uri.='&oauth_callback=' . $callBack; return $uri; } /** * Set input file for PUT method * * @param resource|string $file * @throws Dropbox_Exception */ public function setInfile($file) { if (is_resource($file)) { $stat = fstat($file); $this->inFileSize = $stat['size']; } else if (is_string($file) && is_readable($file)) { $this->inFileSize = filesize($file); $file = fopen($file, 'rb'); } if (!is_resource($file)) { throw new Dropbox_Exception('File must be a file-resource or a string'); } $this->inFile = $file; } /** * Return is PUT method supported * * @return boolean */ public function isPutSupport() { return $this->putSupported; } /** * Get last request response * * @return array: */ public function getLastResponse() { return $this->lastResponse; } /** * Fetches a secured oauth url and returns the response body. * * @param string $uri * @param mixed $arguments * @param string $method * @param array $httpHeaders * @return string */ public abstract function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()); /** * Requests the OAuth request token. * * @return array */ abstract public function getRequestToken(); /** * Requests the OAuth access tokens. * * @return array */ abstract public function getAccessToken(); }