allowedCustomAPICallMethods) || !method_exists($this, $method)) { header('HTTP/1.0 501 Not Implemented'); exit(); } return call_user_func_array([$this, $method], [$params]); } public function oauthOpen($params = []) { $callback = $params['callbackURI'] . '&method=oauthCallback'; $url = $this->getOAuth2HelperUrl(); $url .= (strpos($url, '?') !== false) ? '&' : '?'; $url .= 'callback=' . urlencode($callback); $url .= '&dlid=' . urlencode(Platform::getInstance()->get_platform_configuration_option('update_dlid', '')); Platform::getInstance()->redirect($url); } /** * Fetches the authentication token from the OAuth helper script, after you've run the first step of the OAuth * authentication process. Must be overridden in subclasses. * * @param array $params * * @return void * * @throws OAuthNotSupported */ public function oauthCallback(array $params) { throw new OAuthNotSupported(); } public function recommendsBreakBefore() { return $this->recommendsBreakBefore; } public function recommendsBreakAfter() { return $this->recommendsBreakAfter; } public function isFileDeletionAfterProcessingAdvisable() { return $this->advisesDeletionAfterProcessing; } public function supportsDelete() { return $this->supportsDelete; } public function supportsDownloadToFile() { return $this->supportsDownloadToFile; } public function supportsDownloadToBrowser() { return $this->supportsDownloadToBrowser; } public function doesInlineDownloadToBrowser() { return $this->inlineDownloadToBrowser; } public function getRemotePath() { return $this->remotePath; } /** * Returns the URL to the OAuth2 helper script. Used by the oauthOpen method. Must be overridden in subclasses. * * @return string * * @throws OAuthNotSupported */ protected function getOAuth2HelperUrl() { throw new OAuthNotSupported(); } /** * Returns an instance of the connector object. * * @param bool $forceNew Should I force the creation of a new connector object? * * @return object The connector object * * @throws BadConfiguration If there is a configuration error which prevents creating a connector object. * @throws Exception */ final protected function getConnector($forceNew = false) { if ($forceNew) { $this->resetConnector(); } if (empty($this->connector)) { $this->connector = $this->makeConnector(); } return $this->connector; } /** * Resets the connector. * * If the connector requires any special handling upon destruction you must handle it in its __destruct method. * * @return void */ final protected function resetConnector() { $this->connector = null; } /** * Creates a new connector object based on the engine configuration stored in the backup profile. * * Do not use this method directly. Use getConnector() instead. * * @return object The connector object * * @throws BadConfiguration If there is a configuration error which prevents creating a connector object. * @throws Exception Any other error when creating or initializing the connector object. */ protected abstract function makeConnector(); }