'authenticate']); } return $url; } public static function getOAuthCallbackUrl() { if (($url = View::getPage('url'))) { $url .= '?' . http_build_query(['action' => 'oAuthCallback']); } return $url; } public static function getClearAuthUrl() { if (($url = View::getPage('url'))) { $url .= '?' . http_build_query(['action' => 'clearAuth']); } return $url; } protected function _doAuthenticate() { $this->_getDataObj()->setAuthCallbackUrl(static::getOAuthCallbackUrl()); if (($backUrl = \Qs_Array::get($_SERVER, 'HTTP_REFERER'))) { $this->_setBackUrl($backUrl); } if (false == $this->_getDataObj()->authRequest()) { if (($errors = $this->_getDataObj()->getErrors())) { $this->_setBackErrors($errors); } else { $this->_setBackError('Failed to make twitter authenticate request'); } $this->_doBack(); } exit; } protected function _doOAuthCallback() { if (false == $this->_getDataObj()->completeAuthRequest(\Qs_Request::getGet())) { if (($errors = $this->_getDataObj()->getErrors())) { $this->_setBackErrors($errors); } else { $this->_setBackError('Failed to complete authenticate request'); } } $this->_doBack(); exit; } protected function _doClearAuth() { if (($backUrl = \Qs_Array::get($_SERVER, 'HTTP_REFERER'))) { $this->_setBackUrl($backUrl); } $this->_getDataObj()->clearAccessToken(); $this->_getDataObj()->deleteCache(); $this->_doBack(); exit; } }