30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-09-23 02:29:07 +00:00

Controller Cleanup

This commit is contained in:
Tuan Pham Ngoc 2021-06-20 16:27:34 +07:00
parent 02f9811d37
commit 17fbda865c

View File

@ -12,6 +12,7 @@ namespace Joomla\Component\Weblinks\Administrator\Controller;
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\FormController; use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
@ -33,7 +34,6 @@ class WeblinkController extends FormController
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int'); $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$allow = null;
if ($categoryId) if ($categoryId)
{ {
@ -94,13 +94,13 @@ class WeblinkController extends FormController
*/ */
public function batch($model = null) public function batch($model = null)
{ {
\JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN')); $this->checkToken();
// Set the model // Set the model
$model = $this->getModel('Weblink', '', array()); $model = $this->getModel('Weblink', '', array());
// Preset the redirect // Preset the redirect
$this->setRedirect(\JRoute::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false)); $this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
return parent::batch($model); return parent::batch($model);
} }
@ -121,7 +121,7 @@ class WeblinkController extends FormController
if ($task == 'save') if ($task == 'save')
{ {
$this->setRedirect(\JRoute::_('index.php?option=com_weblinks&view=weblinks', false)); $this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks', false));
} }
} }
} }