/** * Check if the response is json format * * @param string * @return boolean */ public function isJson($string) { //argument 1 must be a string Eden_Dropbox_Error::i()->argument(1, 'string'); json_decode($string); return json_last_error() == JSON_ERROR_NONE; }
/** * Returns the URL used for login. * * @param string the request key * @param string * @param boolean force user re-login * @return string */ public function getLoginUrl($token, $redirect, $force_login = false) { //Argument tests Eden_Dropbox_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'bool'); //Argument 3 must be a boolean //build the query $query = array('oauth_token' => $token, 'oauth_callback' => $redirect, 'force_login' => (int) $force_login); $query = http_build_query($query); return self::AUTHORIZE_URL . '?' . $query; }
/** * Returns dropbox file operation * * @param *string * @param *string * @param *string * @param *string * @return Eden_Dropbox_FileOperations */ public function fileOperations($consumerKey, $consumerSecret, $accessToken, $accessSecret) { //argument test Eden_Dropbox_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string'); //Argument 4 must be a string return Eden_Dropbox_FileOperations::i($consumerKey, $consumerSecret, $accessToken, $accessSecret); }
/** * Deletes a file or folder. * * @param string The path to the file or folder to be deleted. * @param string The root relative to which from_path and to_path are specified. * @return array */ public function deleteFile($path, $root = 'dropbox') { //argument test Eden_Dropbox_Error::i()->argument(1, 'string')->argument(2, 'string'); //Argument 2 must be a string $this->_query['root'] = $root; $this->_query['path'] = $path; return $this->_post(self::DROPBOX_DELETE, $this->_query); }
/** * Set image Size: xs = 32x32, s = 64x64, m = 128x128, l = 640x480, * xl = 1024x768 * * @param string * @return array */ public function setSize($size) { //Argument 1 must be a string Eden_Dropbox_Error::i()->argument(1, 'string'); $this->_query['size'] = $size; return $this; }