Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('banner.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_banners.banner', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $isNew) {
} else {
$toolbar->cancel('client.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_banners.client', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {

$toolbar->cancel('contact.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_contact.contact', $this->item->id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) {
$toolbar->cancel('article.cancel', 'JTOOLBAR_CLOSE');

if (!$isNew) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_content.article', $this->item->id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function addToolbar(): Toolbar

// Clean up input to ensure a clean url.
$filter = InputFilter::getInstance();
$aliasArray = explode('.', $this->state->item_id);
$aliasArray = explode('.', $this->state->get('item_id'));

if ($aliasArray[1] === 'category') {
$option = 'com_categories';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function display($tpl = null)
$this->state = $model->getState();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
$this->enabled = $this->state->params->get('gather_search_statistics', 0);
$this->enabled = $this->state->get('params')->get('gather_search_statistics', 0);
$this->canDo = ContentHelper::getActions('com_finder');
$uri = Uri::getInstance();
$link = 'index.php?option=com_config&view=component&component=com_finder&return=' . base64_encode($uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('newsfeed.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_newsfeeds.newsfeed', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo) {

$toolbar->cancel('tag.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
$toolbar->versions('com_tags.tag', $this->item->id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) {
} else {
$toolbar->cancel('note.cancel');

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $canDo->get('core.edit')) {
$toolbar->versions('com_users.note', $this->item->id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/com_contact/src/View/Form/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function display($tpl = null)
}

// Create a shortcut to the parameters.
$this->params = $this->state->params;
$this->params = $this->state->get('params');

// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''));
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/src/Model/ArchiveModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function populateState($ordering = null, $direction = null)
*/
protected function getListQuery()
{
$params = $this->state->params;
$params = $this->state->get('params');
$app = Factory::getApplication();
$catids = $app->getInput()->get('catid', [], 'array');
$catids = array_values(array_diff($catids, ['']));
Expand Down Expand Up @@ -158,7 +158,7 @@ public function getYears()
$db = $this->getDatabase();
$nowDate = Factory::getDate()->toSql();
$query = $db->getQuery(true);
$queryDate = QueryHelper::getQueryDate($this->state->params->get('order_date'), $db);
$queryDate = QueryHelper::getQueryDate($this->state->get('params')->get('order_date'), $db);
$years = $query->year($queryDate);
$yearSort = $this->state->params->get('year_sort_order', 'ASC');

Expand Down
6 changes: 3 additions & 3 deletions components/com_content/src/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ protected function _buildContentOrderBy()
{
$app = Factory::getApplication();
$db = $this->getDatabase();
$params = $this->state->params;
$params = $this->state->get('params');
$itemid = $app->getInput()->get('id', 0, 'int') . ':' . $app->getInput()->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
Expand Down Expand Up @@ -335,8 +335,8 @@ public function getPagination()
public function getCategory()
{
if (!\is_object($this->_item)) {
if (isset($this->state->params)) {
$params = $this->state->params;
if (!empty($this->state->get('params'))) {
$params = $this->state->get('params');
$options = [];
$options['countItems'] = $params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0);
$options['access'] = $params->get('check_access_rights', 1);
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/src/Model/FeaturedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function populateState($ordering = null, $direction = null)
$limitstart = $input->getUint('limitstart', 0);
$this->setState('list.start', $limitstart);

$params = $this->state->params;
$params = $this->state->get('params');

if ($menu = $app->getMenu()->getActive()) {
$menuParams = $menu->getParams();
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/src/View/Archive/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function display($tpl = null)
$pagination->hideEmptyLimitstart = true;

// Get the page/component configuration
$params = &$state->params;
$params = $state->get('params');

PluginHelper::importPlugin('content');

Expand Down
2 changes: 1 addition & 1 deletion components/com_content/src/View/Featured/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function display($tpl = null)
}

/** @var \Joomla\Registry\Registry $params */
$params = $state->params;
$params = $state->get('params');

// PREPARE THE DATA

Expand Down
6 changes: 3 additions & 3 deletions components/com_content/src/View/Form/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function display($tpl = null)
$this->return_page = $model->getReturnPage();

if (empty($this->item->id)) {
$catid = $this->state->params->get('catid');
$catid = $this->state->get('params')->get('catid');

if ($this->state->params->get('enable_category') == 1 && $catid) {
if ($this->state->get('params')->get('enable_category') == 1 && $catid) {
$authorised = $user->authorise('core.create', 'com_content.category.' . $catid);
} else {
$authorised = $user->authorise('core.create', 'com_content') || \count($user->getAuthorisedCategories('com_content', 'core.create'));
Expand Down Expand Up @@ -160,7 +160,7 @@ public function display($tpl = null)
}

// Create a shortcut to the parameters.
$params = &$this->state->params;
$params = $this->state->get('params');

// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', ''));
Expand Down
2 changes: 1 addition & 1 deletion components/com_privacy/src/View/Confirm/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function display($tpl = null)
$model = $this->getModel();
$this->form = $model->getForm();
$this->state = $model->getState();
$this->params = $this->state->params;
$this->params = $this->state->get('params');

// Check for errors.
if (\count($errors = $model->getErrors())) {
Expand Down
2 changes: 1 addition & 1 deletion components/com_privacy/src/View/Remind/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function display($tpl = null)
$model = $this->getModel();
$this->form = $model->getForm();
$this->state = $model->getState();
$this->params = $this->state->params;
$this->params = $this->state->get('params');

// Check for errors.
if (\count($errors = $model->getErrors())) {
Expand Down
2 changes: 1 addition & 1 deletion components/com_privacy/src/View/Request/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function display($tpl = null)
$model = $this->getModel();
$this->form = $model->getForm();
$this->state = $model->getState();
$this->params = $this->state->params;
$this->params = $this->state->get('params');
$this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1);

// Check for errors.
Expand Down
8 changes: 4 additions & 4 deletions components/com_tags/src/Model/TagModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function getItems()
);

// Get display date
switch ($this->state->params->get('tag_list_show_date')) {
switch ($this->state->get('params')->get('tag_list_show_date')) {
case 'modified':
$item->displayDate = $item->core_modified_time;
break;
Expand Down Expand Up @@ -140,7 +140,7 @@ protected function getListQuery()

$typesr = $this->getState('tag.typesr');
$orderByOption = $this->getState('list.ordering', 'c.core_title');
$includeChildren = $this->state->params->get('include_children', 0);
$includeChildren = $this->getState('params')->get('include_children', 0);
$orderDir = $this->getState('list.direction', 'ASC');
$matchAll = $this->getState('params')->get('return_any_or_all', 1);
$language = $this->getState('tag.language');
Expand Down Expand Up @@ -232,7 +232,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC')

$itemid = $pkString . ':' . $app->getInput()->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderCol = !$orderCol ? $this->state->params->get('tag_list_orderby', 'c.core_title') : $orderCol;
$orderCol = !$orderCol ? $this->state->get('params')->get('tag_list_orderby', 'c.core_title') : $orderCol;

if (!\in_array($orderCol, $this->filter_fields)) {
$orderCol = 'c.core_title';
Expand All @@ -241,7 +241,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC')
$this->setState('list.ordering', $orderCol);

$listOrder = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order_direction', 'filter_order_Dir', '', 'string');
$listOrder = !$listOrder ? $this->state->params->get('tag_list_orderby_direction', 'ASC') : $listOrder;
$listOrder = !$listOrder ? $this->state->get('params')->get('tag_list_orderby_direction', 'ASC') : $listOrder;

if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) {
$listOrder = 'ASC';
Expand Down
10 changes: 5 additions & 5 deletions components/com_tags/src/Model/TagsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ protected function getListQuery()
$user = $this->getCurrentUser();
$groups = $user->getAuthorisedViewLevels();
$pid = (int) $this->getState('tag.parent_id');
$orderby = $this->state->params->get('all_tags_orderby', 'title');
$published = (int) $this->state->params->get('published', 1);
$orderDirection = $this->state->params->get('all_tags_orderby_direction', 'ASC');
$orderby = $this->state->get('params')->get('all_tags_orderby', 'title');
$published = (int) $this->state->get('params')->get('published', 1);
$orderDirection = $this->state->get('params')->get('all_tags_orderby_direction', 'ASC');
$language = $this->getState('tag.language');

// Create a new query object.
Expand Down Expand Up @@ -138,10 +138,10 @@ protected function getListQuery()
if ($format === 'feed') {
$limit = $app->get('feed_limit');
} else {
if ($this->state->params->get('show_pagination_limit')) {
if ($this->state->get('params')->get('show_pagination_limit')) {
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
} else {
$limit = $this->state->params->get('maximum', 20);
$limit = $this->state->get('params')->get('maximum', 20);
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/com_users/src/View/Remind/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function display($tpl = null)
$model = $this->getModel();
$this->form = $model->getForm();
$this->state = $model->getState();
$this->params = $this->state->params;
$this->params = $this->state->get('params');

// Check for errors.
if (\count($errors = $model->getErrors())) {
Expand Down
2 changes: 1 addition & 1 deletion components/com_users/src/View/Reset/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function display($tpl = null)
}

$this->state = $model->getState();
$this->params = $this->state->params;
$this->params = $this->state->get('params');

// Check for errors.
if (\count($errors = $model->getErrors())) {
Expand Down
18 changes: 9 additions & 9 deletions libraries/src/MVC/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\MVC\Model\State;
use Joomla\CMS\MVC\View\JsonApiView;
use Joomla\CMS\Object\CMSObject;
use Joomla\Input\Input;
use Joomla\String\Inflector;
use Tobscure\JsonApi\Exception\InvalidParameterException;
Expand Down Expand Up @@ -86,7 +86,9 @@ class ApiController extends BaseController
/**
* The model state to inject
*
* @var \Joomla\Registry\Registry
* @var State|\Joomla\Registry\Registry
*
* @todo Remove the State type hint in Joomla 7.0 since it will be removed see State class
*/
protected $modelState;

Expand All @@ -106,7 +108,7 @@ class ApiController extends BaseController
*/
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSWebApplicationInterface $app = null, ?Input $input = null)
{
$this->modelState = new CMSObject();
$this->modelState = new State();

parent::__construct($config, $factory, $app, $input);

Expand Down Expand Up @@ -204,15 +206,13 @@ public function displayList()
$offset = null;

if (\array_key_exists('offset', $paginationInfo)) {
$offset = $paginationInfo['offset'];
$property = $this->context . '.limitstart';
$this->modelState->$property = $offset;
$offset = $paginationInfo['offset'];
$this->modelState->set($this->context . '.limitstart', $offset);
}

if (\array_key_exists('limit', $paginationInfo)) {
$limit = $paginationInfo['limit'];
$property = $this->context . '.list.limit';
$this->modelState->$property = $limit;
$limit = $paginationInfo['limit'];
$this->modelState->set($this->context . '.list.limit', $limit);
}

$viewType = $this->app->getDocument()->getType();
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/MVC/View/CategoriesView.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function display($tpl = null)
return false;
}

$params = &$state->params;
$params = $state->get('params');

$items = [$parent->id => $items];

Expand Down
2 changes: 1 addition & 1 deletion libraries/src/MVC/View/FormView.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected function addToolbar()
'btn-success'
);

if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) {
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->get('params')->get('save_history', 0) && $itemEditable) {
ToolbarHelper::versions($this->option . '.' . $viewName, $this->item->id);
}

Expand Down
12 changes: 4 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15288,10 +15288,8 @@ parameters:

-
message: '''
#^Call to method __construct\(\) of deprecated class Joomla\\CMS\\Object\\CMSObject\:
4\.3 will be removed in 6\.0
Use \\stdClass or \\Joomla\\Registry\\Registry instead\.
Example\: new \\Joomla\\Registry\\Registry\(\);$#
#^Call to method __construct\(\) of deprecated class Joomla\\CMS\\MVC\\Model\\State\:
5\.0\.0 will be removed in 7\.0, use the Registry directly$#
'''
identifier: method.deprecatedClass
count: 1
Expand All @@ -15305,10 +15303,8 @@ parameters:

-
message: '''
#^Instantiation of deprecated class Joomla\\CMS\\Object\\CMSObject\:
4\.3 will be removed in 6\.0
Use \\stdClass or \\Joomla\\Registry\\Registry instead\.
Example\: new \\Joomla\\Registry\\Registry\(\);$#
#^Instantiation of deprecated class Joomla\\CMS\\MVC\\Model\\State\:
5\.0\.0 will be removed in 7\.0, use the Registry directly$#
'''
identifier: new.deprecatedClass
count: 1
Expand Down
Loading