diff --git a/components/com_banners/models/banners.php b/components/com_banners/models/banners.php index c7a7e432c0a1e..3173923b5f038 100644 --- a/components/com_banners/models/banners.php +++ b/components/com_banners/models/banners.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); @@ -120,7 +121,7 @@ protected function getListQuery() } elseif ((is_array($categoryId)) && (count($categoryId) > 0)) { - JArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); if ($categoryId != '0') diff --git a/components/com_config/model/form.php b/components/com_config/model/form.php index a0537d2d403ce..18f0f41c7c82f 100644 --- a/components/com_config/model/form.php +++ b/components/com_config/model/form.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Prototype form model. * @@ -137,7 +139,7 @@ abstract public function getForm($data = array(), $loadData = true); protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false) { // Handle the optional arguments. - $options['control'] = JArrayHelper::getValue($options, 'control', false); + $options['control'] = ArrayHelper::getValue($options, 'control', false); // Create a signature hash. $hash = sha1($source . serialize($options)); diff --git a/components/com_content/controllers/article.php b/components/com_content/controllers/article.php index b7b76bb395c26..ec0d966906d9f 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Content article class. * @@ -68,7 +70,7 @@ public function add() protected function allowAdd($data = array()) { $user = JFactory::getUser(); - $categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int'); + $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int'); $allow = null; if ($categoryId) diff --git a/components/com_content/models/articles.php b/components/com_content/models/articles.php index beaf681d3ec26..d2819941f4f76 100644 --- a/components/com_content/models/articles.php +++ b/components/com_content/models/articles.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * This models supports retrieving lists of articles. @@ -301,7 +302,7 @@ protected function getListQuery() } elseif (is_array($published)) { - JArrayHelper::toInteger($published); + $published = ArrayHelper::toInteger($published); $published = implode(',', $published); // Use article state if badcats.id is null, otherwise, force 0 for unpublished @@ -338,7 +339,7 @@ protected function getListQuery() } elseif (is_array($articleId)) { - JArrayHelper::toInteger($articleId); + $articleId = ArrayHelper::toInteger($articleId); $articleId = implode(',', $articleId); $type = $this->getState('filter.article_id.include', true) ? 'IN' : 'NOT IN'; $query->where('a.id ' . $type . ' (' . $articleId . ')'); @@ -381,7 +382,7 @@ protected function getListQuery() } elseif (is_array($categoryId) && (count($categoryId) > 0)) { - JArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); if (!empty($categoryId)) @@ -402,7 +403,7 @@ protected function getListQuery() } elseif (is_array($authorId)) { - JArrayHelper::toInteger($authorId); + $authorId = ArrayHelper::toInteger($authorId); $authorId = implode(',', $authorId); if ($authorId) @@ -427,8 +428,6 @@ protected function getListQuery() if (!empty($first)) { - JArrayHelper::toString($authorAlias); - foreach ($authorAlias as $key => $alias) { $authorAlias[$key] = $db->quote($alias); diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php index f92f90400efa2..5906a59c090e1 100644 --- a/components/com_content/models/category.php +++ b/components/com_content/models/category.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * This models supports retrieving a category, the articles associated with the category, @@ -458,8 +459,7 @@ public function &getChildren() if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha') { - jimport('joomla.utilities.arrayhelper'); - JArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); + $this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); } } diff --git a/components/com_content/models/form.php b/components/com_content/models/form.php index e8a653057a8ed..72dcca654b3f2 100644 --- a/components/com_content/models/form.php +++ b/components/com_content/models/form.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; // Base this model on the backend version. require_once JPATH_ADMINISTRATOR . '/components/com_content/models/article.php'; @@ -83,7 +84,7 @@ public function getItem($itemId = null) } $properties = $table->getProperties(1); - $value = JArrayHelper::toObject($properties, 'JObject'); + $value = ArrayHelper::toObject($properties, 'JObject'); // Convert attrib field to Registry. $value->params = new Registry; diff --git a/components/com_tags/models/tag.php b/components/com_tags/models/tag.php index 4c1bfd3299495..433000b8d8850 100644 --- a/components/com_tags/models/tag.php +++ b/components/com_tags/models/tag.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Tags Component Tag Model * @@ -175,9 +177,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') $this->setState('params', $params); // Load state from the request. - $ids = $app->input->get('id', array(), 'array'); - - JArrayHelper::toInteger($ids); + $ids = ArrayHelper::toInteger($app->input->get('id', array(), 'array')); $pkString = implode(',', $ids); @@ -193,7 +193,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') // Sanitise $typesr = explode(',', $typesr); - JArrayHelper::toInteger($typesr); + $typesr = ArrayHelper::toInteger($typesr); $this->setState('tag.typesr', $typesr); } @@ -290,7 +290,7 @@ public function getItem($pk = null) // Convert the JTable to a clean JObject. $properties = $table->getProperties(1); - $this->item[] = JArrayHelper::toObject($properties, 'JObject'); + $this->item[] = ArrayHelper::toObject($properties, 'JObject'); } catch (RuntimeException $e) { diff --git a/components/com_tags/router.php b/components/com_tags/router.php index bcbb4babd3c28..9bec71e8c2bd2 100644 --- a/components/com_tags/router.php +++ b/components/com_tags/router.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Routing class from com_tags * @@ -47,7 +49,7 @@ public function build(&$query) if (is_array($mId)) { - JArrayHelper::toInteger($mId); + $mId = ArrayHelper::toInteger($mId); } $view = ''; diff --git a/components/com_users/models/remind.php b/components/com_users/models/remind.php index c6238558e9026..cc21693eacecc 100644 --- a/components/com_users/models/remind.php +++ b/components/com_users/models/remind.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Remind model class for Users. * @@ -164,7 +166,7 @@ public function processRemindRequest($data) $mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1); // Put together the email template data. - $data = JArrayHelper::fromObject($user); + $data = ArrayHelper::fromObject($user); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename');