/** * Method to instantiate the file-based api call. * * @param mixed $options Optional custom options to load. JRegistry or array format * * @throws Exception * @since 1.2 */ public function __construct($options = null) { parent::__construct($options); JPluginHelper::importPlugin('redcore'); $this->setWebserviceName(); $this->client = $this->options->get('webserviceClient', 'site'); $this->webserviceVersion = $this->options->get('webserviceVersion', ''); $this->hal = new RApiHalDocumentResource(''); if (!empty($this->webserviceName)) { if (empty($this->webserviceVersion)) { $this->webserviceVersion = RApiHalHelper::getNewestWebserviceVersion($this->client, $this->webserviceName); } $this->webservice = RApiHalHelper::getInstalledWebservice($this->client, $this->webserviceName, $this->webserviceVersion); if (empty($this->webservice)) { throw new Exception(JText::sprintf('LIB_REDCORE_API_HAL_WEBSERVICE_NOT_INSTALLED', $this->webserviceName, $this->webserviceVersion)); } if (empty($this->webservice['state'])) { throw new Exception(JText::sprintf('LIB_REDCORE_API_HAL_WEBSERVICE_UNPUBLISHED', $this->webserviceName, $this->webserviceVersion)); } $this->webservicePath = $this->webservice['path']; $this->configuration = RApiHalHelper::loadWebserviceConfiguration($this->webserviceName, $this->webserviceVersion, 'xml', $this->webservicePath, $this->client); // Set option and view name $this->setOptionViewName($this->webserviceName, $this->configuration); // Set base data $this->setBaseDataValues(); } // Init Environment $this->triggerFunction('setApiOperation'); // Set initial status code $this->setStatusCode($this->statusCode); // Check for defined constants if (!defined('JSON_UNESCAPED_SLASHES')) { define('JSON_UNESCAPED_SLASHES', 64); } // OAuth2 check if (RBootstrap::getConfig('webservices_authorization_check', 0) == 0) { $this->authorizationCheck = 'oauth2'; } elseif (RBootstrap::getConfig('webservices_authorization_check', 0) == 1) { $this->authorizationCheck = 'joomla'; } }