';
@@ -278,7 +278,7 @@ public function select($idxQuery, $options)
}
// Check that we have at least one branch.
- if (count($branches) === 0) {
+ if (\count($branches) === 0) {
return null;
}
@@ -370,13 +370,13 @@ public function select($idxQuery, $options)
$active = null;
// Check if the branch is in the filter.
- if (array_key_exists($bv->title, $idxQuery->filters)) {
+ if (\array_key_exists($bv->title, $idxQuery->filters)) {
// Get the request filters.
$temp = Factory::getApplication()->getInput()->request->get('t', [], 'array');
// Search for active nodes in the branch and get the active node.
$active = array_intersect($temp, $idxQuery->filters[$bv->title]);
- $active = count($active) === 1 ? array_shift($active) : null;
+ $active = \count($active) === 1 ? array_shift($active) : null;
}
// Build a node.
diff --git a/administrator/components/com_finder/src/Service/HTML/Query.php b/administrator/components/com_finder/src/Service/HTML/Query.php
index 3940a3e70df8a..2f2a6ffaafa50 100644
--- a/administrator/components/com_finder/src/Service/HTML/Query.php
+++ b/administrator/components/com_finder/src/Service/HTML/Query.php
@@ -93,7 +93,7 @@ public static function explained(IndexerQuery $query)
}
// Don't include the node if it is not in the request.
- if (!in_array($id, $t)) {
+ if (!\in_array($id, $t)) {
continue;
}
@@ -106,7 +106,7 @@ public static function explained(IndexerQuery $query)
}
// Build the interpreted query.
- return count($parts) ? implode(Text::_('COM_FINDER_QUERY_TOKEN_GLUE'), $parts) : null;
+ return \count($parts) ? implode(Text::_('COM_FINDER_QUERY_TOKEN_GLUE'), $parts) : null;
}
/**
@@ -128,7 +128,7 @@ public static function suggested(IndexerQuery $query)
}
// Check if there were any ignored or included keywords.
- if (count($query->ignored) || count($query->included)) {
+ if (\count($query->ignored) || \count($query->included)) {
$suggested = $query->input;
// Replace the ignored keyword suggestions.
diff --git a/administrator/components/com_finder/src/Table/FilterTable.php b/administrator/components/com_finder/src/Table/FilterTable.php
index 330b5d64bfc18..e1e415a2e841d 100644
--- a/administrator/components/com_finder/src/Table/FilterTable.php
+++ b/administrator/components/com_finder/src/Table/FilterTable.php
@@ -151,8 +151,8 @@ public function store($updateNulls = true)
}
}
- if (is_array($this->data)) {
- $this->map_count = count($this->data);
+ if (\is_array($this->data)) {
+ $this->map_count = \count($this->data);
$this->data = implode(',', $this->data);
} else {
$this->map_count = 0;
diff --git a/administrator/components/com_finder/src/View/Filter/HtmlView.php b/administrator/components/com_finder/src/View/Filter/HtmlView.php
index 8272a5a15d8dc..06d923d1dfbd4 100644
--- a/administrator/components/com_finder/src/View/Filter/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Filter/HtmlView.php
@@ -94,7 +94,7 @@ public function display($tpl = null)
$this->total = $this->get('Total');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -116,7 +116,7 @@ protected function addToolbar()
Factory::getApplication()->getInput()->set('hidemainmenu', true);
$isNew = ($this->item->filter_id == 0);
- $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $this->getCurrentUser()->id);
+ $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $this->getCurrentUser()->id);
$canDo = ContentHelper::getActions('com_finder');
$toolbar = Toolbar::getInstance();
diff --git a/administrator/components/com_finder/src/View/Filters/HtmlView.php b/administrator/components/com_finder/src/View/Filters/HtmlView.php
index f675d361e7c39..e8fd0694b0cff 100644
--- a/administrator/components/com_finder/src/View/Filters/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Filters/HtmlView.php
@@ -114,7 +114,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_finder/src/View/Index/HtmlView.php b/administrator/components/com_finder/src/View/Index/HtmlView.php
index 4efa124ac4eeb..978aa80dd7ca3 100644
--- a/administrator/components/com_finder/src/View/Index/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Index/HtmlView.php
@@ -145,7 +145,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_finder/src/View/Maps/HtmlView.php b/administrator/components/com_finder/src/View/Maps/HtmlView.php
index 5c9d693cfeffb..4d46452055583 100644
--- a/administrator/components/com_finder/src/View/Maps/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Maps/HtmlView.php
@@ -118,7 +118,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_finder/src/View/Searches/HtmlView.php b/administrator/components/com_finder/src/View/Searches/HtmlView.php
index a366a791aa90b..3472846c7774f 100644
--- a/administrator/components/com_finder/src/View/Searches/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Searches/HtmlView.php
@@ -120,7 +120,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_finder/src/View/Statistics/HtmlView.php b/administrator/components/com_finder/src/View/Statistics/HtmlView.php
index 84f9f255d0bf2..4983dbd646f84 100644
--- a/administrator/components/com_finder/src/View/Statistics/HtmlView.php
+++ b/administrator/components/com_finder/src/View/Statistics/HtmlView.php
@@ -48,7 +48,7 @@ public function display($tpl = null)
$this->data = $this->get('Data');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_guidedtours/services/provider.php b/administrator/components/com_guidedtours/services/provider.php
index cb4dcfc98b5a5..8f0fe9d433b0a 100644
--- a/administrator/components/com_guidedtours/services/provider.php
+++ b/administrator/components/com_guidedtours/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_guidedtours/src/Controller/ToursController.php b/administrator/components/com_guidedtours/src/Controller/ToursController.php
index 9d5090f09e0ab..87d53b20806a0 100644
--- a/administrator/components/com_guidedtours/src/Controller/ToursController.php
+++ b/administrator/components/com_guidedtours/src/Controller/ToursController.php
@@ -53,7 +53,7 @@ public function duplicate()
}
$model = $this->getModel();
$model->duplicate($pks);
- $this->setMessage(Text::plural('COM_GUIDEDTOURS_TOURS_DUPLICATED', count($pks)));
+ $this->setMessage(Text::plural('COM_GUIDEDTOURS_TOURS_DUPLICATED', \count($pks)));
} catch (\Exception $e) {
$this->app->enqueueMessage($e->getMessage(), 'warning');
}
diff --git a/administrator/components/com_guidedtours/src/Model/StepsModel.php b/administrator/components/com_guidedtours/src/Model/StepsModel.php
index 4e53af860d544..e81680b990f7b 100644
--- a/administrator/components/com_guidedtours/src/Model/StepsModel.php
+++ b/administrator/components/com_guidedtours/src/Model/StepsModel.php
@@ -171,7 +171,7 @@ protected function getListQuery()
$tourId = (int) $tourId;
$query->where($db->quoteName('a.tour_id') . ' = :tour_id')
->bind(':tour_id', $tourId, ParameterType::INTEGER);
- } elseif (is_array($tourId)) {
+ } elseif (\is_array($tourId)) {
$tourId = ArrayHelper::toInteger($tourId);
$query->whereIn($db->quoteName('a.tour_id'), $tourId);
}
diff --git a/administrator/components/com_guidedtours/src/Model/TourModel.php b/administrator/components/com_guidedtours/src/Model/TourModel.php
index 904d7fb88dcd3..12ff03e0f585a 100644
--- a/administrator/components/com_guidedtours/src/Model/TourModel.php
+++ b/administrator/components/com_guidedtours/src/Model/TourModel.php
@@ -200,7 +200,7 @@ public function getItem($pk = null)
$pk = (!empty($pk)) ? $pk : (int) $this->getState($this->getName() . '.id');
$table = $this->getTable();
- if (is_integer($pk)) {
+ if (\is_integer($pk)) {
$result = $table->load((int) $pk);
} else {
// Attempt to load the row by uid.
diff --git a/administrator/components/com_guidedtours/src/Model/ToursModel.php b/administrator/components/com_guidedtours/src/Model/ToursModel.php
index 17ca7b0add9e4..bbadcc0e9fd6a 100644
--- a/administrator/components/com_guidedtours/src/Model/ToursModel.php
+++ b/administrator/components/com_guidedtours/src/Model/ToursModel.php
@@ -194,7 +194,7 @@ public function getListQuery()
$access = (int) $access;
$query->where($db->quoteName('a.access') . ' = :access')
->bind(':access', $access, ParameterType::INTEGER);
- } elseif (is_array($access)) {
+ } elseif (\is_array($access)) {
$access = ArrayHelper::toInteger($access);
$query->whereIn($db->quoteName('a.access'), $access);
}
diff --git a/administrator/components/com_guidedtours/src/View/Tour/HtmlView.php b/administrator/components/com_guidedtours/src/View/Tour/HtmlView.php
index 848bda5916e92..58c42776ea419 100644
--- a/administrator/components/com_guidedtours/src/View/Tour/HtmlView.php
+++ b/administrator/components/com_guidedtours/src/View/Tour/HtmlView.php
@@ -73,7 +73,7 @@ public function display($tpl = null)
$this->item = $this->get('Item');
$this->state = $this->get('State');
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_installer/services/provider.php b/administrator/components/com_installer/services/provider.php
index a7742a029b25b..3580d05c317d2 100644
--- a/administrator/components/com_installer/services/provider.php
+++ b/administrator/components/com_installer/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_installer/src/Controller/DisplayController.php b/administrator/components/com_installer/src/Controller/DisplayController.php
index 5a7c6fc206280..428087dd6e0c6 100644
--- a/administrator/components/com_installer/src/Controller/DisplayController.php
+++ b/administrator/components/com_installer/src/Controller/DisplayController.php
@@ -94,6 +94,6 @@ public function getMenuBadgeData()
$model = $this->getModel('Warnings');
- echo new JsonResponse(count($model->getItems()));
+ echo new JsonResponse(\count($model->getItems()));
}
}
diff --git a/administrator/components/com_installer/src/Controller/ManageController.php b/administrator/components/com_installer/src/Controller/ManageController.php
index f8deeb148a2e3..f305381a30f8f 100644
--- a/administrator/components/com_installer/src/Controller/ManageController.php
+++ b/administrator/components/com_installer/src/Controller/ManageController.php
@@ -87,7 +87,7 @@ public function publish()
$ntext = 'COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED';
}
- $this->setMessage(Text::plural($ntext, count($ids)));
+ $this->setMessage(Text::plural($ntext, \count($ids)));
}
}
diff --git a/administrator/components/com_installer/src/Controller/UpdateController.php b/administrator/components/com_installer/src/Controller/UpdateController.php
index d3800603c6806..7c93afcb3b709 100644
--- a/administrator/components/com_installer/src/Controller/UpdateController.php
+++ b/administrator/components/com_installer/src/Controller/UpdateController.php
@@ -174,7 +174,7 @@ public function ajax()
$updates = [];
foreach ($unfiltered_updates as $update) {
- if (!in_array($update->extension_id, $skip)) {
+ if (!\in_array($update->extension_id, $skip)) {
$updates[] = $update;
}
}
diff --git a/administrator/components/com_installer/src/Controller/UpdatesitesController.php b/administrator/components/com_installer/src/Controller/UpdatesitesController.php
index 141d7b9f942e6..0eea827352c4f 100644
--- a/administrator/components/com_installer/src/Controller/UpdatesitesController.php
+++ b/administrator/components/com_installer/src/Controller/UpdatesitesController.php
@@ -112,7 +112,7 @@ public function publish()
$ntext = ($value == 0) ? 'COM_INSTALLER_N_UPDATESITES_UNPUBLISHED' : 'COM_INSTALLER_N_UPDATESITES_PUBLISHED';
- $this->setMessage(Text::plural($ntext, count($ids)));
+ $this->setMessage(Text::plural($ntext, \count($ids)));
$this->setRedirect(Route::_('index.php?option=com_installer&view=updatesites', false));
}
diff --git a/administrator/components/com_installer/src/Helper/InstallerHelper.php b/administrator/components/com_installer/src/Helper/InstallerHelper.php
index 44b562e7d469d..9cab7489d789a 100644
--- a/administrator/components/com_installer/src/Helper/InstallerHelper.php
+++ b/administrator/components/com_installer/src/Helper/InstallerHelper.php
@@ -264,10 +264,10 @@ public static function getDownloadKey(CMSObject $extension): array
$prefix = (string) $installXmlFile->dlid['prefix'];
$suffix = (string) $installXmlFile->dlid['suffix'];
- $value = substr($extension->get('extra_query'), strlen($prefix));
+ $value = substr($extension->get('extra_query'), \strlen($prefix));
if ($suffix) {
- $value = substr($value, 0, -strlen($suffix));
+ $value = substr($value, 0, -\strlen($suffix));
}
$downloadKey = [
diff --git a/administrator/components/com_installer/src/Model/DatabaseModel.php b/administrator/components/com_installer/src/Model/DatabaseModel.php
index 4d5700884bda3..d3c7dd63f7d98 100644
--- a/administrator/components/com_installer/src/Model/DatabaseModel.php
+++ b/administrator/components/com_installer/src/Model/DatabaseModel.php
@@ -115,7 +115,7 @@ public function getErrorCount()
private function fetchSchemaCache($cid = 0)
{
// We already have it
- if (array_key_exists($cid, $this->changeSetList)) {
+ if (\array_key_exists($cid, $this->changeSetList)) {
return;
}
@@ -376,7 +376,7 @@ protected function getListQuery()
->bind(':extensionid', $extensionId, ParameterType::INTEGER);
}
- if ($folder != '' && in_array($type, ['plugin', 'library', ''])) {
+ if ($folder != '' && \in_array($type, ['plugin', 'library', ''])) {
$folder = $folder === '*' ? '' : $folder;
$query->where($db->quoteName('extensions.folder') . ' = :folder')
->bind(':folder', $folder);
@@ -409,7 +409,7 @@ protected function mergeSchemaCache($results)
$finalResults = [];
foreach ($results as $result) {
- if (array_key_exists($result->extension_id, $changeSetList) && $changeSetList[$result->extension_id]) {
+ if (\array_key_exists($result->extension_id, $changeSetList) && $changeSetList[$result->extension_id]) {
$finalResults[] = $changeSetList[$result->extension_id];
}
}
@@ -536,8 +536,8 @@ public function compareUpdateVersion($extension)
private function getOtherInformationMessage($status)
{
$problemsMessage = [];
- $problemsMessage[] = Text::sprintf('COM_INSTALLER_MSG_DATABASE_CHECKED_OK', count($status['ok']));
- $problemsMessage[] = Text::sprintf('COM_INSTALLER_MSG_DATABASE_SKIPPED', count($status['skipped']));
+ $problemsMessage[] = Text::sprintf('COM_INSTALLER_MSG_DATABASE_CHECKED_OK', \count($status['ok']));
+ $problemsMessage[] = Text::sprintf('COM_INSTALLER_MSG_DATABASE_SKIPPED', \count($status['skipped']));
return $problemsMessage;
}
diff --git a/administrator/components/com_installer/src/Model/DiscoverModel.php b/administrator/components/com_installer/src/Model/DiscoverModel.php
index 5b26d09a604d2..26cfc37974906 100644
--- a/administrator/components/com_installer/src/Model/DiscoverModel.php
+++ b/administrator/components/com_installer/src/Model/DiscoverModel.php
@@ -117,7 +117,7 @@ protected function getListQuery()
->bind(':clientid', $clientId, ParameterType::INTEGER);
}
- if ($folder != '' && in_array($type, ['plugin', 'library', ''])) {
+ if ($folder != '' && \in_array($type, ['plugin', 'library', ''])) {
$folder = $folder === '*' ? '' : $folder;
$query->where($db->quoteName('folder') . ' = :folder')
->bind(':folder', $folder);
@@ -191,7 +191,7 @@ public function discover()
]
);
- if (!array_key_exists($key, $extensions)) {
+ if (!\array_key_exists($key, $extensions)) {
// Put it into the table
$result->check();
$result->store();
@@ -215,8 +215,8 @@ public function discover_install()
$input = $app->getInput();
$eid = $input->get('cid', 0, 'array');
- if (is_array($eid) || $eid) {
- if (!is_array($eid)) {
+ if (\is_array($eid) || $eid) {
+ if (!\is_array($eid)) {
$eid = [$eid];
}
@@ -310,6 +310,6 @@ public function checkExtensions()
$db->setQuery($query);
$discoveredExtensions = $db->loadObjectList();
- return count($discoveredExtensions) > 0;
+ return \count($discoveredExtensions) > 0;
}
}
diff --git a/administrator/components/com_installer/src/Model/InstallModel.php b/administrator/components/com_installer/src/Model/InstallModel.php
index b1db9fed17720..370341810d3bb 100644
--- a/administrator/components/com_installer/src/Model/InstallModel.php
+++ b/administrator/components/com_installer/src/Model/InstallModel.php
@@ -102,11 +102,11 @@ public function install()
$results = $dispatcher->dispatch('onInstallerBeforeInstallation', $eventBefore)->getArgument('result', []);
$package = $eventBefore->getPackage();
- if (in_array(true, $results, true)) {
+ if (\in_array(true, $results, true)) {
return true;
}
- if (in_array(false, $results, true)) {
+ if (\in_array(false, $results, true)) {
return false;
}
@@ -149,12 +149,12 @@ public function install()
$results = $dispatcher->dispatch('onInstallerBeforeInstaller', $eventBeforeInst)->getArgument('result', []);
$package = $eventBeforeInst->getPackage();
- if (in_array(true, $results, true)) {
+ if (\in_array(true, $results, true)) {
return true;
}
- if (in_array(false, $results, true)) {
- if (in_array($installType, ['upload', 'url'])) {
+ if (\in_array(false, $results, true)) {
+ if (\in_array($installType, ['upload', 'url'])) {
InstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
}
@@ -185,7 +185,7 @@ public function install()
// If a manifest isn't found at the source, this may be a Joomla package; check the package directory for the Joomla manifest
if (file_exists($package['dir'] . '/administrator/manifests/files/joomla.xml')) {
// We have a Joomla package
- if (in_array($installType, ['upload', 'url'])) {
+ if (\in_array($installType, ['upload', 'url'])) {
InstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
}
@@ -201,7 +201,7 @@ public function install()
// Was the package unpacked?
if (empty($package['type'])) {
- if (in_array($installType, ['upload', 'url'])) {
+ if (\in_array($installType, ['upload', 'url'])) {
InstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
}
@@ -281,14 +281,14 @@ protected function _getPackageFromUpload()
}
// Make sure that zlib is loaded so that the package can be unpacked.
- if (!extension_loaded('zlib')) {
+ if (!\extension_loaded('zlib')) {
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB'), 'error');
return false;
}
// If there is no uploaded file, we have a problem...
- if (!is_array($userfile)) {
+ if (!\is_array($userfile)) {
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED'), 'error');
return false;
@@ -397,7 +397,7 @@ protected function _getPackageFromUrl()
// We only allow http & https here
$uri = new Uri($url);
- if (!in_array($uri->getScheme(), ['http', 'https'])) {
+ if (!\in_array($uri->getScheme(), ['http', 'https'])) {
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL_SCHEME'), 'error');
return false;
diff --git a/administrator/components/com_installer/src/Model/InstallerModel.php b/administrator/components/com_installer/src/Model/InstallerModel.php
index 791a3bcd0eacf..cf641cc4d15d2 100644
--- a/administrator/components/com_installer/src/Model/InstallerModel.php
+++ b/administrator/components/com_installer/src/Model/InstallerModel.php
@@ -78,7 +78,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$customOrderFields = ['name', 'client_translated', 'type_translated', 'folder_translated', 'creationDate'];
// Process searching, ordering and pagination for fields that need to be translated.
- if (in_array($listOrder, $customOrderFields) || (!empty($search) && stripos($search, 'id:') !== 0)) {
+ if (\in_array($listOrder, $customOrderFields) || (!empty($search) && stripos($search, 'id:') !== 0)) {
// Get results from database and translate them.
$db->setQuery($query);
$result = $db->loadObjectList();
@@ -118,7 +118,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$result = ArrayHelper::sortObjects($result, $listOrder, strtolower($listDirn) == 'desc' ? -1 : 1, false, true);
// Process pagination.
- $total = count($result);
+ $total = \count($result);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total <= $limitstart) {
@@ -126,7 +126,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$this->setState('list.limitstart', 0);
}
- return array_slice($result, $limitstart, $limit ?: null);
+ return \array_slice($result, $limitstart, $limit ?: null);
}
// Process searching, ordering and pagination for regular database fields.
@@ -149,7 +149,7 @@ protected function translate(&$items)
$lang = Factory::getLanguage();
foreach ($items as &$item) {
- if (strlen($item->manifest_cache) && $data = json_decode($item->manifest_cache)) {
+ if (\strlen($item->manifest_cache) && $data = json_decode($item->manifest_cache)) {
foreach ($data as $key => $value) {
if ($key == 'type') {
// Ignore the type field
@@ -215,7 +215,7 @@ protected function translate(&$items)
settype($item->description, 'string');
- if (!in_array($item->type, ['language'])) {
+ if (!\in_array($item->type, ['language'])) {
$item->description = Text::_($item->description);
}
}
diff --git a/administrator/components/com_installer/src/Model/LanguagesModel.php b/administrator/components/com_installer/src/Model/LanguagesModel.php
index bcbd6b99a627b..39f381c03fe31 100644
--- a/administrator/components/com_installer/src/Model/LanguagesModel.php
+++ b/administrator/components/com_installer/src/Model/LanguagesModel.php
@@ -194,10 +194,10 @@ function ($a, $b) use ($that) {
);
// Count the non-paginated list
- $this->languageCount = count($languages);
+ $this->languageCount = \count($languages);
$limit = ($this->getState('list.limit') > 0) ? $this->getState('list.limit') : $this->languageCount;
- return array_slice($languages, $this->getStart(), $limit);
+ return \array_slice($languages, $this->getStart(), $limit);
}
/**
diff --git a/administrator/components/com_installer/src/Model/ManageModel.php b/administrator/components/com_installer/src/Model/ManageModel.php
index 5bdd21de69137..d6c6e954d5d88 100644
--- a/administrator/components/com_installer/src/Model/ManageModel.php
+++ b/administrator/components/com_installer/src/Model/ManageModel.php
@@ -125,7 +125,7 @@ public function publish(&$eid = [], $value = 1)
* Ensure eid is an array of extension ids
* @todo: If it isn't an array do we want to set an error and fail?
*/
- if (!is_array($eid)) {
+ if (!\is_array($eid)) {
$eid = [$eid];
}
@@ -196,7 +196,7 @@ public function publish(&$eid = [], $value = 1)
*/
public function refresh($eid)
{
- if (!is_array($eid)) {
+ if (!\is_array($eid)) {
$eid = [$eid => 0];
}
@@ -235,7 +235,7 @@ public function remove($eid = [])
* Ensure eid is an array of extension ids in the form id => client_id
* @todo: If it isn't an array do we want to set an error and fail?
*/
- if (!is_array($eid)) {
+ if (!\is_array($eid)) {
$eid = [$eid => 0];
}
diff --git a/administrator/components/com_installer/src/Model/UpdateModel.php b/administrator/components/com_installer/src/Model/UpdateModel.php
index ca1c5c1ea275c..25441e7f27db6 100644
--- a/administrator/components/com_installer/src/Model/UpdateModel.php
+++ b/administrator/components/com_installer/src/Model/UpdateModel.php
@@ -129,7 +129,7 @@ protected function getListQuery()
->bind(':clientid', $clientId, ParameterType::INTEGER);
}
- if ($folder != '' && in_array($type, ['plugin', 'library', ''])) {
+ if ($folder != '' && \in_array($type, ['plugin', 'library', ''])) {
$folder = $folder === '*' ? '' : $folder;
$query->where($db->quoteName('u.folder') . ' = :folder')
->bind(':folder', $folder);
@@ -216,19 +216,19 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$listDirn = $this->getState('list.direction', 'asc');
// Process ordering.
- if (in_array($listOrder, ['client_translated', 'folder_translated', 'type_translated'])) {
+ if (\in_array($listOrder, ['client_translated', 'folder_translated', 'type_translated'])) {
$db->setQuery($query);
$result = $db->loadObjectList();
$this->translate($result);
$result = ArrayHelper::sortObjects($result, $listOrder, strtolower($listDirn) === 'desc' ? -1 : 1, true, true);
- $total = count($result);
+ $total = \count($result);
if ($total < $limitstart) {
$limitstart = 0;
$this->setState('list.start', 0);
}
- return array_slice($result, $limitstart, $limit ?: null);
+ return \array_slice($result, $limitstart, $limit ?: null);
}
$query->order($db->quoteName($listOrder) . ' ' . $db->escape($listDirn));
@@ -564,8 +564,8 @@ protected function preparePreUpdate($update, $table)
if (is_file($path)) {
require_once $path;
- if (class_exists($cname) && is_callable([$cname, 'prepareUpdate'])) {
- call_user_func_array([$cname, 'prepareUpdate'], [&$update, &$table]);
+ if (class_exists($cname) && \is_callable([$cname, 'prepareUpdate'])) {
+ \call_user_func_array([$cname, 'prepareUpdate'], [&$update, &$table]);
}
}
@@ -579,8 +579,8 @@ protected function preparePreUpdate($update, $table)
if (is_file($path)) {
require_once $path;
- if (class_exists($cname) && is_callable([$cname, 'prepareUpdate'])) {
- call_user_func_array([$cname, 'prepareUpdate'], [&$update, &$table]);
+ if (class_exists($cname) && \is_callable([$cname, 'prepareUpdate'])) {
+ \call_user_func_array([$cname, 'prepareUpdate'], [&$update, &$table]);
}
}
diff --git a/administrator/components/com_installer/src/Model/UpdatesitesModel.php b/administrator/components/com_installer/src/Model/UpdatesitesModel.php
index c03dfe20aa32e..16b14f57618e5 100644
--- a/administrator/components/com_installer/src/Model/UpdatesitesModel.php
+++ b/administrator/components/com_installer/src/Model/UpdatesitesModel.php
@@ -86,7 +86,7 @@ public function publish(&$eid = [], $value = 1)
$result = true;
// Ensure eid is an array of extension ids
- if (!is_array($eid)) {
+ if (!\is_array($eid)) {
$eid = [$eid];
}
@@ -125,7 +125,7 @@ public function delete($ids = [])
}
// Ensure eid is an array of extension ids
- if (!is_array($ids)) {
+ if (!\is_array($ids)) {
$ids = [$ids];
}
@@ -148,7 +148,7 @@ public function delete($ids = [])
// Enable the update site in the table and store it in the database
foreach ($ids as $i => $id) {
// Don't allow to delete Joomla Core update sites.
- if (in_array((int) $id, $joomlaUpdateSitesIds)) {
+ if (\in_array((int) $id, $joomlaUpdateSitesIds)) {
$app->enqueueMessage(Text::sprintf('COM_INSTALLER_MSG_UPDATESITES_DELETE_CANNOT_DELETE', $updateSitesNames[$id]->name), 'error');
continue;
}
@@ -609,7 +609,7 @@ protected function getListQuery()
->bind(':clientId', $clientId, ParameterType::INTEGER);
}
- if ($folder !== '' && in_array($type, ['plugin', 'library', ''], true)) {
+ if ($folder !== '' && \in_array($type, ['plugin', 'library', ''], true)) {
$folderForBinding = $folder === '*' ? '' : $folder;
$query->where($db->quoteName('e.folder') . ' = :folder')
->bind(':folder', $folderForBinding);
diff --git a/administrator/components/com_installer/src/View/Discover/HtmlView.php b/administrator/components/com_installer/src/View/Discover/HtmlView.php
index c341c2729254c..52f9fd30183c7 100644
--- a/administrator/components/com_installer/src/View/Discover/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Discover/HtmlView.php
@@ -55,12 +55,12 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
- if (!count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
+ if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
$this->setLayout('emptystate');
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_installer/src/View/Installer/HtmlView.php b/administrator/components/com_installer/src/View/Installer/HtmlView.php
index 600a8dd9952f7..ebc468280a034 100644
--- a/administrator/components/com_installer/src/View/Installer/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Installer/HtmlView.php
@@ -78,7 +78,7 @@ public function display($tpl = null)
// Are there messages to display?
$showMessage = false;
- if (is_object($state)) {
+ if (\is_object($state)) {
$message1 = $state->get('message');
$message2 = $state->get('extension_message');
$showMessage = ($message1 || $message2);
diff --git a/administrator/components/com_installer/src/View/Languages/HtmlView.php b/administrator/components/com_installer/src/View/Languages/HtmlView.php
index 5e0841c5fa14f..4cd75a8a0c5ae 100644
--- a/administrator/components/com_installer/src/View/Languages/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Languages/HtmlView.php
@@ -61,7 +61,7 @@ public function display($tpl = null)
$this->installedLang = LanguageHelper::getInstalledLanguages();
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_installer/src/View/Manage/HtmlView.php b/administrator/components/com_installer/src/View/Manage/HtmlView.php
index 13b87f07b607a..0548b1b84204a 100644
--- a/administrator/components/com_installer/src/View/Manage/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Manage/HtmlView.php
@@ -67,7 +67,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_installer/src/View/Update/HtmlView.php b/administrator/components/com_installer/src/View/Update/HtmlView.php
index 11c091dd6951d..dcc0cb71d0ef4 100644
--- a/administrator/components/com_installer/src/View/Update/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Update/HtmlView.php
@@ -79,7 +79,7 @@ public function display($tpl = null)
$this->paths = &$paths;
- if (count($this->items) === 0 && $this->isEmptyState = $this->get('IsEmptyState')) {
+ if (\count($this->items) === 0 && $this->isEmptyState = $this->get('IsEmptyState')) {
$this->setLayout('emptystate');
} else {
Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE'), 'warning');
diff --git a/administrator/components/com_installer/src/View/Updatesite/HtmlView.php b/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
index 5836d3ea0ff4c..a4644facc63ff 100644
--- a/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Updatesite/HtmlView.php
@@ -72,12 +72,12 @@ public function display($tpl = null): void
$dlidSupportingSites = InstallerHelper::getDownloadKeySupportedSites(false);
$update_site_id = $this->item->get('update_site_id');
- if (!in_array($update_site_id, $dlidSupportingSites)) {
+ if (!\in_array($update_site_id, $dlidSupportingSites)) {
$this->form->removeField('extra_query');
}
// Check for errors.
- if (count($errors = $model->getErrors())) {
+ if (\count($errors = $model->getErrors())) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -101,7 +101,7 @@ protected function addToolbar(): void
$user = $app->getIdentity();
$userId = $user->id;
- $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out === $userId);
+ $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out === $userId);
// Since we don't track these assets at the item level, use the category id.
$canDo = ContentHelper::getActions('com_installer', 'updatesite');
diff --git a/administrator/components/com_installer/src/View/Updatesites/HtmlView.php b/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
index 836d2e4b8d3b0..546bbe2c3815b 100644
--- a/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
+++ b/administrator/components/com_installer/src/View/Updatesites/HtmlView.php
@@ -83,7 +83,7 @@ public function display($tpl = null): void
$this->activeFilters = $model->getActiveFilters();
// Check for errors.
- if (count($errors = $model->getErrors())) {
+ if (\count($errors = $model->getErrors())) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_joomlaupdate/extract.php b/administrator/components/com_joomlaupdate/extract.php
index d157b90de4b3a..c7ed769d314d9 100644
--- a/administrator/components/com_joomlaupdate/extract.php
+++ b/administrator/components/com_joomlaupdate/extract.php
@@ -25,7 +25,7 @@
* overwritten, or if you are given a modified extract.php by a Joomla core contributor with
* changes which might fix your update problem.
*/
-define('_JOOMLA_UPDATE', 1);
+\define('_JOOMLA_UPDATE', 1);
/**
* ZIP archive extraction class
@@ -420,7 +420,7 @@ public function __construct()
*/
public static function getInstance(): self
{
- if (is_null(self::$instance)) {
+ if (\is_null(self::$instance)) {
self::$instance = new self();
}
@@ -442,7 +442,7 @@ public static function getSerialised(): string
$clone->shutdown();
$serialized = serialize($clone);
- return (function_exists('base64_encode') && function_exists('base64_decode')) ? base64_encode($serialized) : $serialized;
+ return (\function_exists('base64_encode') && \function_exists('base64_decode')) ? base64_encode($serialized) : $serialized;
}
/**
@@ -457,7 +457,7 @@ public static function getSerialised(): string
*/
public static function unserialiseInstance(string $serialised): ?self
{
- if (function_exists('base64_encode') && function_exists('base64_decode')) {
+ if (\function_exists('base64_encode') && \function_exists('base64_decode')) {
$serialised = base64_decode($serialised);
}
@@ -468,7 +468,7 @@ public static function unserialiseInstance(string $serialised): ?self
],
]);
- if (($instance === false) || !is_object($instance) || !($instance instanceof self)) {
+ if (($instance === false) || !\is_object($instance) || !($instance instanceof self)) {
return null;
}
@@ -500,7 +500,7 @@ public function __wakeup(): void
$this->fp = @fopen($this->filename, 'rb');
- if ((is_resource($this->fp)) && ($this->currentOffset > 0)) {
+ if ((\is_resource($this->fp)) && ($this->currentOffset > 0)) {
@fseek($this->fp, $this->currentOffset);
}
}
@@ -521,7 +521,7 @@ public function enforceMinimumExecutionTime()
return;
}
- $sleepMillisec = intval($minExecTime - $elapsed);
+ $sleepMillisec = \intval($minExecTime - $elapsed);
/**
* If we need to sleep for more than 1 second we should be using sleep() or time_sleep_until() to prevent high
@@ -529,29 +529,29 @@ public function enforceMinimumExecutionTime()
* other cases we will try to use usleep or time_nanosleep instead.
*/
$longSleep = $sleepMillisec > 1000;
- $miniSleepSupported = function_exists('usleep') || function_exists('time_nanosleep');
+ $miniSleepSupported = \function_exists('usleep') || \function_exists('time_nanosleep');
if (!$longSleep && $miniSleepSupported) {
- if (function_exists('usleep') && ($sleepMillisec < 1000)) {
+ if (\function_exists('usleep') && ($sleepMillisec < 1000)) {
usleep(1000 * $sleepMillisec);
return;
}
- if (function_exists('time_nanosleep') && ($sleepMillisec < 1000)) {
+ if (\function_exists('time_nanosleep') && ($sleepMillisec < 1000)) {
time_nanosleep(0, 1000000 * $sleepMillisec);
return;
}
}
- if (function_exists('sleep')) {
+ if (\function_exists('sleep')) {
sleep(ceil($sleepMillisec / 1000));
return;
}
- if (function_exists('time_sleep_until')) {
+ if (\function_exists('time_sleep_until')) {
time_sleep_until(time() + ceil($sleepMillisec / 1000));
}
}
@@ -574,7 +574,7 @@ public function setFilename(string $value)
}
$this->filename = $value;
- $this->initializeLog(dirname($this->filename));
+ $this->initializeLog(\dirname($this->filename));
}
/**
@@ -678,7 +678,7 @@ public function step(): bool
// Update running tallies when we start extracting a file
$this->filesProcessed++;
- $this->compressedTotal += array_key_exists('compressed', get_object_vars($this->fileHeader))
+ $this->compressedTotal += \array_key_exists('compressed', get_object_vars($this->fileHeader))
? $this->fileHeader->compressed : 0;
$this->uncompressedTotal += $this->fileHeader->uncompressed;
}
@@ -840,11 +840,11 @@ private function setLastExtractedFileTimestamp(int $lastExtractedFileTimestamp):
*/
private function shutdown(): void
{
- if (is_resource(self::$logFP)) {
+ if (\is_resource(self::$logFP)) {
@fclose(self::$logFP);
}
- if (!is_resource($this->fp)) {
+ if (!\is_resource($this->fp)) {
return;
}
@@ -863,15 +863,15 @@ private function shutdown(): void
*/
private function binStringLength(?string $string): int
{
- if (is_null($string)) {
+ if (\is_null($string)) {
return 0;
}
- if (function_exists('mb_strlen')) {
+ if (\function_exists('mb_strlen')) {
return mb_strlen($string, '8bit') ?: 0;
}
- return strlen($string) ?: 0;
+ return \strlen($string) ?: 0;
}
/**
@@ -957,7 +957,7 @@ private function readFileHeader(): bool
{
$this->debugMsg('Reading the file entry header.', self::LOG_DEBUG);
- if (!is_resource($this->fp)) {
+ if (!\is_resource($this->fp)) {
$this->setError('The archive is not open for reading.');
return false;
@@ -1057,7 +1057,7 @@ private function readFileHeader(): bool
// Decide filetype -- Check for directories
$this->fileHeader->type = 'file';
- if (strrpos($this->fileHeader->file, '/') == strlen($this->fileHeader->file) - 1) {
+ if (strrpos($this->fileHeader->file, '/') == \strlen($this->fileHeader->file) - 1) {
$this->fileHeader->type = 'dir';
}
@@ -1088,7 +1088,7 @@ private function readFileHeader(): bool
}
// Also try to find banned files passed in class configuration
- if ((count($this->skipFiles) > 0) && in_array($this->fileHeader->file, $this->skipFiles)) {
+ if ((\count($this->skipFiles) > 0) && \in_array($this->fileHeader->file, $this->skipFiles)) {
$isBannedFile = true;
}
@@ -1242,7 +1242,7 @@ private function openArchiveFile(): void
return;
}
- if (is_resource($this->fp)) {
+ if (\is_resource($this->fp)) {
@fclose($this->fp);
}
@@ -1289,11 +1289,11 @@ private function setCorrectPermissions(string $path): void
{
static $rootDir = null;
- if (is_null($rootDir)) {
+ if (\is_null($rootDir)) {
$rootDir = rtrim($this->addPath, '/\\');
}
- $directory = rtrim(dirname($path), '/\\');
+ $directory = rtrim(\dirname($path), '/\\');
// Is this an unwritable directory?
if (($directory != $rootDir) && !is_writeable($directory)) {
@@ -1316,9 +1316,9 @@ private function setCorrectPermissions(string $path): void
*/
private function isIgnoredDirectory(string $shortFilename): bool
{
- $check = substr($shortFilename, -1) == '/' ? rtrim($shortFilename, '/') : dirname($shortFilename);
+ $check = substr($shortFilename, -1) == '/' ? rtrim($shortFilename, '/') : \dirname($shortFilename);
- return in_array($check, $this->ignoreDirectories);
+ return \in_array($check, $this->ignoreDirectories);
}
/**
@@ -1419,7 +1419,7 @@ private function processTypeFileUncompressed(): bool
// Does the file have any data, at all?
if ($this->fileHeader->compressed == 0) {
// No file data!
- if (is_resource($outfp)) {
+ if (\is_resource($outfp)) {
@fclose($outfp);
}
@@ -1451,7 +1451,7 @@ private function processTypeFileUncompressed(): bool
}
}
- if (is_resource($outfp)) {
+ if (\is_resource($outfp)) {
@fwrite($outfp, $data);
}
@@ -1461,7 +1461,7 @@ private function processTypeFileUncompressed(): bool
}
// Close the file pointer
- if (is_resource($outfp)) {
+ if (\is_resource($outfp)) {
@fclose($outfp);
}
@@ -1509,7 +1509,7 @@ private function processTypeFileCompressed(): bool
$this->debugMsg('Zero byte Compressed file; no data will be read', self::LOG_DEBUG);
// No file data!
- if (is_resource($outfp)) {
+ if (\is_resource($outfp)) {
@fclose($outfp);
}
@@ -1551,7 +1551,7 @@ private function processTypeFileCompressed(): bool
unset($zipData);
// Write to the file.
- if (is_resource($outfp)) {
+ if (\is_resource($outfp)) {
@fwrite($outfp, $unzipData, $this->fileHeader->uncompressed);
@fclose($outfp);
}
@@ -1586,12 +1586,12 @@ private function setupMaxExecTime(): void
*/
private function getPhpMaxExecTime(): int
{
- if (!@function_exists('ini_get')) {
+ if (!@\function_exists('ini_get')) {
return 10;
}
$phpMaxTime = @ini_get("maximum_execution_time");
- $phpMaxTime = (!is_numeric($phpMaxTime) ? 10 : @intval($phpMaxTime)) ?: 10;
+ $phpMaxTime = (!is_numeric($phpMaxTime) ? 10 : @\intval($phpMaxTime)) ?: 10;
return max(1, $phpMaxTime);
}
@@ -1607,15 +1607,15 @@ private function getPhpMaxExecTime(): int
*/
private function debugMsg(string $message, int $priority = self::LOG_INFO): void
{
- if (!defined('_JOOMLA_UPDATE_DEBUG')) {
+ if (!\defined('_JOOMLA_UPDATE_DEBUG')) {
return;
}
- if (!is_resource(self::$logFP) && !is_bool(self::$logFP)) {
+ if (!\is_resource(self::$logFP) && !\is_bool(self::$logFP)) {
self::$logFP = @fopen(self::$logFilePath, 'at');
}
- if (!is_resource(self::$logFP)) {
+ if (!\is_resource(self::$logFP)) {
return;
}
@@ -1650,11 +1650,11 @@ private function debugMsg(string $message, int $priority = self::LOG_INFO): void
*/
private function initializeLog(string $logPath): void
{
- if (!defined('_JOOMLA_UPDATE_DEBUG')) {
+ if (!\defined('_JOOMLA_UPDATE_DEBUG')) {
return;
}
- $logPath = $logPath ?: dirname($this->filename);
+ $logPath = $logPath ?: \dirname($this->filename);
$logFile = rtrim($logPath, '/' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'joomla_update.txt';
self::$logFilePath = $logFile;
@@ -1662,7 +1662,7 @@ private function initializeLog(string $logPath): void
}
// Skip over the mini-controller for testing purposes
-if (defined('_JOOMLA_UPDATE_TESTING')) {
+if (\defined('_JOOMLA_UPDATE_TESTING')) {
return;
}
@@ -1680,9 +1680,9 @@ function clearFileInOPCache(string $file): bool
{
static $hasOpCache = null;
- if (is_null($hasOpCache)) {
+ if (\is_null($hasOpCache)) {
$hasOpCache = ini_get('opcache.enable')
- && function_exists('opcache_invalidate')
+ && \function_exists('opcache_invalidate')
&& (!ini_get('opcache.restrict_api') || stripos(realpath($_SERVER['SCRIPT_FILENAME']), ini_get('opcache.restrict_api')) === 0);
}
@@ -1711,12 +1711,12 @@ function clearFileInOPCache(string $file): bool
*/
function timingSafeEquals($known, $user)
{
- if (function_exists('hash_equals')) {
+ if (\function_exists('hash_equals')) {
return hash_equals($known, $user);
}
- $safeLen = strlen($known);
- $userLen = strlen($user);
+ $safeLen = \strlen($known);
+ $userLen = \strlen($user);
if ($userLen != $safeLen) {
return false;
@@ -1725,7 +1725,7 @@ function timingSafeEquals($known, $user)
$result = 0;
for ($i = 0; $i < $userLen; $i++) {
- $result |= (ord($known[$i]) ^ ord($user[$i]));
+ $result |= (\ord($known[$i]) ^ \ord($user[$i]));
}
// They are only identical strings if $result is exactly 0...
@@ -1742,7 +1742,7 @@ function timingSafeEquals($known, $user)
function getConfiguration(): ?array
{
// Make sure the locale is correct for basename() to work
- if (function_exists('setlocale')) {
+ if (\function_exists('setlocale')) {
@setlocale(LC_ALL, 'en_US.UTF8');
}
@@ -1783,7 +1783,7 @@ function getConfiguration(): ?array
/** @var array $extractionSetup */
// The file exists but no configuration is present?
- if (empty($extractionSetup ?? null) || !is_array($extractionSetup)) {
+ if (empty($extractionSetup ?? null) || !\is_array($extractionSetup)) {
return null;
}
@@ -1795,9 +1795,9 @@ function getConfiguration(): ?array
*/
$password = $extractionSetup['security.password'] ?? null;
$userPassword = $_REQUEST['password'] ?? '';
- $userPassword = !is_string($userPassword) ? '' : trim($userPassword);
+ $userPassword = !\is_string($userPassword) ? '' : trim($userPassword);
- if (empty($password) || !is_string($password) || (trim($password) == '') || (strlen(trim($password)) < 32)) {
+ if (empty($password) || !\is_string($password) || (trim($password) == '') || (\strlen(trim($password)) < 32)) {
return null;
}
@@ -1809,7 +1809,7 @@ function getConfiguration(): ?array
// An "instance" variable will resume the engine from the serialised instance
$serialized = $_REQUEST['instance'] ?? null;
- if (!is_null($serialized) && empty(ZIPExtraction::unserialiseInstance($serialized))) {
+ if (!\is_null($serialized) && empty(ZIPExtraction::unserialiseInstance($serialized))) {
// The serialised instance is corrupt or someone tries to trick us. YOU SHALL NOT PASS!
return null;
}
@@ -1834,7 +1834,7 @@ function getConfiguration(): ?array
*/
function setLongTimeout()
{
- if (!function_exists('ini_set')) {
+ if (!\function_exists('ini_set')) {
return;
}
@@ -1849,7 +1849,7 @@ function setLongTimeout()
*/
function setHugeMemoryLimit()
{
- if (!function_exists('ini_set')) {
+ if (!\function_exists('ini_set')) {
return;
}
@@ -1875,7 +1875,7 @@ function setHugeMemoryLimit()
'administrator/components/com_joomlaupdate/update.php',
];
- if (defined('_JOOMLA_UPDATE_DEBUG')) {
+ if (\defined('_JOOMLA_UPDATE_DEBUG')) {
$skipFiles[] = 'administrator/components/com_joomlaupdate/extract.php';
}
@@ -1937,7 +1937,7 @@ function setHugeMemoryLimit()
@unlink($basePath . 'update.php');
// Import a custom finalisation file
- $filename = dirname(__FILE__) . '/finalisation.php';
+ $filename = \dirname(__FILE__) . '/finalisation.php';
if (file_exists($filename)) {
clearFileInOPCache($filename);
@@ -1946,7 +1946,7 @@ function setHugeMemoryLimit()
}
// Run a custom finalisation script
- if (function_exists('finalizeUpdate')) {
+ if (\function_exists('finalizeUpdate')) {
finalizeUpdate($root, $basePath);
}
diff --git a/administrator/components/com_joomlaupdate/finalisation.php b/administrator/components/com_joomlaupdate/finalisation.php
index f220911e3ee2f..23b19cd471387 100644
--- a/administrator/components/com_joomlaupdate/finalisation.php
+++ b/administrator/components/com_joomlaupdate/finalisation.php
@@ -22,7 +22,7 @@
\define('_JEXEC', 1);
}
- if (!function_exists('jimport')) {
+ if (!\function_exists('jimport')) {
/**
* This is deprecated but it may still be used in the update finalisation script.
*
@@ -40,7 +40,7 @@ function jimport(string $path, ?string $base = null): bool
}
}
- if (!function_exists('finalizeUpdate')) {
+ if (!\function_exists('finalizeUpdate')) {
/**
* Run part of the Joomla! finalisation script, namely the part that cleans up unused files/folders
*
@@ -162,7 +162,7 @@ public static function move(string $src, string $dest): bool
*/
public static function invalidateFileCache($filepath, $force = true)
{
- return \clearFileInOPCache($filepath);
+ return clearFileInOPCache($filepath);
}
}
}
@@ -227,7 +227,7 @@ public static function delete(string $folderName): bool
continue;
}
- \clearFileInOPCache($item->getPathname());
+ clearFileInOPCache($item->getPathname());
@unlink($item->getPathname());
}
diff --git a/administrator/components/com_joomlaupdate/services/provider.php b/administrator/components/com_joomlaupdate/services/provider.php
index db679ba64acab..b55a04a784520 100644
--- a/administrator/components/com_joomlaupdate/services/provider.php
+++ b/administrator/components/com_joomlaupdate/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
index 9582dcc0b0c52..7c57a8ae59c4c 100644
--- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
+++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
@@ -176,7 +176,7 @@ public function refreshUpdates($force = false)
$minimumStability = Updater::STABILITY_STABLE;
$comJoomlaupdateParams = ComponentHelper::getParams('com_joomlaupdate');
- if (in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom'])) {
+ if (\in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom'])) {
$minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
}
@@ -184,7 +184,7 @@ public function refreshUpdates($force = false)
$reflectionMethod = $reflection->getMethod('findUpdates');
$methodParameters = $reflectionMethod->getParameters();
- if (count($methodParameters) >= 4) {
+ if (\count($methodParameters) >= 4) {
// Reinstall support is available in Updater
$updater->findUpdates(ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id, $cache_timeout, $minimumStability, true);
} else {
@@ -281,7 +281,7 @@ public function getUpdateInformation()
$db->setQuery($query);
$updateObject = $db->loadObject();
- if (is_null($updateObject)) {
+ if (\is_null($updateObject)) {
// We have not found any update in the database - we seem to be running the latest version.
$this->updateInformation['latest'] = \JVERSION;
@@ -299,7 +299,7 @@ public function getUpdateInformation()
$minimumStability = Updater::STABILITY_STABLE;
$comJoomlaupdateParams = ComponentHelper::getParams('com_joomlaupdate');
- if (in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom'])) {
+ if (\in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom'])) {
$minimumStability = $comJoomlaupdateParams->get('minimum_stability', Updater::STABILITY_STABLE);
}
@@ -935,12 +935,12 @@ public function upload()
}
// Make sure that zlib is loaded so that the package can be unpacked.
- if (!extension_loaded('zlib')) {
+ if (!\extension_loaded('zlib')) {
throw new \RuntimeException(Text::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB'), 500);
}
// If there is no uploaded file, we have a problem...
- if (!is_array($userfile)) {
+ if (!\is_array($userfile)) {
throw new \RuntimeException(Text::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED'), 500);
}
@@ -1087,19 +1087,19 @@ public function getPhpOptions()
// Check for zlib support.
$option = new \stdClass();
$option->label = Text::_('INSTL_ZLIB_COMPRESSION_SUPPORT');
- $option->state = extension_loaded('zlib');
+ $option->state = \extension_loaded('zlib');
$option->notice = null;
$options[] = $option;
// Check for XML support.
$option = new \stdClass();
$option->label = Text::_('INSTL_XML_SUPPORT');
- $option->state = extension_loaded('xml');
+ $option->state = \extension_loaded('xml');
$option->notice = null;
$options[] = $option;
// Check for mbstring options.
- if (extension_loaded('mbstring')) {
+ if (\extension_loaded('mbstring')) {
// Check for default MB language.
$option = new \stdClass();
$option->label = Text::_('INSTL_MB_LANGUAGE_IS_DEFAULT');
@@ -1118,7 +1118,7 @@ public function getPhpOptions()
// Check for missing native json_encode / json_decode support.
$option = new \stdClass();
$option->label = Text::_('INSTL_JSON_SUPPORT_AVAILABLE');
- $option->state = function_exists('json_encode') && function_exists('json_decode');
+ $option->state = \function_exists('json_encode') && \function_exists('json_decode');
$option->notice = null;
$options[] = $option;
$updateInformation = $this->getUpdateInformation();
@@ -1187,28 +1187,28 @@ public function getPhpSettings()
// Check for native ZIP support.
$setting = new \stdClass();
$setting->label = Text::_('INSTL_ZIP_SUPPORT_AVAILABLE');
- $setting->state = function_exists('zip_open') && function_exists('zip_read');
+ $setting->state = \function_exists('zip_open') && \function_exists('zip_read');
$setting->recommended = true;
$settings[] = $setting;
// Check for GD support
$setting = new \stdClass();
$setting->label = Text::sprintf('INSTL_EXTENSION_AVAILABLE', 'GD');
- $setting->state = extension_loaded('gd');
+ $setting->state = \extension_loaded('gd');
$setting->recommended = true;
$settings[] = $setting;
// Check for iconv support
$setting = new \stdClass();
$setting->label = Text::sprintf('INSTL_EXTENSION_AVAILABLE', 'iconv');
- $setting->state = function_exists('iconv');
+ $setting->state = \function_exists('iconv');
$setting->recommended = true;
$settings[] = $setting;
// Check for intl support
$setting = new \stdClass();
$setting->label = Text::sprintf('INSTL_EXTENSION_AVAILABLE', 'intl');
- $setting->state = function_exists('transliterator_transliterate');
+ $setting->state = \function_exists('transliterator_transliterate');
$setting->recommended = true;
$settings[] = $setting;
@@ -1245,7 +1245,7 @@ public function isDatabaseTypeSupported()
$unsupportedDatabaseTypes = ['sqlsrv', 'sqlazure'];
$currentDatabaseType = $this->getConfiguredDatabaseType();
- return !in_array($currentDatabaseType, $unsupportedDatabaseTypes);
+ return !\in_array($currentDatabaseType, $unsupportedDatabaseTypes);
}
return true;
@@ -1296,16 +1296,16 @@ public function getIniParserAvailability()
if (!empty($disabledFunctions)) {
// Attempt to detect them in the PHP INI disable_functions variable.
$disabledFunctions = explode(',', trim($disabledFunctions));
- $numberOfDisabledFunctions = count($disabledFunctions);
+ $numberOfDisabledFunctions = \count($disabledFunctions);
for ($i = 0; $i < $numberOfDisabledFunctions; $i++) {
$disabledFunctions[$i] = trim($disabledFunctions[$i]);
}
- $result = !in_array('parse_ini_string', $disabledFunctions);
+ $result = !\in_array('parse_ini_string', $disabledFunctions);
} else {
// Attempt to detect their existence; even pure PHP implementations of them will trigger a positive response, though.
- $result = function_exists('parse_ini_string');
+ $result = \function_exists('parse_ini_string');
}
return $result;
@@ -1444,7 +1444,7 @@ public function getNonCorePlugins($folderFilter = ['system', 'user', 'authentica
ExtensionHelper::getCoreExtensionIds()
);
- if (count($folderFilter) > 0) {
+ if (\count($folderFilter) > 0) {
$folderFilter = array_map([$db, 'quote'], $folderFilter);
$query->where($db->quoteName('folder') . ' IN (' . implode(',', $folderFilter) . ')');
@@ -1552,7 +1552,7 @@ private function getUpdateSitesInfo($extensionID)
$result = $db->loadAssocList();
- if (!is_array($result)) {
+ if (!\is_array($result)) {
return [];
}
@@ -1736,7 +1736,7 @@ function ($value) {
$menu = false;
- if (count($ids)) {
+ if (\count($ids)) {
$query = $db->getQuery(true);
$query->select(
@@ -1873,7 +1873,7 @@ private function checkPackageFileNoZip(string $filePath, $packageName)
while ($readsize > 0 && fseek($fp, $readStart) === 0) {
$fileChunk = fread($fp, $readsize);
- if ($fileChunk === false || strlen($fileChunk) !== $readsize) {
+ if ($fileChunk === false || \strlen($fileChunk) !== $readsize) {
@fclose($fp);
throw new \RuntimeException(Text::sprintf('COM_JOOMLAUPDATE_VIEW_UPLOAD_ERROR_PACKAGE_OPEN', $packageName), 500);
diff --git a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
index 60357f479474b..8f3ec804007b1 100644
--- a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
+++ b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
@@ -202,7 +202,7 @@ public function display($tpl = null)
$this->setLayout('update');
}
- if (in_array($this->getLayout(), ['preupdatecheck', 'update', 'upload'])) {
+ if (\in_array($this->getLayout(), ['preupdatecheck', 'update', 'upload'])) {
$language = $this->getLanguage();
$language->load('com_installer', JPATH_ADMINISTRATOR, 'en-GB', false, true);
$language->load('com_installer', JPATH_ADMINISTRATOR, null, true);
@@ -268,7 +268,7 @@ protected function addToolbar()
// Set the toolbar information.
ToolbarHelper::title(Text::_('COM_JOOMLAUPDATE_OVERVIEW'), 'joomla install');
- if (in_array($this->getLayout(), ['update', 'complete'])) {
+ if (\in_array($this->getLayout(), ['update', 'complete'])) {
$arrow = $this->getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left';
ToolbarHelper::link('index.php?option=com_joomlaupdate', 'JTOOLBAR_BACK', $arrow);
diff --git a/administrator/components/com_languages/services/provider.php b/administrator/components/com_languages/services/provider.php
index 6d504ef83249c..96343ed4cdadf 100644
--- a/administrator/components/com_languages/services/provider.php
+++ b/administrator/components/com_languages/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_languages/src/Controller/OverrideController.php b/administrator/components/com_languages/src/Controller/OverrideController.php
index 55bdbf7e40865..583d17d7323d2 100644
--- a/administrator/components/com_languages/src/Controller/OverrideController.php
+++ b/administrator/components/com_languages/src/Controller/OverrideController.php
@@ -44,7 +44,7 @@ public function edit($key = null, $urlVar = null)
$context = "$this->option.edit.$this->context";
// Get the constant name.
- $recordId = (count($cid) ? $cid[0] : $this->input->get('id'));
+ $recordId = (\count($cid) ? $cid[0] : $this->input->get('id'));
// Access check.
if (!$this->allowEdit()) {
@@ -108,7 +108,7 @@ public function save($key = null, $urlVar = null)
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
- for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
+ for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) {
if ($errors[$i] instanceof \Exception) {
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
diff --git a/administrator/components/com_languages/src/Controller/OverridesController.php b/administrator/components/com_languages/src/Controller/OverridesController.php
index ad9869fbe8a6a..7a21a3ecaf768 100644
--- a/administrator/components/com_languages/src/Controller/OverridesController.php
+++ b/administrator/components/com_languages/src/Controller/OverridesController.php
@@ -59,7 +59,7 @@ public function delete()
// Remove the items.
if ($model->delete($cid)) {
- $this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
+ $this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', \count($cid)));
} else {
$this->setMessage($model->getError(), 'error');
}
diff --git a/administrator/components/com_languages/src/Helper/MultilangstatusHelper.php b/administrator/components/com_languages/src/Helper/MultilangstatusHelper.php
index 60c5a50e822a6..1923d723313de 100644
--- a/administrator/components/com_languages/src/Helper/MultilangstatusHelper.php
+++ b/administrator/components/com_languages/src/Helper/MultilangstatusHelper.php
@@ -153,7 +153,7 @@ public static function getStatus()
public static function getContacts()
{
$db = Factory::getDbo();
- $languages = count(LanguageHelper::getLanguages());
+ $languages = \count(LanguageHelper::getLanguages());
// Get the number of contact with all as language
$alang = $db->getQuery(true)
diff --git a/administrator/components/com_languages/src/Model/InstalledModel.php b/administrator/components/com_languages/src/Model/InstalledModel.php
index 49335bfa18655..60a3683f3dd9a 100644
--- a/administrator/components/com_languages/src/Model/InstalledModel.php
+++ b/administrator/components/com_languages/src/Model/InstalledModel.php
@@ -106,7 +106,7 @@ protected function populateState($ordering = 'name', $direction = 'asc')
// Special case for client id.
$clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int');
- $clientId = (!in_array($clientId, [0, 1])) ? 0 : $clientId;
+ $clientId = (!\in_array($clientId, [0, 1])) ? 0 : $clientId;
$this->setState('client_id', $clientId);
// Load the parameters.
@@ -175,7 +175,7 @@ public function getOption()
public function getData()
{
// Fetch language data if not fetched yet.
- if (is_null($this->data)) {
+ if (\is_null($this->data)) {
$this->data = [];
$isCurrentLanguageRtl = Factory::getLanguage()->isRtl();
@@ -219,7 +219,7 @@ public function getData()
foreach ($installedLanguages as $key => $installedLanguage) {
// Filter by client id.
- if (in_array($clientId, [0, 1])) {
+ if (\in_array($clientId, [0, 1])) {
if ($installedLanguage->client_id !== $clientId) {
unset($installedLanguages[$key]);
continue;
@@ -247,12 +247,12 @@ public function getData()
$limit = (int) $this->getState('list.limit', 25);
// Sets the total for pagination.
- $this->total = count($installedLanguages);
+ $this->total = \count($installedLanguages);
if ($limit !== 0) {
$start = (int) $this->getState('list.start', 0);
- return array_slice($installedLanguages, $start, $limit);
+ return \array_slice($installedLanguages, $start, $limit);
}
return $installedLanguages;
@@ -267,7 +267,7 @@ public function getData()
*/
public function getTotal()
{
- if (is_null($this->total)) {
+ if (\is_null($this->total)) {
$this->getData();
}
@@ -338,7 +338,7 @@ public function publish($cid)
*/
protected function getFolders()
{
- if (is_null($this->folders)) {
+ if (\is_null($this->folders)) {
$path = $this->getPath();
$this->folders = Folder::folders($path, '.', false, false, ['.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides']);
}
@@ -355,7 +355,7 @@ protected function getFolders()
*/
protected function getPath()
{
- if (is_null($this->path)) {
+ if (\is_null($this->path)) {
$client = $this->getClient();
$this->path = LanguageHelper::getLanguagePath($client->path);
}
diff --git a/administrator/components/com_languages/src/Model/LanguageModel.php b/administrator/components/com_languages/src/Model/LanguageModel.php
index 47f7e2369f75c..ff7f56fb5fa00 100644
--- a/administrator/components/com_languages/src/Model/LanguageModel.php
+++ b/administrator/components/com_languages/src/Model/LanguageModel.php
@@ -240,7 +240,7 @@ public function save($data)
$result = Factory::getApplication()->triggerEvent($this->event_before_save, [$context, &$table, $isNew]);
// Check the event responses.
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
diff --git a/administrator/components/com_languages/src/Model/OverrideModel.php b/administrator/components/com_languages/src/Model/OverrideModel.php
index 2a61ab7c2c773..ed8d5f5131384 100644
--- a/administrator/components/com_languages/src/Model/OverrideModel.php
+++ b/administrator/components/com_languages/src/Model/OverrideModel.php
@@ -59,7 +59,7 @@ public function getForm($data = [], $loadData = true)
$form->setValue('client', null, Text::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client)));
$form->setValue('language', null, Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language));
- $form->setValue('file', null, Path::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'));
+ $form->setValue('file', null, Path::clean(\constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'));
return $form;
}
@@ -98,7 +98,7 @@ public function getItem($pk = null)
{
$input = Factory::getApplication()->getInput();
$pk = !empty($pk) ? $pk : $input->get('id');
- $fileName = constant('JPATH_' . strtoupper($this->getState('filter.client')))
+ $fileName = \constant('JPATH_' . strtoupper($this->getState('filter.client')))
. '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini';
$strings = LanguageHelper::parseIniFile($fileName);
@@ -111,7 +111,7 @@ public function getItem($pk = null)
$result->override = $strings[$pk];
}
- $oppositeFileName = constant('JPATH_' . strtoupper($this->getState('filter.client') == 'site' ? 'administrator' : 'site'))
+ $oppositeFileName = \constant('JPATH_' . strtoupper($this->getState('filter.client') == 'site' ? 'administrator' : 'site'))
. '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini';
$oppositeStrings = LanguageHelper::parseIniFile($oppositeFileName);
$result->both = isset($oppositeStrings[$pk]) && ($oppositeStrings[$pk] == $strings[$pk]);
@@ -149,7 +149,7 @@ public function save($data, $oppositeClient = false)
// Return false if the constant is a reserved word, i.e. YES, NO, NULL, FALSE, ON, OFF, NONE, TRUE
$reservedWords = ['YES', 'NO', 'NULL', 'FALSE', 'ON', 'OFF', 'NONE', 'TRUE'];
- if (in_array($data['key'], $reservedWords)) {
+ if (\in_array($data['key'], $reservedWords)) {
$this->setError(Text::_('COM_LANGUAGES_OVERRIDE_ERROR_RESERVED_WORDS'));
return false;
@@ -158,7 +158,7 @@ public function save($data, $oppositeClient = false)
$client = $client ? 'administrator' : 'site';
// Parse the override.ini file in order to get the keys and strings.
- $fileName = constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini';
+ $fileName = \constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini';
$strings = LanguageHelper::parseIniFile($fileName);
if (isset($strings[$data['id']])) {
diff --git a/administrator/components/com_languages/src/Model/OverridesModel.php b/administrator/components/com_languages/src/Model/OverridesModel.php
index 613721a741ebc..c05d9e5b511ce 100644
--- a/administrator/components/com_languages/src/Model/OverridesModel.php
+++ b/administrator/components/com_languages/src/Model/OverridesModel.php
@@ -71,7 +71,7 @@ public function getOverrides($all = false)
$client = strtoupper($this->getState('filter.client'));
// Parse the override.ini file in order to get the keys and strings.
- $fileName = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
+ $fileName = \constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
$strings = LanguageHelper::parseIniFile($fileName);
// Delete the override.ini file if empty.
@@ -106,7 +106,7 @@ public function getOverrides($all = false)
// Consider the pagination.
if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit')) {
- $strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true);
+ $strings = \array_slice($strings, $this->getStart(), $this->getState('list.limit'), true);
}
// Add the items to the internal cache.
@@ -133,7 +133,7 @@ public function getTotal()
}
// Add the total to the internal cache.
- $this->cache[$store] = count($this->getOverrides(true));
+ $this->cache[$store] = \count($this->getOverrides(true));
return $this->cache[$store];
}
@@ -210,7 +210,7 @@ public function delete($cids)
}
// Parse the override.ini file in order to get the keys and strings.
- $fileName = constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
+ $fileName = \constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini';
$strings = LanguageHelper::parseIniFile($fileName);
// Unset strings that shall be deleted
@@ -227,7 +227,7 @@ public function delete($cids)
$this->cleanCache();
- return count($cids);
+ return \count($cids);
}
/**
diff --git a/administrator/components/com_languages/src/Model/StringsModel.php b/administrator/components/com_languages/src/Model/StringsModel.php
index 41d861a6d30bb..b805f406630d0 100644
--- a/administrator/components/com_languages/src/Model/StringsModel.php
+++ b/administrator/components/com_languages/src/Model/StringsModel.php
@@ -65,7 +65,7 @@ public function refresh()
$client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site';
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
- $base = constant('JPATH_' . strtoupper($client));
+ $base = \constant('JPATH_' . strtoupper($client));
$path = $base . '/language/' . $language;
$files = [];
@@ -90,7 +90,7 @@ public function refresh()
// Parse all found ini files and add the strings to the database cache.
foreach ($files as $file) {
// Only process if language file is for selected language
- if (strpos($file, $language, strlen($base)) === false) {
+ if (strpos($file, $language, \strlen($base)) === false) {
continue;
}
diff --git a/administrator/components/com_languages/src/View/Installed/HtmlView.php b/administrator/components/com_languages/src/View/Installed/HtmlView.php
index b78c8acfb4759..d4b85596b9330 100644
--- a/administrator/components/com_languages/src/View/Installed/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Installed/HtmlView.php
@@ -93,7 +93,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_languages/src/View/Language/HtmlView.php b/administrator/components/com_languages/src/View/Language/HtmlView.php
index c5a16f4719abf..c6dd4079aed25 100644
--- a/administrator/components/com_languages/src/View/Language/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Language/HtmlView.php
@@ -74,7 +74,7 @@ public function display($tpl = null)
$this->canDo = ContentHelper::getActions('com_languages');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_languages/src/View/Languages/HtmlView.php b/administrator/components/com_languages/src/View/Languages/HtmlView.php
index 09b8b5cf2ec34..536a7d5f9c042 100644
--- a/administrator/components/com_languages/src/View/Languages/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Languages/HtmlView.php
@@ -85,7 +85,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_languages/src/View/Override/HtmlView.php b/administrator/components/com_languages/src/View/Override/HtmlView.php
index 022cb91f0a0d9..35ee0c111f40a 100644
--- a/administrator/components/com_languages/src/View/Override/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Override/HtmlView.php
@@ -79,7 +79,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors));
}
diff --git a/administrator/components/com_languages/src/View/Overrides/HtmlView.php b/administrator/components/com_languages/src/View/Overrides/HtmlView.php
index 5b0d1f595834e..e9dd379eead06 100644
--- a/administrator/components/com_languages/src/View/Overrides/HtmlView.php
+++ b/administrator/components/com_languages/src/View/Overrides/HtmlView.php
@@ -79,7 +79,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors));
}
diff --git a/administrator/components/com_login/services/provider.php b/administrator/components/com_login/services/provider.php
index 5de4d643dff9c..ccab82ec44a6b 100644
--- a/administrator/components/com_login/services/provider.php
+++ b/administrator/components/com_login/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_login/src/Model/LoginModel.php b/administrator/components/com_login/src/Model/LoginModel.php
index 0800ba211e040..af855dbce62ea 100644
--- a/administrator/components/com_login/src/Model/LoginModel.php
+++ b/administrator/components/com_login/src/Model/LoginModel.php
@@ -80,7 +80,7 @@ public static function getLoginModule($name = 'mod_login', $title = null)
{
$result = null;
$modules = self::_load($name);
- $total = count($modules);
+ $total = \count($modules);
for ($i = 0; $i < $total; $i++) {
// Match the title if we're looking for a specific instance of the module.
@@ -91,7 +91,7 @@ public static function getLoginModule($name = 'mod_login', $title = null)
}
// If we didn't find it, and the name is mod_something, create a dummy object.
- if (is_null($result) && substr($name, 0, 4) == 'mod_') {
+ if (\is_null($result) && substr($name, 0, 4) == 'mod_') {
$result = new \stdClass();
$result->id = 0;
$result->title = '';
diff --git a/administrator/components/com_mails/services/provider.php b/administrator/components/com_mails/services/provider.php
index 11cc7bc38117f..2741f20c68a90 100644
--- a/administrator/components/com_mails/services/provider.php
+++ b/administrator/components/com_mails/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_mails/src/Controller/TemplateController.php b/administrator/components/com_mails/src/Controller/TemplateController.php
index d3ac98f40f2f5..ca7c957d2cf9a 100644
--- a/administrator/components/com_mails/src/Controller/TemplateController.php
+++ b/administrator/components/com_mails/src/Controller/TemplateController.php
@@ -211,7 +211,7 @@ public function save($key = null, $urlVar = null)
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
- for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
+ for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) {
if ($errors[$i] instanceof \Exception) {
$this->app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
@@ -286,7 +286,7 @@ public function save($key = null, $urlVar = null)
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
- if (!is_null($return) && Uri::isInternal(base64_decode($return))) {
+ if (!\is_null($return) && Uri::isInternal(base64_decode($return))) {
$url = base64_decode($return);
}
diff --git a/administrator/components/com_mails/src/Helper/MailsHelper.php b/administrator/components/com_mails/src/Helper/MailsHelper.php
index a084686cf7e0c..08d5bc777df78 100644
--- a/administrator/components/com_mails/src/Helper/MailsHelper.php
+++ b/administrator/components/com_mails/src/Helper/MailsHelper.php
@@ -37,7 +37,7 @@ public static function mailtags($mail, $fieldname)
{
Factory::getApplication()->triggerEvent('onMailBeforeTagsRendering', [$mail->template_id, &$mail]);
- if (!isset($mail->params['tags']) || !count($mail->params['tags'])) {
+ if (!isset($mail->params['tags']) || !\count($mail->params['tags'])) {
return '';
}
@@ -90,7 +90,7 @@ public static function loadTranslationFiles($extension)
case 'plg':
$parts = explode('_', $extension, 3);
- if (count($parts) > 2) {
+ if (\count($parts) > 2) {
$source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2];
}
break;
diff --git a/administrator/components/com_mails/src/Model/TemplateModel.php b/administrator/components/com_mails/src/Model/TemplateModel.php
index 809b56c7424d1..3c79464970a7e 100644
--- a/administrator/components/com_mails/src/Model/TemplateModel.php
+++ b/administrator/components/com_mails/src/Model/TemplateModel.php
@@ -282,7 +282,7 @@ public function validate($form, $data, $group = null)
{
$validLanguages = LanguageHelper::getContentLanguages([0, 1]);
- if (!array_key_exists($data['language'], $validLanguages)) {
+ if (!\array_key_exists($data['language'], $validLanguages)) {
$this->setError(Text::_('COM_MAILS_FIELD_LANGUAGE_CODE_INVALID'));
return false;
@@ -345,7 +345,7 @@ public function save($data)
// Trigger the before save event.
$result = Factory::getApplication()->triggerEvent($this->event_before_save, [$context, $table, $isNew, $data]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
diff --git a/administrator/components/com_mails/src/View/Template/HtmlView.php b/administrator/components/com_mails/src/View/Template/HtmlView.php
index 61aed6b95e8d2..bb10e384681fd 100644
--- a/administrator/components/com_mails/src/View/Template/HtmlView.php
+++ b/administrator/components/com_mails/src/View/Template/HtmlView.php
@@ -81,7 +81,7 @@ public function display($tpl = null)
$this->form = $this->get('Form');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -110,7 +110,7 @@ public function display($tpl = null)
];
foreach ($fields as $field) {
- if (is_null($this->item->$field) || $this->item->$field == '') {
+ if (\is_null($this->item->$field) || $this->item->$field == '') {
$this->item->$field = $this->master->$field;
$this->form->setValue($field, null, $this->item->$field);
}
diff --git a/administrator/components/com_mails/src/View/Templates/HtmlView.php b/administrator/components/com_mails/src/View/Templates/HtmlView.php
index 6e12b040380f7..a71f214a1d529 100644
--- a/administrator/components/com_mails/src/View/Templates/HtmlView.php
+++ b/administrator/components/com_mails/src/View/Templates/HtmlView.php
@@ -100,7 +100,7 @@ public function display($tpl = null)
$extensions = $this->get('Extensions');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_media/services/provider.php b/administrator/components/com_media/services/provider.php
index 9bfa93841ca6f..47290f56e19aa 100644
--- a/administrator/components/com_media/services/provider.php
+++ b/administrator/components/com_media/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_media/src/Controller/ApiController.php b/administrator/components/com_media/src/Controller/ApiController.php
index 9f1a76634e497..6ee85b357b2b8 100644
--- a/administrator/components/com_media/src/Controller/ApiController.php
+++ b/administrator/components/com_media/src/Controller/ApiController.php
@@ -63,7 +63,7 @@ public function execute($task)
// Record the actual task being fired
$this->doTask = $doTask;
- if (!in_array($this->doTask, $this->taskMap)) {
+ if (!\in_array($this->doTask, $this->taskMap)) {
throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 405);
}
@@ -374,7 +374,7 @@ private function getAdapter()
{
$parts = explode(':', $this->input->getString('path', ''), 2);
- if (count($parts) < 1) {
+ if (\count($parts) < 1) {
return null;
}
@@ -392,7 +392,7 @@ private function getPath()
{
$parts = explode(':', $this->input->getString('path', ''), 2);
- if (count($parts) < 2) {
+ if (\count($parts) < 2) {
return null;
}
diff --git a/administrator/components/com_media/src/Dispatcher/Dispatcher.php b/administrator/components/com_media/src/Dispatcher/Dispatcher.php
index 58b83adca9188..f22fcbd76ecce 100644
--- a/administrator/components/com_media/src/Dispatcher/Dispatcher.php
+++ b/administrator/components/com_media/src/Dispatcher/Dispatcher.php
@@ -42,7 +42,7 @@ protected function checkAccess()
!$user->authorise('core.manage', 'com_media')
&& (!$asset || (!$user->authorise('core.edit', $asset)
&& !$user->authorise('core.create', $asset)
- && count($user->getAuthorisedCategories($asset, 'core.create')) == 0)
+ && \count($user->getAuthorisedCategories($asset, 'core.create')) == 0)
&& !($user->id == $author && $user->authorise('core.edit.own', $asset)))
) {
throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
diff --git a/administrator/components/com_media/src/Event/AbstractMediaItemValidationEvent.php b/administrator/components/com_media/src/Event/AbstractMediaItemValidationEvent.php
index cea386ee3d63f..c32352b7fe23a 100644
--- a/administrator/components/com_media/src/Event/AbstractMediaItemValidationEvent.php
+++ b/administrator/components/com_media/src/Event/AbstractMediaItemValidationEvent.php
@@ -58,61 +58,61 @@ protected function validate(\stdClass $item): void
}
// Non empty string
- if (!isset($item->name) || !is_string($item->name) || trim($item->name) === '') {
+ if (!isset($item->name) || !\is_string($item->name) || trim($item->name) === '') {
throw new \BadMethodCallException("Property 'name' of argument 'item' of event {$this->name} has a wrong item. Valid: non empty string");
}
// Non empty string
- if (!isset($item->path) || !is_string($item->path) || trim($item->path) === '') {
+ if (!isset($item->path) || !\is_string($item->path) || trim($item->path) === '') {
throw new \BadMethodCallException("Property 'path' of argument 'item' of event {$this->name} has a wrong item. Valid: non empty string");
}
// A string
- if ($item->type === 'file' && (!isset($item->extension) || !is_string($item->extension))) {
+ if ($item->type === 'file' && (!isset($item->extension) || !\is_string($item->extension))) {
throw new \BadMethodCallException("Property 'extension' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
// An empty string or an integer
if (
!isset($item->size) ||
- (!is_integer($item->size) && !is_string($item->size)) ||
- (is_string($item->size) && $item->size !== '')
+ (!\is_integer($item->size) && !\is_string($item->size)) ||
+ (\is_string($item->size) && $item->size !== '')
) {
throw new \BadMethodCallException("Property 'size' of argument 'item' of event {$this->name} has a wrong item. Valid: empty string or integer");
}
// A string
- if (!isset($item->mime_type) || !is_string($item->mime_type)) {
+ if (!isset($item->mime_type) || !\is_string($item->mime_type)) {
throw new \BadMethodCallException("Property 'mime_type' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
// An integer
- if (!isset($item->width) || !is_integer($item->width)) {
+ if (!isset($item->width) || !\is_integer($item->width)) {
throw new \BadMethodCallException("Property 'width' of argument 'item' of event {$this->name} has a wrong item. Valid: integer");
}
// An integer
- if (!isset($item->height) || !is_integer($item->height)) {
+ if (!isset($item->height) || !\is_integer($item->height)) {
throw new \BadMethodCallException("Property 'height' of argument 'item' of event {$this->name} has a wrong item. Valid: integer");
}
// A string
- if (!isset($item->create_date) || !is_string($item->create_date)) {
+ if (!isset($item->create_date) || !\is_string($item->create_date)) {
throw new \BadMethodCallException("Property 'create_date' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
// A string
- if (!isset($item->create_date_formatted) || !is_string($item->create_date_formatted)) {
+ if (!isset($item->create_date_formatted) || !\is_string($item->create_date_formatted)) {
throw new \BadMethodCallException("Property 'create_date_formatted' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
// A string
- if (!isset($item->modified_date) || !is_string($item->modified_date)) {
+ if (!isset($item->modified_date) || !\is_string($item->modified_date)) {
throw new \BadMethodCallException("Property 'modified_date' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
// A string
- if (!isset($item->modified_date_formatted) || !is_string($item->modified_date_formatted)) {
+ if (!isset($item->modified_date_formatted) || !\is_string($item->modified_date_formatted)) {
throw new \BadMethodCallException("Property 'modified_date_formatted' of argument 'item' of event {$this->name} has a wrong item. Valid: string");
}
}
diff --git a/administrator/components/com_media/src/Event/FetchMediaItemEvent.php b/administrator/components/com_media/src/Event/FetchMediaItemEvent.php
index 5df341f6affb9..5961beedf58bc 100644
--- a/administrator/components/com_media/src/Event/FetchMediaItemEvent.php
+++ b/administrator/components/com_media/src/Event/FetchMediaItemEvent.php
@@ -36,7 +36,7 @@ public function __construct($name, array $arguments = [])
parent::__construct($name, $arguments);
// Check for required arguments
- if (!\array_key_exists('item', $arguments) || !is_object($arguments['item'])) {
+ if (!\array_key_exists('item', $arguments) || !\is_object($arguments['item'])) {
throw new \BadMethodCallException("Argument 'item' of event $name is not of the expected type");
}
}
diff --git a/administrator/components/com_media/src/Event/FetchMediaItemUrlEvent.php b/administrator/components/com_media/src/Event/FetchMediaItemUrlEvent.php
index 4d463639579ef..29ce6c908c69b 100644
--- a/administrator/components/com_media/src/Event/FetchMediaItemUrlEvent.php
+++ b/administrator/components/com_media/src/Event/FetchMediaItemUrlEvent.php
@@ -36,7 +36,7 @@ final class FetchMediaItemUrlEvent extends AbstractImmutableEvent
public function __construct($name, array $arguments = [])
{
// Check for required arguments
- if (!\array_key_exists('adapter', $arguments) || !is_string($arguments['adapter'])) {
+ if (!\array_key_exists('adapter', $arguments) || !\is_string($arguments['adapter'])) {
throw new \BadMethodCallException("Argument 'adapter' of event $name is not of the expected type");
}
@@ -44,7 +44,7 @@ public function __construct($name, array $arguments = [])
unset($arguments['adapter']);
// Check for required arguments
- if (!\array_key_exists('path', $arguments) || !is_string($arguments['path'])) {
+ if (!\array_key_exists('path', $arguments) || !\is_string($arguments['path'])) {
throw new \BadMethodCallException("Argument 'path' of event $name is not of the expected type");
}
@@ -52,7 +52,7 @@ public function __construct($name, array $arguments = [])
unset($arguments['path']);
// Check for required arguments
- if (!\array_key_exists('url', $arguments) || !is_string($arguments['url'])) {
+ if (!\array_key_exists('url', $arguments) || !\is_string($arguments['url'])) {
throw new \BadMethodCallException("Argument 'url' of event $name is not of the expected type");
}
diff --git a/administrator/components/com_media/src/Event/FetchMediaItemsEvent.php b/administrator/components/com_media/src/Event/FetchMediaItemsEvent.php
index b7d92767397b8..8b22085b98987 100644
--- a/administrator/components/com_media/src/Event/FetchMediaItemsEvent.php
+++ b/administrator/components/com_media/src/Event/FetchMediaItemsEvent.php
@@ -36,7 +36,7 @@ public function __construct($name, array $arguments = [])
parent::__construct($name, $arguments);
// Check for required arguments
- if (!\array_key_exists('items', $arguments) || !is_array($arguments['items'])) {
+ if (!\array_key_exists('items', $arguments) || !\is_array($arguments['items'])) {
throw new \BadMethodCallException("Argument 'items' of event $name is not of the expected type");
}
}
diff --git a/administrator/components/com_media/src/Model/ApiModel.php b/administrator/components/com_media/src/Model/ApiModel.php
index a36004c9b88f3..6d4eef3ee3f35 100644
--- a/administrator/components/com_media/src/Model/ApiModel.php
+++ b/administrator/components/com_media/src/Model/ApiModel.php
@@ -189,7 +189,7 @@ public function createFolder($adapter, $name, $path, $override)
$result = $app->triggerEvent('onContentBeforeSave', ['com_media.folder', $object, true, $object]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
throw new \Exception($object->getError());
}
@@ -249,7 +249,7 @@ public function createFile($adapter, $name, $path, $data, $override)
$result = $app->triggerEvent('onContentBeforeSave', ['com_media.file', $object, true, $object]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
throw new \Exception($object->getError());
}
@@ -297,7 +297,7 @@ public function updateFile($adapter, $name, $path, $data)
$result = $app->triggerEvent('onContentBeforeSave', ['com_media.file', $object, false, $object]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
throw new \Exception($object->getError());
}
@@ -341,7 +341,7 @@ public function delete($adapter, $path)
$result = $app->triggerEvent('onContentBeforeDelete', ['com_media.' . $type, $object]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
throw new \Exception($object->getError());
}
@@ -457,7 +457,7 @@ private function isMediaFile($path)
$extensions = [];
// Default to showing all supported formats
- if (count($mediaTypes) === 0) {
+ if (\count($mediaTypes) === 0) {
$mediaTypes = ['0', '1', '2', '3'];
}
@@ -525,7 +525,7 @@ function ($mediaType) use (&$types) {
);
foreach ($types as $type) {
- if (in_array($type, ['images', 'audios', 'videos', 'documents'])) {
+ if (\in_array($type, ['images', 'audios', 'videos', 'documents'])) {
$extensions = array_merge($extensions, ${$type});
}
}
@@ -538,6 +538,6 @@ function ($mediaType) use (&$types) {
$extension = strtolower(substr($path, strrpos($path, '.') + 1));
// Check if the extension exists in the allowed extensions
- return in_array($extension, $this->allowedExtensions);
+ return \in_array($extension, $this->allowedExtensions);
}
}
diff --git a/administrator/components/com_media/src/Provider/ProviderManager.php b/administrator/components/com_media/src/Provider/ProviderManager.php
index a0602647f519c..6f83dbbbfbc59 100644
--- a/administrator/components/com_media/src/Provider/ProviderManager.php
+++ b/administrator/components/com_media/src/Provider/ProviderManager.php
@@ -76,7 +76,7 @@ public function unregisterProvider(ProviderInterface $provider = null): void
return;
}
- if (!array_key_exists($provider->getID(), $this->providers)) {
+ if (!\array_key_exists($provider->getID(), $this->providers)) {
return;
}
diff --git a/administrator/components/com_media/src/View/Media/HtmlView.php b/administrator/components/com_media/src/View/Media/HtmlView.php
index dd011c3a1e44a..33b48ba1c61f5 100644
--- a/administrator/components/com_media/src/View/Media/HtmlView.php
+++ b/administrator/components/com_media/src/View/Media/HtmlView.php
@@ -67,7 +67,7 @@ public function display($tpl = null)
$this->providers = $this->get('Providers');
// Check that there are providers
- if (!count($this->providers)) {
+ if (!\count($this->providers)) {
$link = Route::_('index.php?option=com_plugins&view=plugins&filter[folder]=filesystem');
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_MEDIA_ERROR_NO_PROVIDERS', $link), CMSApplication::MSG_WARNING);
}
diff --git a/administrator/components/com_menus/services/provider.php b/administrator/components/com_menus/services/provider.php
index bcba052626e67..e8721c9408abb 100644
--- a/administrator/components/com_menus/services/provider.php
+++ b/administrator/components/com_menus/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Association\AssociationExtensionInterface;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
diff --git a/administrator/components/com_menus/src/Controller/AjaxController.php b/administrator/components/com_menus/src/Controller/AjaxController.php
index 1324cd28a5a81..8f3725679fcd3 100644
--- a/administrator/components/com_menus/src/Controller/AjaxController.php
+++ b/administrator/components/com_menus/src/Controller/AjaxController.php
@@ -69,11 +69,11 @@ public function fetchAssociations()
$associations[$lang]->title = $menuTable->title;
}
- $countContentLanguages = count(LanguageHelper::getContentLanguages([0, 1], false));
+ $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false));
- if (count($associations) == 0) {
+ if (\count($associations) == 0) {
$message = Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE');
- } elseif ($countContentLanguages > count($associations) + 2) {
+ } elseif ($countContentLanguages > \count($associations) + 2) {
$tags = implode(', ', array_keys($associations));
$message = Text::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags);
} else {
diff --git a/administrator/components/com_menus/src/Controller/ItemController.php b/administrator/components/com_menus/src/Controller/ItemController.php
index ba08f7a32e53c..3115b078bf98e 100644
--- a/administrator/components/com_menus/src/Controller/ItemController.php
+++ b/administrator/components/com_menus/src/Controller/ItemController.php
@@ -339,7 +339,7 @@ public function save($key = null, $urlVar = null)
'modem', 'git', 'sms',
];
- if (!in_array($protocol, $scheme)) {
+ if (!\in_array($protocol, $scheme)) {
$app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'warning');
$this->setRedirect(
Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false)
@@ -359,7 +359,7 @@ public function save($key = null, $urlVar = null)
if ($data['type'] == 'component' && !empty($request)) {
$removeArgs = [];
- if (!isset($data['request']) || !is_array($data['request'])) {
+ if (!isset($data['request']) || !\is_array($data['request'])) {
$data['request'] = [];
}
@@ -392,7 +392,7 @@ public function save($key = null, $urlVar = null)
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
- for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
+ for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) {
if ($errors[$i] instanceof \Exception) {
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
@@ -511,7 +511,7 @@ public function setType()
$specialTypes = ['alias', 'separator', 'url', 'heading', 'container'];
- if (!in_array($title, $specialTypes)) {
+ if (!\in_array($title, $specialTypes)) {
$title = 'component';
} else {
// Set correct component id to ensure proper 404 messages with system links
@@ -577,7 +577,7 @@ public function getParentItem()
$results = $model->getItems();
// Pad the option text with spaces using depth level as a multiplier.
- for ($i = 0, $n = count($results); $i < $n; $i++) {
+ for ($i = 0, $n = \count($results); $i < $n; $i++) {
$results[$i]->title = str_repeat(' - ', $results[$i]->level) . $results[$i]->title;
}
}
diff --git a/administrator/components/com_menus/src/Controller/ItemsController.php b/administrator/components/com_menus/src/Controller/ItemsController.php
index 9b48fdec8dc57..edf355ff7e8b0 100644
--- a/administrator/components/com_menus/src/Controller/ItemsController.php
+++ b/administrator/components/com_menus/src/Controller/ItemsController.php
@@ -157,7 +157,7 @@ public function setDefault()
$ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
}
- $this->setMessage(Text::plural($ntext, count($cid)));
+ $this->setMessage(Text::plural($ntext, \count($cid)));
}
}
@@ -220,7 +220,7 @@ public function publish()
$ntext = $this->text_prefix . '_N_ITEMS_TRASHED';
}
- $this->setMessage(Text::plural($ntext, count($cid)), $messageType);
+ $this->setMessage(Text::plural($ntext, \count($cid)), $messageType);
} catch (\Exception $e) {
$this->setMessage($e->getMessage(), 'error');
}
diff --git a/administrator/components/com_menus/src/Controller/MenuController.php b/administrator/components/com_menus/src/Controller/MenuController.php
index daf1511784cb8..df91a9656bb95 100644
--- a/administrator/components/com_menus/src/Controller/MenuController.php
+++ b/administrator/components/com_menus/src/Controller/MenuController.php
@@ -97,7 +97,7 @@ public function save($key = null, $urlVar = null)
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
- for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
+ for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) {
if ($errors[$i] instanceof \Exception) {
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
diff --git a/administrator/components/com_menus/src/Controller/MenusController.php b/administrator/components/com_menus/src/Controller/MenusController.php
index 3ea9837ad2813..b13ce8efa623b 100644
--- a/administrator/components/com_menus/src/Controller/MenusController.php
+++ b/administrator/components/com_menus/src/Controller/MenusController.php
@@ -85,7 +85,7 @@ public function delete()
}
}
- if (count($cids) > 0) {
+ if (\count($cids) > 0) {
// Get the model.
/** @var \Joomla\Component\Menus\Administrator\Model\MenuModel $model */
$model = $this->getModel();
@@ -94,7 +94,7 @@ public function delete()
if (!$model->delete($cids)) {
$this->setMessage($model->getError(), 'error');
} else {
- $this->setMessage(Text::plural('COM_MENUS_N_MENUS_DELETED', count($cids)));
+ $this->setMessage(Text::plural('COM_MENUS_N_MENUS_DELETED', \count($cids)));
}
}
}
diff --git a/administrator/components/com_menus/src/Field/MenuItemByTypeField.php b/administrator/components/com_menus/src/Field/MenuItemByTypeField.php
index f67517fbdc17e..0c85416cacd4b 100644
--- a/administrator/components/com_menus/src/Field/MenuItemByTypeField.php
+++ b/administrator/components/com_menus/src/Field/MenuItemByTypeField.php
@@ -229,7 +229,7 @@ protected function getGroups()
$levelPrefix . $text . $lang,
'value',
'text',
- in_array($link->type, $this->disable)
+ \in_array($link->type, $this->disable)
);
}
} else {
@@ -258,7 +258,7 @@ protected function getGroups()
$levelPrefix . $text . $lang,
'value',
'text',
- in_array($link->type, $this->disable)
+ \in_array($link->type, $this->disable)
);
}
}
diff --git a/administrator/components/com_menus/src/Field/MenuParentField.php b/administrator/components/com_menus/src/Field/MenuParentField.php
index 0e4fa6edab1e7..cb85bd1a6ac48 100644
--- a/administrator/components/com_menus/src/Field/MenuParentField.php
+++ b/administrator/components/com_menus/src/Field/MenuParentField.php
@@ -70,7 +70,7 @@ protected function getOptions()
// Filter by client id.
$clientId = $this->getAttribute('clientid');
- if (!is_null($clientId)) {
+ if (!\is_null($clientId)) {
$clientId = (int) $clientId;
$query->where($db->quoteName('a.client_id') . ' = :clientId')
->bind(':clientId', $clientId, ParameterType::INTEGER);
@@ -99,7 +99,7 @@ protected function getOptions()
}
// Pad the option text with spaces using depth level as a multiplier.
- for ($i = 0, $n = count($options); $i < $n; $i++) {
+ for ($i = 0, $n = \count($options); $i < $n; $i++) {
if ($clientId != 0) {
// Allow translation of custom admin menus
$options[$i]->text = str_repeat('- ', $options[$i]->level) . Text::_($options[$i]->text);
diff --git a/administrator/components/com_menus/src/Field/Modal/MenuField.php b/administrator/components/com_menus/src/Field/Modal/MenuField.php
index 82d029d0c42e3..f59726f5c5970 100644
--- a/administrator/components/com_menus/src/Field/Modal/MenuField.php
+++ b/administrator/components/com_menus/src/Field/Modal/MenuField.php
@@ -160,7 +160,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
$clientId = (int) $this->element['clientid'];
// Prepare enabled actions
- $this->canDo['propagate'] = ((string) $this->element['propagate'] === 'true') && count($languages) > 2;
+ $this->canDo['propagate'] = ((string) $this->element['propagate'] === 'true') && \count($languages) > 2;
// Creating/editing menu items is not supported in frontend.
if (!$app->isClient('administrator')) {
diff --git a/administrator/components/com_menus/src/Helper/AssociationsHelper.php b/administrator/components/com_menus/src/Helper/AssociationsHelper.php
index 2e1c391937938..e7cb3817d68b8 100644
--- a/administrator/components/com_menus/src/Helper/AssociationsHelper.php
+++ b/administrator/components/com_menus/src/Helper/AssociationsHelper.php
@@ -121,7 +121,7 @@ public function getItem($typeName, $id)
break;
}
- if (is_null($table)) {
+ if (\is_null($table)) {
return null;
}
@@ -147,7 +147,7 @@ public function getType($typeName = '')
$support = $this->getSupportTemplate();
$title = '';
- if (in_array($typeName, $this->itemTypes)) {
+ if (\in_array($typeName, $this->itemTypes)) {
switch ($typeName) {
case 'item':
$fields['ordering'] = 'a.lft';
diff --git a/administrator/components/com_menus/src/Helper/MenusHelper.php b/administrator/components/com_menus/src/Helper/MenusHelper.php
index 4f86efc9b9fe5..4ba123ed1f344 100644
--- a/administrator/components/com_menus/src/Helper/MenusHelper.php
+++ b/administrator/components/com_menus/src/Helper/MenusHelper.php
@@ -69,7 +69,7 @@ public static function getLinkKey($request)
}
// Check if the link is in the form of index.php?...
- if (is_string($request)) {
+ if (\is_string($request)) {
$args = [];
if (strpos($request, 'index.php') === 0) {
@@ -83,7 +83,7 @@ public static function getLinkKey($request)
// Only take the option, view and layout parts.
foreach ($request as $name => $value) {
- if ((!in_array($name, self::$_filter)) && (!($name == 'task' && !array_key_exists('view', $request)))) {
+ if ((!\in_array($name, self::$_filter)) && (!($name == 'task' && !\array_key_exists('view', $request)))) {
// Remove the variables we want to ignore.
unset($request[$name]);
}
@@ -332,7 +332,7 @@ public static function getMenuItems($menutype, $enabledOnly = false, $exclude =
'OR'
);
- if (count($exclude)) {
+ if (\count($exclude)) {
$exId = array_map('intval', array_filter($exclude, 'is_numeric'));
$exEl = array_filter($exclude, 'is_string');
@@ -365,7 +365,7 @@ public static function getMenuItems($menutype, $enabledOnly = false, $exclude =
static::resolveAlias($menuitem);
}
- if ($menuitem->link = in_array($menuitem->type, ['separator', 'heading', 'container']) ? '#' : trim($menuitem->link)) {
+ if ($menuitem->link = \in_array($menuitem->type, ['separator', 'heading', 'container']) ? '#' : trim($menuitem->link)) {
$menuitem->submenu = [];
$menuitem->class = $menuitem->img ?? '';
$menuitem->scope = $menuitem->scope ?? null;
@@ -406,7 +406,7 @@ public static function installPreset($preset, $menutype)
{
$root = static::loadPreset($preset, false);
- if (count($root->getChildren()) == 0) {
+ if (\count($root->getChildren()) == 0) {
throw new \Exception(Text::_('COM_MENUS_PRESET_LOAD_FAILED'));
}
@@ -502,7 +502,7 @@ protected static function installPresetItems($node, $menutype)
}
// Translate "hideitems" param value from "element" into "menu-item-id"
- if ($item->type == 'container' && count($hideitems = (array) $item->getParams()->get('hideitems'))) {
+ if ($item->type == 'container' && \count($hideitems = (array) $item->getParams()->get('hideitems'))) {
foreach ($hideitems as &$hel) {
if (!is_numeric($hel)) {
$hel = array_search($hel, $components);
@@ -581,7 +581,7 @@ public static function addPreset($name, $title, $path, $replace = true)
$replace = false;
}
- if (($replace || !array_key_exists($name, static::$presets)) && is_file($path)) {
+ if (($replace || !\array_key_exists($name, static::$presets)) && is_file($path)) {
$preset = new \stdClass();
$preset->name = $name;
@@ -748,7 +748,7 @@ public static function preprocess($item)
static::resolveAlias($item);
}
- if ($item->link = in_array($item->type, ['separator', 'heading', 'container']) ? '#' : trim($item->link)) {
+ if ($item->link = \in_array($item->type, ['separator', 'heading', 'container']) ? '#' : trim($item->link)) {
$item->class = $item->img ?? '';
$item->scope = $item->scope ?? null;
$item->target = $item->browserNav ? '_blank' : '';
diff --git a/administrator/components/com_menus/src/Model/ItemModel.php b/administrator/components/com_menus/src/Model/ItemModel.php
index 39d4a8316f181..4f1103da3a6b0 100644
--- a/administrator/components/com_menus/src/Model/ItemModel.php
+++ b/administrator/components/com_menus/src/Model/ItemModel.php
@@ -250,7 +250,7 @@ protected function batchCopy($value, $pks, $contexts)
// Add child IDs to the array only if they aren't already there.
foreach ($childIds as $childId) {
- if (!in_array($childId, $pks)) {
+ if (!\in_array($childId, $pks)) {
$pks[] = $childId;
}
}
@@ -568,7 +568,7 @@ protected function loadFormData()
// Only merge if there is a session and itemId or itemid is null.
if (
isset($sessionData['id']) && isset($itemData['id']) && $sessionData['id'] === $itemData['id']
- || is_null($itemData['id'])
+ || \is_null($itemData['id'])
) {
$data = array_merge($itemData, $sessionData);
} else {
@@ -1189,7 +1189,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
if ($clientId == 0 && Associations::isEnabled()) {
$languages = LanguageHelper::getContentLanguages(false, false, null, 'ordering', 'asc');
- if (count($languages) > 1) {
+ if (\count($languages) > 1) {
$addform = new \SimpleXMLElement('
');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', 'associations');
@@ -1404,7 +1404,7 @@ public function save($data)
$result = Factory::getApplication()->triggerEvent($this->event_before_save, [$context, &$table, $isNew, $data]);
// Store the data.
- if (in_array(false, $result, true) || !$table->store()) {
+ if (\in_array(false, $result, true) || !$table->store()) {
$this->setError($table->getError());
return false;
@@ -1524,7 +1524,7 @@ public function save($data)
$associations[$table->language] = (int) $table->id;
}
- if (count($associations) > 1) {
+ if (\count($associations) > 1) {
// Adding new association for these items
$key = md5(json_encode($associations));
$query = $db->getQuery(true)
@@ -1630,7 +1630,7 @@ public function setHome(&$pks, $value = 1)
// so we need to loop through the primary key array.
foreach ($pks as $i => $pk) {
if ($table->load($pk)) {
- if (!array_key_exists($table->language, $languages)) {
+ if (!\array_key_exists($table->language, $languages)) {
$languages[$table->language] = true;
if ($table->home == $value) {
diff --git a/administrator/components/com_menus/src/Model/ItemsModel.php b/administrator/components/com_menus/src/Model/ItemsModel.php
index 8539b831e148a..b55ee807863ac 100644
--- a/administrator/components/com_menus/src/Model/ItemsModel.php
+++ b/administrator/components/com_menus/src/Model/ItemsModel.php
@@ -452,7 +452,7 @@ protected function getListQuery()
$query->where(0);
}
}
- } elseif (strlen($menuType)) {
+ } elseif (\strlen($menuType)) {
// Default behavior => load all items from a specific menu
$query->where($db->quoteName('a.menutype') . ' = :menuType')
->bind(':menuType', $menuType);
diff --git a/administrator/components/com_menus/src/Model/MenuModel.php b/administrator/components/com_menus/src/Model/MenuModel.php
index cec6ee678d0ae..9b05b9774a87b 100644
--- a/administrator/components/com_menus/src/Model/MenuModel.php
+++ b/administrator/components/com_menus/src/Model/MenuModel.php
@@ -269,7 +269,7 @@ public function save($data)
$result = Factory::getApplication()->triggerEvent('onContentBeforeSave', [$this->_context, &$table, $isNew, $data]);
// Store the data.
- if (in_array(false, $result, true) || !$table->store()) {
+ if (\in_array(false, $result, true) || !$table->store()) {
$this->setError($table->getError());
return false;
@@ -312,7 +312,7 @@ public function delete(&$pks)
// Trigger the before delete event.
$result = Factory::getApplication()->triggerEvent('onContentBeforeDelete', [$this->_context, $table]);
- if (in_array(false, $result, true) || !$table->delete($itemId)) {
+ if (\in_array(false, $result, true) || !$table->delete($itemId)) {
$this->setError($table->getError());
return false;
diff --git a/administrator/components/com_menus/src/Model/MenusModel.php b/administrator/components/com_menus/src/Model/MenusModel.php
index 7b962701026a0..16a538a34bcdc 100644
--- a/administrator/components/com_menus/src/Model/MenusModel.php
+++ b/administrator/components/com_menus/src/Model/MenusModel.php
@@ -306,7 +306,7 @@ public function getMissingModuleLanguages(): array
$mLanguages = $db->setQuery($query)->loadColumn();
// Check if we have a mod_menu module set to All languages or a mod_menu module for each admin language.
- if (!in_array('*', $mLanguages) && count($langMissing = array_diff(array_keys($langCodes), $mLanguages))) {
+ if (!\in_array('*', $mLanguages) && \count($langMissing = array_diff(array_keys($langCodes), $mLanguages))) {
return array_intersect_key($langCodes, array_flip($langMissing));
}
diff --git a/administrator/components/com_menus/src/Model/MenutypesModel.php b/administrator/components/com_menus/src/Model/MenutypesModel.php
index b23a3ba5c7081..5dc288519f4e4 100644
--- a/administrator/components/com_menus/src/Model/MenutypesModel.php
+++ b/administrator/components/com_menus/src/Model/MenutypesModel.php
@@ -373,7 +373,7 @@ protected function getTypeOptionsFromManifest($component)
$rootMenu = $manifest->administration->menu;
// If the menu item doesn't exist or is hidden do nothing.
- if (!$rootMenu || in_array((string) $rootMenu['hidden'], ['true', 'hidden'])) {
+ if (!$rootMenu || \in_array((string) $rootMenu['hidden'], ['true', 'hidden'])) {
return $options;
}
@@ -415,7 +415,7 @@ protected function getTypeOptionsFromManifest($component)
$options[] = new CMSObject($o);
// Do not repeat the default view link (index.php?option=com_abc).
- if (count($o->request) == 1) {
+ if (\count($o->request) == 1) {
$ro = null;
}
}
diff --git a/administrator/components/com_menus/src/Service/HTML/Menus.php b/administrator/components/com_menus/src/Service/HTML/Menus.php
index 75ee99976e146..1b3fb9771a99c 100644
--- a/administrator/components/com_menus/src/Service/HTML/Menus.php
+++ b/administrator/components/com_menus/src/Service/HTML/Menus.php
@@ -84,7 +84,7 @@ public function association($itemid)
$content_languages = array_column($languages, 'lang_code');
foreach ($items as &$item) {
- if (in_array($item->lang_code, $content_languages)) {
+ if (\in_array($item->lang_code, $content_languages)) {
$text = $item->lang_code;
$url = Route::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);
$tooltip = '
' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . ''
diff --git a/administrator/components/com_menus/src/Table/MenuTable.php b/administrator/components/com_menus/src/Table/MenuTable.php
index 2eae13b5b6d51..af02ec78937ed 100644
--- a/administrator/components/com_menus/src/Table/MenuTable.php
+++ b/administrator/components/com_menus/src/Table/MenuTable.php
@@ -77,7 +77,7 @@ public function check()
}
// Check the publish down date is not earlier than publish up.
- if (!is_null($this->publish_down) && !is_null($this->publish_up) && $this->publish_down < $this->publish_up) {
+ if (!\is_null($this->publish_down) && !\is_null($this->publish_up) && $this->publish_down < $this->publish_up) {
$this->setError(Text::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
return false;
diff --git a/administrator/components/com_menus/src/View/Item/HtmlView.php b/administrator/components/com_menus/src/View/Item/HtmlView.php
index 18681086c6f70..7e190191311d8 100644
--- a/administrator/components/com_menus/src/View/Item/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Item/HtmlView.php
@@ -99,7 +99,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -142,7 +142,7 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$isNew = ($this->item->id == 0);
- $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
+ $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
$clientId = $this->state->get('item.client_id', 0);
$toolbar = Toolbar::getInstance();
@@ -230,7 +230,7 @@ protected function addModalToolbar()
{
$user = $this->getCurrentUser();
$isNew = ($this->item->id == 0);
- $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
+ $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
$toolbar = Toolbar::getInstance();
diff --git a/administrator/components/com_menus/src/View/Items/HtmlView.php b/administrator/components/com_menus/src/View/Items/HtmlView.php
index dfa76d56a6c04..f3c2f0d885c89 100644
--- a/administrator/components/com_menus/src/View/Items/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Items/HtmlView.php
@@ -106,7 +106,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -220,7 +220,7 @@ public function display($tpl = null)
unset($xml);
// Special case if neither a view nor layout title is found
- if (count($titleParts) == 1) {
+ if (\count($titleParts) == 1) {
$titleParts[] = $vars['view'];
}
}
diff --git a/administrator/components/com_menus/src/View/Menu/HtmlView.php b/administrator/components/com_menus/src/View/Menu/HtmlView.php
index 52ae32fcd10a1..f24f53ea77b14 100644
--- a/administrator/components/com_menus/src/View/Menu/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Menu/HtmlView.php
@@ -75,7 +75,7 @@ public function display($tpl = null)
$this->canDo = ContentHelper::getActions('com_menus', 'menu', $this->item->id);
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_menus/src/View/Menus/HtmlView.php b/administrator/components/com_menus/src/View/Menus/HtmlView.php
index 79aebf0691a18..bac7dd1c6df15 100644
--- a/administrator/components/com_menus/src/View/Menus/HtmlView.php
+++ b/administrator/components/com_menus/src/View/Menus/HtmlView.php
@@ -103,7 +103,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_messages/services/provider.php b/administrator/components/com_messages/services/provider.php
index 985159b53f7c2..a589229580e82 100644
--- a/administrator/components/com_messages/services/provider.php
+++ b/administrator/components/com_messages/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_messages/src/Controller/ConfigController.php b/administrator/components/com_messages/src/Controller/ConfigController.php
index c9b236d36c964..19e270de8fa91 100644
--- a/administrator/components/com_messages/src/Controller/ConfigController.php
+++ b/administrator/components/com_messages/src/Controller/ConfigController.php
@@ -55,7 +55,7 @@ public function save()
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
- for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
+ for ($i = 0, $n = \count($errors); $i < $n && $i < 3; $i++) {
if ($errors[$i] instanceof \Exception) {
$this->app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
diff --git a/administrator/components/com_messages/src/Model/ConfigModel.php b/administrator/components/com_messages/src/Model/ConfigModel.php
index a2e30ce552e0b..4b0d3ae9ebc66 100644
--- a/administrator/components/com_messages/src/Model/ConfigModel.php
+++ b/administrator/components/com_messages/src/Model/ConfigModel.php
@@ -143,7 +143,7 @@ public function save($data)
return false;
}
- if (count($data)) {
+ if (\count($data)) {
$query = $db->getQuery(true)
->insert($db->quoteName('#__messages_cfg'))
->columns(
diff --git a/administrator/components/com_messages/src/View/Config/HtmlView.php b/administrator/components/com_messages/src/View/Config/HtmlView.php
index e0748e4a6a351..c881de29ca83b 100644
--- a/administrator/components/com_messages/src/View/Config/HtmlView.php
+++ b/administrator/components/com_messages/src/View/Config/HtmlView.php
@@ -65,7 +65,7 @@ public function display($tpl = null)
$this->state = $this->get('State');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_messages/src/View/Message/HtmlView.php b/administrator/components/com_messages/src/View/Message/HtmlView.php
index a996f147f127a..f19d80bf1d1fa 100644
--- a/administrator/components/com_messages/src/View/Message/HtmlView.php
+++ b/administrator/components/com_messages/src/View/Message/HtmlView.php
@@ -69,7 +69,7 @@ public function display($tpl = null)
$this->state = $this->get('State');
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_modules/services/provider.php b/administrator/components/com_modules/services/provider.php
index 45619cdb809a2..d4eda1ea53f14 100644
--- a/administrator/components/com_modules/services/provider.php
+++ b/administrator/components/com_modules/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
diff --git a/administrator/components/com_modules/src/Controller/DisplayController.php b/administrator/components/com_modules/src/Controller/DisplayController.php
index 1daa2174005fa..cea81b6452219 100644
--- a/administrator/components/com_modules/src/Controller/DisplayController.php
+++ b/administrator/components/com_modules/src/Controller/DisplayController.php
@@ -53,7 +53,7 @@ public function display($cachable = false, $urlparams = false)
// Verify client
$clientId = $this->input->post->getInt('client_id');
- if (!is_null($clientId)) {
+ if (!\is_null($clientId)) {
$uri = Uri::getInstance();
if ((int) $uri->getVar('client_id') !== (int) $clientId) {
diff --git a/administrator/components/com_modules/src/Controller/ModuleController.php b/administrator/components/com_modules/src/Controller/ModuleController.php
index 5ebbb73c64f81..b60e88fbcbdde 100644
--- a/administrator/components/com_modules/src/Controller/ModuleController.php
+++ b/administrator/components/com_modules/src/Controller/ModuleController.php
@@ -291,7 +291,7 @@ public function orderPosition()
}
$orders2 = [];
- $n = count($orders);
+ $n = \count($orders);
if ($n > 0) {
for ($i = 0; $i < $n; $i++) {
diff --git a/administrator/components/com_modules/src/Controller/ModulesController.php b/administrator/components/com_modules/src/Controller/ModulesController.php
index 4d9fc8ee985bd..51ce8f3f7f30d 100644
--- a/administrator/components/com_modules/src/Controller/ModulesController.php
+++ b/administrator/components/com_modules/src/Controller/ModulesController.php
@@ -49,7 +49,7 @@ public function duplicate()
$model = $this->getModel();
$model->duplicate($pks);
- $this->setMessage(Text::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
+ $this->setMessage(Text::plural('COM_MODULES_N_MODULES_DUPLICATED', \count($pks)));
} catch (\Exception $e) {
$this->app->enqueueMessage($e->getMessage(), 'warning');
}
diff --git a/administrator/components/com_modules/src/Helper/ModulesHelper.php b/administrator/components/com_modules/src/Helper/ModulesHelper.php
index 2b4e02cdef957..5a68b64c3ef8b 100644
--- a/administrator/components/com_modules/src/Helper/ModulesHelper.php
+++ b/administrator/components/com_modules/src/Helper/ModulesHelper.php
@@ -82,7 +82,7 @@ public static function getPositions($clientId, $editPositions = false)
try {
$positions = $db->loadColumn();
- $positions = is_array($positions) ? $positions : [];
+ $positions = \is_array($positions) ? $positions : [];
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
diff --git a/administrator/components/com_modules/src/Model/ModuleModel.php b/administrator/components/com_modules/src/Model/ModuleModel.php
index 3003c6825d4b0..a0500393df7fe 100644
--- a/administrator/components/com_modules/src/Model/ModuleModel.php
+++ b/administrator/components/com_modules/src/Model/ModuleModel.php
@@ -345,7 +345,7 @@ public function delete(&$pks)
// Trigger the before delete event.
$result = $app->triggerEvent($this->event_before_delete, [$context, $table]);
- if (in_array(false, $result, true) || !$table->delete($pk)) {
+ if (\in_array(false, $result, true) || !$table->delete($pk)) {
throw new \Exception($table->getError());
}
@@ -606,7 +606,7 @@ protected function loadFormData()
// This allows us to inject parameter settings into a new module.
$params = $app->getUserState('com_modules.add.module.params');
- if (is_array($params)) {
+ if (\is_array($params)) {
$data->set('params', $params);
}
}
@@ -942,7 +942,7 @@ public function save($data)
// Trigger the before save event.
$result = Factory::getApplication()->triggerEvent($this->event_before_save, [$context, &$table, $isNew]);
- if (in_array(false, $result, true)) {
+ if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
diff --git a/administrator/components/com_modules/src/Model/ModulesModel.php b/administrator/components/com_modules/src/Model/ModulesModel.php
index cd43e275def39..2e8751991f9fa 100644
--- a/administrator/components/com_modules/src/Model/ModulesModel.php
+++ b/administrator/components/com_modules/src/Model/ModulesModel.php
@@ -115,7 +115,7 @@ protected function populateState($ordering = 'a.position', $direction = 'asc')
$clientId = 0;
} else {
$clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int');
- $clientId = (!in_array($clientId, [0, 1])) ? 0 : $clientId;
+ $clientId = (!\in_array($clientId, [0, 1])) ? 0 : $clientId;
$this->setState('client_id', $clientId);
}
@@ -175,7 +175,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$db = $this->getDatabase();
// If ordering by fields that need translate we need to sort the array of objects after translating them.
- if (in_array($listOrder, ['pages', 'name'])) {
+ if (\in_array($listOrder, ['pages', 'name'])) {
// Fetch the results.
$db->setQuery($query);
$result = $db->loadObjectList();
@@ -187,7 +187,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$result = ArrayHelper::sortObjects($result, $listOrder, strtolower($listDirn) == 'desc' ? -1 : 1, true, true);
// Process pagination.
- $total = count($result);
+ $total = \count($result);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total < $limitstart) {
@@ -195,7 +195,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0)
$this->setState('list.start', 0);
}
- return array_slice($result, $limitstart, $limit ?: null);
+ return \array_slice($result, $limitstart, $limit ?: null);
}
// If ordering by fields that doesn't need translate just order the query.
@@ -237,7 +237,7 @@ protected function translate(&$items)
|| $lang->load("$extension.sys", $source);
$item->name = Text::_($item->name);
- if (is_null($item->pages)) {
+ if (\is_null($item->pages)) {
$item->pages = Text::_('JNONE');
} elseif ($item->pages < 0) {
$item->pages = Text::_('COM_MODULES_ASSIGNED_VARIES_EXCEPT');
diff --git a/administrator/components/com_modules/src/Model/PositionsModel.php b/administrator/components/com_modules/src/Model/PositionsModel.php
index 7b9959bc0b413..81c0aebe6ac9e 100644
--- a/administrator/components/com_modules/src/Model/PositionsModel.php
+++ b/administrator/components/com_modules/src/Model/PositionsModel.php
@@ -78,7 +78,7 @@ protected function populateState($ordering = 'ordering', $direction = 'asc')
// Special case for the client id.
$clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int');
- $clientId = (!in_array((int) $clientId, [0, 1])) ? 0 : (int) $clientId;
+ $clientId = (!\in_array((int) $clientId, [0, 1])) ? 0 : (int) $clientId;
$this->setState('client_id', $clientId);
// Load the parameters.
@@ -172,7 +172,7 @@ public function getItems()
if ($type == 'user' || ($state != '' && $state != $template->enabled)) {
unset($positions[$value]);
- } elseif (preg_match(chr(1) . $search . chr(1) . 'i', $value) && ($filter_template == '' || $filter_template == $template->element)) {
+ } elseif (preg_match(\chr(1) . $search . \chr(1) . 'i', $value) && ($filter_template == '' || $filter_template == $template->element)) {
if (!isset($positions[$value])) {
$positions[$value] = [];
}
@@ -184,7 +184,7 @@ public function getItems()
}
}
- $this->total = count($positions);
+ $this->total = \count($positions);
if ($limitstart >= $this->total) {
$limitstart = $limitstart < $limit ? 0 : $limitstart - $limit;
@@ -205,7 +205,7 @@ public function getItems()
}
}
- $this->items = array_slice($positions, $limitstart, $limit ?: null);
+ $this->items = \array_slice($positions, $limitstart, $limit ?: null);
}
return $this->items;
diff --git a/administrator/components/com_modules/src/Service/HTML/Modules.php b/administrator/components/com_modules/src/Service/HTML/Modules.php
index 0811aeae51942..78b02e6e90582 100644
--- a/administrator/components/com_modules/src/Service/HTML/Modules.php
+++ b/administrator/components/com_modules/src/Service/HTML/Modules.php
@@ -162,7 +162,7 @@ public function positions($clientId, $state = 1, $selectedPosition = '')
$positions = TemplatesHelper::getPositions($clientId, $template);
- if (is_array($positions)) {
+ if (\is_array($positions)) {
foreach ($positions as $position) {
$text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
$options[] = ModulesHelper::createOption($position, $text);
@@ -248,8 +248,8 @@ public function positionList($clientId = 0)
}
// Pop the first item off the array if it's blank
- if (count($options)) {
- if (strlen($options[0]->text) < 1) {
+ if (\count($options)) {
+ if (\strlen($options[0]->text) < 1) {
array_shift($options);
}
}
diff --git a/administrator/components/com_modules/src/View/Module/HtmlView.php b/administrator/components/com_modules/src/View/Module/HtmlView.php
index 6b3add6c38fc5..d270bb8bccc6b 100644
--- a/administrator/components/com_modules/src/View/Module/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Module/HtmlView.php
@@ -74,7 +74,7 @@ public function display($tpl = null)
$this->canDo = ContentHelper::getActions('com_modules', 'module', $this->item->id);
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
@@ -95,7 +95,7 @@ protected function addToolbar()
$user = $this->getCurrentUser();
$isNew = ($this->item->id == 0);
- $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
+ $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $user->get('id'));
$canDo = $this->canDo;
$toolbar = Toolbar::getInstance();
diff --git a/administrator/components/com_modules/src/View/Modules/HtmlView.php b/administrator/components/com_modules/src/View/Modules/HtmlView.php
index bbcaecd92da8e..07a6a6db0f103 100644
--- a/administrator/components/com_modules/src/View/Modules/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Modules/HtmlView.php
@@ -97,7 +97,7 @@ public function display($tpl = null)
$this->activeFilters = $this->get('ActiveFilters');
$this->clientId = $this->state->get('client_id');
- if (!count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
+ if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
$this->setLayout('emptystate');
}
@@ -108,7 +108,7 @@ public function display($tpl = null)
* 1. Edit the module, change it to new position, save it and come back to Modules Management Screen
* 2. Or move that module to new position using Batch action
*/
- if (count($this->items) === 0 && $this->state->get('filter.position')) {
+ if (\count($this->items) === 0 && $this->state->get('filter.position')) {
$selectedPosition = $this->state->get('filter.position');
$positionField = $this->filterForm->getField('position', 'filter');
@@ -127,7 +127,7 @@ public function display($tpl = null)
}
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_modules/src/View/Select/HtmlView.php b/administrator/components/com_modules/src/View/Select/HtmlView.php
index 7d55d7a765ff7..806b50407dc12 100644
--- a/administrator/components/com_modules/src/View/Select/HtmlView.php
+++ b/administrator/components/com_modules/src/View/Select/HtmlView.php
@@ -63,7 +63,7 @@ public function display($tpl = null)
$this->modalLink = '';
// Check for errors.
- if (count($errors = $this->get('Errors'))) {
+ if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}
diff --git a/administrator/components/com_newsfeeds/services/provider.php b/administrator/components/com_newsfeeds/services/provider.php
index 36033690a8809..9c3b20e1c2eda 100644
--- a/administrator/components/com_newsfeeds/services/provider.php
+++ b/administrator/components/com_newsfeeds/services/provider.php
@@ -8,7 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
-defined('_JEXEC') or die;
+\defined('_JEXEC') or die;
use Joomla\CMS\Association\AssociationExtensionInterface;
use Joomla\CMS\Categories\CategoryFactoryInterface;
diff --git a/administrator/components/com_newsfeeds/src/Controller/AjaxController.php b/administrator/components/com_newsfeeds/src/Controller/AjaxController.php
index e9e6d67a6664a..6364ae87b4714 100644
--- a/administrator/components/com_newsfeeds/src/Controller/AjaxController.php
+++ b/administrator/components/com_newsfeeds/src/Controller/AjaxController.php
@@ -67,11 +67,11 @@ public function fetchAssociations()
$associations[$lang]->title = $newsfeedsTable->name;
}
- $countContentLanguages = count(LanguageHelper::getContentLanguages([0, 1], false));
+ $countContentLanguages = \count(LanguageHelper::getContentLanguages([0, 1], false));
- if (count($associations) == 0) {
+ if (\count($associations) == 0) {
$message = Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE');
- } elseif ($countContentLanguages > count($associations) + 2) {
+ } elseif ($countContentLanguages > \count($associations) + 2) {
$tags = implode(', ', array_keys($associations));
$message = Text::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags);
} else {
diff --git a/administrator/components/com_newsfeeds/src/Field/Modal/NewsfeedField.php b/administrator/components/com_newsfeeds/src/Field/Modal/NewsfeedField.php
index a597e8ff4a0c1..b1ac80b9ab41f 100644
--- a/administrator/components/com_newsfeeds/src/Field/Modal/NewsfeedField.php
+++ b/administrator/components/com_newsfeeds/src/Field/Modal/NewsfeedField.php
@@ -73,7 +73,7 @@ protected function getInput()
if ($allowSelect) {
static $scriptSelect = null;
- if (is_null($scriptSelect)) {
+ if (\is_null($scriptSelect)) {
$scriptSelect = [];
}
@@ -184,9 +184,9 @@ protected function getInput()
}
// Propagate newsfeed button
- if ($allowPropagate && count($languages) > 2) {
+ if ($allowPropagate && \count($languages) > 2) {
// Strip off language tag at the end
- $tagLength = (int) strlen($this->element['language']);
+ $tagLength = (int) \strlen($this->element['language']);
$callbackFunctionStem = substr("jSelectNewsfeed_" . $this->id, 0, -$tagLength);
$html .= '