30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-09 01:32:22 +00:00

Codestyle error fixes

This commit is contained in:
Tuan Pham Ngoc 2021-06-26 17:36:16 +07:00
parent f9d7f8625b
commit b9330b42a9
6 changed files with 52 additions and 27 deletions

View File

@ -19,8 +19,8 @@ class JHtmlIcon
/** /**
* Create a link to create a new weblink * Create a link to create a new weblink
* *
* @param mixed $weblink Unused * @param object $category The category information
* @param mixed $params Unused * @param \Joomla\Registry\Registry $params The item parameters
* *
* @return string * @return string
*/ */

View File

@ -60,7 +60,11 @@ class WeblinkController extends FormController
{ {
// Redirect to the return page. // Redirect to the return page.
$this->setRedirect($this->getReturnPage()); $this->setRedirect($this->getReturnPage());
return false;
} }
return true;
} }
/** /**

View File

@ -10,6 +10,7 @@
namespace Joomla\Component\Weblinks\Site\Model; namespace Joomla\Component\Weblinks\Site\Model;
use Joomla\CMS\Categories\Categories; use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Factory; use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
@ -38,8 +39,18 @@ class CategoriesModel extends ListModel
*/ */
protected $_extension = 'com_weblinks'; protected $_extension = 'com_weblinks';
/**
* Parent category
*
* @var CategoryNode|null
*/
private $_parent = null; private $_parent = null;
/**
* Categories data
*
* @var false|array
*/
private $_items = null; private $_items = null;
/** /**

View File

@ -12,6 +12,7 @@ namespace Joomla\Component\Weblinks\Site\Model;
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\CMS\Categories\Categories; use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory; use Joomla\CMS\Factory;
use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Helper\TagsHelper;
@ -28,18 +29,24 @@ use Joomla\Registry\Registry;
class CategoryModel extends ListModel class CategoryModel extends ListModel
{ {
/** /**
* Category items data * Category item data
* *
* @var array * @var CategoryNode|null
*/ */
protected $_item = null; protected $_item = null;
protected $_articles = null; /**
* Array of child-categories
protected $_siblings = null; *
* @var CategoryNode[]|null
*/
protected $_children = null; protected $_children = null;
/**
* Parent category of the current one
*
* @var CategoryNode|null
*/
protected $_parent = null; protected $_parent = null;
/** /**
@ -65,19 +72,6 @@ class CategoryModel extends ListModel
parent::__construct($config); parent::__construct($config);
} }
/**
* The category that applies.
*
* @var object
*/
protected $_category = null;
/**
* The list of other weblink categories.
*
* @var array
*/
protected $_categories = null;
/** /**
* Method to get a list of items. * Method to get a list of items.

View File

@ -21,10 +21,26 @@ defined('_JEXEC') or die;
*/ */
class HtmlView extends BaseHtmlView class HtmlView extends BaseHtmlView
{ {
/**
* The weblink object
*
* @var \JObject
*/
protected $item; protected $item;
/**
* The page parameters
*
* @var \Joomla\Registry\Registry|null
*/
protected $params; protected $params;
/**
* The item model state
*
* @var \Joomla\Registry\Registry
* @since 1.6
*/
protected $state; protected $state;
/** /**
@ -38,7 +54,7 @@ class HtmlView extends BaseHtmlView
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
$app = Factory::getApplication(); $app = Factory::getApplication();
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->state = $this->get('State'); $this->state = $this->get('State');
@ -49,17 +65,17 @@ class HtmlView extends BaseHtmlView
$offset = $this->state->get('list.offset'); $offset = $this->state->get('list.offset');
$app->triggerEvent('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset)); $app->triggerEvent('onContentPrepare', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event = new \stdClass; $item->event = new \stdClass;
$results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayTitle = trim(implode("\n", $results)); $item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->beforeDisplayContent = trim(implode("\n", $results)); $item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayContent = trim(implode("\n", $results)); $item->event->afterDisplayContent = trim(implode("\n", $results));
parent::display($tpl); parent::display($tpl);

View File

@ -85,7 +85,7 @@ class WeblinksHelper
$model->setState( $model->setState(
'list.select', 'list.select',
'a.*, c.published AS c_published,' . $case_when1 . ',' . $case_when2 . ',' . 'DATE_FORMAT(a.created, "%Y-%m-%d") AS created' 'a.*, c.published AS c_published,' . $case_when1 . ',' . $case_when2 . ', DATE_FORMAT(a.created, "%Y-%m-%d") AS created'
); );
$model->setState('filter.c.published', 1); $model->setState('filter.c.published', 1);