/** * Returns oauth 2 desktop class * * @param string The application client ID, can get through registration * @param string The application secret, can get through registration * @param url Your callback url or where do you want to redirect the user after authentication * @param url The request url, can get through registration * @param url The access url, can get through registration * @return Eden_Oauth2_Client */ public function desktop($client, $secret, $redirect, $requestUrl, $accessUrl) { //argument test Eden_Oauth2_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'url')->argument(4, 'url')->argument(5, 'url'); //argument 5 must be a url return Eden_Oauth2_Desktop::i($client, $secret, $redirect, $requestUrl, $accessUrl); }
/** * Returns website login url * * @param string* * @return array */ public function getAccess($code) { //argument 1 must be a string Eden_Oauth2_Error::i()->argument(1, 'string'); //populate fields $query = array(self::CLIENT_ID => $this->_client, self::CLIENT_SECRET => $this->_secret, self::REDIRECT_URL => $this->_redirect, self::GRANT_TYPE => $this->_grantType); return $this->_getAccess($query, $code); }
/** * Check if the response is json format * * @param string * @return boolean */ public function isJson($string) { //argument 1 must be a string Eden_Oauth2_Error::i()->argument(1, 'string'); json_decode($string); return json_last_error() == JSON_ERROR_NONE; }
if(!class_exists('Eden_Oauth2')){class Eden_Oauth2 extends Eden_Class{public static function i(){return self::_getSingleton(__CLASS__);}public function client($client,$secret,$redirect,$requestUrl,$accessUrl){Eden_Oauth2_Error::i()->argument(1,'string')->argument(2,'string')->argument(3,'url')->argument(4,'url')->argument(5,'url');return Eden_Oauth2_Client::i($client,$secret,$redirect,$requestUrl,$accessUrl);}public function desktop($client,$secret,$redirect,$requestUrl,$accessUrl){Eden_Oauth2_Error::i()->argument(1,'string')->argument(2,'string')->argument(3,'url')->argument(4,'url')->argument(5,'url');return Eden_Oauth2_Desktop::i($client,$secret,$redirect,$requestUrl,$accessUrl);}}}