Ejemplo n.º 1
0
 /**
  * Gets instance of helper object class if exists
  *
  * @return  mixed It will return Api helper class or false if it does not exists
  *
  * @since   1.2
  */
 public function getHelperObject()
 {
     if (!empty($this->apiHelperClass)) {
         return $this->apiHelperClass;
     }
     $version = $this->options->get('webserviceVersion', '');
     $helperFile = RApiHalHelper::getWebserviceFile($this->client, strtolower($this->webserviceName), $version, 'php', $this->webservicePath);
     if (file_exists($helperFile)) {
         require_once $helperFile;
     }
     $webserviceName = preg_replace('/[^A-Z0-9_\\.]/i', '', $this->webserviceName);
     $helperClassName = 'RApiHalHelper' . ucfirst($this->client) . ucfirst(strtolower($webserviceName));
     if (class_exists($helperClassName)) {
         $this->apiHelperClass = new $helperClassName();
     }
     return $this->apiHelperClass;
 }
Ejemplo n.º 2
0
 /**
  * Uninstalls Webservice access and deletes XML file
  *
  * @param   string  $client      Client
  * @param   string  $webservice  Webservice name
  * @param   string  $version     Webservice version
  * @param   string  $path        Path to webservice files
  *
  * @return  boolean  Returns true if Content element was successfully purged
  */
 public function deleteWebservice($client, $webservice = '', $version = '1.0.0', $path = '')
 {
     $xmlFilePath = RApiHalHelper::getWebserviceFile($client, strtolower($webservice), $version, 'xml', $path);
     $helperFilePath = RApiHalHelper::getWebserviceFile($client, strtolower($webservice), $version, 'php', $path);
     try {
         JFile::delete($xmlFilePath);
         if (!empty($helperFilePath)) {
             JFile::delete($helperFilePath);
         }
     } catch (Exception $e) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_WEBSERVICES_WEBSERVICE_DELETE_ERROR', $e->getMessage()), 'error');
         return false;
     }
     JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_WEBSERVICES_WEBSERVICE_DELETED'), 'message');
     return true;
 }