Exemplo n.º 1
0
 public function delete($id = null)
 {
     // Include dependencies
     jimport('joomla.application.component.controller');
     jimport('joomla.form.form');
     jimport('joomla.database.table');
     require_once JPATH_ADMINISTRATOR . '/components/com_content/controllers/articles.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_content/models/article.php';
     JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_content/models/forms/');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/tables/');
     // Fake parameters
     $_POST['task'] = 'trash';
     $_REQUEST['task'] = 'trash';
     $_REQUEST[JUtility::getToken()] = 1;
     $_POST[JUtility::getToken()] = 1;
     JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);
     $controller = new ContentControllerArticles();
     try {
         $controller->execute('trash');
     } catch (JException $e) {
         $success = false;
         $controller->set('messageType', 'error');
         $controller->set('message', $e->getMessage());
     }
     if ($controller->getError()) {
         $response = $this->getErrorResponse(400, $controller->getError());
     } elseif ('error' == $controller->get('messageType')) {
         $response = $this->getErrorResponse(400, $controller->get('message'));
     } else {
         $response = $this->getSuccessResponse(200, $controller->get('message'));
     }
     $this->plugin->setResponse($response);
 }
Exemplo n.º 2
0
 /**
  * Method to get a model object, loading it if required.
  *
  * @param   string  $name    The model name. Optional.
  * @param   string  $prefix  The class prefix. Optional.
  * @param   array   $config  Configuration array for model. Optional.
  *
  * @return  object  The model.
  *
  * @since   1.6
  */
 public function getModel($name = 'Feature', $prefix = 'ContentModel', $config = array('ignore_request' => true))
 {
     $model = parent::getModel($name, $prefix, $config);
     return $model;
 }
Exemplo n.º 3
0
 /**
  * Method to publish a list of articles.
  *
  * @return	void
  * @since	1.0
  */
 function publish()
 {
     parent::publish();
     $this->setRedirect('index.php?option=com_content&view=featured');
 }