diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 75f07363463c6..a51c8521170fe 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -86,6 +86,8 @@ 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], // There should not be useless else cases 'no_useless_else' => true, + // Native function invocation + 'native_function_invocation' => ['include' => ['@compiler_optimized']], ] ) ->setFinder($finder); diff --git a/administrator/components/com_actionlogs/services/provider.php b/administrator/components/com_actionlogs/services/provider.php index 6f6c54d9c4bc4..59795f1b6e762 100644 --- a/administrator/components/com_actionlogs/services/provider.php +++ b/administrator/components/com_actionlogs/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_admin/postinstall/behindproxy.php b/administrator/components/com_admin/postinstall/behindproxy.php index 35594f72b4b07..d784ab7d2e339 100644 --- a/administrator/components/com_admin/postinstall/behindproxy.php +++ b/administrator/components/com_admin/postinstall/behindproxy.php @@ -34,11 +34,11 @@ function admin_postinstall_behindproxy_condition() return false; } - if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + if (\array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { return true; } - if (array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) { + if (\array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) { return true; } diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index aa34bc08663a4..a7e2bf593b2f2 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -81,7 +81,7 @@ protected function collectError(string $context, \Throwable $error) // The errorCollector are required // However when someone already running the script manually the code may fail. if ($this->errorCollector) { - call_user_func($this->errorCollector, $context, $error); + \call_user_func($this->errorCollector, $context, $error); } else { Log::add($error->getMessage(), Log::ERROR, 'Update'); } @@ -104,7 +104,7 @@ public function preflight($action, $installer) if (!empty($installer->extension->manifest_cache)) { $manifestValues = json_decode($installer->extension->manifest_cache, true); - if (array_key_exists('version', $manifestValues)) { + if (\array_key_exists('version', $manifestValues)) { $this->fromVersion = $manifestValues['version']; return true; @@ -2463,11 +2463,11 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) $this->fixFilenameCasing(); - if ($suppressOutput === false && count($status['folders_errors'])) { + if ($suppressOutput === false && \count($status['folders_errors'])) { echo implode('
', $status['folders_errors']); } - if ($suppressOutput === false && count($status['files_errors'])) { + if ($suppressOutput === false && \count($status['files_errors'])) { echo implode('
', $status['files_errors']); } @@ -2772,7 +2772,7 @@ private function migrateTinymceConfiguration(): bool $replace = ['blocks', 'fontfamily', 'fontsize', 'styles']; // Don't redo the template - if (!in_array('jtemplate', $params['configuration']['toolbars'][$setIdx]['menu'])) { + if (!\in_array('jtemplate', $params['configuration']['toolbars'][$setIdx]['menu'])) { $search[] = 'template'; $replace[] = 'jtemplate'; } @@ -2796,7 +2796,7 @@ private function migrateTinymceConfiguration(): bool $replace = ['fontfamily', 'fontsize', 'blocks', 'styles']; // Don't redo the template - if (!in_array('jtemplate', $params['configuration']['toolbars'][$setIdx][$toolbarIdx])) { + if (!\in_array('jtemplate', $params['configuration']['toolbars'][$setIdx][$toolbarIdx])) { $search[] = 'template'; $replace[] = 'jtemplate'; } @@ -2932,7 +2932,7 @@ protected function fixFilenameCasing() // Check if case-insensitive file system, eg on OSX. if (fileinode($oldRealpath) === fileinode($newRealpath)) { // Check deeper because even realpath or glob might not return the actual case. - if (!in_array($expectedBasename, scandir(dirname($newRealpath)))) { + if (!\in_array($expectedBasename, scandir(\dirname($newRealpath)))) { // Rename the file. File::move(JPATH_ROOT . $old, JPATH_ROOT . $old . '.tmp'); File::move(JPATH_ROOT . $old . '.tmp', JPATH_ROOT . $expected); diff --git a/administrator/components/com_admin/services/provider.php b/administrator/components/com_admin/services/provider.php index 33f2e97838907..a414719cc6ebd 100644 --- a/administrator/components/com_admin/services/provider.php +++ b/administrator/components/com_admin/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_admin/src/Model/SysinfoModel.php b/administrator/components/com_admin/src/Model/SysinfoModel.php index b4c07e00fb9af..33365916235e2 100644 --- a/administrator/components/com_admin/src/Model/SysinfoModel.php +++ b/administrator/components/com_admin/src/Model/SysinfoModel.php @@ -679,7 +679,7 @@ private function addDirectory(string $name, string $path, string $message = ''): */ public function &getEditor(): string { - if (!is_null($this->editor)) { + if (!\is_null($this->editor)) { return $this->editor; } diff --git a/administrator/components/com_ajax/ajax.php b/administrator/components/com_ajax/ajax.php index 37e61ad93a326..8a60f2247e914 100644 --- a/administrator/components/com_ajax/ajax.php +++ b/administrator/components/com_ajax/ajax.php @@ -8,6 +8,6 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; require_once JPATH_SITE . '/components/com_ajax/ajax.php'; diff --git a/administrator/components/com_associations/services/provider.php b/administrator/components/com_associations/services/provider.php index 481a24025f6cf..87410f067520f 100644 --- a/administrator/components/com_associations/services/provider.php +++ b/administrator/components/com_associations/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_banners/services/provider.php b/administrator/components/com_banners/services/provider.php index e97106917ead5..d769755d09f02 100644 --- a/administrator/components/com_banners/services/provider.php +++ b/administrator/components/com_banners/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\Categories\CategoryFactoryInterface; use Joomla\CMS\Component\Router\RouterFactoryInterface; diff --git a/administrator/components/com_cache/services/provider.php b/administrator/components/com_cache/services/provider.php index ef0ea0ee7811c..0686e6b86f059 100644 --- a/administrator/components/com_cache/services/provider.php +++ b/administrator/components/com_cache/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_cache/src/Model/CacheModel.php b/administrator/components/com_cache/src/Model/CacheModel.php index 57c1ff29d6fe5..1999b930fad21 100644 --- a/administrator/components/com_cache/src/Model/CacheModel.php +++ b/administrator/components/com_cache/src/Model/CacheModel.php @@ -193,7 +193,7 @@ public function getCache() public function getTotal() { if (empty($this->_total)) { - $this->_total = count($this->getData()); + $this->_total = \count($this->getData()); } return $this->_total; diff --git a/administrator/components/com_categories/services/provider.php b/administrator/components/com_categories/services/provider.php index 01d9a2f8d1e60..f92679f850068 100644 --- a/administrator/components/com_categories/services/provider.php +++ b/administrator/components/com_categories/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_categories/src/Field/Modal/CategoryField.php b/administrator/components/com_categories/src/Field/Modal/CategoryField.php index b048120f737d1..7ff5e2d7d7b06 100644 --- a/administrator/components/com_categories/src/Field/Modal/CategoryField.php +++ b/administrator/components/com_categories/src/Field/Modal/CategoryField.php @@ -79,7 +79,7 @@ protected function getInput() if ($allowSelect) { static $scriptSelect = null; - if (is_null($scriptSelect)) { + if (\is_null($scriptSelect)) { $scriptSelect = []; } diff --git a/administrator/components/com_categories/src/Model/CategoriesModel.php b/administrator/components/com_categories/src/Model/CategoriesModel.php index 48d0e3e0a091a..2b759b42e3ff9 100644 --- a/administrator/components/com_categories/src/Model/CategoriesModel.php +++ b/administrator/components/com_categories/src/Model/CategoriesModel.php @@ -245,12 +245,12 @@ protected function getListQuery() $categoryId = $this->getState('filter.category_id', []); $level = $this->getState('filter.level'); - if (!is_array($categoryId)) { + if (!\is_array($categoryId)) { $categoryId = $categoryId ? [$categoryId] : []; } // Case: Using both categories filter and by level filter - if (count($categoryId)) { + if (\count($categoryId)) { $categoryTable = Table::getInstance('Category', 'JTable'); $subCatItemsWhere = []; diff --git a/administrator/components/com_categories/src/Service/HTML/AdministratorService.php b/administrator/components/com_categories/src/Service/HTML/AdministratorService.php index 0267b1e81b62c..c2c819e1f5960 100644 --- a/administrator/components/com_categories/src/Service/HTML/AdministratorService.php +++ b/administrator/components/com_categories/src/Service/HTML/AdministratorService.php @@ -85,7 +85,7 @@ public function association($catid, $extension = 'com_content') $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_categories&task=category.edit&id=' . (int) $item->id . '&extension=' . $extension); $tooltip = '' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '
' diff --git a/administrator/components/com_categories/src/View/Categories/HtmlView.php b/administrator/components/com_categories/src/View/Categories/HtmlView.php index c022373331ff0..94199e1a1404f 100644 --- a/administrator/components/com_categories/src/View/Categories/HtmlView.php +++ b/administrator/components/com_categories/src/View/Categories/HtmlView.php @@ -111,12 +111,12 @@ public function display($tpl = null) $this->activeFilters = $this->get('ActiveFilters'); // Written this way because we only want to call IsEmptyState if no items, to prevent always calling it when not needed. - 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); } @@ -204,7 +204,7 @@ protected function addToolbar() // Prepare the toolbar. ToolbarHelper::title($title, 'folder categories ' . substr($component, 4) . ($section ? "-$section" : '') . '-categories'); - if ($canDo->get('core.create') || count($user->getAuthorisedCategories($component, 'core.create')) > 0) { + if ($canDo->get('core.create') || \count($user->getAuthorisedCategories($component, 'core.create')) > 0) { $toolbar->addNew('category.add'); } diff --git a/administrator/components/com_categories/src/View/Category/HtmlView.php b/administrator/components/com_categories/src/View/Category/HtmlView.php index f3e8e78486c6e..a1290cc23dc42 100644 --- a/administrator/components/com_categories/src/View/Category/HtmlView.php +++ b/administrator/components/com_categories/src/View/Category/HtmlView.php @@ -93,7 +93,7 @@ public function display($tpl = null) $this->assoc = $this->get('Assoc'); // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -139,7 +139,7 @@ protected function addToolbar() $toolbar = Toolbar::getInstance(); $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); // Avoid nonsense situation. if ($extension == 'com_categories') { @@ -149,7 +149,7 @@ protected function addToolbar() // The extension can be in the form com_foo.section $parts = explode('.', $extension); $component = $parts[0]; - $section = (count($parts) > 1) ? $parts[1] : null; + $section = (\count($parts) > 1) ? $parts[1] : null; $componentParams = ComponentHelper::getParams($component); // Need to load the menu language file as mod_menu hasn't been loaded yet. diff --git a/administrator/components/com_checkin/services/provider.php b/administrator/components/com_checkin/services/provider.php index a01731c926669..fec4e12bead1a 100644 --- a/administrator/components/com_checkin/services/provider.php +++ b/administrator/components/com_checkin/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_checkin/src/Controller/DisplayController.php b/administrator/components/com_checkin/src/Controller/DisplayController.php index 5b17d3e84862e..e267dc566e68c 100644 --- a/administrator/components/com_checkin/src/Controller/DisplayController.php +++ b/administrator/components/com_checkin/src/Controller/DisplayController.php @@ -89,7 +89,7 @@ public function getMenuBadgeData() $model = $this->getModel('Checkin'); - $amount = (int) count($model->getItems()); + $amount = (int) \count($model->getItems()); echo new JsonResponse($amount); } @@ -110,7 +110,7 @@ public function getQuickiconContent() $model = $this->getModel('Checkin'); - $amount = (int) count($model->getItems()); + $amount = (int) \count($model->getItems()); $result = []; diff --git a/administrator/components/com_checkin/src/Model/CheckinModel.php b/administrator/components/com_checkin/src/Model/CheckinModel.php index 22bde7fb6a158..1acd85183f8af 100644 --- a/administrator/components/com_checkin/src/Model/CheckinModel.php +++ b/administrator/components/com_checkin/src/Model/CheckinModel.php @@ -85,7 +85,7 @@ public function checkin($ids = []) { $db = $this->getDatabase(); - if (!is_array($ids)) { + if (!\is_array($ids)) { return 0; } @@ -205,7 +205,7 @@ public function getItems() } } - $this->total = count($results); + $this->total = \count($results); // Order items by table if ($this->getState('list.ordering') == 'table') { @@ -227,7 +227,7 @@ public function getItems() $limit = (int) $this->getState('list.limit'); if ($limit !== 0) { - $this->items = array_slice($results, $this->getState('list.start'), $limit); + $this->items = \array_slice($results, $this->getState('list.start'), $limit); } else { $this->items = $results; } diff --git a/administrator/components/com_config/services/provider.php b/administrator/components/com_config/services/provider.php index e31daa67570e1..6c653b14933c2 100644 --- a/administrator/components/com_config/services/provider.php +++ b/administrator/components/com_config/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_config/src/Controller/ApplicationController.php b/administrator/components/com_config/src/Controller/ApplicationController.php index 218f71620b2d1..7c2a42bb186b0 100644 --- a/administrator/components/com_config/src/Controller/ApplicationController.php +++ b/administrator/components/com_config/src/Controller/ApplicationController.php @@ -121,7 +121,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_config/src/Controller/DisplayController.php b/administrator/components/com_config/src/Controller/DisplayController.php index 39552bfd02b0c..008a20deff0f5 100644 --- a/administrator/components/com_config/src/Controller/DisplayController.php +++ b/administrator/components/com_config/src/Controller/DisplayController.php @@ -55,7 +55,7 @@ public function display($cachable = false, $urlparams = []) // Make sure com_joomlaupdate and com_privacy can only be accessed by SuperUser if ( - in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy']) + \in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy']) && !$this->app->getIdentity()->authorise('core.admin') ) { $this->setRedirect(Route::_('index.php'), Text::_('JERROR_ALERTNOAUTHOR'), 'error'); diff --git a/administrator/components/com_config/src/Dispatcher/Dispatcher.php b/administrator/components/com_config/src/Dispatcher/Dispatcher.php index 97bfa3b44ca9f..18c901eb88288 100644 --- a/administrator/components/com_config/src/Dispatcher/Dispatcher.php +++ b/administrator/components/com_config/src/Dispatcher/Dispatcher.php @@ -37,7 +37,7 @@ class Dispatcher extends ComponentDispatcher protected function checkAccess(): void { // sendtestmail and store do their own checks, so leave the method to handle the permission and send response itself - if (in_array($this->input->getCmd('task'), ['application.sendtestmail', 'application.store'], true)) { + if (\in_array($this->input->getCmd('task'), ['application.sendtestmail', 'application.store'], true)) { return; } diff --git a/administrator/components/com_config/src/Helper/ConfigHelper.php b/administrator/components/com_config/src/Helper/ConfigHelper.php index fd82dadb55872..115d384402162 100644 --- a/administrator/components/com_config/src/Helper/ConfigHelper.php +++ b/administrator/components/com_config/src/Helper/ConfigHelper.php @@ -74,7 +74,7 @@ public static function canChangeComponentConfig(string $component) { $user = Factory::getApplication()->getIdentity(); - if (!in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy'], true)) { + if (!\in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy'], true)) { return $user->authorise('core.admin', $component) || $user->authorise('core.options', $component); } diff --git a/administrator/components/com_config/src/Model/ApplicationModel.php b/administrator/components/com_config/src/Model/ApplicationModel.php index 304e19e621f59..35699473633c3 100644 --- a/administrator/components/com_config/src/Model/ApplicationModel.php +++ b/administrator/components/com_config/src/Model/ApplicationModel.php @@ -122,7 +122,7 @@ public function getData() // Merge in the session data. if (!empty($temp)) { // $temp can sometimes be an object, and we need it to be an array - if (is_object($temp)) { + if (\is_object($temp)) { $temp = ArrayHelper::fromObject($temp); } @@ -354,7 +354,7 @@ public function save($data) $response = HttpFactory::getHttp($options)->get('https://' . $host . Uri::root(true) . '/', ['Host' => $host], 10); // If available in HTTPS check also the status code. - if (!in_array($response->code, [200, 503, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 401], true)) { + if (!\in_array($response->code, [200, 503, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 401], true)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE_HTTP_CODE')); } } catch (\RuntimeException $e) { @@ -745,7 +745,7 @@ public function save($data) $result = $dispatcher->dispatch('onApplicationBeforeSave', $eventBefore)->getArgument('result', []); // Store the data. - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING')); } @@ -788,7 +788,7 @@ public function removeroot() $result = $dispatcher->dispatch('onApplicationBeforeSave', $eventBefore)->getArgument('result', []); // Store the data. - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING')); } @@ -859,7 +859,7 @@ public function storePermissions($permission = null) $input = $app->getInput(); $user = $this->getCurrentUser(); - if (is_null($permission)) { + if (\is_null($permission)) { // Get data from input. $permission = [ 'component' => $input->json->get('comp'), @@ -893,7 +893,7 @@ public function storePermissions($permission = null) $isSuperUserGroupBefore = Access::checkGroup($permission['rule'], 'core.admin'); // Check if current user belongs to changed group. - $currentUserBelongsToGroup = in_array((int) $permission['rule'], $user->groups); + $currentUserBelongsToGroup = \in_array((int) $permission['rule'], $user->groups); // Get current user groups tree. $currentUserGroupsTree = Access::getGroupsByUser($user->id, true); @@ -909,7 +909,7 @@ public function storePermissions($permission = null) } // If user is not Super User cannot change the permissions of a group it belongs to. - if (!$currentUserSuperUser && in_array((int) $permission['rule'], $currentUserGroupsTree)) { + if (!$currentUserSuperUser && \in_array((int) $permission['rule'], $currentUserGroupsTree)) { $app->enqueueMessage(Text::_('JLIB_USER_ERROR_CANNOT_CHANGE_OWN_PARENT_GROUPS'), 'error'); return false; diff --git a/administrator/components/com_config/src/Model/ComponentModel.php b/administrator/components/com_config/src/Model/ComponentModel.php index 232e8272a0ab8..80672f1bdfff5 100644 --- a/administrator/components/com_config/src/Model/ComponentModel.php +++ b/administrator/components/com_config/src/Model/ComponentModel.php @@ -225,7 +225,7 @@ public function save($data) $result = Factory::getApplication()->triggerEvent('onExtensionBeforeSave', [$context, $table, false]); // Store the data. - if (in_array(false, $result, true) || !$table->store()) { + if (\in_array(false, $result, true) || !$table->store()) { throw new \RuntimeException($table->getError()); } diff --git a/administrator/components/com_contact/services/provider.php b/administrator/components/com_contact/services/provider.php index 7de93d94e3b5e..1d0e333ecb8a8 100644 --- a/administrator/components/com_contact/services/provider.php +++ b/administrator/components/com_contact/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_contact/src/Controller/AjaxController.php b/administrator/components/com_contact/src/Controller/AjaxController.php index 11458c601a8d3..18d84fdbb7728 100644 --- a/administrator/components/com_contact/src/Controller/AjaxController.php +++ b/administrator/components/com_contact/src/Controller/AjaxController.php @@ -67,11 +67,11 @@ public function fetchAssociations() $associations[$lang]->title = $contactTable->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_contact/src/Controller/ContactsController.php b/administrator/components/com_contact/src/Controller/ContactsController.php index 2ac3c85d0bf4c..6e141bcc45da1 100644 --- a/administrator/components/com_contact/src/Controller/ContactsController.php +++ b/administrator/components/com_contact/src/Controller/ContactsController.php @@ -98,9 +98,9 @@ public function featured() } if ($value == 1) { - $message = Text::plural('COM_CONTACT_N_ITEMS_FEATURED', count($ids)); + $message = Text::plural('COM_CONTACT_N_ITEMS_FEATURED', \count($ids)); } else { - $message = Text::plural('COM_CONTACT_N_ITEMS_UNFEATURED', count($ids)); + $message = Text::plural('COM_CONTACT_N_ITEMS_UNFEATURED', \count($ids)); } } diff --git a/administrator/components/com_contact/src/Field/Modal/ContactField.php b/administrator/components/com_contact/src/Field/Modal/ContactField.php index 2f8ddc3180562..a7594f397a3f9 100644 --- a/administrator/components/com_contact/src/Field/Modal/ContactField.php +++ b/administrator/components/com_contact/src/Field/Modal/ContactField.php @@ -73,7 +73,7 @@ protected function getInput() if ($allowSelect) { static $scriptSelect = null; - if (is_null($scriptSelect)) { + if (\is_null($scriptSelect)) { $scriptSelect = []; } @@ -183,9 +183,9 @@ protected function getInput() } // Propagate contact 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("jSelectContact_" . $this->id, 0, -$tagLength); $html .= 'getSupportTemplate(); $title = ''; - if (in_array($typeName, $this->itemTypes)) { + if (\in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'contact': $fields['title'] = 'a.name'; diff --git a/administrator/components/com_contact/src/Model/ContactModel.php b/administrator/components/com_contact/src/Model/ContactModel.php index bab7f3f00e18c..7344f38bd7ee3 100644 --- a/administrator/components/com_contact/src/Model/ContactModel.php +++ b/administrator/components/com_contact/src/Model/ContactModel.php @@ -425,7 +425,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content') if (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'); diff --git a/administrator/components/com_contact/src/Model/ContactsModel.php b/administrator/components/com_contact/src/Model/ContactsModel.php index ebe1c11de94bb..784614b1803e0 100644 --- a/administrator/components/com_contact/src/Model/ContactsModel.php +++ b/administrator/components/com_contact/src/Model/ContactsModel.php @@ -222,7 +222,7 @@ protected function getListQuery() // Filter by featured. $featured = (string) $this->getState('filter.featured'); - if (in_array($featured, ['0','1'])) { + if (\in_array($featured, ['0','1'])) { $query->where($db->quoteName('a.featured') . ' = ' . (int) $featured); } @@ -316,12 +316,12 @@ protected function getListQuery() $categoryId = $this->getState('filter.category_id', []); $level = $this->getState('filter.level'); - if (!is_array($categoryId)) { + if (!\is_array($categoryId)) { $categoryId = $categoryId ? [$categoryId] : []; } // Case: Using both categories filter and by level filter - if (count($categoryId)) { + if (\count($categoryId)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryTable = Table::getInstance('Category', '\\Joomla\\CMS\\Table\\'); $subCatItemsWhere = []; diff --git a/administrator/components/com_contact/src/Service/HTML/AdministratorService.php b/administrator/components/com_contact/src/Service/HTML/AdministratorService.php index 332ee0e6ebf27..d99c69510bb38 100644 --- a/administrator/components/com_contact/src/Service/HTML/AdministratorService.php +++ b/administrator/components/com_contact/src/Service/HTML/AdministratorService.php @@ -83,7 +83,7 @@ public function association($contactid) $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_contact&task=contact.edit&id=' . (int) $item->id); $tooltip = '' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '
' diff --git a/administrator/components/com_contact/src/Service/HTML/Icon.php b/administrator/components/com_contact/src/Service/HTML/Icon.php index 69dde75f5f3f5..7955ec57bf3cb 100644 --- a/administrator/components/com_contact/src/Service/HTML/Icon.php +++ b/administrator/components/com_contact/src/Service/HTML/Icon.php @@ -117,7 +117,7 @@ public function edit($contact, $params, $attribs = [], $legacy = false) if ( property_exists($contact, 'checked_out') && property_exists($contact, 'checked_out_time') - && !is_null($contact->checked_out) + && !\is_null($contact->checked_out) && $contact->checked_out !== $user->get('id') ) { $checkoutUser = $this->getUserFactory()->loadUserById($contact->checked_out); diff --git a/administrator/components/com_contact/src/View/Contact/HtmlView.php b/administrator/components/com_contact/src/View/Contact/HtmlView.php index fb87e01eb51e1..6b94a7477b0ad 100644 --- a/administrator/components/com_contact/src/View/Contact/HtmlView.php +++ b/administrator/components/com_contact/src/View/Contact/HtmlView.php @@ -67,7 +67,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); } @@ -105,7 +105,7 @@ protected function addToolbar() $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = Toolbar::getInstance(); // Since we don't track these assets at the item level, use the category id. @@ -116,7 +116,7 @@ protected function addToolbar() // Build the actions for new and existing records. if ($isNew) { // For new records, check the create permission. - if (count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { + if (\count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { $toolbar->apply('contact.apply'); $saveGroup = $toolbar->dropdownButton('save-group'); diff --git a/administrator/components/com_content/services/provider.php b/administrator/components/com_content/services/provider.php index 3220e06f7440c..f8ecf4d4878e2 100644 --- a/administrator/components/com_content/services/provider.php +++ b/administrator/components/com_content/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_content/src/Controller/AjaxController.php b/administrator/components/com_content/src/Controller/AjaxController.php index d0dfb28595784..ba4e05c0f0920 100644 --- a/administrator/components/com_content/src/Controller/AjaxController.php +++ b/administrator/components/com_content/src/Controller/AjaxController.php @@ -68,11 +68,11 @@ public function fetchAssociations() $associations[$lang]->title = $contentTable->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_content/src/Controller/ArticlesController.php b/administrator/components/com_content/src/Controller/ArticlesController.php index 55195d1ef86c0..0fc54328e6439 100644 --- a/administrator/components/com_content/src/Controller/ArticlesController.php +++ b/administrator/components/com_content/src/Controller/ArticlesController.php @@ -110,9 +110,9 @@ public function featured() } if ($value == 1) { - $message = Text::plural('COM_CONTENT_N_ITEMS_FEATURED', count($ids)); + $message = Text::plural('COM_CONTENT_N_ITEMS_FEATURED', \count($ids)); } else { - $message = Text::plural('COM_CONTENT_N_ITEMS_UNFEATURED', count($ids)); + $message = Text::plural('COM_CONTENT_N_ITEMS_UNFEATURED', \count($ids)); } $this->setRedirect(Route::_($redirectUrl, false), $message); diff --git a/administrator/components/com_content/src/Event/Model/FeatureEvent.php b/administrator/components/com_content/src/Event/Model/FeatureEvent.php index 5bd57f193b57a..fa8a194d95f5f 100644 --- a/administrator/components/com_content/src/Event/Model/FeatureEvent.php +++ b/administrator/components/com_content/src/Event/Model/FeatureEvent.php @@ -38,7 +38,7 @@ public function __construct($name, array $arguments = []) throw new \BadMethodCallException("Argument 'extension' of event $this->name is required but has not been provided"); } - if (!isset($arguments['extension']) || !is_string($arguments['extension'])) { + if (!isset($arguments['extension']) || !\is_string($arguments['extension'])) { throw new \BadMethodCallException("Argument 'extension' of event $this->name is not of type 'string'"); } @@ -53,7 +53,7 @@ public function __construct($name, array $arguments = []) $arguments['section'] = $arguments['section'] ?? $parts[1]; } - if (!isset($arguments['pks']) || !is_array($arguments['pks'])) { + if (!isset($arguments['pks']) || !\is_array($arguments['pks'])) { throw new \BadMethodCallException("Argument 'pks' of event $this->name is not of type 'array'"); } diff --git a/administrator/components/com_content/src/Extension/ContentComponent.php b/administrator/components/com_content/src/Extension/ContentComponent.php index 8fba49a54864a..67f0a41535ee0 100644 --- a/administrator/components/com_content/src/Extension/ContentComponent.php +++ b/administrator/components/com_content/src/Extension/ContentComponent.php @@ -275,7 +275,7 @@ public function getModelName($context): string { $parts = explode('.', $context); - if (count($parts) < 2) { + if (\count($parts) < 2) { return ''; } @@ -347,7 +347,7 @@ public function countItems(array $items, string $section) public function countTagItems(array $items, string $extension) { $parts = explode('.', $extension); - $section = count($parts) > 1 ? $parts[1] : null; + $section = \count($parts) > 1 ? $parts[1] : null; $config = (object) [ 'related_tbl' => ($section === 'category' ? 'categories' : 'content'), diff --git a/administrator/components/com_content/src/Field/Modal/ArticleField.php b/administrator/components/com_content/src/Field/Modal/ArticleField.php index 91022c6a65829..e5d5e70b613f8 100644 --- a/administrator/components/com_content/src/Field/Modal/ArticleField.php +++ b/administrator/components/com_content/src/Field/Modal/ArticleField.php @@ -64,7 +64,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) $language = (string) $this->element['language']; // 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; // Prepare Urls $linkArticles = (new Uri())->setPath(Uri::base(true) . '/index.php'); diff --git a/administrator/components/com_content/src/Helper/AssociationsHelper.php b/administrator/components/com_content/src/Helper/AssociationsHelper.php index 89f816a6c6240..7a0c73cc48c0e 100644 --- a/administrator/components/com_content/src/Helper/AssociationsHelper.php +++ b/administrator/components/com_content/src/Helper/AssociationsHelper.php @@ -132,7 +132,7 @@ public function getItem($typeName, $id) break; } - if (is_null($table)) { + if (\is_null($table)) { return null; } @@ -158,7 +158,7 @@ public function getType($typeName = '') $support = $this->getSupportTemplate(); $title = ''; - if (in_array($typeName, $this->itemTypes)) { + if (\in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'article': $support['state'] = true; diff --git a/administrator/components/com_content/src/Helper/ContentHelper.php b/administrator/components/com_content/src/Helper/ContentHelper.php index 746946d77a2fb..46aa32889767d 100644 --- a/administrator/components/com_content/src/Helper/ContentHelper.php +++ b/administrator/components/com_content/src/Helper/ContentHelper.php @@ -70,7 +70,7 @@ public static function filterTransitions(array $transitions, int $pk, int $workf array_filter( $transitions, function ($var) use ($pk, $workflowId) { - return in_array($var['from_stage_id'], [-1, $pk]) && $workflowId == $var['workflow_id']; + return \in_array($var['from_stage_id'], [-1, $pk]) && $workflowId == $var['workflow_id']; } ) ); @@ -170,7 +170,7 @@ public static function onPrepareForm(Form $form, $data) if ($workflow_id = (int) $workflow_id) { $title = $db->loadResult(); - if (!is_null($title)) { + if (!\is_null($title)) { $option = Text::sprintf('COM_WORKFLOW_INHERIT_WORKFLOW', Text::_($title)); break; diff --git a/administrator/components/com_content/src/Model/ArticleModel.php b/administrator/components/com_content/src/Model/ArticleModel.php index 29ef673fcd083..c4c5e0114ce6f 100644 --- a/administrator/components/com_content/src/Model/ArticleModel.php +++ b/administrator/components/com_content/src/Model/ArticleModel.php @@ -202,7 +202,7 @@ protected function batchMove($value, $pks, $contexts) // Set some needed variables. $this->user = $this->getCurrentUser(); $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); + $this->tableClassName = \get_class($this->table); $this->contentType = new UCMType(); $this->type = $this->contentType->getTypeByTable($this->tableClassName); } @@ -342,7 +342,7 @@ protected function prepareTable($table) $table->publish_up = Factory::getDate()->toSql(); } - if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0) { + if ($table->state == Workflow::CONDITION_PUBLISHED && \intval($table->publish_down) == 0) { $table->publish_down = null; } @@ -487,7 +487,7 @@ public function getForm($data = [], $loadData = true) if ($id == 0 && $formField = $form->getField('catid')) { $assignedCatids = $data['catid'] ?? $form->getValue('catid'); - $assignedCatids = is_array($assignedCatids) + $assignedCatids = \is_array($assignedCatids) ? (int) reset($assignedCatids) : (int) $assignedCatids; @@ -519,7 +519,7 @@ public function getForm($data = [], $loadData = true) } else { $catIds = $form->getValue('catid'); - $catId = is_array($catIds) + $catId = \is_array($catIds) ? (int) reset($catIds) : (int) $catIds; @@ -657,7 +657,7 @@ public function save($data) $data['created_by_alias'] = $filter->clean($data['created_by_alias'], 'TRIM'); } - if (isset($data['images']) && is_array($data['images'])) { + if (isset($data['images']) && \is_array($data['images'])) { $registry = new Registry($data['images']); $data['images'] = (string) $registry; @@ -668,7 +668,7 @@ public function save($data) // Create new category, if needed. $createCategory = true; - if (is_null($data['catid'])) { + if (\is_null($data['catid'])) { // When there is no catid passed don't try to create one $createCategory = false; } @@ -704,7 +704,7 @@ public function save($data) $data['catid'] = $categoryModel->getState('category.id'); } - if (isset($data['urls']) && is_array($data['urls'])) { + if (isset($data['urls']) && \is_array($data['urls'])) { $check = $input->post->get('jform', [], 'array'); foreach ($data['urls'] as $i => $url) { @@ -754,7 +754,7 @@ public function save($data) } // Automatic handling of alias for empty fields - if (in_array($input->get('task'), ['apply', 'save', 'save2new']) && (!isset($data['id']) || (int) $data['id'] == 0)) { + if (\in_array($input->get('task'), ['apply', 'save', 'save2new']) && (!isset($data['id']) || (int) $data['id'] == 0)) { if ($data['alias'] == null) { if ($app->get('unicodeslugs') == 1) { $data['alias'] = OutputFilter::stringUrlUnicodeSlug($data['title']); @@ -890,7 +890,7 @@ public function featured($pks, $value = 0, $featuredUp = null, $featuredDown = n $oldFeatured = $db->loadColumn(); // Update old featured articles - if (count($oldFeatured)) { + if (\count($oldFeatured)) { $query = $db->getQuery(true) ->update($db->quoteName('#__content_frontpage')) ->set( @@ -1005,7 +1005,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content') if (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'); diff --git a/administrator/components/com_content/src/Model/ArticlesModel.php b/administrator/components/com_content/src/Model/ArticlesModel.php index f5b0ffd62a913..defc1981763b7 100644 --- a/administrator/components/com_content/src/Model/ArticlesModel.php +++ b/administrator/components/com_content/src/Model/ArticlesModel.php @@ -335,7 +335,7 @@ protected 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); } @@ -387,12 +387,12 @@ protected function getListQuery() $categoryId = $this->getState('filter.category_id', []); $level = (int) $this->getState('filter.level'); - if (!is_array($categoryId)) { + if (!\is_array($categoryId)) { $categoryId = $categoryId ? [$categoryId] : []; } // Case: Using both categories filter and by level filter - if (count($categoryId)) { + if (\count($categoryId)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryTable = Table::getInstance('Category', '\\Joomla\\CMS\\Table\\'); $subCatItemsWhere = []; @@ -434,7 +434,7 @@ protected function getListQuery() $type = $this->getState('filter.author_id.include', true) ? ' = ' : ' <> '; $query->where($db->quoteName('a.created_by') . $type . ':authorId') ->bind(':authorId', $authorId, ParameterType::INTEGER); - } elseif (is_array($authorId)) { + } elseif (\is_array($authorId)) { // Check to see if by_me is in the array if (\in_array('by_me', $authorId)) { // Replace by_me with the current user id in the array @@ -573,7 +573,7 @@ public function getTransitions() $this->cache[$store] = []; try { - if (count($stage_ids) || count($workflow_ids)) { + if (\count($stage_ids) || \count($workflow_ids)) { Factory::getLanguage()->load('com_workflow', JPATH_ADMINISTRATOR); $query = $db->getQuery(true); @@ -604,11 +604,11 @@ public function getTransitions() $where = []; - if (count($stage_ids)) { + if (\count($stage_ids)) { $where[] = $db->quoteName('t.from_stage_id') . ' IN (' . implode(',', $query->bindArray($stage_ids)) . ')'; } - if (count($workflow_ids)) { + if (\count($workflow_ids)) { $where[] = '(' . $db->quoteName('t.from_stage_id') . ' = -1 AND ' . $db->quoteName('t.workflow_id') . ' IN (' . implode(',', $query->bindArray($workflow_ids)) . '))'; } diff --git a/administrator/components/com_content/src/Service/HTML/AdministratorService.php b/administrator/components/com_content/src/Service/HTML/AdministratorService.php index 00eb37912f1b5..bc6836e6897a4 100644 --- a/administrator/components/com_content/src/Service/HTML/AdministratorService.php +++ b/administrator/components/com_content/src/Service/HTML/AdministratorService.php @@ -82,7 +82,7 @@ public function association($articleid) $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_content&task=article.edit&id=' . (int) $item->id); $tooltip = '' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '
' diff --git a/administrator/components/com_content/src/Service/HTML/Icon.php b/administrator/components/com_content/src/Service/HTML/Icon.php index b5b3cc5e6b694..be1bfc6a4dedd 100644 --- a/administrator/components/com_content/src/Service/HTML/Icon.php +++ b/administrator/components/com_content/src/Service/HTML/Icon.php @@ -95,7 +95,7 @@ public function edit($article, $params, $attribs = [], $legacy = false) } // Ignore if the state is negative (trashed). - if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED])) { + if (!\in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED])) { return ''; } @@ -103,7 +103,7 @@ public function edit($article, $params, $attribs = [], $legacy = false) if ( property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') - && !is_null($article->checked_out) + && !\is_null($article->checked_out) && $article->checked_out != $user->get('id') ) { $checkoutUser = Factory::getUser($article->checked_out); diff --git a/administrator/components/com_content/src/View/Article/HtmlView.php b/administrator/components/com_content/src/View/Article/HtmlView.php index 71bb81b07d1b9..f3fad14936e88 100644 --- a/administrator/components/com_content/src/View/Article/HtmlView.php +++ b/administrator/components/com_content/src/View/Article/HtmlView.php @@ -100,7 +100,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); } @@ -141,7 +141,7 @@ protected function addToolbar() $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = Toolbar::getInstance(); // Built the actions for new and existing records. @@ -153,7 +153,7 @@ protected function addToolbar() ); // For new records, check the create permission. - if ($isNew && (count($user->getAuthorisedCategories('com_content', 'core.create')) > 0)) { + if ($isNew && (\count($user->getAuthorisedCategories('com_content', 'core.create')) > 0)) { $toolbar->apply('article.apply'); $saveGroup = $toolbar->dropdownButton('save-group'); @@ -251,7 +251,7 @@ protected function addModalToolbar() $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = Toolbar::getInstance(); // Build the actions for new and existing records. @@ -262,7 +262,7 @@ protected function addModalToolbar() 'pencil-alt article-add' ); - $canCreate = $isNew && (count($user->getAuthorisedCategories('com_content', 'core.create')) > 0); + $canCreate = $isNew && (\count($user->getAuthorisedCategories('com_content', 'core.create')) > 0); $canEdit = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); // For new records, check the create permission. diff --git a/administrator/components/com_contenthistory/services/provider.php b/administrator/components/com_contenthistory/services/provider.php index 5bbd3da59e8d9..dbd7ec31b9ba8 100644 --- a/administrator/components/com_contenthistory/services/provider.php +++ b/administrator/components/com_contenthistory/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_contenthistory/src/Controller/HistoryController.php b/administrator/components/com_contenthistory/src/Controller/HistoryController.php index 8b924833a3839..317fc8e17849c 100644 --- a/administrator/components/com_contenthistory/src/Controller/HistoryController.php +++ b/administrator/components/com_contenthistory/src/Controller/HistoryController.php @@ -67,7 +67,7 @@ public function keep() // Toggle keep forever status of the selected items. if ($model->keep($cid)) { - $this->setMessage(Text::plural('COM_CONTENTHISTORY_N_ITEMS_KEEP_TOGGLE', count($cid))); + $this->setMessage(Text::plural('COM_CONTENTHISTORY_N_ITEMS_KEEP_TOGGLE', \count($cid))); } else { $this->setMessage($model->getError(), 'error'); } diff --git a/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php b/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php index 41db6b4b7e9af..58c27ca4a2947 100644 --- a/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php +++ b/administrator/components/com_contenthistory/src/Helper/ContenthistoryHelper.php @@ -51,7 +51,7 @@ public static function createObjectArray($object) foreach ($object as $name => $value) { $result[$name] = $value; - if (is_object($value)) { + if (\is_object($value)) { foreach ($value as $subName => $subValue) { $result[$subName] = $subValue; } @@ -74,9 +74,9 @@ public static function decodeFields($jsonString) { $object = json_decode($jsonString); - if (is_object($object)) { + if (\is_object($object)) { foreach ($object as $name => $value) { - if (!is_null($value) && $subObject = json_decode($value)) { + if (!\is_null($value) && $subObject = json_decode($value)) { $object->$name = $subObject; } } @@ -130,7 +130,7 @@ public static function getFormValues($object, ContentType $typesTable) $valueText = null; - if (is_array($optionFieldArray) && count($optionFieldArray)) { + if (\is_array($optionFieldArray) && \count($optionFieldArray)) { $valueText = trim((string) $optionFieldArray[0]); } @@ -161,7 +161,7 @@ public static function getFormFile(ContentType $typesTable) // First, see if we have a file name in the $typesTable $options = json_decode($typesTable->content_history_options); - if (is_object($options) && isset($options->formFile) && is_file(JPATH_ROOT . '/' . $options->formFile)) { + if (\is_object($options) && isset($options->formFile) && is_file(JPATH_ROOT . '/' . $options->formFile)) { $result = JPATH_ROOT . '/' . $options->formFile; } else { $aliasArray = explode('.', $typesTable->type_alias); @@ -223,7 +223,7 @@ public static function getLookupValue($lookup, $value) public static function hideFields($object, ContentType $typeTable) { if ($options = json_decode($typeTable->content_history_options)) { - if (isset($options->hideFields) && is_array($options->hideFields)) { + if (isset($options->hideFields) && \is_array($options->hideFields)) { foreach ($options->hideFields as $field) { unset($object->$field); } @@ -246,7 +246,7 @@ public static function loadLanguageFiles($typeAlias) { $aliasArray = explode('.', $typeAlias); - if (is_array($aliasArray) && count($aliasArray) == 2) { + if (\is_array($aliasArray) && \count($aliasArray) == 2) { $component = ($aliasArray[1] == 'category') ? 'com_categories' : $aliasArray[0]; $lang = Factory::getLanguage(); @@ -292,7 +292,7 @@ public static function mergeLabels($object, $formValues) $result->$name->value = $valuesArray[$name] ?? $value; $result->$name->label = $labelsArray[$name] ?? $name; - if (is_object($value)) { + if (\is_object($value)) { $subObject = new \stdClass(); foreach ($value as $subName => $subValue) { @@ -346,7 +346,7 @@ public static function prepareData(ContentHistory $table) public static function processLookupFields($object, ContentType $typesTable) { if ($options = json_decode($typesTable->content_history_options)) { - if (isset($options->displayLookup) && is_array($options->displayLookup)) { + if (isset($options->displayLookup) && \is_array($options->displayLookup)) { foreach ($options->displayLookup as $lookup) { $sourceColumn = $lookup->sourceColumn ?? false; $sourceValue = $object->$sourceColumn->value ?? false; diff --git a/administrator/components/com_contenthistory/src/Model/CompareModel.php b/administrator/components/com_contenthistory/src/Model/CompareModel.php index 1ca5b72bfa350..25b3268de970a 100644 --- a/administrator/components/com_contenthistory/src/Model/CompareModel.php +++ b/administrator/components/com_contenthistory/src/Model/CompareModel.php @@ -176,7 +176,7 @@ protected function canEdit($record) $typeAlias = implode('.', $typeAlias); $contentTypeTable->load(['type_alias' => $typeAlias]); $typeEditables = (array) Factory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); - $result = in_array((int) $id, $typeEditables); + $result = \in_array((int) $id, $typeEditables); } } diff --git a/administrator/components/com_contenthistory/src/Model/HistoryModel.php b/administrator/components/com_contenthistory/src/Model/HistoryModel.php index 7773bafc910f0..1dea5ec5159fa 100644 --- a/administrator/components/com_contenthistory/src/Model/HistoryModel.php +++ b/administrator/components/com_contenthistory/src/Model/HistoryModel.php @@ -95,7 +95,7 @@ protected function canEdit($record) $typeAlias = implode('.', $typeAlias); $contentTypeTable->load(['type_alias' => $typeAlias]); $typeEditables = (array) Factory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); - $result = in_array((int) $id, $typeEditables); + $result = \in_array((int) $id, $typeEditables); return $result; } @@ -198,7 +198,7 @@ public function getItems() } // This should be an array with at least one element - if (!is_array($items) || !isset($items[0])) { + if (!\is_array($items) || !isset($items[0])) { return $items; } diff --git a/administrator/components/com_contenthistory/src/Model/PreviewModel.php b/administrator/components/com_contenthistory/src/Model/PreviewModel.php index ef2b063dacb77..bc38514679991 100644 --- a/administrator/components/com_contenthistory/src/Model/PreviewModel.php +++ b/administrator/components/com_contenthistory/src/Model/PreviewModel.php @@ -141,7 +141,7 @@ protected function canEdit($record) $id = array_pop($typeAlias); $typeAlias = implode('.', $typeAlias); $typeEditables = (array) Factory::getApplication()->getUserState(str_replace('.', '.edit.', $contentTypeTable->type_alias) . '.id'); - $result = in_array((int) $id, $typeEditables); + $result = \in_array((int) $id, $typeEditables); } } diff --git a/administrator/components/com_contenthistory/src/View/Compare/HtmlView.php b/administrator/components/com_contenthistory/src/View/Compare/HtmlView.php index b137ee0568c92..6b3deae045637 100644 --- a/administrator/components/com_contenthistory/src/View/Compare/HtmlView.php +++ b/administrator/components/com_contenthistory/src/View/Compare/HtmlView.php @@ -53,7 +53,7 @@ public function display($tpl = null) $this->items = $this->get('Items'); // 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_contenthistory/src/View/History/HtmlView.php b/administrator/components/com_contenthistory/src/View/History/HtmlView.php index 8862f3ec84ec7..774ce3551c190 100644 --- a/administrator/components/com_contenthistory/src/View/History/HtmlView.php +++ b/administrator/components/com_contenthistory/src/View/History/HtmlView.php @@ -75,7 +75,7 @@ public function display($tpl = null) $this->pagination = $this->get('Pagination'); // 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_contenthistory/src/View/Preview/HtmlView.php b/administrator/components/com_contenthistory/src/View/Preview/HtmlView.php index d206aa4e7fc53..d5f7bebb14eb4 100644 --- a/administrator/components/com_contenthistory/src/View/Preview/HtmlView.php +++ b/administrator/components/com_contenthistory/src/View/Preview/HtmlView.php @@ -60,7 +60,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_cpanel/services/provider.php b/administrator/components/com_cpanel/services/provider.php index e4aa0afec8d58..73ae9996bfeab 100644 --- a/administrator/components/com_cpanel/services/provider.php +++ b/administrator/components/com_cpanel/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_fields/services/provider.php b/administrator/components/com_fields/services/provider.php index 10d4e444bac7f..e828ad7a822d9 100644 --- a/administrator/components/com_fields/services/provider.php +++ b/administrator/components/com_fields/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\Categories\CategoryFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_fields/src/Controller/FieldController.php b/administrator/components/com_fields/src/Controller/FieldController.php index 7e7e733a6b0c0..4c1950afac55e 100644 --- a/administrator/components/com_fields/src/Controller/FieldController.php +++ b/administrator/components/com_fields/src/Controller/FieldController.php @@ -187,7 +187,7 @@ protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { $item = $model->getItem(); - if (isset($item->params) && is_array($item->params)) { + if (isset($item->params) && \is_array($item->params)) { $registry = new Registry(); $registry->loadArray($item->params); $item->params = (string) $registry; diff --git a/administrator/components/com_fields/src/Controller/GroupController.php b/administrator/components/com_fields/src/Controller/GroupController.php index 7aba400b07271..2e4d6e23682a8 100644 --- a/administrator/components/com_fields/src/Controller/GroupController.php +++ b/administrator/components/com_fields/src/Controller/GroupController.php @@ -160,7 +160,7 @@ protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { $item = $model->getItem(); - if (isset($item->params) && is_array($item->params)) { + if (isset($item->params) && \is_array($item->params)) { $registry = new Registry(); $registry->loadArray($item->params); $item->params = (string) $registry; diff --git a/administrator/components/com_fields/src/Field/ComponentsFieldgroupField.php b/administrator/components/com_fields/src/Field/ComponentsFieldgroupField.php index 758ec61af2a4e..0a7f763baf9fc 100644 --- a/administrator/components/com_fields/src/Field/ComponentsFieldgroupField.php +++ b/administrator/components/com_fields/src/Field/ComponentsFieldgroupField.php @@ -58,7 +58,7 @@ protected function getOptions() $options = []; - if (count($items)) { + if (\count($items)) { $lang = Factory::getLanguage(); $components = []; diff --git a/administrator/components/com_fields/src/Field/ComponentsFieldsField.php b/administrator/components/com_fields/src/Field/ComponentsFieldsField.php index 6580adff51377..fecd3715fd762 100644 --- a/administrator/components/com_fields/src/Field/ComponentsFieldsField.php +++ b/administrator/components/com_fields/src/Field/ComponentsFieldsField.php @@ -58,7 +58,7 @@ protected function getOptions() $options = []; - if (count($items)) { + if (\count($items)) { $lang = Factory::getLanguage(); $components = []; diff --git a/administrator/components/com_fields/src/Field/FieldLayoutField.php b/administrator/components/com_fields/src/Field/FieldLayoutField.php index f8350f89cc9fd..4b97841a783b6 100644 --- a/administrator/components/com_fields/src/Field/FieldLayoutField.php +++ b/administrator/components/com_fields/src/Field/FieldLayoutField.php @@ -118,12 +118,12 @@ protected function getInput() $value = basename($file, '.php'); // Remove the default "render.php" or layout files that exist in the component folder - if ($value === 'render' || in_array($value, $component_layouts)) { + if ($value === 'render' || \in_array($value, $component_layouts)) { unset($files[$i]); } } - if (count($files)) { + if (\count($files)) { // Create the group for the template $groups[$template->name] = []; $groups[$template->name]['id'] = $this->id . '_' . $template->element; diff --git a/administrator/components/com_fields/src/Field/SubfieldsField.php b/administrator/components/com_fields/src/Field/SubfieldsField.php index 3919442032175..99a1f6aca4d2e 100644 --- a/administrator/components/com_fields/src/Field/SubfieldsField.php +++ b/administrator/components/com_fields/src/Field/SubfieldsField.php @@ -95,7 +95,7 @@ function ($a, $b) { } ); - if (count($options) == 0) { + if (\count($options) == 0) { Factory::getApplication()->enqueueMessage(Text::_('COM_FIELDS_NO_FIELDS_TO_CREATE_SUBFORM_FIELD_WARNING'), 'warning'); } diff --git a/administrator/components/com_fields/src/Helper/FieldsHelper.php b/administrator/components/com_fields/src/Helper/FieldsHelper.php index 283b9654136ec..2b64dc3cbd72e 100644 --- a/administrator/components/com_fields/src/Helper/FieldsHelper.php +++ b/administrator/components/com_fields/src/Helper/FieldsHelper.php @@ -68,7 +68,7 @@ public static function extract($contextString, $item = null) $parts = explode('.', $contextString, 2); - if (count($parts) < 2) { + if (\count($parts) < 2) { return null; } @@ -131,7 +131,7 @@ public static function getFields( self::$fieldsCache->setState('filter.only_use_in_subform', 0); } - if (is_array($item)) { + if (\is_array($item)) { $item = (object) $item; } @@ -149,7 +149,7 @@ public static function getFields( if ($item && (isset($item->catid) || isset($item->fieldscatid))) { $assignedCatIds = $item->catid ?? $item->fieldscatid; - if (!is_array($assignedCatIds)) { + if (!\is_array($assignedCatIds)) { $assignedCatIds = explode(',', $assignedCatIds); } @@ -193,11 +193,11 @@ function ($f) { */ $field = clone $original; - if ($valuesToOverride && array_key_exists($field->name, $valuesToOverride)) { + if ($valuesToOverride && \array_key_exists($field->name, $valuesToOverride)) { $field->value = $valuesToOverride[$field->name]; - } elseif ($valuesToOverride && array_key_exists($field->id, $valuesToOverride)) { + } elseif ($valuesToOverride && \array_key_exists($field->id, $valuesToOverride)) { $field->value = $valuesToOverride[$field->id]; - } elseif (array_key_exists($field->id, $fieldValues)) { + } elseif (\array_key_exists($field->id, $fieldValues)) { $field->value = $fieldValues[$field->id]; } @@ -208,7 +208,7 @@ function ($f) { $field->rawvalue = $field->value; // If boolean prepare, if int, it is the event type: 1 - After Title, 2 - Before Display Content, 3 - After Display Content, 0 - Do not prepare - if ($prepareValue && (is_bool($prepareValue) || $prepareValue === (int) $field->params->get('display', '2'))) { + if ($prepareValue && (\is_bool($prepareValue) || $prepareValue === (int) $field->params->get('display', '2'))) { /* * On before field prepare * Event allow plugins to modify the output of the field before it is prepared @@ -226,7 +226,7 @@ function ($f) { 'subject' => $field, ]))->getArgument('result', []); - if (is_array($value)) { + if (\is_array($value)) { $value = implode(' ', $value); } @@ -327,7 +327,7 @@ public static function prepareForm($context, Form $form, $data) $assignedCatids = $data->catid ?? $data->fieldscatid ?? $form->getValue('catid'); // Account for case that a submitted form has a multi-value category id field (e.g. a filtering form), just use the first category - $assignedCatids = is_array($assignedCatids) + $assignedCatids = \is_array($assignedCatids) ? (int) reset($assignedCatids) : (int) $assignedCatids; @@ -377,12 +377,12 @@ public static function prepareForm($context, Form $form, $data) $fieldsPerGroup = [0 => []]; foreach ($fields as $field) { - if (!array_key_exists($field->type, $fieldTypes)) { + if (!\array_key_exists($field->type, $fieldTypes)) { // Field type is not available continue; } - if (!array_key_exists($field->group_id, $fieldsPerGroup)) { + if (!\array_key_exists($field->group_id, $fieldsPerGroup)) { $fieldsPerGroup[$field->group_id] = []; } @@ -506,7 +506,7 @@ public static function prepareForm($context, Form $form, $data) continue; } - if (!is_array($value) && $value !== '') { + if (!\is_array($value) && $value !== '') { // Function getField doesn't cache the fields, so we try to do it only when necessary $formField = $form->getField($field->name, 'com_fields'); @@ -691,11 +691,11 @@ public static function getFieldTypes() foreach ($eventData as $fields) { foreach ($fields as $fieldDescription) { - if (!array_key_exists('path', $fieldDescription)) { + if (!\array_key_exists('path', $fieldDescription)) { $fieldDescription['path'] = null; } - if (!array_key_exists('rules', $fieldDescription)) { + if (!\array_key_exists('rules', $fieldDescription)) { $fieldDescription['rules'] = null; } diff --git a/administrator/components/com_fields/src/Model/FieldModel.php b/administrator/components/com_fields/src/Model/FieldModel.php index 194c1b1a224af..880c746a43382 100644 --- a/administrator/components/com_fields/src/Model/FieldModel.php +++ b/administrator/components/com_fields/src/Model/FieldModel.php @@ -118,7 +118,7 @@ public function save($data) if ( isset($data['params']['searchindex']) - && ((is_null($field) && $data['params']['searchindex'] > 0) + && ((\is_null($field) && $data['params']['searchindex'] > 0) || ($field->params['searchindex'] != $data['params']['searchindex']) || ($data['params']['searchindex'] > 0 && ($field->state != $data['state'] || $field->access != $data['access']))) ) { @@ -223,13 +223,13 @@ public function save($data) * when the options of a subfields field are getting changed. */ if ( - $field && in_array($field->type, ['list', 'checkboxes', 'radio'], true) + $field && \in_array($field->type, ['list', 'checkboxes', 'radio'], true) && isset($data['fieldparams']['options']) && isset($field->fieldparams['options']) ) { $oldParams = $this->getParams($field->fieldparams['options']); $newParams = $this->getParams($data['fieldparams']['options']); - if (is_object($oldParams) && is_object($newParams) && $oldParams != $newParams) { + if (\is_object($oldParams) && \is_object($newParams) && $oldParams != $newParams) { // Get new values. $names = array_column((array) $newParams, 'value'); @@ -275,7 +275,7 @@ private function checkDefaultValue($data) $types = FieldsHelper::getFieldTypes(); // Check if type exists - if (!array_key_exists($data['type'], $types)) { + if (!\array_key_exists($data['type'], $types)) { return true; } @@ -361,11 +361,11 @@ private function checkDefaultValue($data) */ private function getParams($params) { - if (is_string($params)) { + if (\is_string($params)) { $params = json_decode($params); } - if (is_array($params)) { + if (\is_array($params)) { $params = (object) $params; } @@ -611,7 +611,7 @@ public function setFieldValue($fieldId, $itemId, $value) $field = $this->getItem($fieldId); $params = $field->params; - if (is_array($params)) { + if (\is_array($params)) { $params = new Registry($params); } @@ -630,9 +630,9 @@ public function setFieldValue($fieldId, $itemId, $value) if ($oldValue === null) { // No records available, doing normal insert $needsInsert = true; - } elseif (count($value) == 1 && count((array) $oldValue) == 1) { + } elseif (\count($value) == 1 && \count((array) $oldValue) == 1) { // Only a single row value update can be done when not empty - $needsUpdate = is_array($value[0]) ? count($value[0]) : strlen($value[0]); + $needsUpdate = \is_array($value[0]) ? \count($value[0]) : \strlen($value[0]); $needsDelete = !$needsUpdate; } else { // Multiple values, we need to purge the data and do a new @@ -700,7 +700,7 @@ public function getFieldValue($fieldId, $itemId) { $values = $this->getFieldValues([$fieldId], $itemId); - if (array_key_exists($fieldId, $values)) { + if (\array_key_exists($fieldId, $values)) { return $values[$fieldId]; } @@ -727,7 +727,7 @@ public function getFieldValues(array $fieldIds, $itemId) $key = md5(serialize($fieldIds) . $itemId); // Fill the cache when it doesn't exist - if (!array_key_exists($key, $this->valueCache)) { + if (!\array_key_exists($key, $this->valueCache)) { // Create the query $db = $this->getDatabase(); $query = $db->getQuery(true); @@ -746,9 +746,9 @@ public function getFieldValues(array $fieldIds, $itemId) // Fill the data container from the database rows foreach ($rows as $row) { // If there are multiple values for a field, create an array - if (array_key_exists($row->field_id, $data)) { + if (\array_key_exists($row->field_id, $data)) { // Transform it to an array - if (!is_array($data[$row->field_id])) { + if (!\is_array($data[$row->field_id])) { $data[$row->field_id] = [$data[$row->field_id]]; } @@ -867,7 +867,7 @@ protected function populateState() $this->setState('field.component', $parts[0]); // Extract the optional section name - $this->setState('field.section', (count($parts) > 1) ? $parts[1] : null); + $this->setState('field.section', (\count($parts) > 1) ? $parts[1] : null); // Load the parameters. $params = ComponentHelper::getParams('com_fields'); @@ -1016,7 +1016,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content') $section = $this->state->get('field.section'); $dataObject = $data; - if (is_array($dataObject)) { + if (\is_array($dataObject)) { $dataObject = (object) $dataObject; } diff --git a/administrator/components/com_fields/src/Model/FieldsModel.php b/administrator/components/com_fields/src/Model/FieldsModel.php index 0d7fe853e97a9..9059b892bdf43 100644 --- a/administrator/components/com_fields/src/Model/FieldsModel.php +++ b/administrator/components/com_fields/src/Model/FieldsModel.php @@ -180,7 +180,7 @@ protected function getListQuery() // Filter by access level. if ($access = $this->getState('filter.access')) { - if (is_array($access)) { + if (\is_array($access)) { $access = ArrayHelper::toInteger($access); $query->whereIn($db->quoteName('a.access'), $access); } else { @@ -250,7 +250,7 @@ function () use ($parts) { // Join over the assigned categories $query->join('LEFT', $db->quoteName('#__fields_categories') . ' AS fc ON fc.field_id = a.id'); - if (in_array('0', $categories)) { + if (\in_array('0', $categories)) { $query->where( '(' . $db->quoteName('fc.category_id') . ' IS NULL OR ' . @@ -396,7 +396,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) { $result = parent::_getList($query, $limitstart, $limit); - if (is_array($result)) { + if (\is_array($result)) { foreach ($result as $field) { $field->fieldparams = new Registry($field->fieldparams); $field->params = new Registry($field->params); diff --git a/administrator/components/com_fields/src/Model/GroupsModel.php b/administrator/components/com_fields/src/Model/GroupsModel.php index 95a7cbb276738..725c0d2252456 100644 --- a/administrator/components/com_fields/src/Model/GroupsModel.php +++ b/administrator/components/com_fields/src/Model/GroupsModel.php @@ -155,7 +155,7 @@ protected function getListQuery() // Filter by access level. if ($access = $this->getState('filter.access')) { - if (is_array($access)) { + if (\is_array($access)) { $access = ArrayHelper::toInteger($access); $query->whereIn($db->quoteName('a.access'), $access); } else { @@ -229,7 +229,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) { $result = parent::_getList($query, $limitstart, $limit); - if (is_array($result)) { + if (\is_array($result)) { foreach ($result as $group) { $group->params = new Registry($group->params); } diff --git a/administrator/components/com_fields/src/Plugin/FieldsPlugin.php b/administrator/components/com_fields/src/Plugin/FieldsPlugin.php index 02fde8361dfb2..6d42cad44dfea 100644 --- a/administrator/components/com_fields/src/Plugin/FieldsPlugin.php +++ b/administrator/components/com_fields/src/Plugin/FieldsPlugin.php @@ -284,12 +284,12 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form // Set the specific field parameters foreach ($params->toArray() as $key => $param) { - if (is_array($param)) { + if (\is_array($param)) { // Multidimensional arrays (eg. list options) can't be transformed properly - $param = count($param) == count($param, COUNT_RECURSIVE) ? implode(',', $param) : ''; + $param = \count($param) == \count($param, COUNT_RECURSIVE) ? implode(',', $param) : ''; } - if ($param === '' || (!is_string($param) && !is_numeric($param))) { + if ($param === '' || (!\is_string($param) && !is_numeric($param))) { continue; } diff --git a/administrator/components/com_fields/src/Table/FieldTable.php b/administrator/components/com_fields/src/Table/FieldTable.php index 99a1705025453..b40fd9524c8cd 100644 --- a/administrator/components/com_fields/src/Table/FieldTable.php +++ b/administrator/components/com_fields/src/Table/FieldTable.php @@ -73,13 +73,13 @@ public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher */ public function bind($src, $ignore = '') { - if (isset($src['params']) && is_array($src['params'])) { + if (isset($src['params']) && \is_array($src['params'])) { $registry = new Registry(); $registry->loadArray($src['params']); $src['params'] = (string) $registry; } - if (isset($src['fieldparams']) && is_array($src['fieldparams'])) { + if (isset($src['fieldparams']) && \is_array($src['fieldparams'])) { // Make sure $registry->options contains no duplicates when the field type is subform if (isset($src['type']) && $src['type'] == 'subform' && isset($src['fieldparams']['options'])) { // Fast lookup map to check which custom field ids we have already seen @@ -111,7 +111,7 @@ public function bind($src, $ignore = '') } // Bind the rules. - if (isset($src['rules']) && is_array($src['rules'])) { + if (isset($src['rules']) && \is_array($src['rules'])) { $rules = new Rules($src['rules']); $this->setRules($rules); } diff --git a/administrator/components/com_fields/src/Table/GroupTable.php b/administrator/components/com_fields/src/Table/GroupTable.php index b2270bc09cb81..e153f289ed0c0 100644 --- a/administrator/components/com_fields/src/Table/GroupTable.php +++ b/administrator/components/com_fields/src/Table/GroupTable.php @@ -71,14 +71,14 @@ public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher */ public function bind($src, $ignore = '') { - if (isset($src['params']) && is_array($src['params'])) { + if (isset($src['params']) && \is_array($src['params'])) { $registry = new Registry(); $registry->loadArray($src['params']); $src['params'] = (string) $registry; } // Bind the rules. - if (isset($src['rules']) && is_array($src['rules'])) { + if (isset($src['rules']) && \is_array($src['rules'])) { $rules = new Rules($src['rules']); $this->setRules($rules); } diff --git a/administrator/components/com_fields/src/View/Field/HtmlView.php b/administrator/components/com_fields/src/View/Field/HtmlView.php index 755d50d6981c2..b623a952ac034 100644 --- a/administrator/components/com_fields/src/View/Field/HtmlView.php +++ b/administrator/components/com_fields/src/View/Field/HtmlView.php @@ -72,7 +72,7 @@ public function display($tpl = null) $this->canDo = ContentHelper::getActions($this->state->get('field.component'), 'field', $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); } @@ -99,7 +99,7 @@ protected function addToolbar() $toolbar = Toolbar::getInstance(); $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); // Avoid nonsense situation. if ($component == 'com_fields') { diff --git a/administrator/components/com_fields/src/View/Fields/HtmlView.php b/administrator/components/com_fields/src/View/Fields/HtmlView.php index c8327df983050..9e39fa46c0a8a 100644 --- a/administrator/components/com_fields/src/View/Fields/HtmlView.php +++ b/administrator/components/com_fields/src/View/Fields/HtmlView.php @@ -90,7 +90,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_fields/src/View/Group/HtmlView.php b/administrator/components/com_fields/src/View/Group/HtmlView.php index 82f4582e9ea8d..da9da713396b7 100644 --- a/administrator/components/com_fields/src/View/Group/HtmlView.php +++ b/administrator/components/com_fields/src/View/Group/HtmlView.php @@ -87,7 +87,7 @@ public function display($tpl = null) $this->canDo = ContentHelper::getActions($component, 'fieldgroup', $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); } @@ -119,7 +119,7 @@ protected function addToolbar() $canDo = $this->canDo; $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); // Avoid nonsense situation. if ($component == 'com_fields') { diff --git a/administrator/components/com_fields/src/View/Groups/HtmlView.php b/administrator/components/com_fields/src/View/Groups/HtmlView.php index 2ce7af2a04195..a445fac094129 100644 --- a/administrator/components/com_fields/src/View/Groups/HtmlView.php +++ b/administrator/components/com_fields/src/View/Groups/HtmlView.php @@ -90,7 +90,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_finder/helpers/indexer/adapter.php b/administrator/components/com_finder/helpers/indexer/adapter.php index d5126ff8f7930..0c4f653b6aae0 100644 --- a/administrator/components/com_finder/helpers/indexer/adapter.php +++ b/administrator/components/com_finder/helpers/indexer/adapter.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; /** * Finder Indexer Adapter class. diff --git a/administrator/components/com_finder/helpers/indexer/helper.php b/administrator/components/com_finder/helpers/indexer/helper.php index 2383df43fa1c4..155fb6e74b641 100644 --- a/administrator/components/com_finder/helpers/indexer/helper.php +++ b/administrator/components/com_finder/helpers/indexer/helper.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; /** * Finder Indexer Helper class. diff --git a/administrator/components/com_finder/helpers/indexer/parser.php b/administrator/components/com_finder/helpers/indexer/parser.php index a1b09ced91d08..79465a956d971 100644 --- a/administrator/components/com_finder/helpers/indexer/parser.php +++ b/administrator/components/com_finder/helpers/indexer/parser.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; /** * Finder Indexer Parser class. diff --git a/administrator/components/com_finder/helpers/indexer/query.php b/administrator/components/com_finder/helpers/indexer/query.php index 50afde7fab1f9..a1bec5b312162 100644 --- a/administrator/components/com_finder/helpers/indexer/query.php +++ b/administrator/components/com_finder/helpers/indexer/query.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; /** * Finder Indexer Query class. diff --git a/administrator/components/com_finder/helpers/indexer/result.php b/administrator/components/com_finder/helpers/indexer/result.php index 9dc7dc0fc655a..70c3ded2ab226 100644 --- a/administrator/components/com_finder/helpers/indexer/result.php +++ b/administrator/components/com_finder/helpers/indexer/result.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; /** * Finder Indexer Result class. diff --git a/administrator/components/com_finder/helpers/indexer/taxonomy.php b/administrator/components/com_finder/helpers/indexer/taxonomy.php index d32813ee55837..e539e7f7d4391 100644 --- a/administrator/components/com_finder/helpers/indexer/taxonomy.php +++ b/administrator/components/com_finder/helpers/indexer/taxonomy.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; /** * Finder Indexer Taxonomy class. diff --git a/administrator/components/com_finder/helpers/indexer/token.php b/administrator/components/com_finder/helpers/indexer/token.php index 78ff43c121867..1d24a63a58562 100644 --- a/administrator/components/com_finder/helpers/indexer/token.php +++ b/administrator/components/com_finder/helpers/indexer/token.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; /** * Finder Indexer Token class. diff --git a/administrator/components/com_finder/services/provider.php b/administrator/components/com_finder/services/provider.php index 2e7cdbc027c31..09cfdb45f137c 100644 --- a/administrator/components/com_finder/services/provider.php +++ b/administrator/components/com_finder/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_finder/src/Controller/FilterController.php b/administrator/components/com_finder/src/Controller/FilterController.php index b8eb4ff522888..ae468bc21a5e0 100644 --- a/administrator/components/com_finder/src/Controller/FilterController.php +++ b/administrator/components/com_finder/src/Controller/FilterController.php @@ -118,7 +118,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 { diff --git a/administrator/components/com_finder/src/Indexer/Adapter.php b/administrator/components/com_finder/src/Indexer/Adapter.php index 16a2099f253c3..c04fcb3a77614 100644 --- a/administrator/components/com_finder/src/Indexer/Adapter.php +++ b/administrator/components/com_finder/src/Indexer/Adapter.php @@ -256,7 +256,7 @@ public function onBuildIndex() $items = $this->getItems($offset, $limit); // Iterate through the items and index them. - for ($i = 0, $n = count($items); $i < $n; $i++) { + for ($i = 0, $n = \count($items); $i < $n; $i++) { // Index the item. $this->index($items[$i]); @@ -302,7 +302,7 @@ public function onFinderGarbageCollection() $this->indexer->remove($item); } - return count($items); + return \count($items); } /** diff --git a/administrator/components/com_finder/src/Indexer/DebugAdapter.php b/administrator/components/com_finder/src/Indexer/DebugAdapter.php index 31a4164e197e5..bbd58a082d789 100644 --- a/administrator/components/com_finder/src/Indexer/DebugAdapter.php +++ b/administrator/components/com_finder/src/Indexer/DebugAdapter.php @@ -254,7 +254,7 @@ public function onBuildIndex() $items = $this->getItems($offset, $limit); // Iterate through the items and index them. - for ($i = 0, $n = count($items); $i < $n; $i++) { + for ($i = 0, $n = \count($items); $i < $n; $i++) { // Index the item. $this->index($items[$i]); @@ -300,7 +300,7 @@ public function onFinderGarbageCollection() $this->indexer->remove($item); } - return count($items); + return \count($items); } /** diff --git a/administrator/components/com_finder/src/Indexer/Helper.php b/administrator/components/com_finder/src/Indexer/Helper.php index 0c965a675a287..ab625c476bd8e 100644 --- a/administrator/components/com_finder/src/Indexer/Helper.php +++ b/administrator/components/com_finder/src/Indexer/Helper.php @@ -75,7 +75,7 @@ public static function tokenize($input, $lang, $phrase = false) $tuplecount = $params->get('tuplecount', 1); } - if (is_null($multilingual)) { + if (\is_null($multilingual)) { $multilingual = Multilanguage::isEnabled(); $config = ComponentHelper::getParams('com_finder'); @@ -119,12 +119,12 @@ public static function tokenize($input, $lang, $phrase = false) * tokenize the individual terms and we do not create the two and three * term combinations. The phrase must contain more than one word! */ - if ($phrase === true && count($terms) > 1) { + if ($phrase === true && \count($terms) > 1) { // Create tokens from the phrase. $tokens[] = new Token($terms, $language->language, $language->spacer); } else { // Create tokens from the terms. - for ($i = 0, $n = count($terms); $i < $n; $i++) { + for ($i = 0, $n = \count($terms); $i < $n; $i++) { if (isset($cache[$lang][$terms[$i]])) { $tokens[] = $cache[$lang][$terms[$i]]; } else { @@ -136,7 +136,7 @@ public static function tokenize($input, $lang, $phrase = false) // Create multi-word phrase tokens from the individual words. if ($tuplecount > 1) { - for ($i = 0, $n = count($tokens); $i < $n; $i++) { + for ($i = 0, $n = \count($tokens); $i < $n; $i++) { $temp = [$tokens[$i]->term]; // Create tokens for 2 to $tuplecount length phrases @@ -162,7 +162,7 @@ public static function tokenize($input, $lang, $phrase = false) } // Prevent the cache to fill up the memory - while (count($cache[$lang]) > 1024) { + while (\count($cache[$lang]) > 1024) { /** * We want to cache the most common words/tokens. At the same time * we don't want to cache too much. The most common words will also @@ -190,7 +190,7 @@ public static function stem($token, $lang) static $multilingual; static $defaultStemmer; - if (is_null($multilingual)) { + if (\is_null($multilingual)) { $multilingual = Multilanguage::isEnabled(); $config = ComponentHelper::getParams('com_finder'); @@ -272,7 +272,7 @@ public static function isCommon($token, $lang) { static $data = [], $default, $multilingual; - if (is_null($multilingual)) { + if (\is_null($multilingual)) { $multilingual = Multilanguage::isEnabled(); $config = ComponentHelper::getParams('com_finder'); @@ -295,7 +295,7 @@ public static function isCommon($token, $lang) } // Check if the token is in the common array. - return in_array($token, $data[$lang], true); + return \in_array($token, $data[$lang], true); } /** @@ -358,7 +358,7 @@ public static function getPrimaryLanguage($lang) // Only parse the identifier if necessary. if (!isset($data[$lang])) { - if (is_callable(['Locale', 'getPrimaryLanguage'])) { + if (\is_callable(['Locale', 'getPrimaryLanguage'])) { // Get the language key using the Locale package. $data[$lang] = \Locale::getPrimaryLanguage($lang); } else { diff --git a/administrator/components/com_finder/src/Indexer/Indexer.php b/administrator/components/com_finder/src/Indexer/Indexer.php index 98c46ba586fd2..22ba7c85a8e63 100644 --- a/administrator/components/com_finder/src/Indexer/Indexer.php +++ b/administrator/components/com_finder/src/Indexer/Indexer.php @@ -400,7 +400,7 @@ public function index($item, $format = 'html') } // Tokenize the property. - if (is_array($item->$property)) { + if (\is_array($item->$property)) { // Tokenize an array of content and add it to the database. foreach ($item->$property as $ip) { /* @@ -823,7 +823,7 @@ protected function tokenizeToDb($input, $context, $lang, $format, $count = 0) } // If the input is a resource, batch the process out. - if (is_resource($input)) { + if (\is_resource($input)) { // Batch the process out to avoid memory limits. while (!feof($input)) { // Read into the buffer. @@ -886,7 +886,7 @@ private function tokenizeToDbShort($input, $context, $lang, $format, $count) { static $filterCommon, $filterNumeric; - if (is_null($filterCommon)) { + if (\is_null($filterCommon)) { $params = ComponentHelper::getParams('com_finder'); $filterCommon = $params->get('filter_commonwords', false); $filterNumeric = $params->get('filter_numerics', false); @@ -903,7 +903,7 @@ private function tokenizeToDbShort($input, $context, $lang, $format, $count) // Tokenize the input. $tokens = Helper::tokenize($input, $lang); - if (count($tokens) == 0) { + if (\count($tokens) == 0) { return $count; } diff --git a/administrator/components/com_finder/src/Indexer/Language.php b/administrator/components/com_finder/src/Indexer/Language.php index 17006ddde16d4..805ad349a2ece 100644 --- a/administrator/components/com_finder/src/Indexer/Language.php +++ b/administrator/components/com_finder/src/Indexer/Language.php @@ -76,7 +76,7 @@ public function __construct($locale = null) try { foreach (StemmerFactory::LANGS as $classname => $isoCodes) { - if (in_array($this->language, $isoCodes)) { + if (\in_array($this->language, $isoCodes)) { $this->stemmer = StemmerFactory::create($this->language); break; } diff --git a/administrator/components/com_finder/src/Indexer/Language/El.php b/administrator/components/com_finder/src/Indexer/Language/El.php index a84280e0eb81d..a99a38178993c 100644 --- a/administrator/components/com_finder/src/Indexer/Language/El.php +++ b/administrator/components/com_finder/src/Indexer/Language/El.php @@ -392,7 +392,7 @@ public function stem($token) if (preg_match($re, $token, $match)) { $stem = $match[1]; $suffix = $match[2]; - $token = $stem . (array_key_exists($suffix, $step1list) ? $step1list[$suffix] : ''); + $token = $stem . (\array_key_exists($suffix, $step1list) ? $step1list[$suffix] : ''); $test1 = false; } @@ -814,7 +814,7 @@ protected function toUpperCase($token, &$wCase) for ($i = 0; $i < mb_strlen($token); $i++) { $char = mb_substr($token, $i, 1); - $isLower = array_key_exists($char, $caseConvert); + $isLower = \array_key_exists($char, $caseConvert); if (!$isLower) { $newToken .= $char; @@ -827,15 +827,15 @@ protected function toUpperCase($token, &$wCase) $wCase[$i] = 1; - if (in_array($char, ['ά', 'έ', 'ή', 'ί', 'ό', 'ύ', 'ώ', 'ς'])) { + if (\in_array($char, ['ά', 'έ', 'ή', 'ί', 'ό', 'ύ', 'ώ', 'ς'])) { $wCase[$i] = 2; } - if (in_array($char, ['ϊ', 'ϋ'])) { + if (\in_array($char, ['ϊ', 'ϋ'])) { $wCase[$i] = 3; } - if (in_array($char, ['ΐ', 'ΰ'])) { + if (\in_array($char, ['ΐ', 'ΰ'])) { $wCase[$i] = 4; } } diff --git a/administrator/components/com_finder/src/Indexer/Parser.php b/administrator/components/com_finder/src/Indexer/Parser.php index 8293129a44fec..4c94e0982d62b 100644 --- a/administrator/components/com_finder/src/Indexer/Parser.php +++ b/administrator/components/com_finder/src/Indexer/Parser.php @@ -80,13 +80,13 @@ public static function getInstance($format) public function parse($input) { // If the input is less than 2KB we can parse it in one go. - if (strlen($input) <= 2048) { + if (\strlen($input) <= 2048) { return $this->process($input); } // Input is longer than 2Kb so parse it in chunks of 2Kb or less. $start = 0; - $end = strlen($input); + $end = \strlen($input); $chunk = 2048; $return = null; diff --git a/administrator/components/com_finder/src/Indexer/Parser/Html.php b/administrator/components/com_finder/src/Indexer/Parser/Html.php index 8534cf00b827a..888990b11bfca 100644 --- a/administrator/components/com_finder/src/Indexer/Parser/Html.php +++ b/administrator/components/com_finder/src/Indexer/Parser/Html.php @@ -117,8 +117,8 @@ private function removeBlocks($input, $startTag, $endTag) { $return = ''; $offset = 0; - $startTagLength = strlen($startTag); - $endTagLength = strlen($endTag); + $startTagLength = \strlen($startTag); + $endTagLength = \strlen($endTag); // Find the first start tag. $start = stripos($input, $startTag); diff --git a/administrator/components/com_finder/src/Indexer/Query.php b/administrator/components/com_finder/src/Indexer/Query.php index 005cb33785f1f..0c3de718e1cd5 100644 --- a/administrator/components/com_finder/src/Indexer/Query.php +++ b/administrator/components/com_finder/src/Indexer/Query.php @@ -274,7 +274,7 @@ public function __construct($options, DatabaseInterface $db = null) // Get the number of matching terms. foreach ($this->included as $token) { - $this->terms += count($token->matches); + $this->terms += \count($token->matches); } // Remove the temporary date storage. @@ -325,7 +325,7 @@ public function toUri($base = '') if ((bool) $this->filters) { foreach ($this->filters as $nodes) { foreach ($nodes as $node) { - if (!in_array($node, $t)) { + if (!\in_array($node, $t)) { continue; } @@ -391,7 +391,7 @@ public function getExcludedTermIds() $results = []; // Iterate through the excluded tokens and compile the matching terms. - for ($i = 0, $c = count($this->excluded); $i < $c; $i++) { + for ($i = 0, $c = \count($this->excluded); $i < $c; $i++) { foreach ($this->excluded[$i]->matches as $match) { $results = array_merge($results, $match); } @@ -415,7 +415,7 @@ public function getIncludedTermIds() $results = []; // Iterate through the included tokens and compile the matching terms. - for ($i = 0, $c = count($this->included); $i < $c; $i++) { + for ($i = 0, $c = \count($this->included); $i < $c; $i++) { // Check if we have any terms. if (empty($this->included[$i]->matches)) { continue; @@ -425,7 +425,7 @@ public function getIncludedTermIds() $term = $this->included[$i]->term; // Prepare the container for the term if necessary. - if (!array_key_exists($term, $results)) { + if (!\array_key_exists($term, $results)) { $results[$term] = []; } @@ -456,14 +456,14 @@ public function getRequiredTermIds() $results = []; // Iterate through the included tokens and compile the matching terms. - for ($i = 0, $c = count($this->included); $i < $c; $i++) { + for ($i = 0, $c = \count($this->included); $i < $c; $i++) { // Check if the token is required. if ($this->included[$i]->required) { // Get the term. $term = $this->included[$i]->term; // Prepare the container for the term if necessary. - if (!array_key_exists($term, $results)) { + if (!\array_key_exists($term, $results)) { $results[$term] = []; } @@ -536,7 +536,7 @@ protected function processStaticTaxonomy($filterId) $filters = ArrayHelper::toInteger($filters); // Remove any values of zero. - if (in_array(0, $filters, true) !== false) { + if (\in_array(0, $filters, true) !== false) { unset($filters[array_search(0, $filters, true)]); } @@ -596,7 +596,7 @@ protected function processDynamicTaxonomy($filters) $filters = ArrayHelper::toInteger($filters); // Remove any values of zero. - if (in_array(0, $filters, true) !== false) { + if (\in_array(0, $filters, true) !== false) { unset($filters[array_search(0, $filters, true)]); } @@ -642,7 +642,7 @@ protected function processDynamicTaxonomy($filters) */ foreach ($results as $result) { // Check if the branch has been cleared. - if (!in_array($result->branch, $cleared, true)) { + if (!\in_array($result->branch, $cleared, true)) { // Clear the branch. $this->filters[$result->branch] = []; @@ -696,7 +696,7 @@ protected function processDates($date1, $date2, $when1, $when2) if ($date->toUnix() !== null) { // Set the date filter. $this->date1 = $date->toSql(); - $this->when1 = in_array($when1, $whens, true) ? $when1 : 'before'; + $this->when1 = \in_array($when1, $whens, true) ? $when1 : 'before'; } // The value of 'today' is a special case that we need to handle. @@ -711,7 +711,7 @@ protected function processDates($date1, $date2, $when1, $when2) if ($date->toUnix() !== null) { // Set the date filter. $this->date2 = $date->toSql(); - $this->when2 = in_array($when2, $whens, true) ? $when2 : 'before'; + $this->when2 = \in_array($when2, $whens, true) ? $when2 : 'before'; } return true; @@ -815,7 +815,7 @@ protected function processString($input, $lang, $mode) if ($date->toUnix() !== null) { // Set the date filter. $this->date1 = $date->toSql(); - $this->when1 = in_array($modifier, $whens, true) ? $modifier : 'before'; + $this->when1 = \in_array($modifier, $whens, true) ? $modifier : 'before'; } break; @@ -828,7 +828,7 @@ protected function processString($input, $lang, $mode) // Check if the node id was found. if ($return) { // Check if the branch has been cleared. - if (!in_array($modifier, $cleared, true)) { + if (!\in_array($modifier, $cleared, true)) { // Clear the branch. $this->filters[$modifier] = []; @@ -886,12 +886,12 @@ protected function processString($input, $lang, $mode) $tuplecount = $params->get('tuplecount', 1); // Check if the phrase is longer than our $tuplecount. - if (count($parts) > $tuplecount && $tuplecount > 1) { - $chunk = array_slice($parts, 0, $tuplecount); - $parts = array_slice($parts, $tuplecount); + if (\count($parts) > $tuplecount && $tuplecount > 1) { + $chunk = \array_slice($parts, 0, $tuplecount); + $parts = \array_slice($parts, $tuplecount); // If the chunk is not empty, add it as a phrase. - if (count($chunk)) { + if (\count($chunk)) { $phrases[] = implode(' ', $chunk); $terms[] = implode(' ', $chunk); } @@ -904,12 +904,12 @@ protected function processString($input, $lang, $mode) * found for the complete phrase and not just portions * of it. */ - for ($i = 0, $c = count($parts); $i < $c; $i++) { + for ($i = 0, $c = \count($parts); $i < $c; $i++) { array_shift($chunk); $chunk[] = array_shift($parts); // If the chunk is not empty, add it as a phrase. - if (count($chunk)) { + if (\count($chunk)) { $phrases[] = implode(' ', $chunk); $terms[] = implode(' ', $chunk); } @@ -946,9 +946,9 @@ protected function processString($input, $lang, $mode) * done based on boolean search operators. Terms that are before an * and/or/not modifier have to be handled in relation to their operator. */ - for ($i = 0, $c = count($terms); $i < $c; $i++) { + for ($i = 0, $c = \count($terms); $i < $c; $i++) { // Check if the term is followed by an operator that we understand. - if (isset($terms[$i + 1]) && in_array($terms[$i + 1], $operators, true)) { + if (isset($terms[$i + 1]) && \in_array($terms[$i + 1], $operators, true)) { // Get the operator mode. $op = array_search($terms[$i + 1], $operators, true); @@ -1144,11 +1144,11 @@ protected function processString($input, $lang, $mode) * phrases as autonomous units and do not break them down into two and * three word combinations. */ - for ($i = 0, $c = count($phrases); $i < $c; $i++) { + for ($i = 0, $c = \count($phrases); $i < $c; $i++) { // Tokenize the phrase. $token = Helper::tokenize($phrases[$i], $lang, true); - if (!count($token)) { + if (!\count($token)) { continue; } @@ -1187,7 +1187,7 @@ protected function processString($input, $lang, $mode) $tokens = Helper::tokenize($terms, $lang, false); // Make sure we are working with an array. - $tokens = is_array($tokens) ? $tokens : [$tokens]; + $tokens = \is_array($tokens) ? $tokens : [$tokens]; // Get the token data and required state for all the tokens. foreach ($tokens as $token) { @@ -1281,7 +1281,7 @@ protected function getTokenData($token) // Check the matching terms. if ((bool) $matches) { // Add the matches to the token. - for ($i = 0, $c = count($matches); $i < $c; $i++) { + for ($i = 0, $c = \count($matches); $i < $c; $i++) { if (!isset($token->matches[$matches[$i]->term])) { $token->matches[$matches[$i]->term] = []; } diff --git a/administrator/components/com_finder/src/Indexer/Result.php b/administrator/components/com_finder/src/Indexer/Result.php index 6cc6470804a74..a9964b8849f95 100644 --- a/administrator/components/com_finder/src/Indexer/Result.php +++ b/administrator/components/com_finder/src/Indexer/Result.php @@ -270,7 +270,7 @@ public function __unset($name) public function getElement($name) { // Get the element value if set. - if (array_key_exists($name, $this->elements)) { + if (\array_key_exists($name, $this->elements)) { return $this->elements[$name]; } @@ -330,7 +330,7 @@ public function addInstruction($group, $property) { // Check if the group exists. We can't add instructions for unknown groups. // Check if the property exists in the group. - if (array_key_exists($group, $this->instructions) && !in_array($property, $this->instructions[$group], true)) { + if (\array_key_exists($group, $this->instructions) && !\in_array($property, $this->instructions[$group], true)) { // Add the property to the group. $this->instructions[$group][] = $property; } @@ -349,7 +349,7 @@ public function addInstruction($group, $property) public function removeInstruction($group, $property) { // Check if the group exists. We can't remove instructions for unknown groups. - if (array_key_exists($group, $this->instructions)) { + if (\array_key_exists($group, $this->instructions)) { // Search for the property in the group. $key = array_search($property, $this->instructions[$group]); diff --git a/administrator/components/com_finder/src/Indexer/Taxonomy.php b/administrator/components/com_finder/src/Indexer/Taxonomy.php index 695913fde2fa0..4b673a8ab8e79 100644 --- a/administrator/components/com_finder/src/Indexer/Taxonomy.php +++ b/administrator/components/com_finder/src/Indexer/Taxonomy.php @@ -457,7 +457,7 @@ public static function removeOrphanNodes() */ public static function getTaxonomy($id = 0) { - if (!count(self::$taxonomies)) { + if (!\count(self::$taxonomies)) { $db = Factory::getDbo(); $query = $db->getQuery(true); @@ -491,7 +491,7 @@ public static function getTaxonomy($id = 0) */ public static function getBranch($title = '') { - if (!count(self::$branches)) { + if (!\count(self::$branches)) { $taxonomies = self::getTaxonomy(); foreach ($taxonomies as $t) { diff --git a/administrator/components/com_finder/src/Indexer/Token.php b/administrator/components/com_finder/src/Indexer/Token.php index 39e5d0ee83aae..30458a006f274 100644 --- a/administrator/components/com_finder/src/Indexer/Token.php +++ b/administrator/components/com_finder/src/Indexer/Token.php @@ -142,7 +142,7 @@ public function __construct($term, $lang, $spacer = ' ') } // Tokens can be a single word or an array of words representing a phrase. - if (is_array($term)) { + if (\is_array($term)) { // Populate the token instance. $this->term = implode($spacer, $term); $this->stem = implode($spacer, array_map([Helper::class, 'stem'], $term, [$lang])); diff --git a/administrator/components/com_finder/src/Model/IndexModel.php b/administrator/components/com_finder/src/Model/IndexModel.php index 1bd47888c8279..75ea94cbcffa7 100644 --- a/administrator/components/com_finder/src/Model/IndexModel.php +++ b/administrator/components/com_finder/src/Model/IndexModel.php @@ -133,7 +133,7 @@ public function delete(&$pks) // Trigger the onContentBeforeDelete event. $result = Factory::getApplication()->triggerEvent($this->event_before_delete, [$context, $table]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { $this->setError($table->getError()); return false; @@ -452,7 +452,7 @@ public function publish(&$pks, $value = 1) // Trigger the onContentChangeState event. $result = Factory::getApplication()->triggerEvent('onContentChangeState', [$context, $pks, $value]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { $this->setError($table->getError()); return false; diff --git a/administrator/components/com_finder/src/Model/MapsModel.php b/administrator/components/com_finder/src/Model/MapsModel.php index 04a4843f8c7cf..b256927f00087 100644 --- a/administrator/components/com_finder/src/Model/MapsModel.php +++ b/administrator/components/com_finder/src/Model/MapsModel.php @@ -118,7 +118,7 @@ public function delete(&$pks) // Trigger the onContentBeforeDelete event. $result = Factory::getApplication()->triggerEvent('onContentBeforeDelete', [$context, $table]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { $this->setError($table->getError()); return false; @@ -346,7 +346,7 @@ public function publish(&$pks, $value = 1) // Trigger the onContentChangeState event. $result = Factory::getApplication()->triggerEvent('onContentChangeState', [$context, $pks, $value]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { $this->setError($table->getError()); return false; diff --git a/administrator/components/com_finder/src/Model/SearchesModel.php b/administrator/components/com_finder/src/Model/SearchesModel.php index 10dd1b9a9d9c8..69399be23d460 100644 --- a/administrator/components/com_finder/src/Model/SearchesModel.php +++ b/administrator/components/com_finder/src/Model/SearchesModel.php @@ -139,7 +139,7 @@ public function getItems() $items = parent::getItems(); foreach ($items as $item) { - if (is_resource($item->query)) { + if (\is_resource($item->query)) { $item->query = unserialize(stream_get_contents($item->query)); } else { $item->query = unserialize($item->query); diff --git a/administrator/components/com_finder/src/Service/HTML/Filter.php b/administrator/components/com_finder/src/Service/HTML/Filter.php index 02fc952242cd0..e67b942310cd9 100644 --- a/administrator/components/com_finder/src/Service/HTML/Filter.php +++ b/administrator/components/com_finder/src/Service/HTML/Filter.php @@ -55,8 +55,8 @@ public function slider($options = []) // Get the configuration options. $filterId = $options['filter_id'] ?? null; - $activeNodes = array_key_exists('selected_nodes', $options) ? $options['selected_nodes'] : []; - $classSuffix = array_key_exists('class_suffix', $options) ? $options['class_suffix'] : ''; + $activeNodes = \array_key_exists('selected_nodes', $options) ? $options['selected_nodes'] : []; + $classSuffix = \array_key_exists('class_suffix', $options) ? $options['class_suffix'] : ''; // Load the predefined filter if specified. if (!empty($filterId)) { @@ -105,7 +105,7 @@ public function slider($options = []) } // Check that we have at least one branch. - if (count($branches) === 0) { + if (\count($branches) === 0) { return null; } @@ -165,7 +165,7 @@ public function slider($options = []) 'accordion', Text::sprintf( 'COM_FINDER_FILTER_BRANCH_LABEL', - Text::_(LanguageHelper::branchSingular($bv->title)) . ' - ' . count($nodes) + Text::_(LanguageHelper::branchSingular($bv->title)) . ' - ' . \count($nodes) ), 'accordion-' . $bk ); @@ -177,7 +177,7 @@ public function slider($options = []) // Populate the group with nodes. foreach ($nodes as $nk => $nv) { // Determine if the node should be checked. - $checked = in_array($nk, $activeNodes) ? ' checked="checked"' : ''; + $checked = \in_array($nk, $activeNodes) ? ' checked="checked"' : ''; // Build a node. $html .= '
'; @@ -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 .= 'getSupportTemplate(); $title = ''; - if (in_array($typeName, $this->itemTypes)) { + if (\in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'newsfeed': $fields['title'] = 'a.name'; diff --git a/administrator/components/com_newsfeeds/src/Helper/NewsfeedsHelper.php b/administrator/components/com_newsfeeds/src/Helper/NewsfeedsHelper.php index 554c34262e7a2..d2733fe1ddc32 100644 --- a/administrator/components/com_newsfeeds/src/Helper/NewsfeedsHelper.php +++ b/administrator/components/com_newsfeeds/src/Helper/NewsfeedsHelper.php @@ -105,7 +105,7 @@ public static function countTagItems(&$items, $extension) $parts = explode('.', $extension); $section = null; - if (count($parts) > 1) { + if (\count($parts) > 1) { $section = $parts[1]; } diff --git a/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php b/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php index e7dadb39613c6..5fccfccf5154c 100644 --- a/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php +++ b/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php @@ -387,7 +387,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content') if (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'); diff --git a/administrator/components/com_newsfeeds/src/Service/HTML/AdministratorService.php b/administrator/components/com_newsfeeds/src/Service/HTML/AdministratorService.php index cc03cdf7c1b19..1de326795b4f3 100644 --- a/administrator/components/com_newsfeeds/src/Service/HTML/AdministratorService.php +++ b/administrator/components/com_newsfeeds/src/Service/HTML/AdministratorService.php @@ -87,7 +87,7 @@ public function association($newsfeedid) $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_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id); $tooltip = '' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '
' diff --git a/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php b/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php index 1cac38c86eae6..4c614f042c7c4 100644 --- a/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php +++ b/administrator/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php @@ -74,7 +74,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); } @@ -108,7 +108,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')); $toolbar = Toolbar::getInstance(); // Since we don't track these assets at the item level, use the category id. @@ -118,7 +118,7 @@ protected function addToolbar() ToolbarHelper::title($title, 'rss newsfeeds'); // If not checked out, can save the item. - if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) { + if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) { $toolbar->apply('newsfeed.apply'); } @@ -127,11 +127,11 @@ protected function addToolbar() $saveGroup->configure( function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) { // If not checked out, can save the item. - if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) { + if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) { $childBar->save('newsfeed.save'); } - if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) { + if (!$checkedOut && \count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) { $childBar->save2new('newsfeed.save2new'); } diff --git a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php index e7d4815ef145d..b8fdb8c116321 100644 --- a/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php +++ b/administrator/components/com_newsfeeds/src/View/Newsfeeds/HtmlView.php @@ -152,7 +152,7 @@ protected function addToolbar() ToolbarHelper::title(Text::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'rss newsfeeds'); - if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) { + if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) { $toolbar->addNew('newsfeed.add'); } diff --git a/administrator/components/com_plugins/services/provider.php b/administrator/components/com_plugins/services/provider.php index 0ce7b1517c90a..0498923af22c6 100644 --- a/administrator/components/com_plugins/services/provider.php +++ b/administrator/components/com_plugins/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_plugins/src/Model/PluginsModel.php b/administrator/components/com_plugins/src/Model/PluginsModel.php index 037a0e05e6e14..6631da01185c4 100644 --- a/administrator/components/com_plugins/src/Model/PluginsModel.php +++ b/administrator/components/com_plugins/src/Model/PluginsModel.php @@ -145,7 +145,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $direction = ($orderingDirection == 'desc') ? -1 : 1; $result = ArrayHelper::sortObjects($result, $ordering, $direction, true, true); - $total = count($result); + $total = \count($result); $this->cache[$this->getStoreId('getTotal')] = $total; if ($total < $limitstart) { @@ -154,7 +154,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $this->cache[$this->getStoreId('getStart')] = $limitstart; - return array_slice($result, $limitstart, $limit ?: null); + return \array_slice($result, $limitstart, $limit ?: null); } if ($ordering === 'ordering') { diff --git a/administrator/components/com_plugins/src/View/Plugin/HtmlView.php b/administrator/components/com_plugins/src/View/Plugin/HtmlView.php index 893a7a64c01f0..ece0f2be4bd81 100644 --- a/administrator/components/com_plugins/src/View/Plugin/HtmlView.php +++ b/administrator/components/com_plugins/src/View/Plugin/HtmlView.php @@ -65,7 +65,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); } diff --git a/administrator/components/com_plugins/src/View/Plugins/HtmlView.php b/administrator/components/com_plugins/src/View/Plugins/HtmlView.php index c47fa676236e8..642766df5a395 100644 --- a/administrator/components/com_plugins/src/View/Plugins/HtmlView.php +++ b/administrator/components/com_plugins/src/View/Plugins/HtmlView.php @@ -81,7 +81,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_postinstall/services/provider.php b/administrator/components/com_postinstall/services/provider.php index 251858b00f109..d84dce82e5704 100644 --- a/administrator/components/com_postinstall/services/provider.php +++ b/administrator/components/com_postinstall/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_postinstall/src/Controller/MessageController.php b/administrator/components/com_postinstall/src/Controller/MessageController.php index 18867a4cbe42a..eea4f229c6573 100644 --- a/administrator/components/com_postinstall/src/Controller/MessageController.php +++ b/administrator/components/com_postinstall/src/Controller/MessageController.php @@ -160,7 +160,7 @@ public function action() if (is_file($file)) { require_once $file; - call_user_func($item->action); + \call_user_func($item->action); } break; } diff --git a/administrator/components/com_postinstall/src/Model/MessagesModel.php b/administrator/components/com_postinstall/src/Model/MessagesModel.php index 5881040c45cdd..c1b61bdc62b7b 100644 --- a/administrator/components/com_postinstall/src/Model/MessagesModel.php +++ b/administrator/components/com_postinstall/src/Model/MessagesModel.php @@ -313,7 +313,7 @@ public function getExtensionName($eid) $extension = $db->loadObject(); - if (!is_object($extension)) { + if (!\is_object($extension)) { return ''; } @@ -416,7 +416,7 @@ protected function onProcessList(&$resultArray) if (is_file($file)) { require_once $file; - $result = call_user_func($item->condition_method); + $result = \call_user_func($item->condition_method); if ($result === false) { $unset_keys[] = $key; @@ -428,7 +428,7 @@ protected function onProcessList(&$resultArray) if (!empty($item->language_extension)) { $hash = $item->language_client_id . '-' . $item->language_extension; - if (!in_array($hash, $language_extensions)) { + if (!\in_array($hash, $language_extensions)) { $language_extensions[] = $hash; Factory::getApplication()->getLanguage()->load($item->language_extension, $item->language_client_id == 0 ? JPATH_SITE : JPATH_ADMINISTRATOR); } @@ -543,7 +543,7 @@ public function getComponentOptions() public function addPostInstallationMessage(array $options) { // Make sure there are options set - if (!is_array($options)) { + if (!\is_array($options)) { throw new \Exception('Post-installation message definitions must be of type array', 500); } @@ -593,7 +593,7 @@ public function addPostInstallationMessage(array $options) } // Make sure there's a valid type - if (!in_array($options['type'], ['message', 'link', 'action'])) { + if (!\in_array($options['type'], ['message', 'link', 'action'])) { throw new \Exception('Post-installation message definitions need to declare a type of message, link or action', 500); } diff --git a/administrator/components/com_privacy/services/provider.php b/administrator/components/com_privacy/services/provider.php index d812c3f9ec90f..b368a88ba5ce3 100644 --- a/administrator/components/com_privacy/services/provider.php +++ b/administrator/components/com_privacy/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_privacy/src/Controller/ConsentsController.php b/administrator/components/com_privacy/src/Controller/ConsentsController.php index 66ac0dc50d54a..2987fa43ce9c3 100644 --- a/administrator/components/com_privacy/src/Controller/ConsentsController.php +++ b/administrator/components/com_privacy/src/Controller/ConsentsController.php @@ -53,7 +53,7 @@ public function invalidate() if (!$model->invalidate($ids)) { $this->setMessage($model->getError()); } else { - $this->setMessage(Text::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', count($ids))); + $this->setMessage(Text::plural('COM_PRIVACY_N_CONSENTS_INVALIDATED', \count($ids))); } } diff --git a/administrator/components/com_privacy/src/Controller/RequestController.php b/administrator/components/com_privacy/src/Controller/RequestController.php index f203f7f7d5000..d13d0dead3c2d 100644 --- a/administrator/components/com_privacy/src/Controller/RequestController.php +++ b/administrator/components/com_privacy/src/Controller/RequestController.php @@ -125,7 +125,7 @@ public function complete($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); } @@ -164,7 +164,7 @@ public function emailexport() // 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); } @@ -282,7 +282,7 @@ public function invalidate($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); } @@ -330,7 +330,7 @@ public function remove() // 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); } @@ -391,7 +391,7 @@ private function canTransition($item, $newStatus) case '1': // A confirmed item can be marked completed or invalid - return in_array($newStatus, ['-1', '2'], true); + return \in_array($newStatus, ['-1', '2'], true); // An item which is already in an invalid or complete state cannot transition, likewise if we don't know the state don't change anything case '-1': diff --git a/administrator/components/com_privacy/src/Plugin/PrivacyPlugin.php b/administrator/components/com_privacy/src/Plugin/PrivacyPlugin.php index e107b58cab640..1317ef650b634 100644 --- a/administrator/components/com_privacy/src/Plugin/PrivacyPlugin.php +++ b/administrator/components/com_privacy/src/Plugin/PrivacyPlugin.php @@ -83,11 +83,11 @@ protected function createItemFromArray(array $data, $itemId = null) $item->id = $itemId; foreach ($data as $key => $value) { - if (is_object($value)) { + if (\is_object($value)) { $value = (array) $value; } - if (is_array($value)) { + if (\is_array($value)) { $value = print_r($value, true); } @@ -133,7 +133,7 @@ protected function createItemForTable($table) */ protected function createCustomFieldsDomain($context, $items = []) { - if (!is_array($items)) { + if (!\is_array($items)) { $items = [$items]; } @@ -152,7 +152,7 @@ protected function createCustomFieldsDomain($context, $items = []) $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $item); foreach ($fields as $field) { - $fieldValue = is_array($field->value) ? implode(', ', $field->value) : $field->value; + $fieldValue = \is_array($field->value) ? implode(', ', $field->value) : $field->value; $data = [ $type . '_id' => $item->id, diff --git a/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php b/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php index d2c226809ba90..243791056cadb 100644 --- a/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php +++ b/administrator/components/com_privacy/src/View/Capabilities/HtmlView.php @@ -61,7 +61,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_privacy/src/View/Consents/HtmlView.php b/administrator/components/com_privacy/src/View/Consents/HtmlView.php index 102360210ec02..1ea0bd5a071b4 100644 --- a/administrator/components/com_privacy/src/View/Consents/HtmlView.php +++ b/administrator/components/com_privacy/src/View/Consents/HtmlView.php @@ -101,12 +101,12 @@ public function display($tpl = null) $this->filterForm = $model->getFilterForm(); $this->activeFilters = $model->getActiveFilters(); - 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_privacy/src/View/Export/XmlView.php b/administrator/components/com_privacy/src/View/Export/XmlView.php index 0e3d595303b11..f00ba8f4bfb16 100644 --- a/administrator/components/com_privacy/src/View/Export/XmlView.php +++ b/administrator/components/com_privacy/src/View/Export/XmlView.php @@ -46,7 +46,7 @@ public function display($tpl = null) $exportData = $model->collectDataForExportRequest(); // 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_privacy/src/View/Request/HtmlView.php b/administrator/components/com_privacy/src/View/Request/HtmlView.php index 9046c197bdf7e..c42e2dc7061d8 100644 --- a/administrator/components/com_privacy/src/View/Request/HtmlView.php +++ b/administrator/components/com_privacy/src/View/Request/HtmlView.php @@ -102,7 +102,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_privacy/src/View/Requests/HtmlView.php b/administrator/components/com_privacy/src/View/Requests/HtmlView.php index a7190b189183a..5d7fbd06dcd6f 100644 --- a/administrator/components/com_privacy/src/View/Requests/HtmlView.php +++ b/administrator/components/com_privacy/src/View/Requests/HtmlView.php @@ -113,12 +113,12 @@ public function display($tpl = null) $this->urgentRequestAge = (int) ComponentHelper::getParams('com_privacy')->get('notify', 14); $this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1); - if (!count($this->items) && $this->get('IsEmptyState')) { + if (!\count($this->items) && $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_redirect/services/provider.php b/administrator/components/com_redirect/services/provider.php index e6783939a320a..32533b87b2753 100644 --- a/administrator/components/com_redirect/services/provider.php +++ b/administrator/components/com_redirect/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_redirect/src/Controller/LinksController.php b/administrator/components/com_redirect/src/Controller/LinksController.php index d223aa0cafa61..f85488d427ba2 100644 --- a/administrator/components/com_redirect/src/Controller/LinksController.php +++ b/administrator/components/com_redirect/src/Controller/LinksController.php @@ -55,7 +55,7 @@ public function activate() if (!$model->activate($ids, $newUrl, $comment)) { $this->app->enqueueMessage($model->getError(), 'warning'); } else { - $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_UPDATED', count($ids))); + $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_UPDATED', \count($ids))); } } @@ -92,7 +92,7 @@ public function duplicateUrls() if (!$model->duplicateUrls($ids, $newUrl, $comment)) { $this->app->enqueueMessage($model->getError(), 'warning'); } else { - $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_UPDATED', count($ids))); + $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_UPDATED', \count($ids))); } } @@ -155,7 +155,7 @@ public function batch() // Execute the batch process if ($model->batchProcess($batch_urls)) { - $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_ADDED', count($batch_urls))); + $this->setMessage(Text::plural('COM_REDIRECT_N_LINKS_ADDED', \count($batch_urls))); } } diff --git a/administrator/components/com_redirect/src/View/Link/HtmlView.php b/administrator/components/com_redirect/src/View/Link/HtmlView.php index f9574242e365f..5542c8b6ab35a 100644 --- a/administrator/components/com_redirect/src/View/Link/HtmlView.php +++ b/administrator/components/com_redirect/src/View/Link/HtmlView.php @@ -66,7 +66,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_scheduler/services/provider.php b/administrator/components/com_scheduler/services/provider.php index f950d9fe074e8..984f6527696a0 100644 --- a/administrator/components/com_scheduler/services/provider.php +++ b/administrator/components/com_scheduler/services/provider.php @@ -9,7 +9,7 @@ */ // Restrict direct access -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; diff --git a/administrator/components/com_scheduler/src/Model/TaskModel.php b/administrator/components/com_scheduler/src/Model/TaskModel.php index 68d768dffbb5f..5d89544d83c95 100644 --- a/administrator/components/com_scheduler/src/Model/TaskModel.php +++ b/administrator/components/com_scheduler/src/Model/TaskModel.php @@ -444,7 +444,7 @@ static function (TaskOption $taskOption): string { return null; } - if (count($ids) === 0) { + if (\count($ids) === 0) { $db->unlockTables(); return null; diff --git a/administrator/components/com_scheduler/src/Scheduler/Scheduler.php b/administrator/components/com_scheduler/src/Scheduler/Scheduler.php index 71175fbb67823..600d25b2da308 100644 --- a/administrator/components/com_scheduler/src/Scheduler/Scheduler.php +++ b/administrator/components/com_scheduler/src/Scheduler/Scheduler.php @@ -148,7 +148,7 @@ public function runTask(array $options): ?Task $duration = $executionSnapshot['duration'] ?? 0; if (\array_key_exists($exitCode, self::LOG_TEXT)) { - $level = in_array($exitCode, [Status::OK, Status::WILL_RESUME]) ? 'info' : 'warning'; + $level = \in_array($exitCode, [Status::OK, Status::WILL_RESUME]) ? 'info' : 'warning'; $task->log(Text::sprintf(self::LOG_TEXT[$exitCode], $taskId, $duration, $netDuration), $level); return $task; diff --git a/administrator/components/com_scheduler/src/Task/Task.php b/administrator/components/com_scheduler/src/Task/Task.php index ff6fece62aa92..931033aea1e11 100644 --- a/administrator/components/com_scheduler/src/Task/Task.php +++ b/administrator/components/com_scheduler/src/Task/Task.php @@ -261,7 +261,7 @@ public function run(): bool } // The only acceptable "successful" statuses are either clean exit or resuming execution. - if (!in_array($this->snapshot['status'], [Status::WILL_RESUME, Status::OK])) { + if (!\in_array($this->snapshot['status'], [Status::WILL_RESUME, Status::OK])) { $this->set('times_failed', $this->get('times_failed') + 1); } @@ -484,7 +484,7 @@ protected function dispatchExitEvent(): void */ public function isSuccess(): bool { - return in_array(($this->snapshot['status'] ?? null), [Status::OK, Status::WILL_RESUME]); + return \in_array(($this->snapshot['status'] ?? null), [Status::OK, Status::WILL_RESUME]); } /** diff --git a/administrator/components/com_tags/services/provider.php b/administrator/components/com_tags/services/provider.php index 2fbd2beb04244..144612aa3a1a6 100644 --- a/administrator/components/com_tags/services/provider.php +++ b/administrator/components/com_tags/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_tags/src/Model/TagModel.php b/administrator/components/com_tags/src/Model/TagModel.php index e95a59075544d..1006bee448dc5 100644 --- a/administrator/components/com_tags/src/Model/TagModel.php +++ b/administrator/components/com_tags/src/Model/TagModel.php @@ -269,7 +269,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_tags/src/Model/TagsModel.php b/administrator/components/com_tags/src/Model/TagsModel.php index eb7c5b289bf9c..409308621cf9e 100644 --- a/administrator/components/com_tags/src/Model/TagsModel.php +++ b/administrator/components/com_tags/src/Model/TagsModel.php @@ -101,7 +101,7 @@ protected function populateState($ordering = 'a.lft', $direction = 'asc') $this->setState('filter.component', $parts[0]); // Extract the optional section name - $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + $this->setState('filter.section', (\count($parts) > 1) ? $parts[1] : null); // Load the parameters. $params = ComponentHelper::getParams('com_tags'); @@ -299,7 +299,7 @@ public function countItems(&$items, $extension) { $parts = explode('.', $extension); - if (count($parts) < 2) { + if (\count($parts) < 2) { return; } diff --git a/administrator/components/com_tags/src/View/Tag/HtmlView.php b/administrator/components/com_tags/src/View/Tag/HtmlView.php index cf632f32bfe42..0db1c2d0ed746 100644 --- a/administrator/components/com_tags/src/View/Tag/HtmlView.php +++ b/administrator/components/com_tags/src/View/Tag/HtmlView.php @@ -81,7 +81,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); } @@ -104,7 +104,7 @@ protected function addToolbar() $user = $this->getCurrentUser(); $userId = $user->get('id'); $isNew = ($this->item->id == 0); - $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); + $checkedOut = !(\is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = Toolbar::getInstance(); $canDo = ContentHelper::getActions('com_tags'); diff --git a/administrator/components/com_templates/services/provider.php b/administrator/components/com_templates/services/provider.php index 91ebdcc4ebdd5..43a4b2a3e2b75 100644 --- a/administrator/components/com_templates/services/provider.php +++ b/administrator/components/com_templates/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_templates/src/Controller/StyleController.php b/administrator/components/com_templates/src/Controller/StyleController.php index dbc90f34cd369..d4f423833a6d1 100644 --- a/administrator/components/com_templates/src/Controller/StyleController.php +++ b/administrator/components/com_templates/src/Controller/StyleController.php @@ -91,7 +91,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 { diff --git a/administrator/components/com_templates/src/Controller/TemplateController.php b/administrator/components/com_templates/src/Controller/TemplateController.php index d50dad8d96c5f..b5ff48124062b 100644 --- a/administrator/components/com_templates/src/Controller/TemplateController.php +++ b/administrator/components/com_templates/src/Controller/TemplateController.php @@ -120,7 +120,7 @@ public function publish() $ntext = 'COM_TEMPLATES_N_OVERRIDE_DELETED'; } - $this->setMessage(Text::plural($ntext, count($ids))); + $this->setMessage(Text::plural($ntext, \count($ids))); } } @@ -165,7 +165,7 @@ public function copy() $model->setState('to_path', $app->get('tmp_path') . '/' . $model->getState('tmp_prefix')); // Process only if we have a new name entered - if (strlen($newName) > 0) { + if (\strlen($newName) > 0) { if (!$this->app->getIdentity()->authorise('core.create', 'com_templates')) { // User is not authorised to delete $this->setMessage(Text::_('COM_TEMPLATES_ERROR_CREATE_NOT_PERMITTED'), 'error'); @@ -317,7 +317,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 { @@ -929,7 +929,7 @@ public function child() $model->setState('to_path', $this->app->get('tmp_path') . '/' . $model->getState('tmp_prefix')); // Process only if we have a new name entered - if (!strlen($newName)) { + if (!\strlen($newName)) { $this->setMessage(Text::sprintf('COM_TEMPLATES_ERROR_INVALID_TEMPLATE_NAME'), 'error'); return false; diff --git a/administrator/components/com_templates/src/Helper/TemplateHelper.php b/administrator/components/com_templates/src/Helper/TemplateHelper.php index e62967e4da56a..4a6c2db7b8f01 100644 --- a/administrator/components/com_templates/src/Helper/TemplateHelper.php +++ b/administrator/components/com_templates/src/Helper/TemplateHelper.php @@ -71,9 +71,9 @@ public static function canUpload($file, $err = '') ]; $explodedFileName = explode('.', $file['name']); - if (count($explodedFileName) > 2) { + if (\count($explodedFileName) > 2) { foreach ($executable as $extensionName) { - if (in_array($extensionName, $explodedFileName)) { + if (\in_array($extensionName, $explodedFileName)) { $app = Factory::getApplication(); $app->enqueueMessage(Text::_('COM_TEMPLATES_ERROR_EXECUTABLE'), 'error'); @@ -98,14 +98,14 @@ public static function canUpload($file, $err = '') $allowable = array_merge($imageTypes, $sourceTypes, $fontTypes, $archiveTypes); - if ($format == '' || $format == false || (!in_array($format, $allowable))) { + if ($format == '' || $format == false || (!\in_array($format, $allowable))) { $app = Factory::getApplication(); $app->enqueueMessage(Text::_('COM_TEMPLATES_ERROR_WARNFILETYPE'), 'error'); return false; } - if (in_array($format, $archiveTypes)) { + if (\in_array($format, $archiveTypes)) { $zip = new \ZipArchive(); if ($zip->open($file['tmp_name']) === true) { @@ -117,7 +117,7 @@ public static function canUpload($file, $err = '') $explodeArray = explode('.', $entry); $ext = end($explodeArray); - if (!in_array($ext, $allowable)) { + if (!\in_array($ext, $allowable)) { $app = Factory::getApplication(); $app->enqueueMessage(Text::_('COM_TEMPLATES_FILE_UNSUPPORTED_ARCHIVE'), 'error'); diff --git a/administrator/components/com_templates/src/Model/StyleModel.php b/administrator/components/com_templates/src/Model/StyleModel.php index 6c7738c482db9..0d8984b4b262e 100644 --- a/administrator/components/com_templates/src/Model/StyleModel.php +++ b/administrator/components/com_templates/src/Model/StyleModel.php @@ -146,7 +146,7 @@ public function delete(&$pks) // Trigger the before delete event. $result = Factory::getApplication()->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)) { $this->setError($table->getError()); return false; @@ -211,7 +211,7 @@ public function duplicate(&$pks) // Trigger the before save event. $result = Factory::getApplication()->triggerEvent($this->event_before_save, [$context, &$table, true]); - if (in_array(false, $result, true) || !$table->store()) { + if (\in_array(false, $result, true) || !$table->store()) { throw new \Exception($table->getError()); } @@ -413,8 +413,8 @@ protected function preprocessForm(Form $form, $data, $group = 'content') // Disable home field if it is default style if ( - (is_array($data) && array_key_exists('home', $data) && $data['home'] == '1') - || (is_object($data) && isset($data->home) && $data->home == '1') + (\is_array($data) && \array_key_exists('home', $data) && $data['home'] == '1') + || (\is_object($data) && isset($data->home) && $data->home == '1') ) { $form->setFieldAttribute('home', 'readonly', 'true'); } @@ -503,7 +503,7 @@ public function save($data) $result = Factory::getApplication()->triggerEvent($this->event_before_save, ['com_templates.style', &$table, $isNew]); // 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; @@ -518,7 +518,7 @@ public function save($data) $tableId = (int) $table->id; $userId = (int) $user->id; - if (!empty($data['assigned']) && is_array($data['assigned'])) { + if (!empty($data['assigned']) && \is_array($data['assigned'])) { $data['assigned'] = ArrayHelper::toInteger($data['assigned']); // Update the mapping for menu items that this style IS assigned to. diff --git a/administrator/components/com_templates/src/Model/StylesModel.php b/administrator/components/com_templates/src/Model/StylesModel.php index 00bbef2cdea3c..69308e029924a 100644 --- a/administrator/components/com_templates/src/Model/StylesModel.php +++ b/administrator/components/com_templates/src/Model/StylesModel.php @@ -76,7 +76,7 @@ protected function populateState($ordering = 'a.template', $direction = 'asc') // Special case for the 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); } diff --git a/administrator/components/com_templates/src/Model/TemplateModel.php b/administrator/components/com_templates/src/Model/TemplateModel.php index bd47a9427db2a..688c515e0dff6 100644 --- a/administrator/components/com_templates/src/Model/TemplateModel.php +++ b/administrator/components/com_templates/src/Model/TemplateModel.php @@ -276,7 +276,7 @@ public function prepareCoreFiles($dir, $element, $template) $dirFiles = scandir($dir); foreach ($dirFiles as $key => $value) { - if (in_array($value, ['.', '..', 'node_modules'])) { + if (\in_array($value, ['.', '..', 'node_modules'])) { continue; } @@ -412,7 +412,7 @@ public function getDirectoryTree($dir) $dirFiles = scandir($dir); foreach ($dirFiles as $key => $value) { - if (!in_array($value, ['.', '..', 'node_modules'])) { + if (!\in_array($value, ['.', '..', 'node_modules'])) { if (is_dir($dir . $value)) { $relativePath = str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . ($this->template->client_id === 0 ? 'site' : 'administrator') . DIRECTORY_SEPARATOR . $this->template->element, '', $dir . $value); $relativePath = str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR . ($this->template->client_id === 0 ? '' : 'administrator' . DIRECTORY_SEPARATOR) . 'templates' . DIRECTORY_SEPARATOR . $this->template->element, '', $relativePath); @@ -494,7 +494,7 @@ public function getCoreFile($file, $client_id) if (stristr($subtype, 'com_')) { $folder = $explodeArray['3']; - $subFolder = array_slice($explodeArray, 4, -1); + $subFolder = \array_slice($explodeArray, 4, -1); $subFolder = implode(DIRECTORY_SEPARATOR, $subFolder); $htmlPath = Path::clean($componentPath . $folder . '/layouts/' . $subFolder); $fileName = $this->getSafeName($fileName); @@ -502,7 +502,7 @@ public function getCoreFile($file, $client_id) return $coreFile; } elseif (stristr($subtype, 'joomla') || stristr($subtype, 'libraries') || stristr($subtype, 'plugins')) { - $subFolder = array_slice($explodeArray, 3, -1); + $subFolder = \array_slice($explodeArray, 3, -1); $subFolder = implode(DIRECTORY_SEPARATOR, $subFolder); $htmlPath = Path::clean($layoutPath . $subFolder); $fileName = $this->getSafeName($fileName); @@ -532,11 +532,11 @@ private function getSafeName($name) // Remove ( Date ) from file $explodeArray = explode('-', $name); - $size = count($explodeArray); + $size = \count($explodeArray); $date = $explodeArray[$size - 2] . '-' . str_replace('.' . $extension, '', $explodeArray[$size - 1]); if ($this->validateDate($date)) { - $nameWithoutExtension = implode('-', array_slice($explodeArray, 0, -2)); + $nameWithoutExtension = implode('-', \array_slice($explodeArray, 0, -2)); // Filtered name $name = $nameWithoutExtension . '.' . $extension; @@ -778,7 +778,7 @@ protected function fixTemplateName() foreach ($files as $file) { $newFile = '/' . str_replace($oldName, $newName, basename($file)); - $result = File::move($file, dirname($file) . $newFile) && $result; + $result = File::move($file, \dirname($file) . $newFile) && $result; } // Edit XML file @@ -1119,7 +1119,7 @@ public function createOverride($override) if (stristr($name, 'mod_') != false) { $htmlPath = Path::clean($client->path . '/templates/' . $template->element . '/html/' . $name); } elseif (stristr($override, 'com_') != false) { - $size = count($explodeArray); + $size = \count($explodeArray); $url = Path::clean($explodeArray[$size - 3] . '/' . $explodeArray[$size - 1]); @@ -1129,11 +1129,11 @@ public function createOverride($override) $htmlPath = Path::clean($client->path . '/templates/' . $template->element . '/html/' . $url); } } elseif (stripos($override, Path::clean(JPATH_ROOT . '/plugins/')) === 0) { - $size = count($explodeArray); + $size = \count($explodeArray); $layoutPath = Path::clean('plg_' . $explodeArray[$size - 2] . '_' . $explodeArray[$size - 1]); $htmlPath = Path::clean($client->path . '/templates/' . $template->element . '/html/' . $layoutPath); } else { - $layoutPath = implode('/', array_slice($explodeArray, -2)); + $layoutPath = implode('/', \array_slice($explodeArray, -2)); $htmlPath = Path::clean($client->path . '/templates/' . $template->element . '/html/layouts/' . $layoutPath); } @@ -1779,7 +1779,7 @@ protected function checkFormat($ext) $this->allowedFormats = array_map('strtolower', $this->allowedFormats); } - return in_array(strtolower($ext), $this->allowedFormats); + return \in_array(strtolower($ext), $this->allowedFormats); } /** diff --git a/administrator/components/com_templates/src/Model/TemplatesModel.php b/administrator/components/com_templates/src/Model/TemplatesModel.php index 86e157ecdb32d..f801a9a9d4a5b 100644 --- a/administrator/components/com_templates/src/Model/TemplatesModel.php +++ b/administrator/components/com_templates/src/Model/TemplatesModel.php @@ -106,7 +106,7 @@ public function updated($exid) $db->setQuery($query); // Load the results as a list of stdClass objects. - $num = count($db->loadObjectList()); + $num = \count($db->loadObjectList()); if ($num > 0) { return $num; @@ -210,7 +210,7 @@ protected function populateState($ordering = 'a.element', $direction = 'asc') // Special case for the 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. diff --git a/administrator/components/com_templates/src/Service/HTML/Templates.php b/administrator/components/com_templates/src/Service/HTML/Templates.php index 9a876001aeebe..a72d198689565 100644 --- a/administrator/components/com_templates/src/Service/HTML/Templates.php +++ b/administrator/components/com_templates/src/Service/HTML/Templates.php @@ -42,7 +42,7 @@ class Templates */ public function thumb($template, $clientId = 0) { - if (is_string($template)) { + if (\is_string($template)) { return HTMLHelper::_('image', 'template_thumbnail.png', Text::_('COM_TEMPLATES_PREVIEW'), [], true, -1); } @@ -100,7 +100,7 @@ public function thumb($template, $clientId = 0) */ public function thumbModal($template, $clientId = 0) { - if (is_string($template)) { + if (\is_string($template)) { return HTMLHelper::_('image', 'template_thumbnail.png', Text::_('COM_TEMPLATES_PREVIEW'), [], true, -1); } diff --git a/administrator/components/com_templates/src/Table/StyleTable.php b/administrator/components/com_templates/src/Table/StyleTable.php index 78ee4222a7a8a..1a8c4f4c34294 100644 --- a/administrator/components/com_templates/src/Table/StyleTable.php +++ b/administrator/components/com_templates/src/Table/StyleTable.php @@ -53,7 +53,7 @@ public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher */ public function bind($array, $ignore = '') { - if (isset($array['params']) && is_array($array['params'])) { + if (isset($array['params']) && \is_array($array['params'])) { $registry = new Registry($array['params']); $array['params'] = (string) $registry; } @@ -133,9 +133,9 @@ public function store($updateNulls = false) public function delete($pk = null) { $k = $this->_tbl_key; - $pk = is_null($pk) ? $this->$k : $pk; + $pk = \is_null($pk) ? $this->$k : $pk; - if (!is_null($pk)) { + if (!\is_null($pk)) { $clientId = (int) $this->client_id; $query = $this->_db->getQuery(true) ->select($this->_db->quoteName('id')) @@ -147,7 +147,7 @@ public function delete($pk = null) $this->_db->setQuery($query); $results = $this->_db->loadColumn(); - if (count($results) == 1 && $results[0] == $pk) { + if (\count($results) == 1 && $results[0] == $pk) { $this->setError(Text::_('COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE')); return false; diff --git a/administrator/components/com_templates/src/View/Style/HtmlView.php b/administrator/components/com_templates/src/View/Style/HtmlView.php index 7b74f922cc452..2d6eb638a1eaa 100644 --- a/administrator/components/com_templates/src/View/Style/HtmlView.php +++ b/administrator/components/com_templates/src/View/Style/HtmlView.php @@ -77,7 +77,7 @@ public function display($tpl = null) $this->canDo = ContentHelper::getActions('com_templates'); // 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_templates/src/View/Styles/HtmlView.php b/administrator/components/com_templates/src/View/Styles/HtmlView.php index aa79c47ec67d6..f0fef55480b9f 100644 --- a/administrator/components/com_templates/src/View/Styles/HtmlView.php +++ b/administrator/components/com_templates/src/View/Styles/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); } diff --git a/administrator/components/com_templates/src/View/Template/HtmlView.php b/administrator/components/com_templates/src/View/Template/HtmlView.php index aa597e271366c..67d9a83f0fd84 100644 --- a/administrator/components/com_templates/src/View/Template/HtmlView.php +++ b/administrator/components/com_templates/src/View/Template/HtmlView.php @@ -179,12 +179,12 @@ public function display($tpl = null) $fontTypes = explode(',', $params->get('font_formats', 'woff,woff2,ttf,otf')); $archiveTypes = explode(',', $params->get('compressed_formats', 'zip')); - if (in_array($ext, $sourceTypes)) { + if (\in_array($ext, $sourceTypes)) { $this->form = $this->get('Form'); $this->form->setFieldAttribute('source', 'syntax', $ext); $this->source = $this->get('Source'); $this->type = 'file'; - } elseif (in_array($ext, $imageTypes)) { + } elseif (\in_array($ext, $imageTypes)) { try { $this->image = $this->get('Image'); $this->type = 'image'; @@ -192,10 +192,10 @@ public function display($tpl = null) $app->enqueueMessage(Text::_('COM_TEMPLATES_GD_EXTENSION_NOT_AVAILABLE')); $this->type = 'home'; } - } elseif (in_array($ext, $fontTypes)) { + } elseif (\in_array($ext, $fontTypes)) { $this->font = $this->get('Font'); $this->type = 'font'; - } elseif (in_array($ext, $archiveTypes)) { + } elseif (\in_array($ext, $archiveTypes)) { $this->archive = $this->get('Archive'); $this->type = 'archive'; } else { @@ -206,7 +206,7 @@ public function display($tpl = null) $this->id = $this->state->get('extension.id'); // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { $app->enqueueMessage(implode("\n", $errors)); return false; @@ -296,7 +296,7 @@ protected function addToolbar() } } - if (count($this->updatedList) !== 0 && $this->pluginState && $this->type === 'home') { + if (\count($this->updatedList) !== 0 && $this->pluginState && $this->type === 'home') { /** @var DropdownButton $dropdown */ $dropdown = $toolbar->dropdownButton('override-group', 'COM_TEMPLATES_BUTTON_CHECK') ->toggleSplit(false) diff --git a/administrator/components/com_templates/src/View/Templates/HtmlView.php b/administrator/components/com_templates/src/View/Templates/HtmlView.php index dc0b679ef28b2..4eb2cbb2b6404 100644 --- a/administrator/components/com_templates/src/View/Templates/HtmlView.php +++ b/administrator/components/com_templates/src/View/Templates/HtmlView.php @@ -116,7 +116,7 @@ public function display($tpl = null) $this->pluginState = PluginHelper::isEnabled('installer', 'override'); // 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_users/postinstall/multifactorauth.php b/administrator/components/com_users/postinstall/multifactorauth.php index 03cb1a1ce5d2d..d1ca2b0f46c21 100644 --- a/administrator/components/com_users/postinstall/multifactorauth.php +++ b/administrator/components/com_users/postinstall/multifactorauth.php @@ -27,7 +27,7 @@ */ function com_users_postinstall_mfa_condition(): bool { - return count(PluginHelper::getPlugin('multifactorauth')) < 1; + return \count(PluginHelper::getPlugin('multifactorauth')) < 1; } /** diff --git a/administrator/components/com_users/services/provider.php b/administrator/components/com_users/services/provider.php index 37cc5c11017d2..323ebfdee141d 100644 --- a/administrator/components/com_users/services/provider.php +++ b/administrator/components/com_users/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/components/com_users/src/Controller/CaptiveController.php b/administrator/components/com_users/src/Controller/CaptiveController.php index 1870c27cded38..392cfb730e3d4 100644 --- a/administrator/components/com_users/src/Controller/CaptiveController.php +++ b/administrator/components/com_users/src/Controller/CaptiveController.php @@ -199,7 +199,7 @@ public function validate($cachable = false, $urlparameters = []) $isValidCode = array_reduce( $results, function (bool $carry, $result) { - return $carry || boolval($result); + return $carry || \boolval($result); }, false ); diff --git a/administrator/components/com_users/src/Controller/DisplayController.php b/administrator/components/com_users/src/Controller/DisplayController.php index ceafea352939a..864e6d23a483a 100644 --- a/administrator/components/com_users/src/Controller/DisplayController.php +++ b/administrator/components/com_users/src/Controller/DisplayController.php @@ -128,7 +128,7 @@ public function display($cachable = false, $urlparams = []) return false; } - if (in_array($view, ['captive', 'callback', 'methods', 'method'])) { + if (\in_array($view, ['captive', 'callback', 'methods', 'method'])) { $controller = $this->factory->createController($view, 'Administrator', [], $this->app, $this->input); $task = $this->input->get('task', ''); diff --git a/administrator/components/com_users/src/Controller/LevelController.php b/administrator/components/com_users/src/Controller/LevelController.php index 1d9d68b6ce501..f4d36c7a69fa7 100644 --- a/administrator/components/com_users/src/Controller/LevelController.php +++ b/administrator/components/com_users/src/Controller/LevelController.php @@ -116,7 +116,7 @@ public function delete() // Remove the items. if ($model->delete($ids)) { - $this->setMessage(Text::plural('COM_USERS_N_LEVELS_DELETED', count($ids))); + $this->setMessage(Text::plural('COM_USERS_N_LEVELS_DELETED', \count($ids))); } } diff --git a/administrator/components/com_users/src/Controller/MethodController.php b/administrator/components/com_users/src/Controller/MethodController.php index d8a852ddf270d..66f921a8180fb 100644 --- a/administrator/components/com_users/src/Controller/MethodController.php +++ b/administrator/components/com_users/src/Controller/MethodController.php @@ -401,7 +401,7 @@ public function save($cachable = false, $urlparams = []): void */ private function assertValidRecordId($id, ?User $user = null): MfaTable { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->app->getIdentity() ?: $this->getUserFactory()->loadUserById(0); } @@ -412,7 +412,7 @@ private function assertValidRecordId($id, ?User $user = null): MfaTable $record = $model->getRecord($user); - if (is_null($record) || ($record->id != $id) || ($record->user_id != $user->id)) { + if (\is_null($record) || ($record->id != $id) || ($record->user_id != $user->id)) { throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403); } diff --git a/administrator/components/com_users/src/Controller/UsersController.php b/administrator/components/com_users/src/Controller/UsersController.php index cca64525cd399..04cb09ebd3bc8 100644 --- a/administrator/components/com_users/src/Controller/UsersController.php +++ b/administrator/components/com_users/src/Controller/UsersController.php @@ -103,9 +103,9 @@ public function changeBlock() $this->setMessage($model->getError(), 'error'); } else { if ($value == 1) { - $this->setMessage(Text::plural('COM_USERS_N_USERS_BLOCKED', count($ids))); + $this->setMessage(Text::plural('COM_USERS_N_USERS_BLOCKED', \count($ids))); } elseif ($value == 0) { - $this->setMessage(Text::plural('COM_USERS_N_USERS_UNBLOCKED', count($ids))); + $this->setMessage(Text::plural('COM_USERS_N_USERS_UNBLOCKED', \count($ids))); } } } @@ -140,7 +140,7 @@ public function activate() if (!$model->activate($ids)) { $this->setMessage($model->getError(), 'error'); } else { - $this->setMessage(Text::plural('COM_USERS_N_USERS_ACTIVATED', count($ids))); + $this->setMessage(Text::plural('COM_USERS_N_USERS_ACTIVATED', \count($ids))); } } diff --git a/administrator/components/com_users/src/DataShape/CaptiveRenderOptions.php b/administrator/components/com_users/src/DataShape/CaptiveRenderOptions.php index e7e84a7312938..914cfabda18b9 100644 --- a/administrator/components/com_users/src/DataShape/CaptiveRenderOptions.php +++ b/administrator/components/com_users/src/DataShape/CaptiveRenderOptions.php @@ -167,7 +167,7 @@ class CaptiveRenderOptions extends DataShapeObject // phpcs:ignore protected function setField_type(string $value) { - if (!in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) { + if (!\in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) { throw new \InvalidArgumentException('Invalid value for property field_type.'); } diff --git a/administrator/components/com_users/src/DataShape/DataShapeObject.php b/administrator/components/com_users/src/DataShape/DataShapeObject.php index 850afde238b9a..c714d5fcde4d0 100644 --- a/administrator/components/com_users/src/DataShape/DataShapeObject.php +++ b/administrator/components/com_users/src/DataShape/DataShapeObject.php @@ -26,7 +26,7 @@ abstract class DataShapeObject implements \ArrayAccess */ public function __construct(array $array = []) { - if (!is_array($array) && !($array instanceof self)) { + if (!\is_array($array) && !($array instanceof self)) { throw new \InvalidArgumentException(sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); } @@ -58,7 +58,7 @@ public function asArray(): array */ public function merge($newValues): self { - if (!is_array($newValues) && !($newValues instanceof self)) { + if (!\is_array($newValues) && !($newValues instanceof self)) { throw new \InvalidArgumentException(sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); } diff --git a/administrator/components/com_users/src/DataShape/SetupRenderOptions.php b/administrator/components/com_users/src/DataShape/SetupRenderOptions.php index b33a7fbc204d5..84087f3a42815 100644 --- a/administrator/components/com_users/src/DataShape/SetupRenderOptions.php +++ b/administrator/components/com_users/src/DataShape/SetupRenderOptions.php @@ -210,7 +210,7 @@ class SetupRenderOptions extends DataShapeObject // phpcs:ignore protected function setField_type($value) { - if (!in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) { + if (!\in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) { throw new \InvalidArgumentException('Invalid value for property field_type.'); } diff --git a/administrator/components/com_users/src/Dispatcher/Dispatcher.php b/administrator/components/com_users/src/Dispatcher/Dispatcher.php index 7f7ca530f641e..2bc92021cf0f1 100644 --- a/administrator/components/com_users/src/Dispatcher/Dispatcher.php +++ b/administrator/components/com_users/src/Dispatcher/Dispatcher.php @@ -38,7 +38,7 @@ protected function checkAccess() $allowedTasks = ['user.edit', 'user.apply', 'user.save', 'user.cancel']; // Allow users to edit their own account - if (in_array($task, $allowedTasks, true) || ($view === 'user' && $layout === 'edit')) { + if (\in_array($task, $allowedTasks, true) || ($view === 'user' && $layout === 'edit')) { $user = $this->app->getIdentity(); $id = $this->input->getInt('id'); @@ -64,7 +64,7 @@ function ($carry, $taskPrefix) use ($task) { false ); - if (in_array(strtolower($view ?? ''), $allowedViews) || $isAllowedTask) { + if (\in_array(strtolower($view ?? ''), $allowedViews) || $isAllowedTask) { return; } diff --git a/administrator/components/com_users/src/Field/GroupparentField.php b/administrator/components/com_users/src/Field/GroupparentField.php index ae4a68aae196d..2537c7047cc17 100644 --- a/administrator/components/com_users/src/Field/GroupparentField.php +++ b/administrator/components/com_users/src/Field/GroupparentField.php @@ -84,7 +84,7 @@ protected function getOptions() $isSuperAdmin = $this->getCurrentUser()->authorise('core.admin'); // 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++) { // Show groups only if user is super admin or group is not super admin if ($isSuperAdmin || !Access::checkGroup($options[$i]->id, 'core.admin')) { $options[$i]->value = $options[$i]->id; diff --git a/administrator/components/com_users/src/Helper/DebugHelper.php b/administrator/components/com_users/src/Helper/DebugHelper.php index c69a1213d7890..2635774858057 100644 --- a/administrator/components/com_users/src/Helper/DebugHelper.php +++ b/administrator/components/com_users/src/Helper/DebugHelper.php @@ -46,7 +46,7 @@ public static function getComponents() $items = $db->setQuery($query)->loadObjectList(); - if (count($items)) { + if (\count($items)) { $lang = Factory::getLanguage(); foreach ($items as &$item) { diff --git a/administrator/components/com_users/src/Helper/Mfa.php b/administrator/components/com_users/src/Helper/Mfa.php index cd867b47c098c..63286de7f5c79 100644 --- a/administrator/components/com_users/src/Helper/Mfa.php +++ b/administrator/components/com_users/src/Helper/Mfa.php @@ -130,7 +130,7 @@ public static function getConfigurationInterface(User $user): ?string * Global Configuration and you can see the error exception which will help you solve * your problem. */ - if (defined('JDEBUG') && JDEBUG) { + if (\defined('JDEBUG') && JDEBUG) { throw $e; } @@ -150,7 +150,7 @@ public static function getMfaMethods(): array { PluginHelper::importPlugin('multifactorauth'); - if (is_null(self::$allMFAs)) { + if (\is_null(self::$allMFAs)) { // Get all the plugin results $event = new GetMethod(); $temp = Factory::getApplication() @@ -162,7 +162,7 @@ public static function getMfaMethods(): array self::$allMFAs = []; foreach ($temp as $method) { - if (!is_array($method) && !($method instanceof MethodDescriptor)) { + if (!\is_array($method) && !($method instanceof MethodDescriptor)) { continue; } @@ -196,15 +196,15 @@ public static function getMfaMethods(): array public static function canAddEditMethod(?User $user = null): bool { // Cannot do MFA operations on no user or a guest user. - if (is_null($user) || $user->guest) { + if (\is_null($user) || $user->guest) { return false; } // If the user is in a user group which disallows MFA we cannot allow adding / editing methods. $neverMFAGroups = ComponentHelper::getParams('com_users')->get('neverMFAUserGroups', []); - $neverMFAGroups = is_array($neverMFAGroups) ? $neverMFAGroups : []; + $neverMFAGroups = \is_array($neverMFAGroups) ? $neverMFAGroups : []; - if (count(array_intersect($user->getAuthorisedGroups(), $neverMFAGroups))) { + if (\count(array_intersect($user->getAuthorisedGroups(), $neverMFAGroups))) { return false; } @@ -235,7 +235,7 @@ public static function canAddEditMethod(?User $user = null): bool public static function canDeleteMethod(?User $user = null): bool { // Cannot do MFA operations on no user or a guest user. - if (is_null($user) || $user->guest) { + if (\is_null($user) || $user->guest) { return false; } @@ -302,7 +302,7 @@ function ($id) use ($factory) { $records = array_filter( $records, function ($record) use (&$hasBackupCodes) { - $isValid = !is_null($record) && (!empty($record->options)); + $isValid = !\is_null($record) && (!empty($record->options)); if ($isValid && ($record->method === 'backupcodes')) { $hasBackupCodes = true; @@ -313,7 +313,7 @@ function ($record) use (&$hasBackupCodes) { ); // If the only Method is backup codes it's as good as having no records - if ((count($records) === 1) && $hasBackupCodes) { + if ((\count($records) === 1) && $hasBackupCodes) { return []; } @@ -339,7 +339,7 @@ public static function canShowConfigurationInterface(?User $user = null): bool // I need at least one MFA method plugin for the setup interface to make any sense. $plugins = PluginHelper::getPlugin('multifactorauth'); - if (count($plugins) < 1) { + if (\count($plugins) < 1) { return false; } diff --git a/administrator/components/com_users/src/Model/BackupcodesModel.php b/administrator/components/com_users/src/Model/BackupcodesModel.php index 1260666d7e7f1..e24e871b5ac83 100644 --- a/administrator/components/com_users/src/Model/BackupcodesModel.php +++ b/administrator/components/com_users/src/Model/BackupcodesModel.php @@ -121,7 +121,7 @@ public function saveBackupCodes(array $codes, ?User $user = null): bool /** @var MfaTable $record */ $record = $this->getTable('Mfa', 'Administrator'); - if (is_null($existingCodes)) { + if (\is_null($existingCodes)) { $record->reset(); $newData = [ @@ -227,7 +227,7 @@ public function isBackupCode($code, ?User $user = null): bool $newArray = []; $dummyArray = []; - $realLength = count($codes); + $realLength = \count($codes); $restLength = 10 - $realLength; for ($i = 0; $i < $realLength; $i++) { diff --git a/administrator/components/com_users/src/Model/CaptiveModel.php b/administrator/components/com_users/src/Model/CaptiveModel.php index 881a6313751d3..a9691e25035b2 100644 --- a/administrator/components/com_users/src/Model/CaptiveModel.php +++ b/administrator/components/com_users/src/Model/CaptiveModel.php @@ -62,7 +62,7 @@ class CaptiveModel extends BaseDatabaseModel */ public function suppressAllModules(CMSApplication $app = null): void { - if (is_null($app)) { + if (\is_null($app)) { $app = Factory::getApplication(); } @@ -82,7 +82,7 @@ public function suppressAllModules(CMSApplication $app = null): void */ public function getRecords(User $user = null, bool $includeBackupCodes = false): array { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } @@ -114,7 +114,7 @@ function ($method) { foreach ($records as $record) { // Backup codes must not be included in the list. We add them in the View, at the end of the list. - if (in_array($record->method, $methodNames)) { + if (\in_array($record->method, $methodNames)) { $ret[$record->id] = $record; } } @@ -130,7 +130,7 @@ function ($method) { */ private function getActiveMethodNames(): ?array { - if (!is_null($this->activeMFAMethodNames)) { + if (!\is_null($this->activeMFAMethodNames)) { return $this->activeMFAMethodNames; } @@ -173,7 +173,7 @@ public function getRecord(?User $user = null): ?MfaTable return null; } - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } @@ -192,7 +192,7 @@ public function getRecord(?User $user = null): ?MfaTable $methodNames = $this->getActiveMethodNames(); - if (!in_array($record->method, $methodNames) && ($record->method != 'backupcodes')) { + if (!\in_array($record->method, $methodNames) && ($record->method != 'backupcodes')) { return null; } @@ -277,7 +277,7 @@ public function translateMethodName(string $name): string { static $map = null; - if (!is_array($map)) { + if (!\is_array($map)) { $map = []; $mfaMethods = MfaHelper::getMfaMethods(); @@ -307,7 +307,7 @@ public function getMethodImage(string $name): string { static $map = null; - if (!is_array($map)) { + if (!\is_array($map)) { $map = []; $mfaMethods = MfaHelper::getMfaMethods(); @@ -376,7 +376,7 @@ private function filterModules(array &$modules): void $filtered = []; foreach ($modules as $module) { - if (in_array($module->position, $allowedPositions)) { + if (\in_array($module->position, $allowedPositions)) { $filtered[] = $module; } } diff --git a/administrator/components/com_users/src/Model/GroupModel.php b/administrator/components/com_users/src/Model/GroupModel.php index 3dd46e855fa11..6c90f55193572 100644 --- a/administrator/components/com_users/src/Model/GroupModel.php +++ b/administrator/components/com_users/src/Model/GroupModel.php @@ -136,7 +136,7 @@ protected function loadFormData() */ protected function preprocessForm(Form $form, $data, $group = '') { - $obj = is_array($data) ? ArrayHelper::toObject($data, CMSObject::class) : $data; + $obj = \is_array($data) ? ArrayHelper::toObject($data, CMSObject::class) : $data; if (isset($obj->parent_id) && $obj->parent_id == 0 && $obj->id > 0) { $form->setFieldAttribute('parent_id', 'type', 'hidden'); @@ -199,7 +199,7 @@ public function save($data) // Next, are we a member of the current group? $myGroups = Access::getGroupsByUser($this->getCurrentUser()->get('id'), false); - if (in_array($data['id'], $myGroups)) { + if (\in_array($data['id'], $myGroups)) { // Now, would we have super admin permissions without the current group? $otherGroups = array_diff($myGroups, [$data['id']]); $otherSuperAdmin = false; @@ -258,7 +258,7 @@ public function delete(&$pks) foreach ($pks as $pk) { // Do not allow to delete groups to which the current user belongs - if (in_array($pk, $groups)) { + if (\in_array($pk, $groups)) { Factory::getApplication()->enqueueMessage(Text::_('COM_USERS_DELETE_ERROR_INVALID_GROUP'), 'error'); return false; diff --git a/administrator/components/com_users/src/Model/LevelModel.php b/administrator/components/com_users/src/Model/LevelModel.php index 3b0b9a3d6a9aa..f511143d530a3 100644 --- a/administrator/components/com_users/src/Model/LevelModel.php +++ b/administrator/components/com_users/src/Model/LevelModel.php @@ -114,7 +114,7 @@ protected function canDelete($record) // Ok, after all that we are ready to check the record :) } - if (in_array($record->id, $this->levelsInUse)) { + if (\in_array($record->id, $this->levelsInUse)) { $this->setError(Text::sprintf('COM_USERS_ERROR_VIEW_LEVEL_IN_USE', $record->id, $record->title)); return false; @@ -261,7 +261,7 @@ public function validate($form, $data, $group = null) // Non Super user should not be able to change the access levels of super user groups if (!$isSuperAdmin) { - if (!isset($data['rules']) || !is_array($data['rules'])) { + if (!isset($data['rules']) || !\is_array($data['rules'])) { $data['rules'] = []; } @@ -279,11 +279,11 @@ public function validate($form, $data, $group = null) $rules = ArrayHelper::toInteger($rules); - for ($i = 0, $n = count($groups); $i < $n; ++$i) { + for ($i = 0, $n = \count($groups); $i < $n; ++$i) { if (Access::checkGroup((int) $groups[$i]->id, 'core.admin')) { - if (in_array((int) $groups[$i]->id, $rules) && !in_array((int) $groups[$i]->id, $data['rules'])) { + if (\in_array((int) $groups[$i]->id, $rules) && !\in_array((int) $groups[$i]->id, $data['rules'])) { $data['rules'][] = (int) $groups[$i]->id; - } elseif (!in_array((int) $groups[$i]->id, $rules) && in_array((int) $groups[$i]->id, $data['rules'])) { + } elseif (!\in_array((int) $groups[$i]->id, $rules) && \in_array((int) $groups[$i]->id, $data['rules'])) { $this->setError(Text::_('JLIB_USER_ERROR_NOT_SUPERADMIN')); return false; diff --git a/administrator/components/com_users/src/Model/MailModel.php b/administrator/components/com_users/src/Model/MailModel.php index 8d6bbe61be880..6de5f948c44a6 100644 --- a/administrator/components/com_users/src/Model/MailModel.php +++ b/administrator/components/com_users/src/Model/MailModel.php @@ -107,13 +107,13 @@ public function send() $db = $this->getDatabase(); $language = Factory::getLanguage(); - $mode = array_key_exists('mode', $data) ? (int) $data['mode'] : 0; - $subject = array_key_exists('subject', $data) ? $data['subject'] : ''; - $grp = array_key_exists('group', $data) ? (int) $data['group'] : 0; - $recurse = array_key_exists('recurse', $data) ? (int) $data['recurse'] : 0; - $bcc = array_key_exists('bcc', $data) ? (int) $data['bcc'] : 0; - $disabled = array_key_exists('disabled', $data) ? (int) $data['disabled'] : 0; - $message_body = array_key_exists('message', $data) ? $data['message'] : ''; + $mode = \array_key_exists('mode', $data) ? (int) $data['mode'] : 0; + $subject = \array_key_exists('subject', $data) ? $data['subject'] : ''; + $grp = \array_key_exists('group', $data) ? (int) $data['group'] : 0; + $recurse = \array_key_exists('recurse', $data) ? (int) $data['recurse'] : 0; + $bcc = \array_key_exists('bcc', $data) ? (int) $data['bcc'] : 0; + $disabled = \array_key_exists('disabled', $data) ? (int) $data['disabled'] : 0; + $message_body = \array_key_exists('message', $data) ? $data['message'] : ''; // Automatically removes html formatting if (!$mode) { @@ -164,7 +164,7 @@ public function send() if (!$rows) { $app->setUserState('com_users.display.mail.data', $data); - if (in_array($user->id, $to)) { + if (\in_array($user->id, $to)) { $this->setError(Text::_('COM_USERS_MAIL_ONLY_YOU_COULD_BE_FOUND_IN_THIS_GROUP')); } else { $this->setError(Text::_('COM_USERS_MAIL_NO_USERS_COULD_BE_FOUND_IN_THIS_GROUP')); @@ -239,7 +239,7 @@ public function send() $data['bcc'] = $bcc; $data['message'] = $message_body; $app->setUserState('com_users.display.mail.data', []); - $app->enqueueMessage(Text::plural('COM_USERS_MAIL_EMAIL_SENT_TO_N_USERS', count($rows)), 'message'); + $app->enqueueMessage(Text::plural('COM_USERS_MAIL_EMAIL_SENT_TO_N_USERS', \count($rows)), 'message'); return true; } diff --git a/administrator/components/com_users/src/Model/MethodModel.php b/administrator/components/com_users/src/Model/MethodModel.php index 9011ec5dc2d06..5d7bd9909a959 100644 --- a/administrator/components/com_users/src/Model/MethodModel.php +++ b/administrator/components/com_users/src/Model/MethodModel.php @@ -72,7 +72,7 @@ public function getMethod(string $method): array */ public function methodExists(string $method): bool { - if (!is_array($this->mfaMethods)) { + if (!\is_array($this->mfaMethods)) { $this->populateMfaMethods(); } @@ -89,7 +89,7 @@ public function methodExists(string $method): bool */ public function getRenderOptions(?User $user = null): SetupRenderOptions { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } @@ -128,7 +128,7 @@ public function getRenderOptions(?User $user = null): SetupRenderOptions */ public function getRecord(User $user = null): MfaTable { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } @@ -193,14 +193,14 @@ public function getPageTitle(): string */ protected function getDefaultRecord(?User $user = null): MfaTable { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } $method = $this->getState('method'); $title = ''; - if (is_null($this->mfaMethods)) { + if (\is_null($this->mfaMethods)) { $this->populateMfaMethods(); } diff --git a/administrator/components/com_users/src/Model/MethodsModel.php b/administrator/components/com_users/src/Model/MethodsModel.php index eb0a45710e335..c3f3e508bf60c 100644 --- a/administrator/components/com_users/src/Model/MethodsModel.php +++ b/administrator/components/com_users/src/Model/MethodsModel.php @@ -41,7 +41,7 @@ class MethodsModel extends BaseDatabaseModel */ public function getMethods(?User $user = null): array { - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser(); } @@ -87,7 +87,7 @@ public function getMethods(?User $user = null): array public function deleteAll(?User $user = null): void { // Make sure we have a user object - if (is_null($user)) { + if (\is_null($user)) { $user = $this->getCurrentUser() ?: Factory::getApplication()->getIdentity(); } @@ -200,7 +200,7 @@ public function setFlag(User $user, bool $flag = true): void return; } - $exists = !is_null($result); + $exists = !\is_null($result); $object = (object) [ 'user_id' => $user->id, diff --git a/administrator/components/com_users/src/Model/UserModel.php b/administrator/components/com_users/src/Model/UserModel.php index 193707124a08d..794b8731edab1 100644 --- a/administrator/components/com_users/src/Model/UserModel.php +++ b/administrator/components/com_users/src/Model/UserModel.php @@ -313,7 +313,7 @@ public function delete(&$pks) PluginHelper::importPlugin($this->events_map['delete']); - if (in_array($user->id, $pks)) { + if (\in_array($user->id, $pks)) { $this->setError(Text::_('COM_USERS_USERS_ERROR_CANNOT_DELETE_SELF')); return false; @@ -424,7 +424,7 @@ public function block(&$pks, $value = 1) // Trigger the before save event. $result = Factory::getApplication()->triggerEvent($this->event_before_save, [$old, false, $table->getProperties()]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { // Plugin will have to raise its own error or throw an exception. return false; } @@ -511,7 +511,7 @@ public function activate(&$pks) // Trigger the before save event. $result = Factory::getApplication()->triggerEvent($this->event_before_save, [$old, false, $table->getProperties()]); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { // Plugin will have to raise it's own error or throw an exception. return false; } @@ -804,7 +804,7 @@ public function batchUser($groupId, $userIds, $action) $groups = false; foreach ($userIds as $id) { - if (!in_array($id, $users)) { + if (!\in_array($id, $users)) { $query->values($id . ',' . $groupId); $groups = true; } diff --git a/administrator/components/com_users/src/Model/UsersModel.php b/administrator/components/com_users/src/Model/UsersModel.php index 0d3c46551726f..b5c7f3ceaac50 100644 --- a/administrator/components/com_users/src/Model/UsersModel.php +++ b/administrator/components/com_users/src/Model/UsersModel.php @@ -167,7 +167,7 @@ public function getItems() $groups = $this->getState('filter.groups'); $groupId = $this->getState('filter.group_id'); - if (isset($groups) && (empty($groups) || $groupId && !in_array($groupId, $groups))) { + if (isset($groups) && (empty($groups) || $groupId && !\in_array($groupId, $groups))) { $items = []; } else { $items = parent::getItems(); diff --git a/administrator/components/com_users/src/Service/Encrypt.php b/administrator/components/com_users/src/Service/Encrypt.php index 9415a44e221fc..a15f452662b89 100644 --- a/administrator/components/com_users/src/Service/Encrypt.php +++ b/administrator/components/com_users/src/Service/Encrypt.php @@ -53,7 +53,7 @@ public function __construct() */ public function encrypt(string $data): string { - if (!is_object($this->aes)) { + if (!\is_object($this->aes)) { return $data; } @@ -81,7 +81,7 @@ public function decrypt(string $data, bool $legacy = false): string $data = substr($data, 12); - if (!is_object($this->aes)) { + if (!\is_object($this->aes)) { return $data; } @@ -100,7 +100,7 @@ public function decrypt(string $data, bool $legacy = false): string */ private function initialize(): void { - if (is_object($this->aes)) { + if (\is_object($this->aes)) { return; } diff --git a/administrator/components/com_users/src/Service/HTML/Users.php b/administrator/components/com_users/src/Service/HTML/Users.php index bd08d1e9d4c74..83adfbc60a489 100644 --- a/administrator/components/com_users/src/Service/HTML/Users.php +++ b/administrator/components/com_users/src/Service/HTML/Users.php @@ -256,7 +256,7 @@ public function activateStates() */ public function value($value) { - if (is_string($value)) { + if (\is_string($value)) { $value = trim($value); } @@ -264,7 +264,7 @@ public function value($value) return Text::_('COM_USERS_PROFILE_VALUE_NOT_FOUND'); } - if (!is_array($value)) { + if (!\is_array($value)) { return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); } } diff --git a/administrator/components/com_users/src/Table/MfaTable.php b/administrator/components/com_users/src/Table/MfaTable.php index dea65df85958e..dd069d1bad2d4 100644 --- a/administrator/components/com_users/src/Table/MfaTable.php +++ b/administrator/components/com_users/src/Table/MfaTable.php @@ -160,7 +160,7 @@ function (bool $carry, $record) { $mustCreateBackupCodes = !$hasBackupCodes; // If the only other entry is the backup records one I need to make this the default method - if ($hasBackupCodes && count($records) === 1) { + if ($hasBackupCodes && \count($records) === 1) { $this->default = 1; } } @@ -281,15 +281,15 @@ private function decryptOptions(): void // Try with modern decryption $decrypted = @json_decode($this->encryptService->decrypt($this->options ?? ''), true); - if (is_string($decrypted)) { + if (\is_string($decrypted)) { $decrypted = @json_decode($decrypted, true); } // Fall back to legacy decryption - if (!is_array($decrypted)) { + if (!\is_array($decrypted)) { $decrypted = @json_decode($this->encryptService->decrypt($this->options ?? '', true), true); - if (is_string($decrypted)) { + if (\is_string($decrypted)) { $decrypted = @json_decode($decrypted, true); } } @@ -352,7 +352,7 @@ private function generateBackupCodes(): void */ private function afterDelete($pk): void { - if (is_array($pk)) { + if (\is_array($pk)) { $pk = $pk[$this->_tbl_key] ?? array_shift($pk); } diff --git a/administrator/components/com_users/src/View/Captive/HtmlView.php b/administrator/components/com_users/src/View/Captive/HtmlView.php index d1c56b56670b1..2a53cfcb19f2f 100644 --- a/administrator/components/com_users/src/View/Captive/HtmlView.php +++ b/administrator/components/com_users/src/View/Captive/HtmlView.php @@ -128,7 +128,7 @@ public function display($tpl = null) $codesModel = $this->getModel('Backupcodes'); $backupCodesRecord = $codesModel->getBackupCodesRecord(); - if (!is_null($backupCodesRecord)) { + if (!\is_null($backupCodesRecord)) { $backupCodesRecord->title = Text::_('COM_USERS_USER_BACKUPCODES'); $this->records[] = $backupCodesRecord; } @@ -140,7 +140,7 @@ public function display($tpl = null) $this->record = reset($this->records); // If we have multiple records try to make this record the default - if (count($this->records) > 1) { + if (\count($this->records) > 1) { foreach ($this->records as $record) { if ($record->default) { $this->record = $record; @@ -155,7 +155,7 @@ public function display($tpl = null) $this->setLayout('default'); // If we have no record selected or explicitly asked to run the 'select' task use the correct layout - if (is_null($this->record) || ($model->getState('task') == 'select')) { + if (\is_null($this->record) || ($model->getState('task') == 'select')) { $this->setLayout('select'); } @@ -204,7 +204,7 @@ public function display($tpl = null) ->icon('icon icon-lock'); $bar->appendButton($button); - if (count($this->records) > 1) { + if (\count($this->records) > 1) { $arrow = Factory::getApplication()->getLanguage()->isRtl() ? 'arrow-right' : 'arrow-left'; $button = (new BasicButton('user-mfa-choose-another')) ->text('COM_USERS_MFA_USE_DIFFERENT_METHOD') diff --git a/administrator/components/com_users/src/View/Debuggroup/HtmlView.php b/administrator/components/com_users/src/View/Debuggroup/HtmlView.php index 5eeb703798831..2fd5d5a6374f2 100644 --- a/administrator/components/com_users/src/View/Debuggroup/HtmlView.php +++ b/administrator/components/com_users/src/View/Debuggroup/HtmlView.php @@ -105,7 +105,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_users/src/View/Debuguser/HtmlView.php b/administrator/components/com_users/src/View/Debuguser/HtmlView.php index e752a6429a5b4..b758771386e2d 100644 --- a/administrator/components/com_users/src/View/Debuguser/HtmlView.php +++ b/administrator/components/com_users/src/View/Debuguser/HtmlView.php @@ -105,7 +105,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_users/src/View/Group/HtmlView.php b/administrator/components/com_users/src/View/Group/HtmlView.php index 004e90cedf412..c7ce08d8b425e 100644 --- a/administrator/components/com_users/src/View/Group/HtmlView.php +++ b/administrator/components/com_users/src/View/Group/HtmlView.php @@ -66,7 +66,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); } diff --git a/administrator/components/com_users/src/View/Groups/HtmlView.php b/administrator/components/com_users/src/View/Groups/HtmlView.php index 6fab461e8d040..15e92af7d453e 100644 --- a/administrator/components/com_users/src/View/Groups/HtmlView.php +++ b/administrator/components/com_users/src/View/Groups/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_users/src/View/Level/HtmlView.php b/administrator/components/com_users/src/View/Level/HtmlView.php index 0841950142309..339d1292f0cfd 100644 --- a/administrator/components/com_users/src/View/Level/HtmlView.php +++ b/administrator/components/com_users/src/View/Level/HtmlView.php @@ -66,7 +66,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_users/src/View/Levels/HtmlView.php b/administrator/components/com_users/src/View/Levels/HtmlView.php index ba655a982e3e8..40a81d5adf922 100644 --- a/administrator/components/com_users/src/View/Levels/HtmlView.php +++ b/administrator/components/com_users/src/View/Levels/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_users/src/View/Method/HtmlView.php b/administrator/components/com_users/src/View/Method/HtmlView.php index 5dcc833abd962..93a5c6e3ef45e 100644 --- a/administrator/components/com_users/src/View/Method/HtmlView.php +++ b/administrator/components/com_users/src/View/Method/HtmlView.php @@ -130,7 +130,7 @@ public function display($tpl = null): void $backupCodes = $this->record->options; - if (!is_array($backupCodes)) { + if (!\is_array($backupCodes)) { $backupCodes = []; } @@ -141,7 +141,7 @@ function ($x) { } ); - if (count($backupCodes) % 2 != 0) { + if (\count($backupCodes) % 2 != 0) { $backupCodes[] = ''; } diff --git a/administrator/components/com_users/src/View/Methods/HtmlView.php b/administrator/components/com_users/src/View/Methods/HtmlView.php index f10a4dd04119c..bbadb57bbf09d 100644 --- a/administrator/components/com_users/src/View/Methods/HtmlView.php +++ b/administrator/components/com_users/src/View/Methods/HtmlView.php @@ -124,7 +124,7 @@ public function display($tpl = null): void $activeRecords = 0; foreach ($this->methods as $methodName => $method) { - $methodActiveRecords = count($method['active']); + $methodActiveRecords = \count($method['active']); if (!$methodActiveRecords) { continue; @@ -153,7 +153,7 @@ public function display($tpl = null): void $backupCodesRecord = $model->getBackupCodesRecord($this->user); - if (!is_null($backupCodesRecord)) { + if (!\is_null($backupCodesRecord)) { $this->methods = array_merge( [ 'backupcodes' => new MethodDescriptor( diff --git a/administrator/components/com_users/src/View/Note/HtmlView.php b/administrator/components/com_users/src/View/Note/HtmlView.php index 0a9e4d7362f42..be207e6fdee66 100644 --- a/administrator/components/com_users/src/View/Note/HtmlView.php +++ b/administrator/components/com_users/src/View/Note/HtmlView.php @@ -73,7 +73,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); } @@ -96,7 +96,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')); $toolbar = Toolbar::getInstance(); // Since we don't track these assets at the item level, use the category id. @@ -105,7 +105,7 @@ protected function addToolbar() ToolbarHelper::title(Text::_('COM_USERS_NOTES'), 'users user'); // If not checked out, can save the item. - if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) { + if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_users', 'core.create')))) { $toolbar->apply('note.apply'); } @@ -114,16 +114,16 @@ protected function addToolbar() $saveGroup->configure( function (Toolbar $childBar) use ($checkedOut, $canDo, $user, $isNew) { // If not checked out, can save the item. - if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) { + if (!$checkedOut && ($canDo->get('core.edit') || \count($user->getAuthorisedCategories('com_users', 'core.create')))) { $childBar->save('note.save'); } - if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) { + if (!$checkedOut && \count($user->getAuthorisedCategories('com_users', 'core.create'))) { $childBar->save2new('note.save2new'); } // If an existing item, can save to a copy. - if (!$isNew && (count($user->getAuthorisedCategories('com_users', 'core.create')) > 0)) { + if (!$isNew && (\count($user->getAuthorisedCategories('com_users', 'core.create')) > 0)) { $childBar->save2copy('note.save2copy'); } } diff --git a/administrator/components/com_users/src/View/User/HtmlView.php b/administrator/components/com_users/src/View/User/HtmlView.php index 27dea84c46058..9a8c81920e0cc 100644 --- a/administrator/components/com_users/src/View/User/HtmlView.php +++ b/administrator/components/com_users/src/View/User/HtmlView.php @@ -100,7 +100,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_users/src/View/Users/HtmlView.php b/administrator/components/com_users/src/View/Users/HtmlView.php index a43e1a71fe9e2..9298ed0c5825d 100644 --- a/administrator/components/com_users/src/View/Users/HtmlView.php +++ b/administrator/components/com_users/src/View/Users/HtmlView.php @@ -110,7 +110,7 @@ public function display($tpl = null) $this->db = Factory::getDbo(); // 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_workflow/services/provider.php b/administrator/components/com_workflow/services/provider.php index 35c04024047aa..d6c37cc81a0d1 100644 --- a/administrator/components/com_workflow/services/provider.php +++ b/administrator/components/com_workflow/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_workflow/src/Controller/DisplayController.php b/administrator/components/com_workflow/src/Controller/DisplayController.php index a1cfef912cdc6..69901710696e7 100644 --- a/administrator/components/com_workflow/src/Controller/DisplayController.php +++ b/administrator/components/com_workflow/src/Controller/DisplayController.php @@ -104,7 +104,7 @@ public function display($cachable = false, $urlparams = []) $id = $this->input->getInt('id'); // Check for edit form. - if (in_array($view, ['workflow', 'stage', 'transition']) && $layout == 'edit' && !$this->checkEditId('com_workflow.edit.' . $view, $id)) { + if (\in_array($view, ['workflow', 'stage', 'transition']) && $layout == 'edit' && !$this->checkEditId('com_workflow.edit.' . $view, $id)) { // Somehow the person just went to the form - we don't allow that. if (!\count($this->app->getMessageQueue())) { $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); diff --git a/administrator/components/com_workflow/src/Controller/StagesController.php b/administrator/components/com_workflow/src/Controller/StagesController.php index 7e8bf3cc58f46..4f82b57d433a5 100644 --- a/administrator/components/com_workflow/src/Controller/StagesController.php +++ b/administrator/components/com_workflow/src/Controller/StagesController.php @@ -157,7 +157,7 @@ public function setDefault() if (empty($cid)) { $this->setMessage(Text::_('COM_WORKFLOW_NO_ITEM_SELECTED'), 'warning'); - } elseif (count($cid) > 1) { + } elseif (\count($cid) > 1) { $this->setMessage(Text::_('COM_WORKFLOW_TOO_MANY_STAGES'), 'error'); } else { // Get the model. diff --git a/administrator/components/com_workflow/src/Controller/WorkflowsController.php b/administrator/components/com_workflow/src/Controller/WorkflowsController.php index 95a43c92dec4f..9291a5945afd8 100644 --- a/administrator/components/com_workflow/src/Controller/WorkflowsController.php +++ b/administrator/components/com_workflow/src/Controller/WorkflowsController.php @@ -132,7 +132,7 @@ public function setDefault() if (empty($cid)) { $this->setMessage(Text::_('COM_WORKFLOW_NO_ITEM_SELECTED'), 'warning'); - } elseif (count($cid) > 1) { + } elseif (\count($cid) > 1) { $this->setMessage(Text::_('COM_WORKFLOW_TOO_MANY_WORKFLOWS'), 'error'); } else { // Get the model. @@ -151,7 +151,7 @@ public function setDefault() $ntext = 'COM_WORKFLOW_ITEM_UNSET_DEFAULT'; } - $this->setMessage(Text::_($ntext, count($cid))); + $this->setMessage(Text::_($ntext, \count($cid))); } } diff --git a/administrator/components/com_workflow/src/Field/ComponentsWorkflowField.php b/administrator/components/com_workflow/src/Field/ComponentsWorkflowField.php index d3d35e033cf76..cd4ed6361082a 100644 --- a/administrator/components/com_workflow/src/Field/ComponentsWorkflowField.php +++ b/administrator/components/com_workflow/src/Field/ComponentsWorkflowField.php @@ -58,7 +58,7 @@ protected function getOptions() $options = []; - if (count($items)) { + if (\count($items)) { $lang = Factory::getLanguage(); $components = []; diff --git a/administrator/components/com_workflow/src/Field/WorkflowcontextsField.php b/administrator/components/com_workflow/src/Field/WorkflowcontextsField.php index cfbdcba1c2356..ac6ce7145bcc9 100644 --- a/administrator/components/com_workflow/src/Field/WorkflowcontextsField.php +++ b/administrator/components/com_workflow/src/Field/WorkflowcontextsField.php @@ -42,7 +42,7 @@ class WorkflowcontextsField extends ListField */ protected function getInput() { - if (count($this->getOptions()) < 2) { + if (\count($this->getOptions()) < 2) { $this->layout = 'joomla.form.field.hidden'; } diff --git a/administrator/components/com_workflow/src/Model/StageModel.php b/administrator/components/com_workflow/src/Model/StageModel.php index 3cc2dd92182d7..2c038e8daf1ff 100644 --- a/administrator/components/com_workflow/src/Model/StageModel.php +++ b/administrator/components/com_workflow/src/Model/StageModel.php @@ -183,7 +183,7 @@ protected function canEditState($record) $context = $this->option . '.' . $this->name; $extension = $app->getUserStateFromRequest($context . '.filter.extension', 'extension', null, 'cmd'); - if (!\property_exists($record, 'workflow_id')) { + if (!property_exists($record, 'workflow_id')) { $workflowID = $app->getUserStateFromRequest($context . '.filter.workflow_id', 'workflow_id', 0, 'int'); $record->workflow_id = $workflowID; } diff --git a/administrator/components/com_workflow/src/Model/TransitionModel.php b/administrator/components/com_workflow/src/Model/TransitionModel.php index 1a82b1ec08137..a1db4c04d00ec 100644 --- a/administrator/components/com_workflow/src/Model/TransitionModel.php +++ b/administrator/components/com_workflow/src/Model/TransitionModel.php @@ -86,7 +86,7 @@ protected function canEditState($record) $context = $this->option . '.' . $this->name; $extension = $app->getUserStateFromRequest($context . '.filter.extension', 'extension', null, 'cmd'); - if (!\property_exists($record, 'workflow_id')) { + if (!property_exists($record, 'workflow_id')) { $workflowID = $app->getUserStateFromRequest($context . '.filter.workflow_id', 'workflow_id', 0, 'int'); $record->workflow_id = $workflowID; } diff --git a/administrator/components/com_workflow/src/Model/WorkflowsModel.php b/administrator/components/com_workflow/src/Model/WorkflowsModel.php index 2044f5a2225c9..be244ffb1fe8a 100644 --- a/administrator/components/com_workflow/src/Model/WorkflowsModel.php +++ b/administrator/components/com_workflow/src/Model/WorkflowsModel.php @@ -81,7 +81,7 @@ protected function populateState($ordering = 'w.ordering', $direction = 'asc') $this->setState('filter.component', $parts[0]); // Extract the optional section name - $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + $this->setState('filter.section', (\count($parts) > 1) ? $parts[1] : null); parent::populateState($ordering, $direction); } diff --git a/administrator/components/com_workflow/src/View/Stage/HtmlView.php b/administrator/components/com_workflow/src/View/Stage/HtmlView.php index 73062a3f76066..b80ff4499c593 100644 --- a/administrator/components/com_workflow/src/View/Stage/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Stage/HtmlView.php @@ -87,7 +87,7 @@ public function display($tpl = null) $this->item = $this->get('Item'); // 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_workflow/src/View/Stages/HtmlView.php b/administrator/components/com_workflow/src/View/Stages/HtmlView.php index 96d83424908ee..805f0e328a38a 100644 --- a/administrator/components/com_workflow/src/View/Stages/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Stages/HtmlView.php @@ -131,7 +131,7 @@ public function display($tpl = null) $this->workflow = $this->get('Workflow'); // 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_workflow/src/View/Transition/HtmlView.php b/administrator/components/com_workflow/src/View/Transition/HtmlView.php index 1500cf584790f..f7d198222c1ad 100644 --- a/administrator/components/com_workflow/src/View/Transition/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Transition/HtmlView.php @@ -114,7 +114,7 @@ public function display($tpl = null) $this->item = $this->get('Item'); // 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_workflow/src/View/Transitions/HtmlView.php b/administrator/components/com_workflow/src/View/Transitions/HtmlView.php index 2229f032ab09c..e2431dd320345 100644 --- a/administrator/components/com_workflow/src/View/Transitions/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Transitions/HtmlView.php @@ -131,7 +131,7 @@ public function display($tpl = null) $this->workflow = $this->get('Workflow'); // 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_workflow/src/View/Workflow/HtmlView.php b/administrator/components/com_workflow/src/View/Workflow/HtmlView.php index 5d3dc642543cf..b1d55bf640101 100644 --- a/administrator/components/com_workflow/src/View/Workflow/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Workflow/HtmlView.php @@ -92,7 +92,7 @@ public function display($tpl = null) $this->item = $this->get('Item'); // 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_workflow/src/View/Workflows/HtmlView.php b/administrator/components/com_workflow/src/View/Workflows/HtmlView.php index b4a9d3d0c115e..b8f05192a2797 100644 --- a/administrator/components/com_workflow/src/View/Workflows/HtmlView.php +++ b/administrator/components/com_workflow/src/View/Workflows/HtmlView.php @@ -111,7 +111,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_wrapper/services/provider.php b/administrator/components/com_wrapper/services/provider.php index e09affe30388c..ebee780e079f8 100644 --- a/administrator/components/com_wrapper/services/provider.php +++ b/administrator/components/com_wrapper/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\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; diff --git a/administrator/includes/app.php b/administrator/includes/app.php index 0fdbb854aaed3..7548b6adbf068 100644 --- a/administrator/includes/app.php +++ b/administrator/includes/app.php @@ -7,14 +7,14 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Saves the start time and memory usage. $startTime = microtime(1); $startMem = memory_get_usage(); -if (file_exists(dirname(__DIR__) . '/defines.php')) { - include_once dirname(__DIR__) . '/defines.php'; +if (file_exists(\dirname(__DIR__) . '/defines.php')) { + include_once \dirname(__DIR__) . '/defines.php'; } require_once __DIR__ . '/defines.php'; diff --git a/administrator/includes/defines.php b/administrator/includes/defines.php index 23b7ff2790212..95f664560b025 100644 --- a/administrator/includes/defines.php +++ b/administrator/includes/defines.php @@ -7,26 +7,26 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Define JPATH constants if not defined yet -defined('JPATH_BASE') || define('JPATH_BASE', dirname(__DIR__)); +\defined('JPATH_BASE') || \define('JPATH_BASE', \dirname(__DIR__)); // Global definitions $parts = explode(DIRECTORY_SEPARATOR, JPATH_BASE); array_pop($parts); // Defines -defined('JPATH_ROOT') || define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); -defined('JPATH_SITE') || define('JPATH_SITE', JPATH_ROOT); -defined('JPATH_PUBLIC') || define('JPATH_PUBLIC', JPATH_ROOT); -defined('JPATH_CONFIGURATION') || define('JPATH_CONFIGURATION', JPATH_ROOT); -defined('JPATH_ADMINISTRATOR') || define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); -defined('JPATH_LIBRARIES') || define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); -defined('JPATH_PLUGINS') || define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); -defined('JPATH_INSTALLATION') || define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); -defined('JPATH_THEMES') || define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); -defined('JPATH_CACHE') || define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); -defined('JPATH_MANIFESTS') || define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); -defined('JPATH_API') || define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); -defined('JPATH_CLI') || define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); +\defined('JPATH_ROOT') || \define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); +\defined('JPATH_SITE') || \define('JPATH_SITE', JPATH_ROOT); +\defined('JPATH_PUBLIC') || \define('JPATH_PUBLIC', JPATH_ROOT); +\defined('JPATH_CONFIGURATION') || \define('JPATH_CONFIGURATION', JPATH_ROOT); +\defined('JPATH_ADMINISTRATOR') || \define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); +\defined('JPATH_LIBRARIES') || \define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); +\defined('JPATH_PLUGINS') || \define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); +\defined('JPATH_INSTALLATION') || \define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); +\defined('JPATH_THEMES') || \define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); +\defined('JPATH_CACHE') || \define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); +\defined('JPATH_MANIFESTS') || \define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); +\defined('JPATH_API') || \define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); +\defined('JPATH_CLI') || \define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); diff --git a/administrator/includes/framework.php b/administrator/includes/framework.php index 51ba932c0496c..e24951cdfeae1 100644 --- a/administrator/includes/framework.php +++ b/administrator/includes/framework.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Version; use Joomla\Utilities\IpHelper; @@ -77,7 +77,7 @@ break; } -define('JDEBUG', $config->debug); +\define('JDEBUG', $config->debug); // Check deprecation logging if (empty($config->log_deprecated)) { diff --git a/administrator/index.php b/administrator/index.php index 75d1d5fb55a8e..c47e4bb494d0a 100644 --- a/administrator/index.php +++ b/administrator/index.php @@ -10,14 +10,14 @@ // NOTE: This file should remain compatible with PHP 5.2 to allow us to run our PHP minimum check and show a friendly error message // Define the application's minimum supported PHP version as a constant so it can be referenced within the application. -define('JOOMLA_MINIMUM_PHP', '8.1.0'); +\define('JOOMLA_MINIMUM_PHP', '8.1.0'); if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { die( str_replace( '{{phpversion}}', JOOMLA_MINIMUM_PHP, - file_get_contents(dirname(dirname(__FILE__)) . '/includes/incompatible.html') + file_get_contents(\dirname(\dirname(__FILE__)) . '/includes/incompatible.html') ) ); } @@ -26,7 +26,7 @@ * Constant that is checked in included files to prevent direct access. * define() is used rather than "const" to not error for PHP 5.2 and lower */ -define('_JEXEC', 1); +\define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once dirname(__FILE__) . '/includes/app.php'; +require_once \dirname(__FILE__) . '/includes/app.php'; diff --git a/administrator/modules/mod_custom/mod_custom.php b/administrator/modules/mod_custom/mod_custom.php index 05476b1e6f05f..fff0ea7ebba93 100644 --- a/administrator/modules/mod_custom/mod_custom.php +++ b/administrator/modules/mod_custom/mod_custom.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\Helper\ModuleHelper; use Joomla\CMS\HTML\HTMLHelper; diff --git a/administrator/modules/mod_feed/mod_feed.php b/administrator/modules/mod_feed/mod_feed.php index 3a3c9d760d88b..091f5c323f9cc 100644 --- a/administrator/modules/mod_feed/mod_feed.php +++ b/administrator/modules/mod_feed/mod_feed.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; $feed = \Joomla\Module\Feed\Administrator\Helper\FeedHelper::getFeed($params); $rssurl = $params->get('rssurl', ''); diff --git a/administrator/modules/mod_frontend/mod_frontend.php b/administrator/modules/mod_frontend/mod_frontend.php index 809d5fc671af8..30a2040ff5100 100644 --- a/administrator/modules/mod_frontend/mod_frontend.php +++ b/administrator/modules/mod_frontend/mod_frontend.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\Helper\ModuleHelper; diff --git a/administrator/modules/mod_guidedtours/services/provider.php b/administrator/modules/mod_guidedtours/services/provider.php index 04990a95b3816..a72859048ebda 100644 --- a/administrator/modules/mod_guidedtours/services/provider.php +++ b/administrator/modules/mod_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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/administrator/modules/mod_latest/mod_latest.php b/administrator/modules/mod_latest/mod_latest.php index e9e90f3085cdb..09f9f0b132a8b 100644 --- a/administrator/modules/mod_latest/mod_latest.php +++ b/administrator/modules/mod_latest/mod_latest.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\Component\ComponentHelper; use Joomla\CMS\Helper\ModuleHelper; @@ -27,7 +27,7 @@ $module->title = LatestHelper::getTitle($params); } -if (count($list)) { +if (\count($list)) { require ModuleHelper::getLayoutPath('mod_latest', $params->get('layout', 'default')); } else { $app->getLanguage()->load('com_content'); diff --git a/administrator/modules/mod_latestactions/mod_latestactions.php b/administrator/modules/mod_latestactions/mod_latestactions.php index 91e0a7f37427a..6672e1a38b002 100644 --- a/administrator/modules/mod_latestactions/mod_latestactions.php +++ b/administrator/modules/mod_latestactions/mod_latestactions.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\Helper\ModuleHelper; use Joomla\Module\LatestActions\Administrator\Helper\LatestActionsHelper; diff --git a/administrator/modules/mod_logged/mod_logged.php b/administrator/modules/mod_logged/mod_logged.php index 27a210d8570f3..e2aa197c39076 100644 --- a/administrator/modules/mod_logged/mod_logged.php +++ b/administrator/modules/mod_logged/mod_logged.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\Factory; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_login/mod_login.php b/administrator/modules/mod_login/mod_login.php index 25e009c372ce2..538a3628d8ad5 100644 --- a/administrator/modules/mod_login/mod_login.php +++ b/administrator/modules/mod_login/mod_login.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\Helper\AuthenticationHelper; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_loginsupport/mod_loginsupport.php b/administrator/modules/mod_loginsupport/mod_loginsupport.php index 77be815970ec0..a18fa6e566bc4 100644 --- a/administrator/modules/mod_loginsupport/mod_loginsupport.php +++ b/administrator/modules/mod_loginsupport/mod_loginsupport.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\Helper\ModuleHelper; use Joomla\CMS\Language\Text; diff --git a/administrator/modules/mod_menu/mod_menu.php b/administrator/modules/mod_menu/mod_menu.php index 754b3a753cede..ee03a43dd0df7 100644 --- a/administrator/modules/mod_menu/mod_menu.php +++ b/administrator/modules/mod_menu/mod_menu.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\Helper\ModuleHelper; use Joomla\Module\Menu\Administrator\Menu\CssMenu; diff --git a/administrator/modules/mod_menu/src/Menu/CssMenu.php b/administrator/modules/mod_menu/src/Menu/CssMenu.php index cbf908967090c..4e9c4fddd8e2a 100644 --- a/administrator/modules/mod_menu/src/Menu/CssMenu.php +++ b/administrator/modules/mod_menu/src/Menu/CssMenu.php @@ -413,7 +413,7 @@ protected function preprocess($parent) } // Exclude if link is invalid - if (is_null($item->link) || !\in_array($item->type, ['separator', 'heading', 'container']) && trim($item->link) === '') { + if (\is_null($item->link) || !\in_array($item->type, ['separator', 'heading', 'container']) && trim($item->link) === '') { $parent->removeChild($item); continue; } diff --git a/administrator/modules/mod_messages/mod_messages.php b/administrator/modules/mod_messages/mod_messages.php index 36ce8130708c9..3ba859aa80b2c 100644 --- a/administrator/modules/mod_messages/mod_messages.php +++ b/administrator/modules/mod_messages/mod_messages.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\Helper\ModuleHelper; @@ -31,6 +31,6 @@ $app->enqueueMessage($e->getMessage(), 'error'); } -$countUnread = count($messages); +$countUnread = \count($messages); require ModuleHelper::getLayoutPath('mod_messages', $params->get('layout', 'default')); diff --git a/administrator/modules/mod_multilangstatus/mod_multilangstatus.php b/administrator/modules/mod_multilangstatus/mod_multilangstatus.php index 959e1fb4fefe9..8193348594647 100644 --- a/administrator/modules/mod_multilangstatus/mod_multilangstatus.php +++ b/administrator/modules/mod_multilangstatus/mod_multilangstatus.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\Factory; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_popular/mod_popular.php b/administrator/modules/mod_popular/mod_popular.php index 87e0ae7ce75a2..1896c3d58aff5 100644 --- a/administrator/modules/mod_popular/mod_popular.php +++ b/administrator/modules/mod_popular/mod_popular.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\Component\ComponentHelper; use Joomla\CMS\Helper\ModuleHelper; @@ -34,7 +34,7 @@ } // If there are some articles to display. -if (count($list)) { +if (\count($list)) { require ModuleHelper::getLayoutPath('mod_popular', $params->get('layout', 'default')); return; diff --git a/administrator/modules/mod_post_installation_messages/mod_post_installation_messages.php b/administrator/modules/mod_post_installation_messages/mod_post_installation_messages.php index 9f9268c4ccf59..802c1bba90cc4 100644 --- a/administrator/modules/mod_post_installation_messages/mod_post_installation_messages.php +++ b/administrator/modules/mod_post_installation_messages/mod_post_installation_messages.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\Extension\ExtensionHelper; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_privacy_dashboard/mod_privacy_dashboard.php b/administrator/modules/mod_privacy_dashboard/mod_privacy_dashboard.php index 28c4bb5e75f88..73d007261eddf 100644 --- a/administrator/modules/mod_privacy_dashboard/mod_privacy_dashboard.php +++ b/administrator/modules/mod_privacy_dashboard/mod_privacy_dashboard.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\Helper\ModuleHelper; use Joomla\CMS\Layout\LayoutHelper; @@ -29,7 +29,7 @@ $list = PrivacyDashboardHelper::getData(); -if (count($list)) { +if (\count($list)) { require ModuleHelper::getLayoutPath('mod_privacy_dashboard', $params->get('layout', 'default')); } else { echo LayoutHelper::render('joomla.content.emptystate_module', [ diff --git a/administrator/modules/mod_privacy_status/mod_privacy_status.php b/administrator/modules/mod_privacy_status/mod_privacy_status.php index 69a74628c439f..3f31253333489 100644 --- a/administrator/modules/mod_privacy_status/mod_privacy_status.php +++ b/administrator/modules/mod_privacy_status/mod_privacy_status.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\Component\ComponentHelper; use Joomla\CMS\Factory; diff --git a/administrator/modules/mod_quickicon/services/provider.php b/administrator/modules/mod_quickicon/services/provider.php index b25f41022d315..dd546aaf4ac37 100644 --- a/administrator/modules/mod_quickicon/services/provider.php +++ b/administrator/modules/mod_quickicon/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/administrator/modules/mod_sampledata/mod_sampledata.php b/administrator/modules/mod_sampledata/mod_sampledata.php index 79ffb01326e69..7f15a7c4a8eec 100644 --- a/administrator/modules/mod_sampledata/mod_sampledata.php +++ b/administrator/modules/mod_sampledata/mod_sampledata.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; $items = \Joomla\Module\Sampledata\Administrator\Helper\SampledataHelper::getList(); diff --git a/administrator/modules/mod_stats_admin/mod_stats_admin.php b/administrator/modules/mod_stats_admin/mod_stats_admin.php index 49e9cb3f8c2d1..6b5e4c1bce172 100644 --- a/administrator/modules/mod_stats_admin/mod_stats_admin.php +++ b/administrator/modules/mod_stats_admin/mod_stats_admin.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\Factory; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_submenu/mod_submenu.php b/administrator/modules/mod_submenu/mod_submenu.php index 8a0a77e01f863..1a5ed3285d9a3 100644 --- a/administrator/modules/mod_submenu/mod_submenu.php +++ b/administrator/modules/mod_submenu/mod_submenu.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\Factory; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_title/mod_title.php b/administrator/modules/mod_title/mod_title.php index 3e1340ffba5f8..0644615f954f3 100644 --- a/administrator/modules/mod_title/mod_title.php +++ b/administrator/modules/mod_title/mod_title.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\Helper\ModuleHelper; diff --git a/administrator/modules/mod_toolbar/mod_toolbar.php b/administrator/modules/mod_toolbar/mod_toolbar.php index 4c1cb606e6f6a..31a579d9987ee 100644 --- a/administrator/modules/mod_toolbar/mod_toolbar.php +++ b/administrator/modules/mod_toolbar/mod_toolbar.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\Factory; use Joomla\CMS\Helper\ModuleHelper; diff --git a/administrator/modules/mod_user/mod_user.php b/administrator/modules/mod_user/mod_user.php index 5a2b27777d54a..a78693f73252a 100644 --- a/administrator/modules/mod_user/mod_user.php +++ b/administrator/modules/mod_user/mod_user.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\Helper\ModuleHelper; diff --git a/administrator/modules/mod_version/mod_version.php b/administrator/modules/mod_version/mod_version.php index c94b138b69e15..44df5077adcb2 100644 --- a/administrator/modules/mod_version/mod_version.php +++ b/administrator/modules/mod_version/mod_version.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; $version = \Joomla\Module\Version\Administrator\Helper\VersionHelper::getVersion(); diff --git a/administrator/templates/system/component.php b/administrator/templates/system/component.php index 672f4e6fb6648..cf30601fe5ff2 100644 --- a/administrator/templates/system/component.php +++ b/administrator/templates/system/component.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; /** @var \Joomla\CMS\Document\HtmlDocument $this */ ?> diff --git a/administrator/templates/system/error.php b/administrator/templates/system/error.php index a40d8ee77aba8..d469a07a1b1c9 100644 --- a/administrator/templates/system/error.php +++ b/administrator/templates/system/error.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\Language\Text; use Joomla\CMS\Router\Route; diff --git a/administrator/templates/system/index.php b/administrator/templates/system/index.php index c0d47db820eef..182c0492d94c4 100644 --- a/administrator/templates/system/index.php +++ b/administrator/templates/system/index.php @@ -8,6 +8,6 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; include __DIR__ . '/component.php'; diff --git a/api/components/com_content/src/Controller/ArticlesController.php b/api/components/com_content/src/Controller/ArticlesController.php index a9935bb3e0839..dff694fbb778f 100644 --- a/api/components/com_content/src/Controller/ArticlesController.php +++ b/api/components/com_content/src/Controller/ArticlesController.php @@ -83,11 +83,11 @@ public function displayList() $apiListInfo = $this->input->get('list', [], 'array'); - if (array_key_exists('ordering', $apiListInfo)) { + if (\array_key_exists('ordering', $apiListInfo)) { $this->modelState->set('list.ordering', $filter->clean($apiListInfo['ordering'], 'STRING')); } - if (array_key_exists('direction', $apiListInfo)) { + if (\array_key_exists('direction', $apiListInfo)) { $this->modelState->set('list.direction', $filter->clean($apiListInfo['direction'], 'STRING')); } diff --git a/api/components/com_media/src/Model/MediumModel.php b/api/components/com_media/src/Model/MediumModel.php index b316741c2cf3d..fee47d95dd300 100644 --- a/api/components/com_media/src/Model/MediumModel.php +++ b/api/components/com_media/src/Model/MediumModel.php @@ -138,7 +138,7 @@ public function save($path = null): string // com_media expects separate directory and file name. // If we moved the file before, we must use the new path. $basename = basename($resultPath ?: $path); - $dirname = dirname($resultPath ?: $path); + $dirname = \dirname($resultPath ?: $path); try { // If there is content, com_media's assumes the new item is a file. @@ -192,7 +192,7 @@ public function save($path = null): string // com_media expects separate directory and file name. // If we moved the file before, we must use the new path. $basename = basename($resultPath ?: $oldPath); - $dirname = dirname($resultPath ?: $oldPath); + $dirname = \dirname($resultPath ?: $oldPath); try { $this->mediaApiModel->updateFile( diff --git a/api/includes/app.php b/api/includes/app.php index 61559562e1469..5a1a04426038a 100644 --- a/api/includes/app.php +++ b/api/includes/app.php @@ -7,14 +7,14 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Saves the start time and memory usage. $startTime = microtime(1); $startMem = memory_get_usage(); -if (file_exists(dirname(__DIR__) . '/defines.php')) { - include_once dirname(__DIR__) . '/defines.php'; +if (file_exists(\dirname(__DIR__) . '/defines.php')) { + include_once \dirname(__DIR__) . '/defines.php'; } require_once __DIR__ . '/defines.php'; diff --git a/api/includes/defines.php b/api/includes/defines.php index bc05a4ac58f31..8f980ee1bfbf5 100644 --- a/api/includes/defines.php +++ b/api/includes/defines.php @@ -7,26 +7,26 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Define JPATH constants if not defined yet -defined('JPATH_BASE') || define('JPATH_BASE', dirname(__DIR__)); +\defined('JPATH_BASE') || \define('JPATH_BASE', \dirname(__DIR__)); // Global definitions $parts = explode(DIRECTORY_SEPARATOR, JPATH_BASE); array_pop($parts); // Defines -defined('JPATH_ROOT') || define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); -defined('JPATH_SITE') || define('JPATH_SITE', JPATH_ROOT); -defined('JPATH_PUBLIC') || define('JPATH_PUBLIC', JPATH_ROOT); -defined('JPATH_CONFIGURATION') || define('JPATH_CONFIGURATION', JPATH_ROOT); -defined('JPATH_ADMINISTRATOR') || define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); -defined('JPATH_LIBRARIES') || define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); -defined('JPATH_PLUGINS') || define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); -defined('JPATH_INSTALLATION') || define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); -defined('JPATH_THEMES') || define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); -defined('JPATH_CACHE') || define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); -defined('JPATH_MANIFESTS') || define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); -defined('JPATH_API') || define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); -defined('JPATH_CLI') || define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); +\defined('JPATH_ROOT') || \define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); +\defined('JPATH_SITE') || \define('JPATH_SITE', JPATH_ROOT); +\defined('JPATH_PUBLIC') || \define('JPATH_PUBLIC', JPATH_ROOT); +\defined('JPATH_CONFIGURATION') || \define('JPATH_CONFIGURATION', JPATH_ROOT); +\defined('JPATH_ADMINISTRATOR') || \define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); +\defined('JPATH_LIBRARIES') || \define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); +\defined('JPATH_PLUGINS') || \define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); +\defined('JPATH_INSTALLATION') || \define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); +\defined('JPATH_THEMES') || \define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); +\defined('JPATH_CACHE') || \define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); +\defined('JPATH_MANIFESTS') || \define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); +\defined('JPATH_API') || \define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); +\defined('JPATH_CLI') || \define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); diff --git a/api/includes/framework.php b/api/includes/framework.php index 305d924abd092..cacb8898df304 100644 --- a/api/includes/framework.php +++ b/api/includes/framework.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Version; use Joomla\Utilities\IpHelper; @@ -77,7 +77,7 @@ break; } -define('JDEBUG', $config->debug); +\define('JDEBUG', $config->debug); // Check deprecation logging if (empty($config->log_deprecated)) { diff --git a/api/index.php b/api/index.php index e315f987eef98..e8a1306cbcdae 100644 --- a/api/index.php +++ b/api/index.php @@ -10,7 +10,7 @@ // NOTE: This file should remain compatible with PHP 5.2 to allow us to run our PHP minimum check and show a friendly error message // Define the application's minimum supported PHP version as a constant so it can be referenced within the application. -define('JOOMLA_MINIMUM_PHP', '8.1.0'); +\define('JOOMLA_MINIMUM_PHP', '8.1.0'); if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { header('HTTP/1.1 500 Internal Server Error'); @@ -25,7 +25,7 @@ * Constant that is checked in included files to prevent direct access. * define() is used rather than "const" to not cause an error for PHP 5.2 and lower */ -define('_JEXEC', 1); +\define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once dirname(__FILE__) . '/includes/app.php'; +require_once \dirname(__FILE__) . '/includes/app.php'; diff --git a/build/build.php b/build/build.php index dc2ab73d895bd..657a87b7da45f 100644 --- a/build/build.php +++ b/build/build.php @@ -224,7 +224,7 @@ function clean_composer(string $dir) umask(022); // Shortcut the paths to the repository root and build folder -$repo = dirname(__DIR__); +$repo = \dirname(__DIR__); $here = __DIR__; // Set paths for the build packages @@ -325,7 +325,7 @@ function clean_composer(string $dir) echo "Workspace built.\n"; // Import the version class to set the version information -define('_JEXEC', 1); +\define('_JEXEC', 1); require_once $fullpath . '/libraries/src/Version.php'; // Set version information for the build @@ -476,17 +476,17 @@ function clean_composer(string $dir) $folderPath = explode('/', $fileName); $baseFolderName = $folderPath[0]; - $doNotPackageFile = in_array(trim($fileName), $doNotPackage); - $doNotPatchFile = in_array(trim($fileName), $doNotPatch); - $doNotPackageBaseFolder = in_array($baseFolderName, $doNotPackage); - $doNotPatchBaseFolder = in_array($baseFolderName, $doNotPatch); + $doNotPackageFile = \in_array(trim($fileName), $doNotPackage); + $doNotPatchFile = \in_array(trim($fileName), $doNotPatch); + $doNotPackageBaseFolder = \in_array($baseFolderName, $doNotPackage); + $doNotPatchBaseFolder = \in_array($baseFolderName, $doNotPatch); $dirtyHackForMediaCheck = false; // The raw files for the vue files are not packaged but are not a top level directory so aren't handled by the // above checks. This is dirty but a fairly performant fix for now until we can come up with something better. - if (count($folderPath) >= 4) { + if (\count($folderPath) >= 4) { $fullPath = [$folderPath[0] . '/' . $folderPath[1] . '/' . $folderPath[2] . '/' . $folderPath[3]]; - $dirtyHackForMediaCheck = in_array('administrator/components/com_media/resources', $fullPath); + $dirtyHackForMediaCheck = \in_array('administrator/components/com_media/resources', $fullPath); } if ($dirtyHackForMediaCheck || $doNotPackageFile || $doNotPatchFile || $doNotPackageBaseFolder || $doNotPatchBaseFolder) { diff --git a/build/bump.php b/build/bump.php index 46a16c13149bf..dec1c78643505 100644 --- a/build/bump.php +++ b/build/bump.php @@ -188,7 +188,7 @@ function usage($command) echo PHP_EOL; -$rootPath = dirname(__DIR__); +$rootPath = \dirname(__DIR__); // Updates the version in version class. if (file_exists($rootPath . $versionFile)) { @@ -282,7 +282,7 @@ function usage($command) } // Exclude certain files. - if (in_array($relativePath, $directoryLoopExcludeFiles)) { + if (\in_array($relativePath, $directoryLoopExcludeFiles)) { continue; } diff --git a/build/check_ruleset_xml.php b/build/check_ruleset_xml.php index 503d875fea3b7..f3ba91a7f51fc 100644 --- a/build/check_ruleset_xml.php +++ b/build/check_ruleset_xml.php @@ -21,7 +21,7 @@ function usage($command) echo 'Usage: php ' . $command . ' [options]' . PHP_EOL; echo PHP_EOL; echo "[options]:" . PHP_EOL; - echo "--file :\tPath to the PHPCS ruleset XML file to be checked, defaults to '" . dirname(__DIR__) . "/ruleset.xml'." . PHP_EOL; + echo "--file :\tPath to the PHPCS ruleset XML file to be checked, defaults to '" . \dirname(__DIR__) . "/ruleset.xml'." . PHP_EOL; echo "--fix:\t\tFix the XML file if any obsolete exclude patterns were found." . PHP_EOL; echo "--help:\t\tShow this help output." . PHP_EOL; echo PHP_EOL; @@ -35,7 +35,7 @@ function usage($command) exit(0); } -$rulesetFile = $options['file'] ?? dirname(__DIR__) . '/ruleset.xml'; +$rulesetFile = $options['file'] ?? \dirname(__DIR__) . '/ruleset.xml'; // Exclude patterns to be skipped from the check because the file or folder might not exist $ignoreList = [ @@ -55,7 +55,7 @@ function usage($command) continue; } - if (in_array($matches[1], $ignoreList)) { + if (\in_array($matches[1], $ignoreList)) { continue; } @@ -73,11 +73,11 @@ function usage($command) } if (substr($path, -1) === '/') { - if (!is_dir(dirname(__DIR__) . '/' . $path)) { + if (!is_dir(\dirname(__DIR__) . '/' . $path)) { echo 'Line no. ' . $line + 1 . ': Folder "' . $path . '" doesn\'t exist.' . PHP_EOL; $obsoleteLineIdxs[] = $line; } - } elseif (!is_file(dirname(__DIR__) . '/' . $path)) { + } elseif (!is_file(\dirname(__DIR__) . '/' . $path)) { echo 'Line no. ' . $line + 1 . ': File "' . $path . '" doesn\'t exist.' . PHP_EOL; $obsoleteLineIdxs[] = $line; } @@ -85,7 +85,7 @@ function usage($command) echo "... done." . PHP_EOL; -if (!count($obsoleteLineIdxs)) { +if (!\count($obsoleteLineIdxs)) { echo "No obsolete lines found." . PHP_EOL; exit(0); diff --git a/build/convert_or_die.php b/build/convert_or_die.php index b7d79b005d91a..7f7ae1f706281 100644 --- a/build/convert_or_die.php +++ b/build/convert_or_die.php @@ -6,7 +6,7 @@ function insertDefineOrDie($file, $keyword) { global $jexecfound, $skipped; - $realfile = dirname(__DIR__) . '/' . $file; + $realfile = \dirname(__DIR__) . '/' . $file; if (!file_exists($realfile)) { if ($file === 'plugins/task/checkfiles/checkfiles.php') { @@ -52,10 +52,10 @@ function insertDefineOrDie($file, $keyword) } array_splice($currentcontent, $insert + 1, $distance, [ - chr(10), - "// phpcs:disable PSR1.Files.SideEffects" . chr(10), - "\defined('" . $keyword . "') or die;" . chr(10), - "// phpcs:enable PSR1.Files.SideEffects" . chr(10), + \chr(10), + "// phpcs:disable PSR1.Files.SideEffects" . \chr(10), + "\defined('" . $keyword . "') or die;" . \chr(10), + "// phpcs:enable PSR1.Files.SideEffects" . \chr(10), ]); file_put_contents($realfile, implode('', $currentcontent)); @@ -186,7 +186,7 @@ function insertDefineOrDie($file, $keyword) } if ($keyword === '') { - if (!in_array($file, $additional)) { + if (!\in_array($file, $additional)) { $nojexec[$file] = $file; unset($skipped[$file]); continue; diff --git a/build/deleted_file_check.php b/build/deleted_file_check.php index ea7b011481bdd..fed50c63fb8cf 100644 --- a/build/deleted_file_check.php +++ b/build/deleted_file_check.php @@ -88,7 +88,7 @@ function usage($command) * @return bool True if you need to recurse or if the item is acceptable */ $previousReleaseFilter = function ($file, $key, $iterator) use ($previousReleaseExclude) { - if ($iterator->hasChildren() && !in_array($file->getPathname(), $previousReleaseExclude)) { + if ($iterator->hasChildren() && !\in_array($file->getPathname(), $previousReleaseExclude)) { return true; } @@ -108,7 +108,7 @@ function usage($command) * @return bool True if you need to recurse or if the item is acceptable */ $newReleaseFilter = function ($file, $key, $iterator) use ($newReleaseExclude) { - if ($iterator->hasChildren() && !in_array($file->getPathname(), $newReleaseExclude)) { + if ($iterator->hasChildren() && !\in_array($file->getPathname(), $newReleaseExclude)) { return true; } @@ -225,7 +225,7 @@ function usage($command) if ($matches !== false) { foreach ($matches as $match) { - if (dirname($match) === dirname($file) && strtolower(basename($match)) === strtolower(basename($file))) { + if (\dirname($match) === \dirname($file) && strtolower(basename($match)) === strtolower(basename($file))) { // File has been renamed only: Add to renamed files list $renamedFiles[] = substr($file, 0, -1) . ' => ' . $match; @@ -245,4 +245,4 @@ function usage($command) file_put_contents(__DIR__ . '/renamed_files.txt', implode("\n", $renamedFiles)); echo PHP_EOL; -echo 'There are ' . count($deletedFiles) . ' deleted files, ' . count($foldersDifference) . ' deleted folders and ' . count($renamedFiles) . ' renamed files in comparison to "' . $options['from'] . '"' . PHP_EOL; +echo 'There are ' . \count($deletedFiles) . ' deleted files, ' . \count($foldersDifference) . ' deleted folders and ' . \count($renamedFiles) . ' renamed files in comparison to "' . $options['from'] . '"' . PHP_EOL; diff --git a/build/helpTOC.php b/build/helpTOC.php index 6e533903c663f..53488957f8046 100644 --- a/build/helpTOC.php +++ b/build/helpTOC.php @@ -29,8 +29,8 @@ */ const JOOMLA_MINIMUM_PHP = '8.1.0'; -if (!defined('_JDEFINES')) { - define('JPATH_BASE', dirname(__DIR__)); +if (!\defined('_JDEFINES')) { + \define('JPATH_BASE', \dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } @@ -167,7 +167,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in } } - $io->comment(sprintf('Number of strings: %d', count($toc))); + $io->comment(sprintf('Number of strings: %d', \count($toc))); // JSON encode the file and write it to JPATH_ADMINISTRATOR/help/en-GB/toc.json file_put_contents(JPATH_ADMINISTRATOR . '/help/en-GB/toc.json', json_encode($toc)); diff --git a/build/stubGenerator.php b/build/stubGenerator.php index e29c39ea375fb..71437f51f37bd 100644 --- a/build/stubGenerator.php +++ b/build/stubGenerator.php @@ -17,12 +17,12 @@ use Joomla\CMS\Factory; // Load system defines -if (file_exists(dirname(__DIR__) . '/defines.php')) { - require_once dirname(__DIR__) . '/defines.php'; +if (file_exists(\dirname(__DIR__) . '/defines.php')) { + require_once \dirname(__DIR__) . '/defines.php'; } -if (!defined('_JDEFINES')) { - define('JPATH_BASE', dirname(__DIR__)); +if (!\defined('_JDEFINES')) { + \define('JPATH_BASE', \dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } @@ -94,7 +94,7 @@ public function doExecute() $fileContents .= "\t$modifier$type $className extends \\$newName {}\n\n"; - if (!array_key_exists($targetNamespace, $contentsByNamespace)) { + if (!\array_key_exists($targetNamespace, $contentsByNamespace)) { $contentsByNamespace[$targetNamespace] = ''; } diff --git a/build/update_fido_cache.php b/build/update_fido_cache.php index 186b2033328d8..9a048e8de954c 100644 --- a/build/update_fido_cache.php +++ b/build/update_fido_cache.php @@ -17,7 +17,7 @@ TEXT; if (!isset($fullPath)) { - $fullPath = dirname(__DIR__); + $fullPath = \dirname(__DIR__); } $filePath = rtrim($fullPath, '\\/') . '/plugins/system/webauthn/fido.jwt'; diff --git a/cli/joomla.php b/cli/joomla.php index c0cf73258a638..44870d75c072e 100755 --- a/cli/joomla.php +++ b/cli/joomla.php @@ -25,12 +25,12 @@ } // Load system defines -if (file_exists(dirname(__DIR__) . '/defines.php')) { - require_once dirname(__DIR__) . '/defines.php'; +if (file_exists(\dirname(__DIR__) . '/defines.php')) { + require_once \dirname(__DIR__) . '/defines.php'; } -if (!defined('_JDEFINES')) { - define('JPATH_BASE', dirname(__DIR__)); +if (!\defined('_JDEFINES')) { + \define('JPATH_BASE', \dirname(__DIR__)); require_once JPATH_BASE . '/includes/defines.php'; } diff --git a/components/com_ajax/ajax.php b/components/com_ajax/ajax.php index f4be6f9194ad1..f8aaceb484b36 100644 --- a/components/com_ajax/ajax.php +++ b/components/com_ajax/ajax.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\Event\Plugin\AjaxEvent; use Joomla\CMS\Factory; @@ -100,7 +100,7 @@ || $lang->load('mod_' . $module, $basePath . '/modules/mod_' . $module); try { - $results = call_user_func($class . '::' . $method . 'Ajax'); + $results = \call_user_func($class . '::' . $method . 'Ajax'); } catch (Exception $e) { $results = $e; } @@ -184,7 +184,7 @@ || $lang->load('tpl_' . $template, $basePath . '/templates/' . $template); try { - $results = call_user_func($class . '::' . $method . 'Ajax'); + $results = \call_user_func($class . '::' . $method . 'Ajax'); } catch (Exception $e) { $results = $e; } @@ -221,7 +221,7 @@ $app->setHeader('status', $results->getCode(), true); // Echo exception type and message - $out = get_class($results) . ': ' . $results->getMessage(); + $out = \get_class($results) . ': ' . $results->getMessage(); } elseif (is_scalar($results)) { // Output string/ null $out = (string) $results; diff --git a/components/com_banners/src/Model/BannersModel.php b/components/com_banners/src/Model/BannersModel.php index 28035214a7176..a7af743bde551 100644 --- a/components/com_banners/src/Model/BannersModel.php +++ b/components/com_banners/src/Model/BannersModel.php @@ -169,7 +169,7 @@ protected function getListQuery() $query->where($db->quoteName('a.catid') . $type . ':categoryId') ->bind(':categoryId', $categoryId, ParameterType::INTEGER); } - } elseif (is_array($categoryId) && (count($categoryId) > 0)) { + } elseif (\is_array($categoryId) && (\count($categoryId) > 0)) { $categoryId = ArrayHelper::toInteger($categoryId); if ($this->getState('filter.category_id.include', true)) { @@ -216,7 +216,7 @@ protected function getListQuery() . ' = SUBSTRING(' . $bounded[1] . ',1,LENGTH(' . $db->quoteName('cl.metakey_prefix') . '))' . ' OR ' . $db->quoteName('a.own_prefix') . ' = 0' . ' AND ' . $db->quoteName('cl.own_prefix') . ' = 0' - . ' AND ' . ($prefix == substr($keyword, 0, strlen($prefix)) ? '0 = 0' : '0 != 0'); + . ' AND ' . ($prefix == substr($keyword, 0, \strlen($prefix)) ? '0 = 0' : '0 != 0'); $condition2 = $db->quoteName('a.metakey') . ' ' . $query->regexp($bounded[2]); @@ -296,7 +296,7 @@ public function impress() $db = $this->getDatabase(); $bid = []; - if (!count($items)) { + if (!\count($items)) { return; } diff --git a/components/com_banners/src/Service/Router.php b/components/com_banners/src/Service/Router.php index e08e3c07feeef..ad7b74fa6b18d 100644 --- a/components/com_banners/src/Service/Router.php +++ b/components/com_banners/src/Service/Router.php @@ -80,7 +80,7 @@ public function parse(&$segments) $count--; $segment = array_shift($segments); - if (\is_numeric($segment)) { + if (is_numeric($segment)) { $vars['id'] = $segment; } else { $vars['task'] = $segment; @@ -90,7 +90,7 @@ public function parse(&$segments) if ($count) { $segment = array_shift($segments); - if (\is_numeric($segment)) { + if (is_numeric($segment)) { $vars['id'] = $segment; } } diff --git a/components/com_config/src/Model/FormModel.php b/components/com_config/src/Model/FormModel.php index e6fdbaf4f4d29..fa0ec9fd8de62 100644 --- a/components/com_config/src/Model/FormModel.php +++ b/components/com_config/src/Model/FormModel.php @@ -63,7 +63,7 @@ public function checkin($pk = null) } // Check if this is the user has previously checked out the row. - if (!is_null($table->checked_out) && $table->checked_out != $user->get('id') && !$user->authorise('core.admin', 'com_checkin')) { + if (!\is_null($table->checked_out) && $table->checked_out != $user->get('id') && !$user->authorise('core.admin', 'com_checkin')) { throw new \RuntimeException($table->getError()); } @@ -99,7 +99,7 @@ public function checkout($pk = null) } // Check if this is the user having previously checked out the row. - if (!is_null($table->checked_out) && $table->checked_out != $user->get('id')) { + if (!\is_null($table->checked_out) && $table->checked_out != $user->get('id')) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_CHECKOUT_USER_MISMATCH')); } diff --git a/components/com_config/src/Model/ModulesModel.php b/components/com_config/src/Model/ModulesModel.php index f37d5a8e231aa..bbd899c81d6b0 100644 --- a/components/com_config/src/Model/ModulesModel.php +++ b/components/com_config/src/Model/ModulesModel.php @@ -187,7 +187,7 @@ public static function getActivePositions($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/components/com_contact/src/Model/CategoriesModel.php b/components/com_contact/src/Model/CategoriesModel.php index 1e3e46b2901c8..e1801d8e5a017 100644 --- a/components/com_contact/src/Model/CategoriesModel.php +++ b/components/com_contact/src/Model/CategoriesModel.php @@ -128,7 +128,7 @@ public function getItems() $categories = Categories::getInstance('Contact', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); - if (is_object($this->_parent)) { + if (\is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); } else { $this->_items = false; @@ -147,7 +147,7 @@ public function getItems() */ public function getParent() { - if (!is_object($this->_parent)) { + if (!\is_object($this->_parent)) { $this->getItems(); } diff --git a/components/com_contact/src/Model/CategoryModel.php b/components/com_contact/src/Model/CategoryModel.php index c9e90cd62566b..ca35c872dc04a 100644 --- a/components/com_contact/src/Model/CategoryModel.php +++ b/components/com_contact/src/Model/CategoryModel.php @@ -136,7 +136,7 @@ public function getItems() // Load tags of all items. if ($taggedItems) { $tagsHelper = new TagsHelper(); - $itemIds = \array_keys($taggedItems); + $itemIds = array_keys($taggedItems); foreach ($tagsHelper->getMultipleItemTags('com_contact.contact', $itemIds) as $id => $tags) { $taggedItems[$id]->tags->itemTags = $tags; @@ -286,7 +286,7 @@ protected function populateState($ordering = null, $direction = null) $orderCol = $input->get('filter_order', $params->get('initial_sort', 'ordering')); - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } @@ -294,7 +294,7 @@ protected function populateState($ordering = null, $direction = null) $listOrder = $input->get('filter_order_Dir', 'ASC'); - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } @@ -325,7 +325,7 @@ protected function populateState($ordering = null, $direction = null) */ public function getCategory() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $app = Factory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); @@ -341,7 +341,7 @@ public function getCategory() $categories = Categories::getInstance('Contact', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); - if (is_object($this->_item)) { + if (\is_object($this->_item)) { $this->_children = $this->_item->getChildren(); $this->_parent = false; @@ -367,7 +367,7 @@ public function getCategory() */ public function getParent() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -381,7 +381,7 @@ public function getParent() */ public function &getLeftSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -395,7 +395,7 @@ public function &getLeftSibling() */ public function &getRightSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -409,7 +409,7 @@ public function &getRightSibling() */ public function &getChildren() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } diff --git a/components/com_contact/src/Model/ContactModel.php b/components/com_contact/src/Model/ContactModel.php index c75494373a0a8..a86a56a7879ab 100644 --- a/components/com_contact/src/Model/ContactModel.php +++ b/components/com_contact/src/Model/ContactModel.php @@ -261,9 +261,9 @@ public function getItem($pk = null) $groups = $user->getAuthorisedViewLevels(); if ($data->catid == 0 || $data->category_access === null) { - $data->params->set('access-view', in_array($data->access, $groups)); + $data->params->set('access-view', \in_array($data->access, $groups)); } else { - $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); + $data->params->set('access-view', \in_array($data->access, $groups) && \in_array($data->category_access, $groups)); } } diff --git a/components/com_contact/src/Model/FeaturedModel.php b/components/com_contact/src/Model/FeaturedModel.php index 43866457166ef..3211e27e0f5e9 100644 --- a/components/com_contact/src/Model/FeaturedModel.php +++ b/components/com_contact/src/Model/FeaturedModel.php @@ -64,7 +64,7 @@ public function getItems() $items = parent::getItems(); // Convert the params field into an object, saving original in _params - for ($i = 0, $n = count($items); $i < $n; $i++) { + for ($i = 0, $n = \count($items); $i < $n; $i++) { $item = &$items[$i]; if (!isset($this->_params)) { @@ -177,7 +177,7 @@ protected function populateState($ordering = null, $direction = null) $orderCol = $input->get('filter_order', 'ordering'); - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } @@ -185,7 +185,7 @@ protected function populateState($ordering = null, $direction = null) $listOrder = $input->get('filter_order_Dir', 'ASC'); - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } diff --git a/components/com_contact/src/View/Category/HtmlView.php b/components/com_contact/src/View/Category/HtmlView.php index 144d9ebd7a542..2932813e2af30 100644 --- a/components/com_contact/src/View/Category/HtmlView.php +++ b/components/com_contact/src/View/Category/HtmlView.php @@ -109,7 +109,7 @@ protected function prepareDocument() if ( $menu && $menu->component == 'com_contact' && isset($menu->query['view']) - && in_array($menu->query['view'], ['categories', 'category']) + && \in_array($menu->query['view'], ['categories', 'category']) ) { $id = $menu->query['id']; } else { diff --git a/components/com_contact/src/View/Contact/HtmlView.php b/components/com_contact/src/View/Contact/HtmlView.php index 7ed59308def36..ebeda332b207d 100644 --- a/components/com_contact/src/View/Contact/HtmlView.php +++ b/components/com_contact/src/View/Contact/HtmlView.php @@ -193,14 +193,14 @@ 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); } // Check if access is not public $groups = $user->getAuthorisedViewLevels(); - if (!in_array($item->access, $groups) || !in_array($item->category_access, $groups)) { + if (!\in_array($item->access, $groups) || !\in_array($item->category_access, $groups)) { $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->setHeader('status', 403, true); @@ -314,7 +314,7 @@ public function display($tpl = null) } // Add links to contacts - if ($item->params->get('show_contact_list') && count($contacts) > 1) { + if ($item->params->get('show_contact_list') && \count($contacts) > 1) { foreach ($contacts as &$contact) { $contact->link = Route::_(RouteHelper::getContactRoute($contact->slug, $contact->catid, $contact->language)); } @@ -422,7 +422,7 @@ protected function _prepareDocument() // Get ID of the category from active menu item if ( $menu && $menu->component == 'com_contact' && isset($menu->query['view']) - && in_array($menu->query['view'], ['categories', 'category']) + && \in_array($menu->query['view'], ['categories', 'category']) ) { $id = $menu->query['id']; } else { diff --git a/components/com_contact/src/View/Contact/VcfView.php b/components/com_contact/src/View/Contact/VcfView.php index 40821068062ca..6f4dfefc45794 100644 --- a/components/com_contact/src/View/Contact/VcfView.php +++ b/components/com_contact/src/View/Contact/VcfView.php @@ -47,7 +47,7 @@ public function display($tpl = null) $item = $this->get('Item'); // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -60,7 +60,7 @@ public function display($tpl = null) // e.g. "de Gaulle, Charles" $namearray = explode(',', $item->name); - if (count($namearray) > 1) { + if (\count($namearray) > 1) { $lastname = $namearray[0]; $card_name = $lastname; $name_and_midname = trim($namearray[1]); @@ -71,16 +71,16 @@ public function display($tpl = null) $namearray = explode(' ', $name_and_midname); $firstname = $namearray[0]; - $middlename = (count($namearray) > 1) ? $namearray[1] : ''; + $middlename = (\count($namearray) > 1) ? $namearray[1] : ''; $card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name; } } else { // "Firstname Middlename Lastname" format support $namearray = explode(' ', $item->name); - $middlename = (count($namearray) > 2) ? $namearray[1] : ''; + $middlename = (\count($namearray) > 2) ? $namearray[1] : ''; $firstname = array_shift($namearray); - $lastname = count($namearray) ? end($namearray) : ''; + $lastname = \count($namearray) ? end($namearray) : ''; $card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : ''); } diff --git a/components/com_contact/src/View/Featured/HtmlView.php b/components/com_contact/src/View/Featured/HtmlView.php index 51ef02becb4f8..9f6dfe7276b79 100644 --- a/components/com_contact/src/View/Featured/HtmlView.php +++ b/components/com_contact/src/View/Featured/HtmlView.php @@ -99,13 +99,13 @@ public function display($tpl = null) $pagination->hideEmptyLimitstart = true; // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } // Prepare the data. // Compute the contact slug. - for ($i = 0, $n = count($items); $i < $n; $i++) { + for ($i = 0, $n = \count($items); $i < $n; $i++) { $item = &$items[$i]; $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; $temp = $item->params; diff --git a/components/com_contact/src/View/Form/HtmlView.php b/components/com_contact/src/View/Form/HtmlView.php index 7c428a75a405a..370e3c5af2e75 100644 --- a/components/com_contact/src/View/Form/HtmlView.php +++ b/components/com_contact/src/View/Form/HtmlView.php @@ -86,7 +86,7 @@ public function display($tpl = null) $this->return_page = $this->get('ReturnPage'); if (empty($this->item->id)) { - $authorised = $user->authorise('core.create', 'com_contact') || count($user->getAuthorisedCategories('com_contact', 'core.create')); + $authorised = $user->authorise('core.create', 'com_contact') || \count($user->getAuthorisedCategories('com_contact', 'core.create')); } else { // Since we don't track these assets at the item level, use the category id. $canDo = ContactHelper::getActions('com_contact', 'category', $this->item->catid); @@ -107,7 +107,7 @@ public function display($tpl = null) } // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { $app->enqueueMessage(implode("\n", $errors), 'error'); return false; diff --git a/components/com_content/src/Controller/ArticleController.php b/components/com_content/src/Controller/ArticleController.php index 381535b81ec92..2b7bc43a9d61e 100644 --- a/components/com_content/src/Controller/ArticleController.php +++ b/components/com_content/src/Controller/ArticleController.php @@ -182,7 +182,7 @@ public function cancel($key = 'a_id') $lang = ''; if (Multilanguage::isEnabled()) { - $lang = !is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; + $lang = !\is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; } // Redirect to the user specified return page. @@ -199,7 +199,7 @@ public function cancel($key = 'a_id') $item = $app->getMenu()->getItem($menuitemId); if (Multilanguage::isEnabled()) { - $lang = !is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; + $lang = !\is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; } // Redirect to the general (redirect_menuitem) user specified return page. @@ -359,7 +359,7 @@ public function save($key = null, $urlVar = 'a_id') if (Multilanguage::isEnabled()) { $item = $app->getMenu()->getItem($menuitem); - $lang = !is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; + $lang = !\is_null($item) && $item->language != '*' ? '&lang=' . $item->language : ''; } // If ok, redirect to the return page. diff --git a/components/com_content/src/Dispatcher/Dispatcher.php b/components/com_content/src/Dispatcher/Dispatcher.php index f93a512204524..4b6e81d041b71 100644 --- a/components/com_content/src/Dispatcher/Dispatcher.php +++ b/components/com_content/src/Dispatcher/Dispatcher.php @@ -39,11 +39,11 @@ public function dispatch() if ($checkCreateEdit) { // Can create in any category (component permission) or at least in one category $canCreateRecords = $this->app->getIdentity()->authorise('core.create', 'com_content') - || count($this->app->getIdentity()->getAuthorisedCategories('com_content', 'core.create')) > 0; + || \count($this->app->getIdentity()->getAuthorisedCategories('com_content', 'core.create')) > 0; // Instead of checking edit on all records, we can use **same** check as the form editing view $values = (array) $this->app->getUserState('com_content.edit.article.id'); - $isEditingRecords = count($values); + $isEditingRecords = \count($values); $hasAccess = $canCreateRecords || $isEditingRecords; if (!$hasAccess) { diff --git a/components/com_content/src/Helper/AssociationHelper.php b/components/com_content/src/Helper/AssociationHelper.php index 3e4b89f998f2c..45ce2595abd4c 100644 --- a/components/com_content/src/Helper/AssociationHelper.php +++ b/components/com_content/src/Helper/AssociationHelper.php @@ -127,17 +127,17 @@ public static function displayAssociations($id) } // Do not display language without frontend UI - if (!array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) { + if (!\array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) { continue; } // Do not display language without specific home menu - if (!array_key_exists($language->lang_code, Multilanguage::getSiteHomePages())) { + if (!\array_key_exists($language->lang_code, Multilanguage::getSiteHomePages())) { continue; } // Do not display language without authorized access level - if (isset($language->access) && $language->access && !in_array($language->access, $levels)) { + if (isset($language->access) && $language->access && !\in_array($language->access, $levels)) { continue; } diff --git a/components/com_content/src/Model/ArchiveModel.php b/components/com_content/src/Model/ArchiveModel.php index 66df84c761dd0..ed3da6326daa3 100644 --- a/components/com_content/src/Model/ArchiveModel.php +++ b/components/com_content/src/Model/ArchiveModel.php @@ -123,7 +123,7 @@ protected function getListQuery() ->bind(':year', $year, ParameterType::INTEGER); } - if (count($catids) > 0) { + if (\count($catids) > 0) { $query->whereIn($db->quoteName('c.id'), $catids); } diff --git a/components/com_content/src/Model/ArticleModel.php b/components/com_content/src/Model/ArticleModel.php index 8243fdb75bf9b..5a2114607363e 100644 --- a/components/com_content/src/Model/ArticleModel.php +++ b/components/com_content/src/Model/ArticleModel.php @@ -258,9 +258,9 @@ public function getItem($pk = null) $groups = $user->getAuthorisedViewLevels(); if ($data->catid == 0 || $data->category_access === null) { - $data->params->set('access-view', in_array($data->access, $groups)); + $data->params->set('access-view', \in_array($data->access, $groups)); } else { - $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); + $data->params->set('access-view', \in_array($data->access, $groups) && \in_array($data->category_access, $groups)); } } diff --git a/components/com_content/src/Model/ArticlesModel.php b/components/com_content/src/Model/ArticlesModel.php index a851ab2f14ffd..acda4d0217aa3 100644 --- a/components/com_content/src/Model/ArticlesModel.php +++ b/components/com_content/src/Model/ArticlesModel.php @@ -105,7 +105,7 @@ protected function populateState($ordering = 'ordering', $direction = 'ASC') $orderCol = $input->get('filter_order', 'a.ordering'); - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } @@ -113,7 +113,7 @@ protected function populateState($ordering = 'ordering', $direction = 'ASC') $listOrder = $input->get('filter_order_Dir', 'ASC'); - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } @@ -335,7 +335,7 @@ protected function getListQuery() // Category has to be published $query->where($db->quoteName('c.published') . ' = 1 AND ' . $db->quoteName('a.state') . ' = :condition') ->bind(':condition', $condition, ParameterType::INTEGER); - } elseif (is_array($condition)) { + } elseif (\is_array($condition)) { // Category has to be published $query->where( $db->quoteName('c.published') . ' = 1 AND ' . $db->quoteName('a.state') @@ -387,7 +387,7 @@ protected function getListQuery() $type = $this->getState('filter.article_id.include', true) ? ' = ' : ' <> '; $query->where($db->quoteName('a.id') . $type . ':articleId') ->bind(':articleId', $articleId, ParameterType::INTEGER); - } elseif (is_array($articleId)) { + } elseif (\is_array($articleId)) { $articleId = ArrayHelper::toInteger($articleId); if ($this->getState('filter.article_id.include', true)) { @@ -438,7 +438,7 @@ protected function getListQuery() $query->where($db->quoteName('a.catid') . $type . ':categoryId'); $query->bind(':categoryId', $categoryId, ParameterType::INTEGER); } - } elseif (is_array($categoryId) && (count($categoryId) > 0)) { + } elseif (\is_array($categoryId) && (\count($categoryId) > 0)) { $categoryId = ArrayHelper::toInteger($categoryId); if (!empty($categoryId)) { @@ -459,7 +459,7 @@ protected function getListQuery() $type = $this->getState('filter.author_id.include', true) ? ' = ' : ' <> '; $authorWhere = $db->quoteName('a.created_by') . $type . ':authorId'; $query->bind(':authorId', $authorId, ParameterType::INTEGER); - } elseif (is_array($authorId)) { + } elseif (\is_array($authorId)) { $authorId = array_values(array_filter($authorId, 'is_numeric')); if ($authorId) { @@ -472,7 +472,7 @@ protected function getListQuery() $authorAlias = $this->getState('filter.author_alias'); $authorAliasWhere = ''; - if (is_string($authorAlias)) { + if (\is_string($authorAlias)) { $type = $this->getState('filter.author_alias.include', true) ? ' = ' : ' <> '; $authorAliasWhere = $db->quoteName('a.created_by_alias') . $type . ':authorAlias'; $query->bind(':authorAlias', $authorAlias); @@ -540,7 +540,7 @@ protected function getListQuery() } // Process the filter for list views with user-entered filters - if (is_object($params) && ($params->get('filter_field') !== 'hide') && ($filter = $this->getState('list.filter'))) { + if (\is_object($params) && ($params->get('filter_field') !== 'hide') && ($filter = $this->getState('list.filter'))) { // Clean filter variable $filter = StringHelper::strtolower($filter); $monthFilter = $filter; @@ -594,11 +594,11 @@ protected function getListQuery() // Filter by a single or group of tags. $tagId = $this->getState('filter.tag'); - if (is_array($tagId) && count($tagId) === 1) { + if (\is_array($tagId) && \count($tagId) === 1) { $tagId = current($tagId); } - if (is_array($tagId)) { + if (\is_array($tagId)) { $tagId = ArrayHelper::toInteger($tagId); if ($tagId) { @@ -698,7 +698,7 @@ public function getItems() } // Merge the selected article params - if (count($articleArray) > 0) { + if (\count($articleArray) > 0) { $articleParams = new Registry($articleArray); $item->params->merge($articleParams); } @@ -750,9 +750,9 @@ public function getItems() } else { // If no access filter is set, the layout takes some responsibility for display of limited information. if ($item->catid == 0 || $item->category_access === null) { - $item->params->set('access-view', in_array($item->access, $groups)); + $item->params->set('access-view', \in_array($item->access, $groups)); } else { - $item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups)); + $item->params->set('access-view', \in_array($item->access, $groups) && \in_array($item->category_access, $groups)); } } @@ -770,7 +770,7 @@ public function getItems() // Load tags of all items. if ($taggedItems) { $tagsHelper = new TagsHelper(); - $itemIds = \array_keys($taggedItems); + $itemIds = array_keys($taggedItems); foreach ($tagsHelper->getMultipleItemTags('com_content.article', $itemIds) as $id => $tags) { $taggedItems[$id]->tags->itemTags = $tags; diff --git a/components/com_content/src/Model/CategoriesModel.php b/components/com_content/src/Model/CategoriesModel.php index 6a6c1167252a3..5c25dc5f4227e 100644 --- a/components/com_content/src/Model/CategoriesModel.php +++ b/components/com_content/src/Model/CategoriesModel.php @@ -127,7 +127,7 @@ public function getItems($recursive = false) $categories = Categories::getInstance('Content', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); - if (is_object($this->_parent)) { + if (\is_object($this->_parent)) { $this->cache[$store] = $this->_parent->getChildren($recursive); } else { $this->cache[$store] = false; @@ -146,7 +146,7 @@ public function getItems($recursive = false) */ public function getParent() { - if (!is_object($this->_parent)) { + if (!\is_object($this->_parent)) { $this->getItems(); } diff --git a/components/com_content/src/Model/CategoryModel.php b/components/com_content/src/Model/CategoryModel.php index 5793b014e8aa4..674a2bd238409 100644 --- a/components/com_content/src/Model/CategoryModel.php +++ b/components/com_content/src/Model/CategoryModel.php @@ -177,7 +177,7 @@ protected function populateState($ordering = null, $direction = null) // Filter.order $orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } @@ -185,7 +185,7 @@ protected function populateState($ordering = null, $direction = null) $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } @@ -284,11 +284,11 @@ protected function _buildContentOrderBy() $orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); $orderby = ' '; - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = null; } - if (!in_array(strtoupper($orderDirn), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($orderDirn), ['ASC', 'DESC', ''])) { $orderDirn = 'ASC'; } @@ -332,7 +332,7 @@ public function getPagination() */ public function getCategory() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { if (isset($this->state->params)) { $params = $this->state->params; $options = []; @@ -346,7 +346,7 @@ public function getCategory() $this->_item = $categories->get($this->getState('category.id', 'root')); // Compute selected asset permissions. - if (is_object($this->_item)) { + if (\is_object($this->_item)) { $user = $this->getCurrentUser(); $asset = 'com_content.category.' . $this->_item->id; @@ -383,7 +383,7 @@ public function getCategory() */ public function getParent() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -399,7 +399,7 @@ public function getParent() */ public function &getLeftSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -415,7 +415,7 @@ public function &getLeftSibling() */ public function &getRightSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -431,7 +431,7 @@ public function &getRightSibling() */ public function &getChildren() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } diff --git a/components/com_content/src/Model/FeaturedModel.php b/components/com_content/src/Model/FeaturedModel.php index a26f1e25241d1..bb32df96614f9 100644 --- a/components/com_content/src/Model/FeaturedModel.php +++ b/components/com_content/src/Model/FeaturedModel.php @@ -159,7 +159,7 @@ protected function getListQuery() // Filter by categories $featuredCategories = $this->getState('filter.frontpage.categories'); - if (is_array($featuredCategories) && !in_array('', $featuredCategories)) { + if (\is_array($featuredCategories) && !\in_array('', $featuredCategories)) { $query->where('a.catid IN (' . implode(',', ArrayHelper::toInteger($featuredCategories)) . ')'); } diff --git a/components/com_content/src/View/Archive/HtmlView.php b/components/com_content/src/View/Archive/HtmlView.php index a027142f17a6b..526c502fda38d 100644 --- a/components/com_content/src/View/Archive/HtmlView.php +++ b/components/com_content/src/View/Archive/HtmlView.php @@ -196,7 +196,7 @@ public function display($tpl = null) $years = []; $years[] = HTMLHelper::_('select.option', null, Text::_('JYEAR')); - for ($i = 0, $iMax = count($this->years); $i < $iMax; $i++) { + for ($i = 0, $iMax = \count($this->years); $i < $iMax; $i++) { $years[] = HTMLHelper::_('select.option', $this->years[$i], $this->years[$i]); } diff --git a/components/com_content/src/View/Article/HtmlView.php b/components/com_content/src/View/Article/HtmlView.php index 3abc25ae1fbde..b67bbf701ce7b 100644 --- a/components/com_content/src/View/Article/HtmlView.php +++ b/components/com_content/src/View/Article/HtmlView.php @@ -113,7 +113,7 @@ public function display($tpl = null) $this->user = $user; // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -189,7 +189,7 @@ public function display($tpl = null) * - Deny access to logged users with 403 code * NOTE: we do not recheck for no access-view + show_noauth disabled ... since it was checked above */ - if ($item->params->get('access-view') == false && !strlen($item->fulltext)) { + if ($item->params->get('access-view') == false && !\strlen($item->fulltext)) { if ($this->user->get('guest')) { $return = base64_encode(Uri::getInstance()); $login_url_with_return = Route::_('index.php?option=com_users&view=login&return=' . $return); @@ -288,7 +288,7 @@ protected function _prepareDocument() // Get ID of the category from active menu item if ( $menu && $menu->component == 'com_content' && isset($menu->query['view']) - && in_array($menu->query['view'], ['categories', 'category']) + && \in_array($menu->query['view'], ['categories', 'category']) ) { $id = $menu->query['id']; } else { diff --git a/components/com_content/src/View/Category/HtmlView.php b/components/com_content/src/View/Category/HtmlView.php index 3fb4c8779b6d0..e367adf7d50bb 100644 --- a/components/com_content/src/View/Category/HtmlView.php +++ b/components/com_content/src/View/Category/HtmlView.php @@ -163,7 +163,7 @@ public function display($tpl = null) $this->getDocument()->setMetaData('robots', $this->params->get('robots')); } - if (!is_object($this->category->metadata)) { + if (!\is_object($this->category->metadata)) { $this->category->metadata = new Registry($this->category->metadata); } @@ -203,7 +203,7 @@ protected function prepareDocument() if ( $menu && $menu->component == 'com_content' && isset($menu->query['view']) - && in_array($menu->query['view'], ['categories', 'category']) + && \in_array($menu->query['view'], ['categories', 'category']) ) { $id = $menu->query['id']; } else { diff --git a/components/com_content/src/View/Featured/HtmlView.php b/components/com_content/src/View/Featured/HtmlView.php index 110dae0d2aa22..270dde180f857 100644 --- a/components/com_content/src/View/Featured/HtmlView.php +++ b/components/com_content/src/View/Featured/HtmlView.php @@ -125,7 +125,7 @@ public function display($tpl = null) $pagination->hideEmptyLimitstart = true; // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -173,7 +173,7 @@ public function display($tpl = null) // Preprocess the breakdown of leading, intro and linked articles. // This makes it much easier for the designer to just integrate the arrays. - $max = count($items); + $max = \count($items); // The first group is the leading articles. $limit = $numLeading; diff --git a/components/com_content/src/View/Form/HtmlView.php b/components/com_content/src/View/Form/HtmlView.php index e6b2253198fb2..7663d028e486f 100644 --- a/components/com_content/src/View/Form/HtmlView.php +++ b/components/com_content/src/View/Form/HtmlView.php @@ -125,7 +125,7 @@ public function display($tpl = null) if ($this->state->params->get('enable_category') == 1 && $catid) { $authorised = $user->authorise('core.create', 'com_content.category.' . $catid); } else { - $authorised = $user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create')); + $authorised = $user->authorise('core.create', 'com_content') || \count($user->getAuthorisedCategories('com_content', 'core.create')); } } else { $authorised = $this->item->params->get('access-edit'); @@ -153,7 +153,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/components/com_finder/src/Helper/RouteHelper.php b/components/com_finder/src/Helper/RouteHelper.php index 32c8a2d5169ed..a8df7499f8386 100644 --- a/components/com_finder/src/Helper/RouteHelper.php +++ b/components/com_finder/src/Helper/RouteHelper.php @@ -120,7 +120,7 @@ public static function getItemid($query) $menu = $app->getMenu(); $active = $menu->getActive(); $items = $menu->getItems('component_id', $com->id); - $items = is_array($items) ? $items : []; + $items = \is_array($items) ? $items : []; } // Try to match the active view and filter. diff --git a/components/com_finder/src/Model/SearchModel.php b/components/com_finder/src/Model/SearchModel.php index 9df36d2329cd0..acfbae9802bf5 100644 --- a/components/com_finder/src/Model/SearchModel.php +++ b/components/com_finder/src/Model/SearchModel.php @@ -114,7 +114,7 @@ public function getItems() // Convert the rows to result objects. foreach ($items as $rk => $row) { // Build the result object. - if (is_resource($row->object)) { + if (\is_resource($row->object)) { $result = unserialize(stream_get_contents($row->object)); } else { $result = unserialize($row->object); @@ -191,13 +191,13 @@ protected function getListQuery() if (!empty($this->searchquery->filters)) { // Convert the associative array to a numerically indexed array. $groups = array_values($this->searchquery->filters); - $taxonomies = call_user_func_array('array_merge', array_values($this->searchquery->filters)); + $taxonomies = \call_user_func_array('array_merge', array_values($this->searchquery->filters)); $query->join('INNER', $db->quoteName('#__finder_taxonomy_map') . ' AS t ON t.link_id = l.link_id') ->where('t.node_id IN (' . implode(',', array_unique($taxonomies)) . ')'); // Iterate through each taxonomy group. - for ($i = 0, $c = count($groups); $i < $c; $i++) { + for ($i = 0, $c = \count($groups); $i < $c; $i++) { $query->having('SUM(CASE WHEN t.node_id IN (' . implode(',', $groups[$i]) . ') THEN 1 ELSE 0 END) > 0'); } } @@ -289,12 +289,12 @@ protected function getListQuery() return $query; } - $included = call_user_func_array('array_merge', array_values($this->includedTerms)); + $included = \call_user_func_array('array_merge', array_values($this->includedTerms)); $query->join('INNER', $db->quoteName('#__finder_links_terms') . ' AS m ON m.link_id = l.link_id') ->where('m.term_id IN (' . implode(',', $included) . ')'); // Check if there are any excluded terms to deal with. - if (count($this->excludedTerms)) { + if (\count($this->excludedTerms)) { $query2 = $db->getQuery(true); $query2->select('e.link_id') ->from($db->quoteName('#__finder_links_terms', 'e')) @@ -305,9 +305,9 @@ protected function getListQuery() /* * The query contains required search terms. */ - if (count($this->requiredTerms)) { + if (\count($this->requiredTerms)) { foreach ($this->requiredTerms as $terms) { - if (count($terms)) { + if (\count($terms)) { $query->having('SUM(CASE WHEN m.term_id IN (' . implode(',', $terms) . ') THEN 1 ELSE 0 END) > 0'); } else { $query->where('false'); @@ -341,7 +341,7 @@ public function getSortOrderFields() $queryUri = Uri::getInstance($this->getQuery()->toUri()); // If the default field is not included in the shown sort fields, add it. - if (!in_array($defaultSortFieldValue, $sortOrderFieldValues)) { + if (!\in_array($defaultSortFieldValue, $sortOrderFieldValues)) { array_unshift($sortOrderFieldValues, $defaultSortFieldValue); } @@ -390,7 +390,7 @@ protected function getSortField(string $value, string $direction, Uri $queryUri) $currentOrderingDirection = $app->getInput()->getWord('od', $app->getParams()->get('sort_direction', 'desc')); // Validate the sorting direction and add it only if it is different than the set in the params. - if (in_array($direction, ['asc', 'desc']) && $direction != $app->getParams()->get('sort_direction', 'desc')) { + if (\in_array($direction, ['asc', 'desc']) && $direction != $app->getParams()->get('sort_direction', 'desc')) { $queryUri->setVar('od', StringHelper::strtolower($direction)); } diff --git a/components/com_finder/src/Model/SuggestionsModel.php b/components/com_finder/src/Model/SuggestionsModel.php index c68740fbe78f1..7ae65bbf1920b 100644 --- a/components/com_finder/src/Model/SuggestionsModel.php +++ b/components/com_finder/src/Model/SuggestionsModel.php @@ -88,7 +88,7 @@ protected function getListQuery() $termIds = $db->setQuery($termIdQuery, 0, 100)->loadColumn(); // Early return on term mismatch - if (!count($termIds)) { + if (!\count($termIds)) { return $termIdQuery; } diff --git a/components/com_finder/src/View/Search/HtmlView.php b/components/com_finder/src/View/Search/HtmlView.php index c15e3384b4bd6..c06fbdf37119c 100644 --- a/components/com_finder/src/View/Search/HtmlView.php +++ b/components/com_finder/src/View/Search/HtmlView.php @@ -155,7 +155,7 @@ public function display($tpl = null) $this->pagination->hideEmptyLimitstart = true; // Check for errors. - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -175,7 +175,7 @@ public function display($tpl = null) } // Run an event on each result item - if (is_array($this->results)) { + if (\is_array($this->results)) { $dispatcher = $this->getDispatcher(); // Import Finder plugins diff --git a/components/com_newsfeeds/src/Model/CategoriesModel.php b/components/com_newsfeeds/src/Model/CategoriesModel.php index dd891aece8d43..6ad7b106849a2 100644 --- a/components/com_newsfeeds/src/Model/CategoriesModel.php +++ b/components/com_newsfeeds/src/Model/CategoriesModel.php @@ -130,7 +130,7 @@ public function getItems() $categories = Categories::getInstance('Newsfeeds', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); - if (is_object($this->_parent)) { + if (\is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); } else { $this->_items = false; @@ -147,7 +147,7 @@ public function getItems() */ public function getParent() { - if (!is_object($this->_parent)) { + if (!\is_object($this->_parent)) { $this->getItems(); } diff --git a/components/com_newsfeeds/src/Model/CategoryModel.php b/components/com_newsfeeds/src/Model/CategoryModel.php index 284d750dfbc8e..c979ee6958f46 100644 --- a/components/com_newsfeeds/src/Model/CategoryModel.php +++ b/components/com_newsfeeds/src/Model/CategoryModel.php @@ -133,7 +133,7 @@ public function getItems() // Load tags of all items. if ($taggedItems) { $tagsHelper = new TagsHelper(); - $itemIds = \array_keys($taggedItems); + $itemIds = array_keys($taggedItems); foreach ($tagsHelper->getMultipleItemTags('com_newsfeeds.newsfeed', $itemIds) as $id => $tags) { $taggedItems[$id]->tags->itemTags = $tags; @@ -260,7 +260,7 @@ protected function populateState($ordering = null, $direction = null) $orderCol = $input->get('filter_order', 'ordering'); - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } @@ -268,7 +268,7 @@ protected function populateState($ordering = null, $direction = null) $listOrder = $input->get('filter_order_Dir', 'ASC'); - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } @@ -299,7 +299,7 @@ protected function populateState($ordering = null, $direction = null) */ public function getCategory() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $app = Factory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); @@ -315,7 +315,7 @@ public function getCategory() $categories = Categories::getInstance('Newsfeeds', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); - if (is_object($this->_item)) { + if (\is_object($this->_item)) { $this->_children = $this->_item->getChildren(); $this->_parent = false; @@ -341,7 +341,7 @@ public function getCategory() */ public function getParent() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -355,7 +355,7 @@ public function getParent() */ public function &getLeftSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -369,7 +369,7 @@ public function &getLeftSibling() */ public function &getRightSibling() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } @@ -383,7 +383,7 @@ public function &getRightSibling() */ public function &getChildren() { - if (!is_object($this->_item)) { + if (!\is_object($this->_item)) { $this->getCategory(); } diff --git a/components/com_newsfeeds/src/Model/NewsfeedModel.php b/components/com_newsfeeds/src/Model/NewsfeedModel.php index 15417df06a0d7..154e30e1defdd 100644 --- a/components/com_newsfeeds/src/Model/NewsfeedModel.php +++ b/components/com_newsfeeds/src/Model/NewsfeedModel.php @@ -186,7 +186,7 @@ public function &getItem($pk = null) // If no access filter is set, the layout takes some responsibility for display of limited information. $user = $this->getCurrentUser(); $groups = $user->getAuthorisedViewLevels(); - $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); + $data->params->set('access-view', \in_array($data->access, $groups) && \in_array($data->category_access, $groups)); } $this->_item[$pk] = $data; diff --git a/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php b/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php index e02e4a038db43..0d9f50fdffb53 100644 --- a/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php +++ b/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php @@ -107,7 +107,7 @@ public function display($tpl = null) // Check for errors. // @TODO: Maybe this could go into ComponentHelper::raiseErrors($this->get('Errors')) - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -163,7 +163,7 @@ public function display($tpl = null) // Check the access to the newsfeed $levels = $user->getAuthorisedViewLevels(); - if (!in_array($item->access, $levels) || (in_array($item->access, $levels) && (!in_array($item->category_access, $levels)))) { + if (!\in_array($item->access, $levels) || (\in_array($item->access, $levels) && (!\in_array($item->category_access, $levels)))) { $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->setHeader('status', 403, true); diff --git a/components/com_privacy/src/Controller/DisplayController.php b/components/com_privacy/src/Controller/DisplayController.php index 579b37a1237df..4f631b6a506ce 100644 --- a/components/com_privacy/src/Controller/DisplayController.php +++ b/components/com_privacy/src/Controller/DisplayController.php @@ -40,7 +40,7 @@ public function display($cachable = false, $urlparams = []) $view = $this->input->get('view', $this->default_view); // Submitting information requests and confirmation through the frontend is restricted to authenticated users at this time - if (in_array($view, ['confirm', 'request']) && $this->app->getIdentity()->guest) { + if (\in_array($view, ['confirm', 'request']) && $this->app->getIdentity()->guest) { $this->setRedirect( Route::_('index.php?option=com_users&view=login&return=' . base64_encode('index.php?option=com_privacy&view=' . $view), false) ); @@ -49,7 +49,7 @@ public function display($cachable = false, $urlparams = []) } // Set a Referrer-Policy header for views which require it - if (in_array($view, ['confirm', 'remind'])) { + if (\in_array($view, ['confirm', 'remind'])) { $this->app->setHeader('Referrer-Policy', 'no-referrer', true); } diff --git a/components/com_privacy/src/View/Confirm/HtmlView.php b/components/com_privacy/src/View/Confirm/HtmlView.php index 798848aefbdb8..8fc24825e7e46 100644 --- a/components/com_privacy/src/View/Confirm/HtmlView.php +++ b/components/com_privacy/src/View/Confirm/HtmlView.php @@ -79,7 +79,7 @@ public function display($tpl = null) $this->params = $this->state->params; // 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/components/com_privacy/src/View/Remind/HtmlView.php b/components/com_privacy/src/View/Remind/HtmlView.php index b0edb354f21f2..a2f8f1b163a0c 100644 --- a/components/com_privacy/src/View/Remind/HtmlView.php +++ b/components/com_privacy/src/View/Remind/HtmlView.php @@ -79,7 +79,7 @@ public function display($tpl = null) $this->params = $this->state->params; // 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/components/com_privacy/src/View/Request/HtmlView.php b/components/com_privacy/src/View/Request/HtmlView.php index ff20fe80af0a1..0904f392c6186 100644 --- a/components/com_privacy/src/View/Request/HtmlView.php +++ b/components/com_privacy/src/View/Request/HtmlView.php @@ -88,7 +88,7 @@ public function display($tpl = null) $this->sendMailEnabled = (bool) Factory::getApplication()->get('mailonline', 1); // 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/components/com_tags/src/Helper/RouteHelper.php b/components/com_tags/src/Helper/RouteHelper.php index 78b51fd233064..98d11dd42a957 100644 --- a/components/com_tags/src/Helper/RouteHelper.php +++ b/components/com_tags/src/Helper/RouteHelper.php @@ -110,7 +110,7 @@ public static function getTagRoute($id) public static function getComponentTagRoute(string $id, string $language = '*'): string { // We actually would want to allow arrays of tags here, but can't due to B/C - if (!is_array($id)) { + if (!\is_array($id)) { if ($id < 1) { return ''; } @@ -120,7 +120,7 @@ public static function getComponentTagRoute(string $id, string $language = '*'): $id = array_values(array_filter($id)); - if (!count($id)) { + if (!\count($id)) { return ''; } @@ -206,9 +206,9 @@ protected static function _findItem($needles = null) } // Only match menu items that list one tag - if (isset($item->query['id']) && is_array($item->query['id'])) { + if (isset($item->query['id']) && \is_array($item->query['id'])) { foreach ($item->query['id'] as $position => $tagId) { - if (!isset(self::$lookup[$lang][$view][$item->query['id'][$position]]) || count($item->query['id']) == 1) { + if (!isset(self::$lookup[$lang][$view][$item->query['id'][$position]]) || \count($item->query['id']) == 1) { self::$lookup[$lang][$view][$item->query['id'][$position]] = $item->id; } } diff --git a/components/com_tags/src/Model/TagModel.php b/components/com_tags/src/Model/TagModel.php index 39d464506daa7..2467f26716f1f 100644 --- a/components/com_tags/src/Model/TagModel.php +++ b/components/com_tags/src/Model/TagModel.php @@ -185,7 +185,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') // Load state from the request. $ids = (array) $app->getInput()->get('id', [], 'string'); - if (count($ids) == 1) { + if (\count($ids) == 1) { $ids = explode(',', $ids[0]); } @@ -234,7 +234,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') $orderCol = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); $orderCol = !$orderCol ? $this->state->params->get('tag_list_orderby', 'c.core_title') : $orderCol; - if (!in_array($orderCol, $this->filter_fields)) { + if (!\in_array($orderCol, $this->filter_fields)) { $orderCol = 'c.core_title'; } @@ -243,7 +243,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') $listOrder = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order_direction', 'filter_order_Dir', '', 'string'); $listOrder = !$listOrder ? $this->state->params->get('tag_list_orderby_direction', 'ASC') : $listOrder; - if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { + if (!\in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } @@ -267,7 +267,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') */ public function getItem($pk = null) { - if (!count($this->item)) { + if (!\count($this->item)) { if (empty($pk)) { $pk = $this->getState('tag.id'); } @@ -290,7 +290,7 @@ public function getItem($pk = null) } } - if (!in_array($table->access, $this->getCurrentUser()->getAuthorisedViewLevels())) { + if (!\in_array($table->access, $this->getCurrentUser()->getAuthorisedViewLevels())) { continue; } @@ -304,7 +304,7 @@ public function getItem($pk = null) } } - if (count($this->item) != count($idsArray)) { + if (\count($this->item) != \count($idsArray)) { throw new \Exception(Text::_('COM_TAGS_TAG_NOT_FOUND'), 404); } } diff --git a/components/com_tags/src/Service/Router.php b/components/com_tags/src/Service/Router.php index a425a8008ce1e..8efdda701f696 100644 --- a/components/com_tags/src/Service/Router.php +++ b/components/com_tags/src/Service/Router.php @@ -109,7 +109,7 @@ public function preprocess($query) } } elseif (isset($query['view']) && $query['view'] === 'tag') { if (isset($query['id'])) { - if (!is_array($query['id'])) { + if (!\is_array($query['id'])) { $query['id'] = [$query['id']]; } @@ -172,7 +172,7 @@ public function build(&$query) if ($menuItem->query['view'] == 'tags' && isset($query['id'])) { $ids = $query['id']; - if (!is_array($ids)) { + if (!\is_array($ids)) { $ids = [$ids]; } @@ -190,7 +190,7 @@ public function build(&$query) * We check if there is a difference between the tags of the menu item and the query. * If they are identical, we exactly match the menu item. Otherwise we append all tags to the URL */ - if (count(array_diff($int_ids, $mIds)) > 0 || count(array_diff($mIds, $int_ids)) > 0) { + if (\count(array_diff($int_ids, $mIds)) > 0 || \count(array_diff($mIds, $int_ids)) > 0) { foreach ($ids as $id) { $segments[] = $id; } @@ -204,7 +204,7 @@ public function build(&$query) $segments[] = $query['view']; unset($query['view'], $query['Itemid']); - if (isset($query['id']) && is_array($query['id'])) { + if (isset($query['id']) && \is_array($query['id'])) { foreach ($query['id'] as $id) { $segments[] = $id; } @@ -255,12 +255,12 @@ public function parse(&$segments) $ids = $item->query['id']; } - while (count($segments)) { + while (\count($segments)) { $id = array_shift($segments); $ids[] = $this->fixSegment($id); } - if (count($ids)) { + if (\count($ids)) { $vars['id'] = $ids; $vars['view'] = 'tag'; } @@ -306,8 +306,8 @@ protected function buildLookup() foreach ($this->lookup as $language => $items) { // We have tags views with parent_id set and need to load child tags to be assigned to this menu item if ( - count($this->lookup[$language]['tags']) > 1 - || (count($this->lookup[$language]['tags']) == 1 && !isset($this->lookup[$language]['tags'][0])) + \count($this->lookup[$language]['tags']) > 1 + || (\count($this->lookup[$language]['tags']) == 1 && !isset($this->lookup[$language]['tags'][0])) ) { foreach ($this->lookup[$language]['tags'] as $id => $menu) { if ($id === 0) { diff --git a/components/com_tags/src/View/Tag/HtmlView.php b/components/com_tags/src/View/Tag/HtmlView.php index ea7fe01455d10..56b4b5d035bec 100644 --- a/components/com_tags/src/View/Tag/HtmlView.php +++ b/components/com_tags/src/View/Tag/HtmlView.php @@ -146,7 +146,7 @@ public function display($tpl = null) // Flag indicates to not add limitstart=0 to URL $this->pagination->hideEmptyLimitstart = true; - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -162,7 +162,7 @@ public function display($tpl = null) $temp = new Registry($itemElement->params); // If the current view is the active item and a tag view for at least this tag, then the menu item params take priority - if ($query['option'] == 'com_tags' && $query['view'] == 'tag' && in_array($itemElement->id, $query['id'])) { + if ($query['option'] == 'com_tags' && $query['view'] == 'tag' && \in_array($itemElement->id, $query['id'])) { // Merge so that the menu item params take priority $itemElement->params = $temp; $itemElement->params->merge($this->params); @@ -289,7 +289,7 @@ protected function _prepareDocument() } } - if (count($this->item) === 1) { + if (\count($this->item) === 1) { foreach ($this->item[0]->metadata->toArray() as $k => $v) { if ($v) { $this->getDocument()->setMetaData($k, $v); diff --git a/components/com_tags/src/View/Tags/HtmlView.php b/components/com_tags/src/View/Tags/HtmlView.php index 3782ab138a2af..2f5a7e7ff59c0 100644 --- a/components/com_tags/src/View/Tags/HtmlView.php +++ b/components/com_tags/src/View/Tags/HtmlView.php @@ -93,7 +93,7 @@ public function display($tpl = null) $this->params = $this->state->get('params'); $this->user = $this->getCurrentUser(); - if (count($errors = $this->get('Errors'))) { + if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } diff --git a/components/com_users/src/Controller/DisplayController.php b/components/com_users/src/Controller/DisplayController.php index 51ebdefc0c399..6d9b827df0e89 100644 --- a/components/com_users/src/Controller/DisplayController.php +++ b/components/com_users/src/Controller/DisplayController.php @@ -122,7 +122,7 @@ public function display($cachable = false, $urlparams = false) } // Make sure we don't send a referer - if (in_array($vName, ['remind', 'reset'])) { + if (\in_array($vName, ['remind', 'reset'])) { $this->app->setHeader('Referrer-Policy', 'no-referrer', true); } diff --git a/components/com_users/src/Controller/ProfileController.php b/components/com_users/src/Controller/ProfileController.php index 4ee53fa500af9..d2277af632da2 100644 --- a/components/com_users/src/Controller/ProfileController.php +++ b/components/com_users/src/Controller/ProfileController.php @@ -125,7 +125,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) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { diff --git a/components/com_users/src/Controller/RegistrationController.php b/components/com_users/src/Controller/RegistrationController.php index 95c3895f1a589..2f12250c07973 100644 --- a/components/com_users/src/Controller/RegistrationController.php +++ b/components/com_users/src/Controller/RegistrationController.php @@ -61,7 +61,7 @@ public function activate() $token = $input->getAlnum('token'); // Check that the token is in a valid format. - if ($token === null || strlen($token) !== 32) { + if ($token === null || \strlen($token) !== 32) { throw new \Exception(Text::_('JINVALID_TOKEN'), 403); } @@ -175,7 +175,7 @@ public function register() $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(), 'error'); } else { diff --git a/components/com_users/src/Model/ProfileModel.php b/components/com_users/src/Model/ProfileModel.php index 4ce182d56ffc9..9b8e1ec0acebc 100644 --- a/components/com_users/src/Model/ProfileModel.php +++ b/components/com_users/src/Model/ProfileModel.php @@ -131,7 +131,7 @@ public function getForm($data = [], $loadData = true) if ($username) { $isUsernameCompliant = !(preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $username) - || strlen(mb_convert_encoding($username, 'ISO-8859-1', 'UTF-8')) < 2 + || \strlen(mb_convert_encoding($username, 'ISO-8859-1', 'UTF-8')) < 2 || trim($username) !== $username); } diff --git a/components/com_users/src/Model/RegistrationModel.php b/components/com_users/src/Model/RegistrationModel.php index 869b8423fa18a..673553fe6a916 100644 --- a/components/com_users/src/Model/RegistrationModel.php +++ b/components/com_users/src/Model/RegistrationModel.php @@ -280,7 +280,7 @@ public function getData() foreach ($temp as $k => $v) { // Here we could have a grouped field, let's check it - if (is_array($v)) { + if (\is_array($v)) { $this->data->$k = new \stdClass(); foreach ($v as $key => $val) { @@ -601,7 +601,7 @@ public function register($temp) return false; } - if (count($userids) > 0) { + if (\count($userids) > 0) { $jdate = new Date(); $dateToSql = $jdate->toSql(); $subject = Text::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT'); diff --git a/components/com_users/src/Rule/LoginUniqueFieldRule.php b/components/com_users/src/Rule/LoginUniqueFieldRule.php index ee3bee40f781e..44891f7084820 100644 --- a/components/com_users/src/Rule/LoginUniqueFieldRule.php +++ b/components/com_users/src/Rule/LoginUniqueFieldRule.php @@ -49,11 +49,11 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry $loginRedirectMenuitem = $input['params']->login_redirect_menuitem; if ($form === null) { - throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', get_class($this))); + throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', \get_class($this))); } if ($input === null) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', get_class($this))); + throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); } // Test the input values for login. diff --git a/components/com_users/src/Rule/LogoutUniqueFieldRule.php b/components/com_users/src/Rule/LogoutUniqueFieldRule.php index 7e26ca78a4961..e387311426344 100644 --- a/components/com_users/src/Rule/LogoutUniqueFieldRule.php +++ b/components/com_users/src/Rule/LogoutUniqueFieldRule.php @@ -49,11 +49,11 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry $logoutRedirectMenuitem = $input['params']->logout_redirect_menuitem; if ($form === null) { - throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', get_class($this))); + throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', \get_class($this))); } if ($input === null) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', get_class($this))); + throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); } // Test the input values for logout. diff --git a/components/com_users/src/View/Login/HtmlView.php b/components/com_users/src/View/Login/HtmlView.php index 8d994edffb061..25dbab1724748 100644 --- a/components/com_users/src/View/Login/HtmlView.php +++ b/components/com_users/src/View/Login/HtmlView.php @@ -102,7 +102,7 @@ public function display($tpl = null) $this->params = $this->state->get('params'); // 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/components/com_users/src/View/Profile/HtmlView.php b/components/com_users/src/View/Profile/HtmlView.php index 06f7c89b34074..6cca57149707c 100644 --- a/components/com_users/src/View/Profile/HtmlView.php +++ b/components/com_users/src/View/Profile/HtmlView.php @@ -111,7 +111,7 @@ public function display($tpl = null) $this->db = Factory::getDbo(); // 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/components/com_users/src/View/Registration/HtmlView.php b/components/com_users/src/View/Registration/HtmlView.php index ea2985e85a518..5e3cd0c4d8063 100644 --- a/components/com_users/src/View/Registration/HtmlView.php +++ b/components/com_users/src/View/Registration/HtmlView.php @@ -99,7 +99,7 @@ public function display($tpl = null) $this->params = $this->state->get('params'); // 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/components/com_users/src/View/Remind/HtmlView.php b/components/com_users/src/View/Remind/HtmlView.php index dbee8ab10e461..1f0820d97b9f4 100644 --- a/components/com_users/src/View/Remind/HtmlView.php +++ b/components/com_users/src/View/Remind/HtmlView.php @@ -73,7 +73,7 @@ public function display($tpl = null) $this->params = $this->state->params; // 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/components/com_users/src/View/Reset/HtmlView.php b/components/com_users/src/View/Reset/HtmlView.php index 2c469bf6b1c4d..53481c9f382b3 100644 --- a/components/com_users/src/View/Reset/HtmlView.php +++ b/components/com_users/src/View/Reset/HtmlView.php @@ -70,7 +70,7 @@ public function display($tpl = null) $name = $this->getLayout(); // Check that the name is valid - has an associated model. - if (!in_array($name, ['confirm', 'complete'])) { + if (!\in_array($name, ['confirm', 'complete'])) { $name = 'default'; } @@ -86,7 +86,7 @@ public function display($tpl = null) $this->params = $this->state->params; // 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/includes/app.php b/includes/app.php index 649a588260712..349c7446f75cb 100644 --- a/includes/app.php +++ b/includes/app.php @@ -7,14 +7,14 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Saves the start time and memory usage. $startTime = microtime(1); $startMem = memory_get_usage(); -if (file_exists(dirname(__DIR__) . '/defines.php')) { - include_once dirname(__DIR__) . '/defines.php'; +if (file_exists(\dirname(__DIR__) . '/defines.php')) { + include_once \dirname(__DIR__) . '/defines.php'; } require_once __DIR__ . '/defines.php'; diff --git a/includes/defines.php b/includes/defines.php index cf156324c5cb6..23420179bb6f2 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -7,20 +7,20 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Define JPATH constants if not defined yet -defined('JPATH_BASE') || define('JPATH_BASE', dirname(__DIR__)); -defined('JPATH_ROOT') || define('JPATH_ROOT', JPATH_BASE); -defined('JPATH_SITE') || define('JPATH_SITE', JPATH_ROOT); -defined('JPATH_PUBLIC') || define('JPATH_PUBLIC', JPATH_ROOT); -defined('JPATH_CONFIGURATION') || define('JPATH_CONFIGURATION', JPATH_ROOT); -defined('JPATH_ADMINISTRATOR') || define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); -defined('JPATH_LIBRARIES') || define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); -defined('JPATH_PLUGINS') || define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); -defined('JPATH_INSTALLATION') || define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); -defined('JPATH_THEMES') || define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); -defined('JPATH_CACHE') || define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); -defined('JPATH_MANIFESTS') || define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); -defined('JPATH_API') || define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); -defined('JPATH_CLI') || define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); +\defined('JPATH_BASE') || \define('JPATH_BASE', \dirname(__DIR__)); +\defined('JPATH_ROOT') || \define('JPATH_ROOT', JPATH_BASE); +\defined('JPATH_SITE') || \define('JPATH_SITE', JPATH_ROOT); +\defined('JPATH_PUBLIC') || \define('JPATH_PUBLIC', JPATH_ROOT); +\defined('JPATH_CONFIGURATION') || \define('JPATH_CONFIGURATION', JPATH_ROOT); +\defined('JPATH_ADMINISTRATOR') || \define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); +\defined('JPATH_LIBRARIES') || \define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); +\defined('JPATH_PLUGINS') || \define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); +\defined('JPATH_INSTALLATION') || \define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); +\defined('JPATH_THEMES') || \define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); +\defined('JPATH_CACHE') || \define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); +\defined('JPATH_MANIFESTS') || \define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); +\defined('JPATH_API') || \define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); +\defined('JPATH_CLI') || \define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); diff --git a/includes/framework.php b/includes/framework.php index 2cb506561d78f..ca0f22d3e407d 100644 --- a/includes/framework.php +++ b/includes/framework.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Version; use Joomla\Utilities\IpHelper; @@ -77,8 +77,8 @@ break; } -if (!defined('JDEBUG')) { - define('JDEBUG', $config->debug); +if (!\defined('JDEBUG')) { + \define('JDEBUG', $config->debug); } // Check deprecation logging diff --git a/installation/includes/app.php b/installation/includes/app.php index 5378d6ae1fa16..ca11a3dbfcf89 100644 --- a/installation/includes/app.php +++ b/installation/includes/app.php @@ -8,10 +8,10 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Define the base path and require the other defines -define('JPATH_BASE', dirname(__DIR__)); +\define('JPATH_BASE', \dirname(__DIR__)); require_once __DIR__ . '/defines.php'; diff --git a/installation/includes/cli.php b/installation/includes/cli.php index e305bf09bd4be..26332b69c7fa0 100644 --- a/installation/includes/cli.php +++ b/installation/includes/cli.php @@ -8,10 +8,10 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Define the base path and require the other defines -define('JPATH_BASE', dirname(__DIR__)); +\define('JPATH_BASE', \dirname(__DIR__)); require_once __DIR__ . '/defines.php'; diff --git a/installation/includes/defines.php b/installation/includes/defines.php index 1f94b7a344471..fa8ee2578e5ce 100644 --- a/installation/includes/defines.php +++ b/installation/includes/defines.php @@ -8,23 +8,23 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Global definitions $parts = explode(DIRECTORY_SEPARATOR, JPATH_BASE); array_pop($parts); // Defines -define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); -define('JPATH_SITE', JPATH_ROOT); -define('JPATH_PUBLIC', JPATH_ROOT); -define('JPATH_CONFIGURATION', JPATH_ROOT); -define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); -define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); -define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); -define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); -define('JPATH_THEMES', JPATH_BASE); -define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); -define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); -define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); -define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); +\define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts)); +\define('JPATH_SITE', JPATH_ROOT); +\define('JPATH_PUBLIC', JPATH_ROOT); +\define('JPATH_CONFIGURATION', JPATH_ROOT); +\define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); +\define('JPATH_LIBRARIES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'libraries'); +\define('JPATH_PLUGINS', JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins'); +\define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); +\define('JPATH_THEMES', JPATH_BASE); +\define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); +\define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); +\define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); +\define('JPATH_CLI', JPATH_ROOT . DIRECTORY_SEPARATOR . 'cli'); diff --git a/installation/includes/framework.php b/installation/includes/framework.php index a414acff3db99..cf88f9b57b8a5 100644 --- a/installation/includes/framework.php +++ b/installation/includes/framework.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; // Ensure sensible default for JDEBUG is set. const JDEBUG = false; diff --git a/installation/index.php b/installation/index.php index 95c9f428c178f..163297bc31829 100644 --- a/installation/index.php +++ b/installation/index.php @@ -10,14 +10,14 @@ // NOTE: This file should remain compatible with PHP 5.2 to allow us to run our PHP minimum check and show a friendly error message // Define the application's minimum supported PHP version as a constant so it can be referenced within the application. -define('JOOMLA_MINIMUM_PHP', '8.1.0'); +\define('JOOMLA_MINIMUM_PHP', '8.1.0'); if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { die( str_replace( '{{phpversion}}', JOOMLA_MINIMUM_PHP, - file_get_contents(dirname(__FILE__) . '/../templates/system/incompatible.html') + file_get_contents(\dirname(__FILE__) . '/../templates/system/incompatible.html') ) ); } @@ -26,7 +26,7 @@ * Constant that is checked in included files to prevent direct access. * define() is used rather than "const" to not error for PHP 5.2 and lower */ -define('_JEXEC', 1); +\define('_JEXEC', 1); // Run the application - All executable code should be triggered through this file -require_once dirname(__FILE__) . '/includes/app.php'; +require_once \dirname(__FILE__) . '/includes/app.php'; diff --git a/installation/joomla.php b/installation/joomla.php index 08893f79d0b3b..7e1910dbfdafa 100644 --- a/installation/joomla.php +++ b/installation/joomla.php @@ -14,7 +14,7 @@ /** * Define the application's minimum supported PHP version as a constant so it can be referenced within the application. */ -define('JOOMLA_MINIMUM_PHP', '7.2.5'); +\define('JOOMLA_MINIMUM_PHP', '7.2.5'); if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { echo 'Sorry, your PHP version is not supported.' . PHP_EOL; @@ -30,10 +30,10 @@ * Constant that is checked in included files to prevent direct access. * define() is used rather than "const" to not error for PHP 5.2 and lower */ -define('_JEXEC', 1); +\define('_JEXEC', 1); // Constant to identify the CLI installation -define('_JCLI_INSTALLATION', 1); +\define('_JCLI_INSTALLATION', 1); // Run the application - All executable code should be triggered through this file -require_once dirname(__FILE__) . '/includes/cli.php'; +require_once \dirname(__FILE__) . '/includes/cli.php'; diff --git a/installation/src/Application/InstallationApplication.php b/installation/src/Application/InstallationApplication.php index dc64e11ea83d5..543b0f8c2f921 100644 --- a/installation/src/Application/InstallationApplication.php +++ b/installation/src/Application/InstallationApplication.php @@ -118,7 +118,7 @@ public function debugLanguage() $errorfiles = $lang->getErrorFiles(); - if (count($errorfiles)) { + if (\count($errorfiles)) { $output .= '
    '; foreach ($errorfiles as $error) { @@ -134,7 +134,7 @@ public function debugLanguage() $output .= '
    ';
             $orphans = $lang->getOrphans();
     
    -        if (count($orphans)) {
    +        if (\count($orphans)) {
                 ksort($orphans, SORT_STRING);
     
                 $guesses = [];
    @@ -144,7 +144,7 @@ public function debugLanguage()
     
                     $parts = explode(' ', $guess);
     
    -                if (count($parts) > 1) {
    +                if (\count($parts) > 1) {
                         array_shift($parts);
                         $guess = implode(' ', $parts);
                     }
    diff --git a/installation/src/Console/InstallCommand.php b/installation/src/Console/InstallCommand.php
    index 6e27e0821055f..667dfe5b6caee 100644
    --- a/installation/src/Console/InstallCommand.php
    +++ b/installation/src/Console/InstallCommand.php
    @@ -358,7 +358,7 @@ protected function getStringFromOption($option, $question, FormField $field): st
             if ($givenOption || !$this->cliInput->isInteractive()) {
                 $answer = $this->getApplication()->getConsoleInput()->getOption($option);
     
    -            if (!is_string($answer)) {
    +            if (!\is_string($answer)) {
                     throw new \Exception($option . ' has been declared, but has not been given!');
                 }
     
    @@ -373,7 +373,7 @@ protected function getStringFromOption($option, $question, FormField $field): st
     
             // We don't have a CLI option and now interactively get that from the user.
             while (\is_null($answer) || $answer === false) {
    -            if (in_array($option, ['admin-password', 'db-pass', 'public_folder'])) {
    +            if (\in_array($option, ['admin-password', 'db-pass', 'public_folder'])) {
                     $answer = $this->ioStyle->askHidden($question);
                 } else {
                     $answer = $this->ioStyle->ask(
    diff --git a/installation/src/Controller/InstallationController.php b/installation/src/Controller/InstallationController.php
    index f19066c5f57a9..558f5fe20d34f 100644
    --- a/installation/src/Controller/InstallationController.php
    +++ b/installation/src/Controller/InstallationController.php
    @@ -170,7 +170,7 @@ public function populate()
             $schema     = $files[$step];
             $serverType = $db->getServerType();
     
    -        if (in_array($step, ['custom1', 'custom2']) && !is_file(JPATH_INSTALLATION . '/sql/' . $serverType . '/' . $schema . '.sql')) {
    +        if (\in_array($step, ['custom1', 'custom2']) && !is_file(JPATH_INSTALLATION . '/sql/' . $serverType . '/' . $schema . '.sql')) {
                 $this->sendJsonResponse($r);
     
                 return;
    diff --git a/installation/src/Controller/JSONController.php b/installation/src/Controller/JSONController.php
    index 9e4e561b37fa8..2d224e00f8a94 100644
    --- a/installation/src/Controller/JSONController.php
    +++ b/installation/src/Controller/JSONController.php
    @@ -43,7 +43,7 @@ protected function sendJsonResponse($response)
             $this->app->mimeType = 'application/json';
     
             // Very crude workaround to give an error message when JSON is disabled
    -        if (!function_exists('json_encode') || !function_exists('json_decode')) {
    +        if (!\function_exists('json_encode') || !\function_exists('json_decode')) {
                 $this->app->setHeader('status', 500);
                 echo '{"token":"' . Session::getFormToken(true) . '","lang":"' . Factory::getLanguage()->getTag()
                     . '","error":true,"header":"' . Text::_('INSTL_HEADER_ERROR') . '","message":"' . Text::_('INSTL_WARNJSON') . '"}';
    diff --git a/installation/src/Form/Rule/UsernameRule.php b/installation/src/Form/Rule/UsernameRule.php
    index 7442286d988d7..b1f9402b860b0 100644
    --- a/installation/src/Form/Rule/UsernameRule.php
    +++ b/installation/src/Form/Rule/UsernameRule.php
    @@ -44,9 +44,9 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry
     
             if (
                 preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $value)
    -            || strlen(mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8')) < 2
    +            || \strlen(mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8')) < 2
                 || $filterInput->clean($value, 'TRIM') !== $value
    -            || strlen(mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8')) > $element['size']
    +            || \strlen(mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8')) > $element['size']
             ) {
                 return false;
             }
    diff --git a/installation/src/Helper/DatabaseHelper.php b/installation/src/Helper/DatabaseHelper.php
    index d7511c376695f..aa4f1351a7fb1 100644
    --- a/installation/src/Helper/DatabaseHelper.php
    +++ b/installation/src/Helper/DatabaseHelper.php
    @@ -156,7 +156,7 @@ public static function getMinimumServerVersion($db, $options)
             $minDbVersionRequired = $db->getMinimum();
     
             // Get minimum database version required by the CMS
    -        if (in_array($options->db_type, ['mysql', 'mysqli'])) {
    +        if (\in_array($options->db_type, ['mysql', 'mysqli'])) {
                 if ($db->isMariaDb()) {
                     $minDbVersionCms = self::$dbMinimumMariaDb;
                 } else {
    @@ -202,7 +202,7 @@ public static function validateConnectionParameters($options)
             }
     
             // Validate length of database name.
    -        if (strlen($options->db_name) > 64) {
    +        if (\strlen($options->db_name) > 64) {
                 return Text::_('INSTL_DATABASE_NAME_TOO_LONG');
             }
     
    @@ -212,21 +212,21 @@ public static function validateConnectionParameters($options)
             }
     
             // Validate length of database table prefix.
    -        if (strlen($options->db_prefix) > 15) {
    +        if (\strlen($options->db_prefix) > 15) {
                 return Text::_('INSTL_DATABASE_FIX_TOO_LONG');
             }
     
             // Validate database name.
    -        if (in_array($options->db_type, ['pgsql', 'postgresql']) && !preg_match('#^[a-zA-Z_][0-9a-zA-Z_$]*$#', $options->db_name)) {
    +        if (\in_array($options->db_type, ['pgsql', 'postgresql']) && !preg_match('#^[a-zA-Z_][0-9a-zA-Z_$]*$#', $options->db_name)) {
                 return Text::_('INSTL_DATABASE_NAME_MSG_POSTGRES');
             }
     
    -        if (in_array($options->db_type, ['mysql', 'mysqli']) && preg_match('#[\\\\\/]#', $options->db_name)) {
    +        if (\in_array($options->db_type, ['mysql', 'mysqli']) && preg_match('#[\\\\\/]#', $options->db_name)) {
                 return Text::_('INSTL_DATABASE_NAME_MSG_MYSQL');
             }
     
             // Workaround for UPPERCASE table prefix for postgresql
    -        if (in_array($options->db_type, ['pgsql', 'postgresql'])) {
    +        if (\in_array($options->db_type, ['pgsql', 'postgresql'])) {
                 if (strtolower($options->db_prefix) != $options->db_prefix) {
                     return Text::_('INSTL_DATABASE_FIX_LOWERCASE');
                 }
    @@ -337,7 +337,7 @@ public static function checkRemoteDbHost($options)
         {
             // Security check for remote db hosts: Check env var if disabled. Also disable in CLI.
             $shouldCheckLocalhost = getenv('JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK') !== '1'
    -            && !defined('_JCLI_INSTALLATION');
    +            && !\defined('_JCLI_INSTALLATION');
     
             // Per default allowed DB hosts: localhost / 127.0.0.1 / ::1 (optionally with port)
             $localhost = '/^(((localhost|127\.0\.0\.1|\[\:\:1\])(\:[1-9]{1}[0-9]{0,4})?)|(\:\:1))$/';
    @@ -469,7 +469,7 @@ public static function checkDbServerParameters($db, $options)
     
             // Check minimum database version
             if (version_compare($dbVersion, $minDbVersionRequired) < 0) {
    -            if (in_array($options->db_type, ['mysql', 'mysqli']) && $db->isMariaDb()) {
    +            if (\in_array($options->db_type, ['mysql', 'mysqli']) && $db->isMariaDb()) {
                     $errorMessage = Text::sprintf(
                         'INSTL_DATABASE_INVALID_MARIADB_VERSION',
                         $minDbVersionRequired,
    diff --git a/installation/src/Model/ChecksModel.php b/installation/src/Model/ChecksModel.php
    index a5e82730a5e2b..a40d2dd7ea69e 100644
    --- a/installation/src/Model/ChecksModel.php
    +++ b/installation/src/Model/ChecksModel.php
    @@ -40,16 +40,16 @@ public function getIniParserAvailability()
             if (!empty($disabled_functions)) {
                 // Attempt to detect them in the PHP INI disable_functions variable.
                 $disabled_functions           = explode(',', trim($disabled_functions));
    -            $number_of_disabled_functions = count($disabled_functions);
    +            $number_of_disabled_functions = \count($disabled_functions);
     
                 for ($i = 0, $l = $number_of_disabled_functions; $i < $l; $i++) {
                     $disabled_functions[$i] = trim($disabled_functions[$i]);
                 }
     
    -            $result = !in_array('parse_ini_string', $disabled_functions);
    +            $result = !\in_array('parse_ini_string', $disabled_functions);
             } else {
                 // Attempt to detect their existence; even pure PHP implementation of them will trigger a positive response, though.
    -            $result = function_exists('parse_ini_string');
    +            $result = \function_exists('parse_ini_string');
             }
     
             return $result;
    @@ -69,14 +69,14 @@ 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 = $option->state ? null : Text::_('INSTL_NOTICE_ZLIB_COMPRESSION_SUPPORT');
             $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 = $option->state ? null : Text::_('INSTL_NOTICE_XML_SUPPORT');
             $options[]      = $option;
     
    @@ -86,12 +86,12 @@ public function getPhpOptions()
             $option         = new \stdClass();
             $option->label  = Text::_('INSTL_DATABASE_SUPPORT');
             $option->label .= '
    (' . implode(', ', $available) . ')'; - $option->state = count($available); + $option->state = \count($available); $option->notice = $option->state ? null : Text::_('INSTL_NOTICE_DATABASE_SUPPORT'); $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'); @@ -110,7 +110,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 = $option->state ? null : Text::_('INSTL_NOTICE_JSON_SUPPORT_AVAILABLE'); $options[] = $option; @@ -189,28 +189,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; diff --git a/installation/src/Model/CleanupModel.php b/installation/src/Model/CleanupModel.php index 4d563388ce5eb..471ec8ea4dbc8 100644 --- a/installation/src/Model/CleanupModel.php +++ b/installation/src/Model/CleanupModel.php @@ -40,7 +40,7 @@ public function deleteInstallationFolder() $return = File::move(JPATH_ROOT . '/robots.txt.dist', JPATH_ROOT . '/robots.txt'); } - \clearstatcache(true, JPATH_INSTALLATION . '/index.php'); + clearstatcache(true, JPATH_INSTALLATION . '/index.php'); return $return; } diff --git a/installation/src/Model/ConfigurationModel.php b/installation/src/Model/ConfigurationModel.php index 9c094df4b74d2..24b06d836cdea 100644 --- a/installation/src/Model/ConfigurationModel.php +++ b/installation/src/Model/ConfigurationModel.php @@ -160,7 +160,7 @@ public function setup($options) // Handle default backend language setting. This feature is available for localized versions of Joomla. $languages = Factory::getApplication()->getLocaliseAdmin($db); - if (in_array($options->language, $languages['admin']) || in_array($options->language, $languages['site'])) { + if (\in_array($options->language, $languages['admin']) || \in_array($options->language, $languages['site'])) { // Build the language parameters for the language manager. $params = []; @@ -168,11 +168,11 @@ public function setup($options) $params['administrator'] = 'en-GB'; $params['site'] = 'en-GB'; - if (in_array($options->language, $languages['admin'])) { + if (\in_array($options->language, $languages['admin'])) { $params['administrator'] = $options->language; } - if (in_array($options->language, $languages['site'])) { + if (\in_array($options->language, $languages['site'])) { $params['site'] = $options->language; } @@ -463,7 +463,7 @@ public function createConfiguration($options) * If the file exists but isn't writable OR if the file doesn't exist and the parent directory * is not writable the user needs to fix this. */ - if ((file_exists($path) && !is_writable($path)) || (!file_exists($path) && !is_writable(dirname($path) . '/'))) { + if ((file_exists($path) && !is_writable($path)) || (!file_exists($path) && !is_writable(\dirname($path) . '/'))) { return false; } diff --git a/installation/src/Model/DatabaseModel.php b/installation/src/Model/DatabaseModel.php index fda7d4076fe5e..d00e69737546a 100644 --- a/installation/src/Model/DatabaseModel.php +++ b/installation/src/Model/DatabaseModel.php @@ -211,12 +211,12 @@ public function createDatabase(array $options) } // @internal Check for spaces in beginning or end of name. - if (strlen(trim($options->db_name)) <> strlen($options->db_name)) { + if (\strlen(trim($options->db_name)) <> \strlen($options->db_name)) { throw new \RuntimeException(Text::_('INSTL_DATABASE_NAME_INVALID_SPACES')); } // @internal Check for asc(00) Null in name. - if (strpos($options->db_name, chr(00)) !== false) { + if (strpos($options->db_name, \chr(00)) !== false) { throw new \RuntimeException(Text::_('INSTL_DATABASE_NAME_INVALID_CHAR')); } @@ -482,7 +482,7 @@ protected function splitQueries($query) $query = $funct[0]; // Parse the schema file to break up queries. - for ($i = 0; $i < strlen($query) - 1; $i++) { + for ($i = 0; $i < \strlen($query) - 1; $i++) { if ($query[$i] == ';' && !$in_string) { $queries[] = substr($query, 0, $i); $query = substr($query, $i + 1); @@ -508,7 +508,7 @@ protected function splitQueries($query) } // Add function part as is. - for ($f = 1, $fMax = count($funct); $f < $fMax; $f++) { + for ($f = 1, $fMax = \count($funct); $f < $fMax; $f++) { $queries[] = 'CREATE OR REPLACE FUNCTION ' . $funct[$f]; } diff --git a/installation/src/Model/LanguagesModel.php b/installation/src/Model/LanguagesModel.php index da851c0cb58a5..f63c9198ee3a1 100644 --- a/installation/src/Model/LanguagesModel.php +++ b/installation/src/Model/LanguagesModel.php @@ -340,7 +340,7 @@ protected function getInstalledlangs($clientName = 'administrator') $row = new \stdClass(); $row->language = $lang; - if (!is_array($info)) { + if (!\is_array($info)) { continue; } diff --git a/installation/src/Response/JsonResponse.php b/installation/src/Response/JsonResponse.php index 17bac112db31b..fae375113512c 100644 --- a/installation/src/Response/JsonResponse.php +++ b/installation/src/Response/JsonResponse.php @@ -100,7 +100,7 @@ public function __construct($data) $messages = Factory::getApplication()->getMessageQueue(); // Build the sorted message list - if (is_array($messages) && count($messages)) { + if (\is_array($messages) && \count($messages)) { foreach ($messages as $msg) { if (isset($msg['type'], $msg['message'])) { $lists[$msg['type']][] = $msg['message']; @@ -109,7 +109,7 @@ public function __construct($data) } // If messages exist add them to the output - if (isset($lists) && is_array($lists)) { + if (isset($lists) && \is_array($lists)) { $this->messages = $lists; } diff --git a/installation/template/body.php b/installation/template/body.php index 0a9688bc8dc62..db11f024b0bb7 100644 --- a/installation/template/body.php +++ b/installation/template/body.php @@ -7,6 +7,6 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; ?> diff --git a/installation/template/error.php b/installation/template/error.php index 67b479c9ac302..edb9dba322c98 100644 --- a/installation/template/error.php +++ b/installation/template/error.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; diff --git a/installation/template/index.php b/installation/template/index.php index 7ac31f5e4b876..d28080ff2ac4d 100644 --- a/installation/template/index.php +++ b/installation/template/index.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; diff --git a/libraries/src/Adapter/Adapter.php b/libraries/src/Adapter/Adapter.php index e82cd3eee74b9..e415206781180 100644 --- a/libraries/src/Adapter/Adapter.php +++ b/libraries/src/Adapter/Adapter.php @@ -119,7 +119,7 @@ public function getDbo() */ public function getAdapter($name, $options = []) { - if (array_key_exists($name, $this->_adapters)) { + if (\array_key_exists($name, $this->_adapters)) { return $this->_adapters[$name]; } @@ -143,7 +143,7 @@ public function getAdapter($name, $options = []) */ public function setAdapter($name, &$adapter = null, $options = []) { - if (is_object($adapter)) { + if (\is_object($adapter)) { $this->_adapters[$name] = &$adapter; return true; diff --git a/libraries/src/Application/AdministratorApplication.php b/libraries/src/Application/AdministratorApplication.php index a40fc7fc35955..672a206e4416c 100644 --- a/libraries/src/Application/AdministratorApplication.php +++ b/libraries/src/Application/AdministratorApplication.php @@ -488,7 +488,7 @@ public function findOption(): string * with a user account that has the Backend Login privilege. */ if ($user->get('guest') || !$user->authorise('core.login.admin')) { - $option = in_array($option, $this->allowedUnprivilegedOptions) ? $option : 'com_login'; + $option = \in_array($option, $this->allowedUnprivilegedOptions) ? $option : 'com_login'; } /** diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 49b30637ff78e..6332f1e3e2906 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -273,7 +273,7 @@ private function sanityCheckSystemVariables() $invalidInputVariables = array_filter( ['option', 'view', 'format', 'lang', 'Itemid', 'template', 'templateStyle', 'task'], function ($systemVariable) use ($input) { - return $input->exists($systemVariable) && is_array($input->getRaw($systemVariable)); + return $input->exists($systemVariable) && \is_array($input->getRaw($systemVariable)); } ); @@ -531,7 +531,7 @@ public function getMenu($name = null, $options = []) $options['app'] = $this; } - if (array_key_exists($name, $this->menus)) { + if (\array_key_exists($name, $this->menus)) { return $this->menus[$name]; } @@ -1329,8 +1329,8 @@ private function setupLogging(): void foreach ($this->get('log_priorities', ['all']) as $p) { $const = '\\Joomla\\CMS\\Log\\Log::' . strtoupper($p); - if (defined($const)) { - $priority |= constant($const); + if (\defined($const)) { + $priority |= \constant($const); } } diff --git a/libraries/src/Application/ConsoleApplication.php b/libraries/src/Application/ConsoleApplication.php index ee6f69bb1f502..4155e4f7c88e6 100644 --- a/libraries/src/Application/ConsoleApplication.php +++ b/libraries/src/Application/ConsoleApplication.php @@ -270,7 +270,7 @@ public function execute() */ public function enqueueMessage($msg, $type = self::MSG_INFO) { - if (!array_key_exists($type, $this->messages)) { + if (!\array_key_exists($type, $this->messages)) { $this->messages[$type] = []; } diff --git a/libraries/src/Application/MultiFactorAuthenticationHandler.php b/libraries/src/Application/MultiFactorAuthenticationHandler.php index adf5fa858da07..67666f6a67f7d 100644 --- a/libraries/src/Application/MultiFactorAuthenticationHandler.php +++ b/libraries/src/Application/MultiFactorAuthenticationHandler.php @@ -100,15 +100,15 @@ protected function isHandlingMultiFactorAuthentication(): bool $userOptions = ComponentHelper::getParams('com_users'); $neverMFAUserGroups = $userOptions->get('neverMFAUserGroups', []); $forceMFAUserGroups = $userOptions->get('forceMFAUserGroups', []); - $isMFADisallowed = count( + $isMFADisallowed = \count( array_intersect( - is_array($neverMFAUserGroups) ? $neverMFAUserGroups : [], + \is_array($neverMFAUserGroups) ? $neverMFAUserGroups : [], $user->getAuthorisedGroups() ) ) >= 1; - $isMFAMandatory = count( + $isMFAMandatory = \count( array_intersect( - is_array($forceMFAUserGroups) ? $forceMFAUserGroups : [], + \is_array($forceMFAUserGroups) ? $forceMFAUserGroups : [], $user->getAuthorisedGroups() ) ) >= 1; @@ -197,7 +197,7 @@ private function isMultiFactorAuthenticationPending(): bool $records = MfaHelper::getUserMfaRecords($user->id); // No MFA Methods? Then we obviously don't need to display a Captive login page. - if (count($records) < 1) { + if (\count($records) < 1) { return false; } @@ -218,7 +218,7 @@ private function isMultiFactorAuthenticationPending(): bool // Filter the records based on currently active MFA Methods foreach ($records as $record) { - if (in_array($record->method, $methodNames)) { + if (\in_array($record->method, $methodNames)) { // We found an active Method. Show the Captive page. return true; } @@ -281,7 +281,7 @@ private function needsMultiFactorAuthenticationRedirection(): bool $task = strtolower($this->input->getCmd('task', '')); // Allow the frontend user to log out (in case they forgot their MFA code or something) - if (!$isAdmin && ($option == 'com_users') && in_array($task, ['user.logout', 'user.menulogout'])) { + if (!$isAdmin && ($option == 'com_users') && \in_array($task, ['user.logout', 'user.menulogout'])) { return false; } @@ -291,7 +291,7 @@ private function needsMultiFactorAuthenticationRedirection(): bool } // Allow the Joomla update finalisation to run - if ($isAdmin && $option === 'com_joomlaupdate' && in_array($task, ['update.finalise', 'update.cleanup', 'update.finaliseconfirm'])) { + if ($isAdmin && $option === 'com_joomlaupdate' && \in_array($task, ['update.finalise', 'update.cleanup', 'update.finaliseconfirm'])) { return false; } @@ -332,7 +332,7 @@ public function isMultiFactorAuthenticationPage(bool $onlyCaptive = false): bool ); } - return in_array($view, $allowedViews) || in_array($task, $allowedTasks); + return \in_array($view, $allowedViews) || \in_array($task, $allowedTasks); } /** @@ -504,13 +504,13 @@ private function decryptLegacyTFAString(string $secret, string $stringToDecrypt) $aes = new Aes($secret, 256); $decrypted = $aes->decryptString($stringToDecrypt); - if (!is_string($decrypted) || empty($decrypted)) { + if (!\is_string($decrypted) || empty($decrypted)) { $aes->setPassword($secret, true); $decrypted = $aes->decryptString($stringToDecrypt); } - if (!is_string($decrypted) || empty($decrypted)) { + if (!\is_string($decrypted) || empty($decrypted)) { return ''; } diff --git a/libraries/src/Application/SiteApplication.php b/libraries/src/Application/SiteApplication.php index 1ffaa56f3c09e..5450677e9209a 100644 --- a/libraries/src/Application/SiteApplication.php +++ b/libraries/src/Application/SiteApplication.php @@ -850,7 +850,7 @@ public function setLanguageFilter($state = false) */ public function setTemplate($template, $styleParams = null) { - if (is_object($template)) { + if (\is_object($template)) { $templateName = empty($template->template) ? '' : $template->template; diff --git a/libraries/src/Button/FeaturedButton.php b/libraries/src/Button/FeaturedButton.php index a099849e648f2..a2225ea11c73d 100644 --- a/libraries/src/Button/FeaturedButton.php +++ b/libraries/src/Button/FeaturedButton.php @@ -73,11 +73,11 @@ public function render(?int $value = null, ?int $row = null, array $options = [] $tz = Factory::getUser()->getTimezone(); - if (!is_null($featuredUp)) { + if (!\is_null($featuredUp)) { $featuredUp = Factory::getDate($featuredUp, 'UTC')->setTimezone($tz); } - if (!is_null($featuredDown)) { + if (!\is_null($featuredDown)) { $featuredDown = Factory::getDate($featuredDown, 'UTC')->setTimezone($tz); } diff --git a/libraries/src/Button/PublishedButton.php b/libraries/src/Button/PublishedButton.php index f6758e0cc2990..67492efdbf082 100644 --- a/libraries/src/Button/PublishedButton.php +++ b/libraries/src/Button/PublishedButton.php @@ -98,7 +98,7 @@ public function render(?int $value = null, ?int $row = null, array $options = [] $default['icon'] = 'expired'; } - if (array_key_exists('category_published', $options)) { + if (\array_key_exists('category_published', $options)) { $categoryPublished = $options['category_published']; if ($categoryPublished === 0) { diff --git a/libraries/src/Cache/Cache.php b/libraries/src/Cache/Cache.php index 312fdf892d35f..6bcea93c8c1f9 100644 --- a/libraries/src/Cache/Cache.php +++ b/libraries/src/Cache/Cache.php @@ -616,7 +616,7 @@ public static function setWorkarounds($data, $options = []) } // Sanitize empty data - foreach (\array_keys($headNow) as $key) { + foreach (array_keys($headNow) as $key) { if (!isset($headNow[$key]) || $headNow[$key] === []) { unset($headNow[$key]); } diff --git a/libraries/src/Captcha/Captcha.php b/libraries/src/Captcha/Captcha.php index 31128e5aa0850..a5b673de074a8 100644 --- a/libraries/src/Captcha/Captcha.php +++ b/libraries/src/Captcha/Captcha.php @@ -258,7 +258,7 @@ public function setupField(CaptchaField $field, \SimpleXMLElement $element) private function update($name, &$args) { if (method_exists($this->captcha, $name)) { - return call_user_func_array([$this->captcha, $name], array_values($args)); + return \call_user_func_array([$this->captcha, $name], array_values($args)); } return null; diff --git a/libraries/src/Component/Router/Rules/NomenuRules.php b/libraries/src/Component/Router/Rules/NomenuRules.php index 630c9a82e61b2..61cf23054283b 100644 --- a/libraries/src/Component/Router/Rules/NomenuRules.php +++ b/libraries/src/Component/Router/Rules/NomenuRules.php @@ -88,7 +88,7 @@ public function parse(&$segments, &$vars) if ($view->nestable) { $vars[$view->key] = 0; - while (count($segments)) { + while (\count($segments)) { $segment = array_shift($segments); $result = \call_user_func_array([$this->router, 'get' . ucfirst($view->name) . 'Id'], [$segment, $vars]); @@ -152,7 +152,7 @@ public function build(&$query, &$segments) if ($view->nestable) { array_pop($result); - while (count($result)) { + while (\count($result)) { $segments[] = str_replace(':', '-', array_pop($result)); } } else { diff --git a/libraries/src/Console/FinderIndexCommand.php b/libraries/src/Console/FinderIndexCommand.php index e44c3ab63b07d..1d91e843baf16 100644 --- a/libraries/src/Console/FinderIndexCommand.php +++ b/libraries/src/Console/FinderIndexCommand.php @@ -306,7 +306,7 @@ private function getFilters(): void } } - $this->ioStyle->text(Text::sprintf('FINDER_CLI_SAVE_FILTER_COMPLETED', count($filters))); + $this->ioStyle->text(Text::sprintf('FINDER_CLI_SAVE_FILTER_COMPLETED', \count($filters))); } /** @@ -504,6 +504,6 @@ private function putFilters() $db->setQuery($query)->execute(); } - $this->ioStyle->text(Text::sprintf('FINDER_CLI_RESTORE_FILTER_COMPLETED', count($this->filters))); + $this->ioStyle->text(Text::sprintf('FINDER_CLI_RESTORE_FILTER_COMPLETED', \count($this->filters))); } } diff --git a/libraries/src/Console/GetConfigurationCommand.php b/libraries/src/Console/GetConfigurationCommand.php index 49f98725e563e..70cb50bbc20db 100644 --- a/libraries/src/Console/GetConfigurationCommand.php +++ b/libraries/src/Console/GetConfigurationCommand.php @@ -223,7 +223,7 @@ public function formatConfig(array $configs): array $config = $config === false ? "false" : $config; $config = $config === true ? "true" : $config; - if (!in_array($key, ['cwd', 'execution'])) { + if (!\in_array($key, ['cwd', 'execution'])) { $newConfig[$key] = $config; } } @@ -244,7 +244,7 @@ public function processSingleOption($option): int { $configs = $this->getApplication()->getConfig()->toArray(); - if (!array_key_exists($option, $configs)) { + if (!\array_key_exists($option, $configs)) { $this->ioStyle->error("Can't find option *$option* in configuration list"); return self::CONFIG_GET_OPTION_NOT_FOUND; @@ -281,11 +281,11 @@ protected function formatConfigValue($value): string } if (\is_array($value)) { - return \json_encode($value); + return json_encode($value); } if (\is_object($value)) { - return \json_encode(\get_object_vars($value)); + return json_encode(get_object_vars($value)); } return $value; diff --git a/libraries/src/Console/RemoveOldFilesCommand.php b/libraries/src/Console/RemoveOldFilesCommand.php index ea2d13878c229..7ea3c970e5eef 100644 --- a/libraries/src/Console/RemoveOldFilesCommand.php +++ b/libraries/src/Console/RemoveOldFilesCommand.php @@ -60,7 +60,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in if ($output->isVeryVerbose() || $output->isDebug()) { foreach ($status['files_checked'] as $file) { - $exists = in_array($file, array_values($status['files_exist'])); + $exists = \in_array($file, array_values($status['files_exist'])); if ($exists) { $symfonyStyle->writeln('File Checked & Exists - ' . $file, OutputInterface::VERBOSITY_VERY_VERBOSE); @@ -70,7 +70,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in } foreach ($status['folders_checked'] as $folder) { - $exists = in_array($folder, array_values($status['folders_exist'])); + $exists = \in_array($folder, array_values($status['folders_exist'])); if ($exists) { $symfonyStyle->writeln('Folder Checked & Exists - ' . $folder, OutputInterface::VERBOSITY_VERY_VERBOSE); diff --git a/libraries/src/Console/SetConfigurationCommand.php b/libraries/src/Console/SetConfigurationCommand.php index d144a4e0102ce..8692a185f8ec2 100644 --- a/libraries/src/Console/SetConfigurationCommand.php +++ b/libraries/src/Console/SetConfigurationCommand.php @@ -160,7 +160,7 @@ private function validateOptions(): bool array_walk( $this->options, function ($value, $key) use ($configs, &$valid) { - if (!array_key_exists($key, $configs)) { + if (!\array_key_exists($key, $configs)) { $this->ioStyle->error("Can't find option *$key* in configuration list"); $valid = false; } @@ -290,34 +290,34 @@ public function checkDb($options): bool } // Validate length of database table prefix. - if (isset($options['dbprefix']) && strlen($options['dbprefix']) > 15) { + if (isset($options['dbprefix']) && \strlen($options['dbprefix']) > 15) { $this->ioStyle->error(Text::_('INSTL_DATABASE_FIX_TOO_LONG'), 'warning'); return false; } // Validate length of database name. - if (strlen($options['db']) > 64) { + if (\strlen($options['db']) > 64) { $this->ioStyle->error(Text::_('INSTL_DATABASE_NAME_TOO_LONG')); return false; } // Validate database name. - if (in_array($options['dbtype'], ['pgsql', 'postgresql'], true) && !preg_match('#^[a-zA-Z_][0-9a-zA-Z_$]*$#', $options['db'])) { + if (\in_array($options['dbtype'], ['pgsql', 'postgresql'], true) && !preg_match('#^[a-zA-Z_][0-9a-zA-Z_$]*$#', $options['db'])) { $this->ioStyle->error(Text::_('INSTL_DATABASE_NAME_MSG_POSTGRES')); return false; } - if (in_array($options['dbtype'], ['mysql', 'mysqli']) && preg_match('#[\\\\\/]#', $options['db'])) { + if (\in_array($options['dbtype'], ['mysql', 'mysqli']) && preg_match('#[\\\\\/]#', $options['db'])) { $this->ioStyle->error(Text::_('INSTL_DATABASE_NAME_MSG_MYSQL')); return false; } // Workaround for UPPERCASE table prefix for PostgreSQL - if (in_array($options['dbtype'], ['pgsql', 'postgresql'])) { + if (\in_array($options['dbtype'], ['pgsql', 'postgresql'])) { if (isset($options['dbprefix']) && strtolower($options['dbprefix']) !== $options['dbprefix']) { $this->ioStyle->error(Text::_('INSTL_DATABASE_FIX_LOWERCASE')); diff --git a/libraries/src/Console/UpdateCoreCommand.php b/libraries/src/Console/UpdateCoreCommand.php index 7feefd9844ac9..787ecd1ad1031 100644 --- a/libraries/src/Console/UpdateCoreCommand.php +++ b/libraries/src/Console/UpdateCoreCommand.php @@ -330,7 +330,7 @@ public function setUpdateModel(): void $app = $this->getApplication(); $updatemodel = $app->bootComponent('com_joomlaupdate')->getMVCFactory($app)->createModel('Update', 'Administrator'); - if (is_bool($updatemodel)) { + if (\is_bool($updatemodel)) { $this->updateModel = $updatemodel; return; diff --git a/libraries/src/Crypt/Crypt.php b/libraries/src/Crypt/Crypt.php index 9943c526b2357..2b134dee8addc 100644 --- a/libraries/src/Crypt/Crypt.php +++ b/libraries/src/Crypt/Crypt.php @@ -45,7 +45,7 @@ public static function timingSafeCompare($known, $unknown) * than that. However, this does not prevent a misguided server administrator from disabling * hash_equals in php.ini. Hence the need for checking whether the function exists or not. */ - if (function_exists('hash_equals')) { + if (\function_exists('hash_equals')) { return hash_equals($known, $unknown); } @@ -54,8 +54,8 @@ public static function timingSafeCompare($known, $unknown) * * @link https://blog.ircmaxell.com/2014/11/its-all-about-time.html */ - $safeLen = strlen($known); - $userLen = strlen($unknown); + $safeLen = \strlen($known); + $userLen = \strlen($unknown); if ($userLen != $safeLen) { return false; @@ -64,7 +64,7 @@ public static function timingSafeCompare($known, $unknown) $result = 0; for ($i = 0; $i < $userLen; $i++) { - $result |= (ord($known[$i]) ^ ord($unknown[$i])); + $result |= (\ord($known[$i]) ^ \ord($unknown[$i])); } // They are only identical strings if $result is exactly 0... diff --git a/libraries/src/Document/HtmlDocument.php b/libraries/src/Document/HtmlDocument.php index b56ec29af3bc8..26cfa49973012 100644 --- a/libraries/src/Document/HtmlDocument.php +++ b/libraries/src/Document/HtmlDocument.php @@ -704,7 +704,7 @@ public function countMenuChildren() { $active = CmsFactory::getApplication()->getMenu()->getActive(); - return $active ? count($active->getChildren()) : 0; + return $active ? \count($active->getChildren()) : 0; } /** diff --git a/libraries/src/Document/Renderer/Html/MetasRenderer.php b/libraries/src/Document/Renderer/Html/MetasRenderer.php index 8773d9290dde6..5c924eeea7364 100644 --- a/libraries/src/Document/Renderer/Html/MetasRenderer.php +++ b/libraries/src/Document/Renderer/Html/MetasRenderer.php @@ -131,8 +131,8 @@ public function render($head, $params = [], $content = null) } if (is_file($dir . $icon)) { - $urlBase = in_array($base, [0, 2]) ? Uri::base(true) : Uri::root(true); - $base = in_array($base, [0, 2]) ? JPATH_BASE : JPATH_ROOT; + $urlBase = \in_array($base, [0, 2]) ? Uri::base(true) : Uri::root(true); + $base = \in_array($base, [0, 2]) ? JPATH_BASE : JPATH_ROOT; $path = str_replace($base, '', $dir); $path = str_replace('\\', '/', $path); $this->_doc->addFavicon($urlBase . $path . $icon); diff --git a/libraries/src/Document/Renderer/Html/ScriptsRenderer.php b/libraries/src/Document/Renderer/Html/ScriptsRenderer.php index 396536a4754f2..a9ffb25cf069b 100644 --- a/libraries/src/Document/Renderer/Html/ScriptsRenderer.php +++ b/libraries/src/Document/Renderer/Html/ScriptsRenderer.php @@ -177,7 +177,7 @@ private function renderElement($item): string } // Add "nonce" attribute if exist - if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { + if ($this->_doc->cspNonce && !\is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } @@ -242,7 +242,7 @@ private function renderInlineElement($item): string } // Add "nonce" attribute if exist - if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { + if ($this->_doc->cspNonce && !\is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } @@ -382,7 +382,7 @@ private function renderImportmap(array &$assets) $attribs = ['type' => 'importmap']; // Add "nonce" attribute if exist - if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { + if ($this->_doc->cspNonce && !\is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } diff --git a/libraries/src/Document/Renderer/Html/StylesRenderer.php b/libraries/src/Document/Renderer/Html/StylesRenderer.php index d05c3d122da60..39cef83b2a4ec 100644 --- a/libraries/src/Document/Renderer/Html/StylesRenderer.php +++ b/libraries/src/Document/Renderer/Html/StylesRenderer.php @@ -166,7 +166,7 @@ private function renderElement($item): string } // Add "nonce" attribute if exist - if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { + if ($this->_doc->cspNonce && !\is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } @@ -241,7 +241,7 @@ private function renderInlineElement($item): string } // Add "nonce" attribute if exist - if ($this->_doc->cspNonce && !is_null($this->_doc->cspNonce)) { + if ($this->_doc->cspNonce && !\is_null($this->_doc->cspNonce)) { $attribs['nonce'] = $this->_doc->cspNonce; } diff --git a/libraries/src/Editor/Button/Button.php b/libraries/src/Editor/Button/Button.php index ffe9bfa1636ce..4d862041ff7cd 100644 --- a/libraries/src/Editor/Button/Button.php +++ b/libraries/src/Editor/Button/Button.php @@ -86,7 +86,7 @@ public function get(string $name, $default = null) return $this->getOptions(); } - return array_key_exists($name, $this->props) ? $this->props[$name] : $default; + return \array_key_exists($name, $this->props) ? $this->props[$name] : $default; } /** diff --git a/libraries/src/Event/AbstractEvent.php b/libraries/src/Event/AbstractEvent.php index d4c72337b3957..0277c16bcb791 100644 --- a/libraries/src/Event/AbstractEvent.php +++ b/libraries/src/Event/AbstractEvent.php @@ -139,7 +139,7 @@ public function getArgument($name, $default = null) // B/C check for numeric access to named argument, eg $event->getArgument('0'). if (is_numeric($name)) { if (key($this->arguments) != 0) { - $argNames = \array_keys($this->arguments); + $argNames = array_keys($this->arguments); $name = $argNames[$name] ?? ''; } @@ -202,7 +202,7 @@ public function setArgument($name, $value) // B/C check for numeric access to named argument, eg $event->setArgument('0', $value). if (is_numeric($name)) { if (key($this->arguments) != 0) { - $argNames = \array_keys($this->arguments); + $argNames = array_keys($this->arguments); $name = $argNames[$name] ?? ''; } diff --git a/libraries/src/Event/Module/ModuleListEvent.php b/libraries/src/Event/Module/ModuleListEvent.php index 792dcfe341120..df5adb2f07635 100644 --- a/libraries/src/Event/Module/ModuleListEvent.php +++ b/libraries/src/Event/Module/ModuleListEvent.php @@ -74,7 +74,7 @@ protected function onSetModules(array $value): array { // Filter out Module elements. Non empty result means invalid data $valid = !array_filter($value, function ($item) { - return !is_object($item); + return !\is_object($item); }); if (!$valid) { diff --git a/libraries/src/Event/MultiFactor/NotifyActionLog.php b/libraries/src/Event/MultiFactor/NotifyActionLog.php index dbdb28c7b08b7..e8cde3eefe8dd 100644 --- a/libraries/src/Event/MultiFactor/NotifyActionLog.php +++ b/libraries/src/Event/MultiFactor/NotifyActionLog.php @@ -51,7 +51,7 @@ class NotifyActionLog extends AbstractImmutableEvent */ public function __construct(string $name, array $arguments = []) { - if (!in_array($name, self::ACCEPTABLE_EVENTS)) { + if (!\in_array($name, self::ACCEPTABLE_EVENTS)) { throw new \InvalidArgumentException(sprintf('The %s event class does not support the %s event name.', __CLASS__, $name)); } diff --git a/libraries/src/Event/Plugin/AjaxEvent.php b/libraries/src/Event/Plugin/AjaxEvent.php index 2db78c940983d..06b3efa3defca 100644 --- a/libraries/src/Event/Plugin/AjaxEvent.php +++ b/libraries/src/Event/Plugin/AjaxEvent.php @@ -86,7 +86,7 @@ public function addResult($data): void if (\is_array($this->arguments['result'])) { $this->arguments['result'][] = $data; - } elseif (\is_scalar($this->arguments['result']) && \is_scalar($data)) { + } elseif (is_scalar($this->arguments['result']) && is_scalar($data)) { $this->arguments['result'] .= $data; } else { throw new \UnexpectedValueException('Mixed data in the result for the event ' . $this->getName()); diff --git a/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php b/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php index bcdc578c151ce..d4880fc430eb7 100644 --- a/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php +++ b/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php @@ -40,7 +40,7 @@ public function typeCheckResult($data): void return; } - if (!is_string($data) || @json_decode($data) === null) { + if (!\is_string($data) || @json_decode($data) === null) { throw new \InvalidArgumentException(sprintf('Event %s only accepts JSON results.', $this->getName())); } } diff --git a/libraries/src/Event/Privacy/ExportRequestEvent.php b/libraries/src/Event/Privacy/ExportRequestEvent.php index ffd33dbad4b74..74b94aed61213 100644 --- a/libraries/src/Event/Privacy/ExportRequestEvent.php +++ b/libraries/src/Event/Privacy/ExportRequestEvent.php @@ -128,7 +128,7 @@ public function getUser(): ?User */ public function typeCheckResult($data): void { - if (!is_array($data)) { + if (!\is_array($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts Array results.', \get_class($this))); } diff --git a/libraries/src/Event/Result/ResultAware.php b/libraries/src/Event/Result/ResultAware.php index 66203dd645221..66c2be1b4f3ca 100644 --- a/libraries/src/Event/Result/ResultAware.php +++ b/libraries/src/Event/Result/ResultAware.php @@ -52,12 +52,12 @@ public function addResult($data): void { // Ensure this trait is applied to an Event object. if (!($this instanceof BaseEvent)) { - throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', get_class($this), BaseEvent::class)); + throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), BaseEvent::class)); } // Ensure the Event object fully implements the ResultAwareInterface. if (!($this instanceof ResultAwareInterface)) { - throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', get_class($this), ResultAwareInterface::class)); + throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), ResultAwareInterface::class)); } // Make sure the data type is correct diff --git a/libraries/src/Event/Result/ResultTypeArrayAware.php b/libraries/src/Event/Result/ResultTypeArrayAware.php index 8879ac17e8519..56e20b63f8de8 100644 --- a/libraries/src/Event/Result/ResultTypeArrayAware.php +++ b/libraries/src/Event/Result/ResultTypeArrayAware.php @@ -63,7 +63,7 @@ public function typeCheckResult($data): void return; } - if (!is_array($data)) { + if (!\is_array($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts Array results.', $this->getName())); } } diff --git a/libraries/src/Event/Result/ResultTypeBooleanAware.php b/libraries/src/Event/Result/ResultTypeBooleanAware.php index a6d2f9319dd86..50d68ddf60457 100644 --- a/libraries/src/Event/Result/ResultTypeBooleanAware.php +++ b/libraries/src/Event/Result/ResultTypeBooleanAware.php @@ -48,7 +48,7 @@ public function typeCheckResult($data): void return; } - if (!is_bool($data)) { + if (!\is_bool($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts Boolean results.', $this->getName())); } } diff --git a/libraries/src/Event/Result/ResultTypeFloatAware.php b/libraries/src/Event/Result/ResultTypeFloatAware.php index b6547a31ca7c0..44979c9a38a9b 100644 --- a/libraries/src/Event/Result/ResultTypeFloatAware.php +++ b/libraries/src/Event/Result/ResultTypeFloatAware.php @@ -63,7 +63,7 @@ public function typeCheckResult($data): void return; } - if (!is_float($data)) { + if (!\is_float($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts Float results.', $this->getName())); } } diff --git a/libraries/src/Event/Result/ResultTypeIntegerAware.php b/libraries/src/Event/Result/ResultTypeIntegerAware.php index 99c8ab68c43b3..b5f0e37c0e06e 100644 --- a/libraries/src/Event/Result/ResultTypeIntegerAware.php +++ b/libraries/src/Event/Result/ResultTypeIntegerAware.php @@ -63,7 +63,7 @@ public function typeCheckResult($data): void return; } - if (!is_int($data)) { + if (!\is_int($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts Integer results.', $this->getName())); } } diff --git a/libraries/src/Event/Result/ResultTypeObjectAware.php b/libraries/src/Event/Result/ResultTypeObjectAware.php index 43cf161e04317..16f8faba453d3 100644 --- a/libraries/src/Event/Result/ResultTypeObjectAware.php +++ b/libraries/src/Event/Result/ResultTypeObjectAware.php @@ -73,7 +73,7 @@ public function typeCheckResult($data): void return; } - if (!is_object($data)) { + if (!\is_object($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts object results.', $this->getName())); } diff --git a/libraries/src/Event/Result/ResultTypeStringAware.php b/libraries/src/Event/Result/ResultTypeStringAware.php index 08469f93e679a..9b1d6a6796f4b 100644 --- a/libraries/src/Event/Result/ResultTypeStringAware.php +++ b/libraries/src/Event/Result/ResultTypeStringAware.php @@ -63,7 +63,7 @@ public function typeCheckResult($data): void return; } - if (!is_string($data)) { + if (!\is_string($data)) { throw new \InvalidArgumentException(sprintf('Event %s only accepts String results.', $this->getName())); } } diff --git a/libraries/src/Event/View/DisplayEvent.php b/libraries/src/Event/View/DisplayEvent.php index 60a0d5a8a3816..8c70c686d8471 100644 --- a/libraries/src/Event/View/DisplayEvent.php +++ b/libraries/src/Event/View/DisplayEvent.php @@ -47,7 +47,7 @@ public function __construct($name, array $arguments = []) throw new \BadMethodCallException("Argument 'extension' of event {$this->name} is required but has not been provided"); } - if (!isset($arguments['extension']) || !is_string($arguments['extension'])) { + if (!isset($arguments['extension']) || !\is_string($arguments['extension'])) { throw new \BadMethodCallException("Argument 'extension' of event {$this->name} is not of type 'string'"); } diff --git a/libraries/src/Event/WebAsset/WebAssetRegistryAssetChanged.php b/libraries/src/Event/WebAsset/WebAssetRegistryAssetChanged.php index 73f591869eb41..1c5eb06cdf2b9 100644 --- a/libraries/src/Event/WebAsset/WebAssetRegistryAssetChanged.php +++ b/libraries/src/Event/WebAsset/WebAssetRegistryAssetChanged.php @@ -42,11 +42,11 @@ public function __construct($name, array $arguments = []) throw new \BadMethodCallException("Argument 'asset' of event $name is not of the expected type"); } - if (!\array_key_exists('assetType', $arguments) || !is_string($arguments['assetType'])) { + if (!\array_key_exists('assetType', $arguments) || !\is_string($arguments['assetType'])) { throw new \BadMethodCallException("Argument 'assetType' of event $name is not of the expected type"); } - if (!\array_key_exists('change', $arguments) || !is_string($arguments['change'])) { + if (!\array_key_exists('change', $arguments) || !\is_string($arguments['change'])) { throw new \BadMethodCallException("Argument 'change' of event $name is not of the expected type"); } } diff --git a/libraries/src/Event/Workflow/AbstractEvent.php b/libraries/src/Event/Workflow/AbstractEvent.php index 0e3b1adc4a00e..d9475275eb689 100644 --- a/libraries/src/Event/Workflow/AbstractEvent.php +++ b/libraries/src/Event/Workflow/AbstractEvent.php @@ -47,7 +47,7 @@ public function __construct($name, array $arguments = []) } if (!\array_key_exists('extensionName', $arguments) || !\array_key_exists('section', $arguments)) { - $parts = \explode('.', $arguments['extension']); + $parts = explode('.', $arguments['extension']); $arguments['extensionName'] = $arguments['extensionName'] ?? $parts[0]; $arguments['section'] = $arguments['section'] ?? $parts[1]; diff --git a/libraries/src/Filesystem/File.php b/libraries/src/Filesystem/File.php index 6ee25e80899aa..38be4f957cef6 100644 --- a/libraries/src/Filesystem/File.php +++ b/libraries/src/Filesystem/File.php @@ -96,7 +96,7 @@ public static function makeSafe($file) $file = rtrim($file, '.'); // Try transliterating the file name using the native php function - if (function_exists('transliterator_transliterate') && function_exists('iconv')) { + if (\function_exists('transliterator_transliterate') && \function_exists('iconv')) { // Using iconv to ignore characters that can't be transliterated $file = iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", transliterator_transliterate('Any-Latin; Latin-ASCII', $file)); } @@ -229,7 +229,7 @@ public static function canFlushFileCache() if ( 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) ) { static::$canFlushFileCache = true; diff --git a/libraries/src/Filter/InputFilter.php b/libraries/src/Filter/InputFilter.php index a5f9e483dbe8d..b9f2edd4c90ff 100644 --- a/libraries/src/Filter/InputFilter.php +++ b/libraries/src/Filter/InputFilter.php @@ -294,7 +294,7 @@ public static function isSafeFile($file, $options = []) || $options['shorttag_in_content'] || $options['phar_stub_in_content'] || ($options['fobidden_ext_in_content'] && !empty($options['forbidden_extensions'])) ) { - $fp = strlen($tempName) ? @fopen($tempName, 'r') : false; + $fp = \strlen($tempName) ? @fopen($tempName, 'r') : false; if ($fp !== false) { $data = ''; diff --git a/libraries/src/Filter/OutputFilter.php b/libraries/src/Filter/OutputFilter.php index 6f3f07a7e4b48..a15f5bb21d3a2 100644 --- a/libraries/src/Filter/OutputFilter.php +++ b/libraries/src/Filter/OutputFilter.php @@ -56,7 +56,7 @@ public static function stringJSSafe($string) foreach ($chars as $chr) { $code = str_pad(dechex(StringHelper::ord($chr)), 4, '0', STR_PAD_LEFT); - if (strlen($code) < 5) { + if (\strlen($code) < 5) { $new_str .= '\\u' . $code; } else { $new_str .= '\\u{' . $code . '}'; diff --git a/libraries/src/Form/Field/AccessiblemediaField.php b/libraries/src/Form/Field/AccessiblemediaField.php index 356935eff6101..b8ff8feb03388 100644 --- a/libraries/src/Form/Field/AccessiblemediaField.php +++ b/libraries/src/Form/Field/AccessiblemediaField.php @@ -139,7 +139,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) * However, this method expects an object or a string, not an array. Typecasting the array * to an object solves the data format discrepancy. */ - $value = is_array($value) ? (object) $value : $value; + $value = \is_array($value) ? (object) $value : $value; /** * If the value is not a string, it is @@ -164,7 +164,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) } } } elseif ( - !is_object($value) + !\is_object($value) || !property_exists($value, 'imagefile') || !property_exists($value, 'alt_text') ) { diff --git a/libraries/src/Form/Field/PredefinedlistField.php b/libraries/src/Form/Field/PredefinedlistField.php index 67e8dbc4122a3..d5b518c95d33b 100644 --- a/libraries/src/Form/Field/PredefinedlistField.php +++ b/libraries/src/Form/Field/PredefinedlistField.php @@ -109,7 +109,7 @@ protected function getOptions() foreach ($this->predefinedOptions as $value => $text) { $val = (string) $value; - if (empty($this->optionsFilter) || in_array($val, $this->optionsFilter, true)) { + if (empty($this->optionsFilter) || \in_array($val, $this->optionsFilter, true)) { $text = $this->translate ? Text::_($text) : $text; $options[] = (object) [ diff --git a/libraries/src/Form/Field/SubformField.php b/libraries/src/Form/Field/SubformField.php index 54cbd96142b06..82db9446da18e 100644 --- a/libraries/src/Form/Field/SubformField.php +++ b/libraries/src/Form/Field/SubformField.php @@ -168,7 +168,7 @@ public function __set($name, $value) case 'value': // We allow a json encoded string or an array - if (is_string($value)) { + if (\is_string($value)) { $value = json_decode($value, true); } @@ -425,7 +425,7 @@ public function filter($value, $group = null, Registry $input = null) $subForm = $this->loadSubForm(); // Subform field may have a default value, that is a JSON string - if ($value && is_string($value)) { + if ($value && \is_string($value)) { $value = json_decode($value, true); // The string is invalid json diff --git a/libraries/src/Form/Field/TagField.php b/libraries/src/Form/Field/TagField.php index 53648af19b54c..4d260c12bc44a 100644 --- a/libraries/src/Form/Field/TagField.php +++ b/libraries/src/Form/Field/TagField.php @@ -192,7 +192,7 @@ protected function getOptions() $topIds = $db->loadColumn(); // Merge the used values into the most used tags - if (!empty($this->value) && is_array($this->value)) { + if (!empty($this->value) && \is_array($this->value)) { $topIds = array_unique(array_merge($topIds, $this->value)); } @@ -214,7 +214,7 @@ protected function getOptions() } // Limit the main query to the missing amount of tags - $count = count($options); + $count = \count($options); $prefillLimit -= $count; $query->setLimit($prefillLimit); diff --git a/libraries/src/Form/Form.php b/libraries/src/Form/Form.php index 2572efa1851f9..6680c8f7052f1 100644 --- a/libraries/src/Form/Form.php +++ b/libraries/src/Form/Form.php @@ -1377,7 +1377,7 @@ protected function &findGroup($group) // Make sure there is actually a group to find. $group = explode('.', $group); - if (count($group)) { + if (\count($group)) { // Get any fields elements with the correct group name. $elements = $this->xml->xpath('//fields[@name="' . (string) $group[0] . '" and not(ancestor::field/form/*)]'); diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php index a6a13928f53f3..a9f8e6f445a1e 100644 --- a/libraries/src/Form/FormField.php +++ b/libraries/src/Form/FormField.php @@ -489,7 +489,7 @@ public function __get($name) default: // Check for data attribute - if (strpos($name, 'data-') === 0 && array_key_exists($name, $this->dataAttributes)) { + if (strpos($name, 'data-') === 0 && \array_key_exists($name, $this->dataAttributes)) { return $this->dataAttributes[$name]; } } @@ -1119,7 +1119,7 @@ public function filter($value, $group = null, Registry $input = null) $subForm = $this->loadSubForm(); // Subform field may have a default value, that is a JSON string - if ($value && is_string($value)) { + if ($value && \is_string($value)) { $value = json_decode($value, true); // The string is invalid json diff --git a/libraries/src/Form/FormHelper.php b/libraries/src/Form/FormHelper.php index 26ed8fddaf990..f86c3b6a76661 100644 --- a/libraries/src/Form/FormHelper.php +++ b/libraries/src/Form/FormHelper.php @@ -360,10 +360,10 @@ protected static function addPath($entity, $new = null) // Add the new paths to the stack if not already there. foreach ($new as $path) { - $path = \trim($path); + $path = trim($path); if (!\in_array($path, $paths)) { - \array_unshift($paths, $path); + array_unshift($paths, $path); } } diff --git a/libraries/src/Form/FormRule.php b/libraries/src/Form/FormRule.php index 1e1ad6de501fb..0214326571bb6 100644 --- a/libraries/src/Form/FormRule.php +++ b/libraries/src/Form/FormRule.php @@ -80,7 +80,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry static $unicodePropertiesSupport = null; if ($unicodePropertiesSupport === null) { - $unicodePropertiesSupport = (bool) @\preg_match('/\pL/u', 'a'); + $unicodePropertiesSupport = (bool) @preg_match('/\pL/u', 'a'); } // Add unicode property support if available. diff --git a/libraries/src/Form/Rule/FilePathRule.php b/libraries/src/Form/Rule/FilePathRule.php index ad3fa953e46f8..e58f8d106aa6a 100644 --- a/libraries/src/Form/Rule/FilePathRule.php +++ b/libraries/src/Form/Rule/FilePathRule.php @@ -60,7 +60,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry // Check the exclude setting $path = preg_split('/[\/\\\\]/', $value); - if (in_array(strtolower($path[0]), $exclude) || empty($path[0])) { + if (\in_array(strtolower($path[0]), $exclude) || empty($path[0])) { return false; } diff --git a/libraries/src/Form/Rule/TimeRule.php b/libraries/src/Form/Rule/TimeRule.php index 686afe9e23f1b..eb33b7f64993f 100644 --- a/libraries/src/Form/Rule/TimeRule.php +++ b/libraries/src/Form/Rule/TimeRule.php @@ -56,7 +56,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry $stringValue = (string) $value; // If the length of a field is smaller than 5 return error message - if (strlen($stringValue) !== 5 && !isset($element['step'])) { + if (\strlen($stringValue) !== 5 && !isset($element['step'])) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_TIME_INPUT'), 'warning' @@ -91,7 +91,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry $max = $element['max'][0] . $element['max'][1]; // If the input is smaller than the set min return error message - if (intval($min) > intval($stringValue[0] . $stringValue[1])) { + if (\intval($min) > \intval($stringValue[0] . $stringValue[1])) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_MIN_TIME', $min), 'warning' @@ -101,7 +101,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry } // If the input is greater than the set max return error message - if (intval($max) < intval($stringValue[0] . $stringValue[1])) { + if (\intval($max) < \intval($stringValue[0] . $stringValue[1])) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_MAX_TIME'), 'warning' @@ -111,8 +111,8 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry } // If the hour input is equal to the set max but the minutes input is greater than zero return error message - if (intval($max) === intval($stringValue[0] . $stringValue[1])) { - if (intval($element['min'][3] . $element['min'][4]) !== 0) { + if (\intval($max) === \intval($stringValue[0] . $stringValue[1])) { + if (\intval($element['min'][3] . $element['min'][4]) !== 0) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_MAX_TIME'), 'warning' @@ -124,7 +124,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry } // If the first symbol is greater than 2 return error message - if (intval($stringValue[0]) > 2) { + if (\intval($stringValue[0]) > 2) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_TIME_INPUT'), 'warning' @@ -134,7 +134,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry } // If the first symbol is greater than 2 and the second symbol is greater than 3 return error message - if (intval($stringValue[0]) === 2 && intval($stringValue[1]) > 3) { + if (\intval($stringValue[0]) === 2 && \intval($stringValue[1]) > 3) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_TIME_INPUT'), 'warning' @@ -144,7 +144,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry } // If the fourth symbol is greater than 5 return error message - if (intval($stringValue[3]) > 5) { + if (\intval($stringValue[3]) > 5) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_TIME_INPUT'), 'warning' @@ -156,9 +156,9 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry // If the step is set return same error messages as above but taking into a count that there 8 and not 5 symbols if (isset($element['step'])) { if ( - strlen($stringValue) !== 8 - || intval($stringValue[5]) !== ':' - || intval($stringValue[6]) > 5 + \strlen($stringValue) !== 8 + || \intval($stringValue[5]) !== ':' + || \intval($stringValue[6]) > 5 ) { Factory::getApplication()->enqueueMessage( Text::_('JLIB_FORM_FIELD_INVALID_TIME_INPUT_SECONDS'), diff --git a/libraries/src/HTML/HTMLHelper.php b/libraries/src/HTML/HTMLHelper.php index 7404576d69003..ba48e27f778c0 100644 --- a/libraries/src/HTML/HTMLHelper.php +++ b/libraries/src/HTML/HTMLHelper.php @@ -718,7 +718,7 @@ public static function image($file, $alt, $attribs = null, $relative = false, $r } // When it is a string, we need convert it to an array - if (is_string($attribs)) { + if (\is_string($attribs)) { $attributes = []; // Go through each argument diff --git a/libraries/src/HTML/Helpers/Access.php b/libraries/src/HTML/Helpers/Access.php index eaa210b54c617..dd4b2f44f432f 100644 --- a/libraries/src/HTML/Helpers/Access.php +++ b/libraries/src/HTML/Helpers/Access.php @@ -79,7 +79,7 @@ public static function level($name, $selected, $attribs = '', $params = true, $i $options = $db->loadObjectList(); // If params is an array, push these options to the array - if (is_array($params)) { + if (\is_array($params)) { $options = array_merge($params, $options); } elseif ($params) { // If all levels is allowed, push it into the array. @@ -116,7 +116,7 @@ public static function usergroup($name, $selected, $attribs = '', $allowAll = tr { $options = array_values(UserGroupsHelper::getInstance()->getAll()); - for ($i = 0, $n = count($options); $i < $n; $i++) { + for ($i = 0, $n = \count($options); $i < $n; $i++) { $options[$i]->value = $options[$i]->id; $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title; } @@ -152,7 +152,7 @@ public static function usergroups($name, $selected, $checkSuperAdmin = false) $html = []; - for ($i = 0, $n = count($groups); $i < $n; $i++) { + for ($i = 0, $n = \count($groups); $i < $n; $i++) { $item = &$groups[$i]; // If checkSuperAdmin is true, only add item if the user is superadmin or the group is not super admin @@ -164,7 +164,7 @@ public static function usergroups($name, $selected, $checkSuperAdmin = false) $checked = ''; if ($selected) { - $checked = in_array($item->id, $selected) ? ' checked="checked"' : ''; + $checked = \in_array($item->id, $selected) ? ' checked="checked"' : ''; } $rel = ($item->parent_id > 0) ? ' rel="group_' . $item->parent_id . '_' . $count . '"' : ''; @@ -212,12 +212,12 @@ public static function actions($name, $selected, $component, $section = 'global' $html = []; $html[] = '
      '; - for ($i = 0, $n = count($actions); $i < $n; $i++) { + for ($i = 0, $n = \count($actions); $i < $n; $i++) { $item = &$actions[$i]; // Setup the variable attributes. $eid = $count . 'action_' . $item->id; - $checked = in_array($item->id, $selected) ? ' checked="checked"' : ''; + $checked = \in_array($item->id, $selected) ? ' checked="checked"' : ''; // Build the HTML for the item. $html[] = '
    • '; diff --git a/libraries/src/HTML/Helpers/Bootstrap.php b/libraries/src/HTML/Helpers/Bootstrap.php index cf9448081954c..fefae6dec6ade 100644 --- a/libraries/src/HTML/Helpers/Bootstrap.php +++ b/libraries/src/HTML/Helpers/Bootstrap.php @@ -55,7 +55,7 @@ public static function alert($selector = ''): void $scriptOptions = $doc->getScriptOptions('bootstrap.alert'); $options = [$selector]; - if (is_array($scriptOptions)) { + if (\is_array($scriptOptions)) { $options = array_merge($scriptOptions, $options); } @@ -95,7 +95,7 @@ public static function button($selector = ''): void $scriptOptions = $doc->getScriptOptions('bootstrap.button'); $options = [$selector]; - if (is_array($scriptOptions)) { + if (\is_array($scriptOptions)) { $options = array_merge($scriptOptions, $options); } diff --git a/libraries/src/HTML/Helpers/Category.php b/libraries/src/HTML/Helpers/Category.php index eabf47577c964..9a9e98458ecee 100644 --- a/libraries/src/HTML/Helpers/Category.php +++ b/libraries/src/HTML/Helpers/Category.php @@ -80,7 +80,7 @@ public static function options($extension, $config = ['filter.published' => [0, if (is_numeric($config['filter.published'])) { $query->where($db->quoteName('a.published') . ' = :published') ->bind(':published', $config['filter.published'], ParameterType::INTEGER); - } elseif (is_array($config['filter.published'])) { + } elseif (\is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->whereIn($db->quoteName('a.published'), $config['filter.published']); } @@ -88,10 +88,10 @@ public static function options($extension, $config = ['filter.published' => [0, // Filter on the language if (isset($config['filter.language'])) { - if (is_string($config['filter.language'])) { + if (\is_string($config['filter.language'])) { $query->where($db->quoteName('a.language') . ' = :language') ->bind(':language', $config['filter.language']); - } elseif (is_array($config['filter.language'])) { + } elseif (\is_array($config['filter.language'])) { $query->whereIn($db->quoteName('a.language'), $config['filter.language'], ParameterType::STRING); } } @@ -101,7 +101,7 @@ public static function options($extension, $config = ['filter.published' => [0, if (is_numeric($config['filter.access'])) { $query->where($db->quoteName('a.access') . ' = :access') ->bind(':access', $config['filter_access'], ParameterType::INTEGER); - } elseif (is_array($config['filter.access'])) { + } elseif (\is_array($config['filter.access'])) { $config['filter.access'] = ArrayHelper::toInteger($config['filter.access']); $query->whereIn($db->quoteName('a.access'), $config['filter.access']); } @@ -175,7 +175,7 @@ public static function categories($extension, $config = ['filter.published' => [ if (is_numeric($config['filter.published'])) { $query->where($db->quoteName('a.published') . ' = :published') ->bind(':published', $config['filter.published'], ParameterType::INTEGER); - } elseif (is_array($config['filter.published'])) { + } elseif (\is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->whereIn($db->quoteName('a.published'), $config['filter.published']); } diff --git a/libraries/src/HTML/Helpers/FormBehavior.php b/libraries/src/HTML/Helpers/FormBehavior.php index 6dd2b40c4cdd7..dca083606fdf7 100644 --- a/libraries/src/HTML/Helpers/FormBehavior.php +++ b/libraries/src/HTML/Helpers/FormBehavior.php @@ -89,7 +89,7 @@ public static function chosen($selector = '.advancedSelect', $debug = null, $opt } // Options array to json options string - $options_str = \json_encode($options, ($debug && \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false)); + $options_str = json_encode($options, ($debug && \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false)); // Add chosen.js assets diff --git a/libraries/src/HTML/Helpers/Grid.php b/libraries/src/HTML/Helpers/Grid.php index 296b6111caa77..1c77f9bfe01c2 100644 --- a/libraries/src/HTML/Helpers/Grid.php +++ b/libraries/src/HTML/Helpers/Grid.php @@ -172,7 +172,7 @@ public static function checkedOut(&$row, $i, $identifier = 'id') */ public static function published($value, $i, $img1 = 'tick.png', $img0 = 'publish_x.png', $prefix = '') { - if (is_object($value)) { + if (\is_object($value)) { $value = $value->published; } @@ -237,7 +237,7 @@ public static function state($filterState = '*', $published = 'JPUBLISHED', $unp public static function order($rows, $image = 'filesave.png', $task = 'saveorder') { return ''; } diff --git a/libraries/src/HTML/Helpers/Icons.php b/libraries/src/HTML/Helpers/Icons.php index 5bc80e6674c00..529d868da6570 100644 --- a/libraries/src/HTML/Helpers/Icons.php +++ b/libraries/src/HTML/Helpers/Icons.php @@ -60,7 +60,7 @@ public static function buttons($buttons) public static function button($button) { if (isset($button['access'])) { - if (is_bool($button['access'])) { + if (\is_bool($button['access'])) { if ($button['access'] == false) { return ''; } @@ -69,7 +69,7 @@ public static function button($button) $user = Factory::getUser(); // Take each pair of permission, context values. - for ($i = 0, $n = count($button['access']); $i < $n; $i += 2) { + for ($i = 0, $n = \count($button['access']); $i < $n; $i += 2) { if (!$user->authorise($button['access'][$i], $button['access'][$i + 1])) { return ''; } diff --git a/libraries/src/HTML/Helpers/JGrid.php b/libraries/src/HTML/Helpers/JGrid.php index a2de64fd6a866..07d4b956911db 100644 --- a/libraries/src/HTML/Helpers/JGrid.php +++ b/libraries/src/HTML/Helpers/JGrid.php @@ -62,17 +62,17 @@ public static function action( ) { $html = []; - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $activeTitle = array_key_exists('active_title', $options) ? $options['active_title'] : $activeTitle; - $inactiveTitle = array_key_exists('inactive_title', $options) ? $options['inactive_title'] : $inactiveTitle; - $tip = array_key_exists('tip', $options) ? $options['tip'] : $tip; - $activeClass = array_key_exists('active_class', $options) ? $options['active_class'] : $activeClass; - $inactiveClass = array_key_exists('inactive_class', $options) ? $options['inactive_class'] : $inactiveClass; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $translate = array_key_exists('translate', $options) ? $options['translate'] : $translate; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $activeTitle = \array_key_exists('active_title', $options) ? $options['active_title'] : $activeTitle; + $inactiveTitle = \array_key_exists('inactive_title', $options) ? $options['inactive_title'] : $inactiveTitle; + $tip = \array_key_exists('tip', $options) ? $options['tip'] : $tip; + $activeClass = \array_key_exists('active_class', $options) ? $options['active_class'] : $activeClass; + $inactiveClass = \array_key_exists('inactive_class', $options) ? $options['inactive_class'] : $inactiveClass; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $translate = \array_key_exists('translate', $options) ? $options['translate'] : $translate; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } if ($tip) { @@ -130,22 +130,22 @@ public static function action( */ public static function state($states, $value, $i, $prefix = '', $enabled = true, $translate = true, $checkbox = 'cb', $formId = null) { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $translate = array_key_exists('translate', $options) ? $options['translate'] : $translate; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $translate = \array_key_exists('translate', $options) ? $options['translate'] : $translate; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $state = ArrayHelper::getValue($states, (int) $value, $states[0]); - $task = array_key_exists('task', $state) ? $state['task'] : $state[0]; - $text = array_key_exists('text', $state) ? $state['text'] : (array_key_exists(1, $state) ? $state[1] : ''); - $activeTitle = array_key_exists('active_title', $state) ? $state['active_title'] : (array_key_exists(2, $state) ? $state[2] : ''); - $inactiveTitle = array_key_exists('inactive_title', $state) ? $state['inactive_title'] : (array_key_exists(3, $state) ? $state[3] : ''); - $tip = array_key_exists('tip', $state) ? $state['tip'] : (array_key_exists(4, $state) ? $state[4] : false); - $activeClass = array_key_exists('active_class', $state) ? $state['active_class'] : (array_key_exists(5, $state) ? $state[5] : ''); - $inactiveClass = array_key_exists('inactive_class', $state) ? $state['inactive_class'] : (array_key_exists(6, $state) ? $state[6] : ''); + $task = \array_key_exists('task', $state) ? $state['task'] : $state[0]; + $text = \array_key_exists('text', $state) ? $state['text'] : (\array_key_exists(1, $state) ? $state[1] : ''); + $activeTitle = \array_key_exists('active_title', $state) ? $state['active_title'] : (\array_key_exists(2, $state) ? $state[2] : ''); + $inactiveTitle = \array_key_exists('inactive_title', $state) ? $state['inactive_title'] : (\array_key_exists(3, $state) ? $state[3] : ''); + $tip = \array_key_exists('tip', $state) ? $state['tip'] : (\array_key_exists(4, $state) ? $state[4] : false); + $activeClass = \array_key_exists('active_class', $state) ? $state['active_class'] : (\array_key_exists(5, $state) ? $state[5] : ''); + $inactiveClass = \array_key_exists('inactive_class', $state) ? $state['inactive_class'] : (\array_key_exists(6, $state) ? $state[6] : ''); return static::action( $i, @@ -190,11 +190,11 @@ public static function published( $publishDown = null, $formId = null ) { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $states = [ @@ -278,11 +278,11 @@ public static function published( */ public static function isdefault($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb', $formId = null, $active_class = 'icon-color-featured icon-star', $inactive_class = 'icon-unfeatured') { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $states = [ @@ -310,23 +310,23 @@ public static function publishedOptions($config = []) // Build the active state filter options. $options = []; - if (!array_key_exists('published', $config) || $config['published']) { + if (!\array_key_exists('published', $config) || $config['published']) { $options[] = HTMLHelper::_('select.option', '1', 'JPUBLISHED'); } - if (!array_key_exists('unpublished', $config) || $config['unpublished']) { + if (!\array_key_exists('unpublished', $config) || $config['unpublished']) { $options[] = HTMLHelper::_('select.option', '0', 'JUNPUBLISHED'); } - if (!array_key_exists('archived', $config) || $config['archived']) { + if (!\array_key_exists('archived', $config) || $config['archived']) { $options[] = HTMLHelper::_('select.option', '2', 'JARCHIVED'); } - if (!array_key_exists('trash', $config) || $config['trash']) { + if (!\array_key_exists('trash', $config) || $config['trash']) { $options[] = HTMLHelper::_('select.option', '-2', 'JTRASHED'); } - if (!array_key_exists('all', $config) || $config['all']) { + if (!\array_key_exists('all', $config) || $config['all']) { $options[] = HTMLHelper::_('select.option', '*', 'JALL'); } @@ -350,11 +350,11 @@ public static function publishedOptions($config = []) */ public static function checkedout($i, $editorName, $time, $prefix = '', $enabled = false, $checkbox = 'cb', $formId = null) { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $text = $editorName . '
      ' . HTMLHelper::_('date', $time, Text::_('DATE_FORMAT_LC')) . '
      ' . HTMLHelper::_('date', $time, 'H:i'); @@ -394,12 +394,12 @@ public static function checkedout($i, $editorName, $time, $prefix = '', $enabled */ public static function orderUp($i, $task = 'orderup', $prefix = '', $text = 'JLIB_HTML_MOVE_UP', $enabled = true, $checkbox = 'cb', $formId = null) { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $text = array_key_exists('text', $options) ? $options['text'] : $text; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $text = \array_key_exists('text', $options) ? $options['text'] : $text; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } return static::action($i, $task, $prefix, $text, $text, false, 'uparrow', 'uparrow_disabled', $enabled, true, $checkbox, $formId); @@ -429,12 +429,12 @@ public static function orderDown( $checkbox = 'cb', $formId = null ) { - if (is_array($prefix)) { + if (\is_array($prefix)) { $options = $prefix; - $text = array_key_exists('text', $options) ? $options['text'] : $text; - $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; - $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; + $text = \array_key_exists('text', $options) ? $options['text'] : $text; + $enabled = \array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; + $checkbox = \array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; + $prefix = \array_key_exists('prefix', $options) ? $options['prefix'] : ''; } return static::action($i, $task, $prefix, $text, $text, false, 'downarrow', 'downarrow_disabled', $enabled, true, $checkbox, $formId); diff --git a/libraries/src/HTML/Helpers/Links.php b/libraries/src/HTML/Helpers/Links.php index 23bf177ed30e9..3c71a24380ba0 100644 --- a/libraries/src/HTML/Helpers/Links.php +++ b/libraries/src/HTML/Helpers/Links.php @@ -37,7 +37,7 @@ public static function linksgroups($groupsOfLinks) { $html = []; - if (count($groupsOfLinks) > 0) { + if (\count($groupsOfLinks) > 0) { $layout = new FileLayout('joomla.links.groupsopen'); $html[] = $layout->render(''); @@ -100,7 +100,7 @@ public static function links($links) public static function link($link) { if (isset($link['access'])) { - if (is_bool($link['access'])) { + if (\is_bool($link['access'])) { if ($link['access'] == false) { return ''; } @@ -109,7 +109,7 @@ public static function link($link) $user = Factory::getUser(); // Take each pair of permission, context values. - for ($i = 0, $n = count($link['access']); $i < $n; $i += 2) { + for ($i = 0, $n = \count($link['access']); $i < $n; $i += 2) { if (!$user->authorise($link['access'][$i], $link['access'][$i + 1])) { return ''; } diff --git a/libraries/src/HTML/Helpers/ListHelper.php b/libraries/src/HTML/Helpers/ListHelper.php index d0d5d731fa66e..637b7078e77a7 100644 --- a/libraries/src/HTML/Helpers/ListHelper.php +++ b/libraries/src/HTML/Helpers/ListHelper.php @@ -105,7 +105,7 @@ public static function genericordering($query, $chop = 30) $options[] = HTMLHelper::_('select.option', 0, ' - ' . Text::_('JLIB_FORM_FIELD_PARAM_INTEGER_FIRST_LABEL') . ' - '); - for ($i = 0, $n = count($items); $i < $n; $i++) { + for ($i = 0, $n = \count($items); $i < $n; $i++) { $items[$i]->text = Text::_($items[$i]->text); if (StringHelper::strlen($items[$i]->text) > $chop) { diff --git a/libraries/src/HTML/Helpers/Menu.php b/libraries/src/HTML/Helpers/Menu.php index b4990e2d3095d..a4885061ac346 100644 --- a/libraries/src/HTML/Helpers/Menu.php +++ b/libraries/src/HTML/Helpers/Menu.php @@ -101,7 +101,7 @@ public static function menuItems($config = []) if (empty(static::$items[$key])) { // B/C - not passed = 0, null can be passed for both clients - $clientId = array_key_exists('clientid', $config) ? $config['clientid'] : 0; + $clientId = \array_key_exists('clientid', $config) ? $config['clientid'] : 0; $menus = static::menus($clientId); $db = Factory::getDbo(); @@ -399,7 +399,7 @@ public static function linkOptions($all = false, $unassigned = false, $clientId */ public static function treerecurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1) { - if ($level <= $maxlevel && isset($children[$id]) && is_array($children[$id])) { + if ($level <= $maxlevel && isset($children[$id]) && \is_array($children[$id])) { if ($type) { $pre = '|_ '; $spacer = '.      '; @@ -420,8 +420,8 @@ public static function treerecurse($id, $indent, $list, &$children, $maxlevel = $list[$id] = $v; $list[$id]->treename = $indent . $txt; - if (isset($children[$id]) && is_array($children[$id])) { - $list[$id]->children = count($children[$id]); + if (isset($children[$id]) && \is_array($children[$id])) { + $list[$id]->children = \count($children[$id]); $list = static::treerecurse($id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type); } else { $list[$id]->children = 0; diff --git a/libraries/src/HTML/Helpers/Number.php b/libraries/src/HTML/Helpers/Number.php index 962f67dac43f5..e0b30086a6459 100644 --- a/libraries/src/HTML/Helpers/Number.php +++ b/libraries/src/HTML/Helpers/Number.php @@ -79,11 +79,11 @@ public static function bytes($bytes, $unit = 'auto', $precision = 2, $iec = fals $iecSuffixes = ['b', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; // User supplied method - if (in_array($unit, $iecSuffixes)) { + if (\in_array($unit, $iecSuffixes)) { $base = 1024; $i = array_search($unit, $iecSuffixes, true); $suffix = $unit; - } elseif (in_array($unit, $stdSuffixes)) { + } elseif (\in_array($unit, $stdSuffixes)) { $base = $iec ? 1000 : 1024; $i = array_search($unit, $stdSuffixes, true); $suffix = $unit; diff --git a/libraries/src/HTML/Helpers/SearchTools.php b/libraries/src/HTML/Helpers/SearchTools.php index 942c19be22db5..dd9e3e6fccbae 100644 --- a/libraries/src/HTML/Helpers/SearchTools.php +++ b/libraries/src/HTML/Helpers/SearchTools.php @@ -73,7 +73,7 @@ public static function form($selector = '.js-stools-form', $options = []) private static function optionsToRegistry($options) { // Support options array - if (is_array($options)) { + if (\is_array($options)) { $options = new Registry($options); } diff --git a/libraries/src/HTML/Helpers/Select.php b/libraries/src/HTML/Helpers/Select.php index d9049c49f4170..f6e8d2d6c01eb 100644 --- a/libraries/src/HTML/Helpers/Select.php +++ b/libraries/src/HTML/Helpers/Select.php @@ -109,7 +109,7 @@ public static function genericlist( // Set default options $options = array_merge(HTMLHelper::$formatOptions, ['format.depth' => 0, 'id' => false]); - if (is_array($attribs) && func_num_args() === 3) { + if (\is_array($attribs) && \func_num_args() === 3) { // Assume we have an options array $options = array_merge($options, $attribs); } else { @@ -125,7 +125,7 @@ public static function genericlist( $attribs = ''; if (isset($options['list.attr'])) { - if (is_array($options['list.attr'])) { + if (\is_array($options['list.attr'])) { $attribs = ArrayHelper::toString($options['list.attr']); } else { $attribs = $options['list.attr']; @@ -205,7 +205,7 @@ public static function groupedlist($data, $name, $options = []) $attribs = ''; if (isset($options['list.attr'])) { - if (is_array($options['list.attr'])) { + if (\is_array($options['list.attr'])) { $attribs = ArrayHelper::toString($options['list.attr']); } else { $attribs = $options['list.attr']; @@ -230,12 +230,12 @@ public static function groupedlist($data, $name, $options = []) foreach ($data as $dataKey => $group) { $label = $dataKey; $id = ''; - $noGroup = is_int($dataKey); + $noGroup = \is_int($dataKey); if ($options['group.items'] == null) { // Sub-list is an associative array $subList = $group; - } elseif (is_array($group)) { + } elseif (\is_array($group)) { // Sub-list is in an element of an array. $subList = $group[$options['group.items']]; @@ -248,7 +248,7 @@ public static function groupedlist($data, $name, $options = []) $id = $group[$options['group.id']]; $noGroup = false; } - } elseif (is_object($group)) { + } elseif (\is_object($group)) { // Sub-list is in a property of an object $subList = $group->{$options['group.items']}; @@ -301,7 +301,7 @@ public static function integerlist($start, $end, $inc, $name, $attribs = null, $ // Set default options $options = array_merge(HTMLHelper::$formatOptions, ['format.depth' => 0, 'option.format' => '', 'id' => false]); - if (is_array($attribs) && func_num_args() === 5) { + if (\is_array($attribs) && \func_num_args() === 5) { // Assume we have an options array $options = array_merge($options, $attribs); @@ -373,7 +373,7 @@ public static function option($value, $text = '', $optKey = 'value', $optText = 'option.text' => 'text', ]; - if (is_array($optKey)) { + if (\is_array($optKey)) { // Merge in caller's options $options = array_merge($options, $optKey); } else { @@ -464,7 +464,7 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele ['format.depth' => 0, 'groups' => true, 'list.select' => null, 'list.translate' => false] ); - if (is_array($optKey)) { + if (\is_array($optKey)) { // Set default options and overwrite with anything passed in $options = array_merge($options, $optKey); } else { @@ -484,7 +484,7 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele $label = ''; $id = ''; - if (is_array($element)) { + if (\is_array($element)) { $key = $options['option.key'] === null ? $elementKey : $element[$options['option.key']]; $text = $element[$options['option.text']]; @@ -503,7 +503,7 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele if (isset($element[$options['option.disable']]) && $element[$options['option.disable']]) { $extra .= ' disabled="disabled"'; } - } elseif (is_object($element)) { + } elseif (\is_object($element)) { $key = $options['option.key'] === null ? $elementKey : $element->{$options['option.key']}; $text = $element->{$options['option.text']}; @@ -569,7 +569,7 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele $label = htmlentities($label); } - if (is_array($attr)) { + if (\is_array($attr)) { $attr = ArrayHelper::toString($attr); } else { $attr = trim($attr); @@ -577,9 +577,9 @@ public static function options($arr, $optKey = 'value', $optText = 'text', $sele $extra = ($id ? ' id="' . $id . '"' : '') . ($label ? ' label="' . $label . '"' : '') . ($attr ? ' ' . $attr : '') . $extra; - if (is_array($options['list.select'])) { + if (\is_array($options['list.select'])) { foreach ($options['list.select'] as $val) { - $key2 = is_object($val) ? $val->{$options['option.key']} : $val; + $key2 = \is_object($val) ? $val->{$options['option.key']} : $val; if ($key == $key2) { $extra .= ' selected="selected"'; @@ -631,7 +631,7 @@ public static function radiolist( $idtag = false, $translate = false ) { - if (is_array($attribs)) { + if (\is_array($attribs)) { $attribs = ArrayHelper::toString($attribs); } @@ -649,9 +649,9 @@ public static function radiolist( $extra = ''; $id = $id ? $obj->id : $id_text . $k; - if (is_array($selected)) { + if (\is_array($selected)) { foreach ($selected as $val) { - $k2 = is_object($val) ? $val->$optKey : $val; + $k2 = \is_object($val) ? $val->$optKey : $val; if ($k == $k2) { $extra .= ' selected="selected" '; diff --git a/libraries/src/HTML/Helpers/Sidebar.php b/libraries/src/HTML/Helpers/Sidebar.php index cb5b49a9745fd..67d6af3f5b432 100644 --- a/libraries/src/HTML/Helpers/Sidebar.php +++ b/libraries/src/HTML/Helpers/Sidebar.php @@ -61,8 +61,8 @@ public static function render() $data->list = static::getEntries(); $data->filters = static::getFilters(); $data->action = static::getAction(); - $data->displayMenu = count($data->list); - $data->displayFilters = count($data->filters); + $data->displayMenu = \count($data->list); + $data->displayFilters = \count($data->filters); $data->hide = Factory::getApplication()->getInput()->getBool('hidemainmenu'); // Create a layout object and ask it to render the sidebar diff --git a/libraries/src/HTML/Helpers/StringHelper.php b/libraries/src/HTML/Helpers/StringHelper.php index 1bc47f88a27f2..ab4fe1e637546 100644 --- a/libraries/src/HTML/Helpers/StringHelper.php +++ b/libraries/src/HTML/Helpers/StringHelper.php @@ -77,7 +77,7 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml // If there are no spaces and the string is longer than the maximum // we need to just use the ellipsis. In that case we are done. - if ($offset === false && strlen($text) > $length) { + if ($offset === false && \strlen($text) > $length) { return '...'; } @@ -99,16 +99,16 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml preg_match_all("#]*?)>#iU", $tmp, $result); $closedTags = $result[1]; - $numOpened = count($openedTags); + $numOpened = \count($openedTags); // Not all tags are closed so trim the text and finish. - if (count($closedTags) !== $numOpened) { + if (\count($closedTags) !== $numOpened) { // Closing tags need to be in the reverse order of opening tags. $openedTags = array_reverse($openedTags); // Close tags for ($i = 0; $i < $numOpened; $i++) { - if (!in_array($openedTags[$i], $closedTags)) { + if (!\in_array($openedTags[$i], $closedTags)) { $tmp .= ''; } else { unset($closedTags[array_search($openedTags[$i], $closedTags)]); @@ -123,7 +123,7 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml } } - if ($tmp === false || strlen($text) > strlen($tmp)) { + if ($tmp === false || \strlen($text) > \strlen($tmp)) { $text = trim($tmp) . '...'; } } @@ -157,7 +157,7 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml public static function truncateComplex($html, $maxLength = 0, $noSplit = true) { // Start with some basic rules. - $baseLength = strlen($html); + $baseLength = \strlen($html); // If the original HTML string is shorter than the $maxLength do nothing and return that. if ($baseLength <= $maxLength || $maxLength === 0) { @@ -171,7 +171,7 @@ public static function truncateComplex($html, $maxLength = 0, $noSplit = true) // Deal with maximum length of 1 where the string starts with a tag. if ($maxLength === 1 && $html[0] === '<') { - $endTagPos = strlen(strstr($html, '>', true)); + $endTagPos = \strlen(strstr($html, '>', true)); $tag = substr($html, 1, $endTagPos); $l = $endTagPos + 1; @@ -214,7 +214,7 @@ public static function truncateComplex($html, $maxLength = 0, $noSplit = true) // Get the truncated string assuming HTML is allowed. $htmlString = HTMLHelper::_('string.truncate', $html, $maxLength, $noSplit, $allowHtml = true); - if ($htmlString === '...' && strlen($ptString) + 3 > $maxLength) { + if ($htmlString === '...' && \strlen($ptString) + 3 > $maxLength) { return $htmlString; } @@ -230,7 +230,7 @@ public static function truncateComplex($html, $maxLength = 0, $noSplit = true) } // Get the number of HTML tag characters in the first $maxLength characters - $diffLength = strlen($ptString) - strlen($htmlStringToPtString); + $diffLength = \strlen($ptString) - \strlen($htmlStringToPtString); if ($diffLength <= 0) { return $htmlString . '...'; diff --git a/libraries/src/HTML/Helpers/Tag.php b/libraries/src/HTML/Helpers/Tag.php index 594cdfa254cde..0657edcbcf8f8 100644 --- a/libraries/src/HTML/Helpers/Tag.php +++ b/libraries/src/HTML/Helpers/Tag.php @@ -69,7 +69,7 @@ public static function options($config = ['filter.published' => [0, 1]]) if (is_numeric($config['filter.published'])) { $query->where('a.published = :published') ->bind(':published', $config['filter.published'], ParameterType::INTEGER); - } elseif (is_array($config['filter.published'])) { + } elseif (\is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->whereIn($db->quoteName('a.published'), $config['filter.published']); } @@ -77,10 +77,10 @@ public static function options($config = ['filter.published' => [0, 1]]) // Filter on the language if (isset($config['filter.language'])) { - if (is_string($config['filter.language'])) { + if (\is_string($config['filter.language'])) { $query->where($db->quoteName('a.language') . ' = :language') ->bind(':language', $config['filter.language']); - } elseif (is_array($config['filter.language'])) { + } elseif (\is_array($config['filter.language'])) { $query->whereIn($db->quoteName('a.language'), $config['filter.language'], ParameterType::STRING); } } @@ -134,7 +134,7 @@ public static function tags($config = ['filter.published' => [0, 1]]) if (is_numeric($config['filter.published'])) { $query->where($db->quoteName('a.published') . ' = :published') ->bind(':published', $config['filter.published'], ParameterType::INTEGER); - } elseif (is_array($config['filter.published'])) { + } elseif (\is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->whereIn($db->quoteName('a.published'), $config['filter.published']); } diff --git a/libraries/src/HTML/Helpers/User.php b/libraries/src/HTML/Helpers/User.php index a23f462f5c8ab..00ecb79fb4593 100644 --- a/libraries/src/HTML/Helpers/User.php +++ b/libraries/src/HTML/Helpers/User.php @@ -38,7 +38,7 @@ public static function groups($includeSuperAdmin = false) { $options = array_values(UserGroupsHelper::getInstance()->getAll()); - for ($i = 0, $n = count($options); $i < $n; $i++) { + for ($i = 0, $n = \count($options); $i < $n; $i++) { $options[$i]->value = $options[$i]->id; $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title; $groups[] = HTMLHelper::_('select.option', $options[$i]->value, $options[$i]->text); diff --git a/libraries/src/HTML/Helpers/WorkflowStage.php b/libraries/src/HTML/Helpers/WorkflowStage.php index 805ece3490c8c..6c71b86d293c0 100644 --- a/libraries/src/HTML/Helpers/WorkflowStage.php +++ b/libraries/src/HTML/Helpers/WorkflowStage.php @@ -63,7 +63,7 @@ public static function existing($options) // Using workflow ID to differentiate workflows having same title $workflowStageKey = Text::_($stage->workflow_title) . ' (' . $stage->workflow_id . ')'; - if (!array_key_exists($workflowStageKey, $workflowStages)) { + if (!\array_key_exists($workflowStageKey, $workflowStages)) { $workflowStages[$workflowStageKey] = []; } diff --git a/libraries/src/Helper/AuthenticationHelper.php b/libraries/src/Helper/AuthenticationHelper.php index 49ecc19498957..7941fa8f30077 100644 --- a/libraries/src/Helper/AuthenticationHelper.php +++ b/libraries/src/Helper/AuthenticationHelper.php @@ -105,12 +105,12 @@ public static function getLoginButtons(string $formId): array foreach ($results as $result) { // Did we get garbage back from the plugin? - if (!is_array($result) || empty($result)) { + if (!\is_array($result) || empty($result)) { continue; } // Did the developer accidentally return a single button definition instead of an array? - if (array_key_exists('label', $result)) { + if (\array_key_exists('label', $result)) { $result = [$result]; } @@ -135,7 +135,7 @@ public static function getLoginButtons(string $formId): array continue; } - if (!in_array($key, ['label', 'tooltip', 'icon', 'image', 'svg', 'class', 'id', 'onclick'])) { + if (!\in_array($key, ['label', 'tooltip', 'icon', 'image', 'svg', 'class', 'id', 'onclick'])) { unset($button[$key]); } } diff --git a/libraries/src/Helper/MediaHelper.php b/libraries/src/Helper/MediaHelper.php index b7c24ca376d8e..6c8b8399bf945 100644 --- a/libraries/src/Helper/MediaHelper.php +++ b/libraries/src/Helper/MediaHelper.php @@ -174,11 +174,11 @@ public static function checkFileExtension($extension, $component = 'com_media', $executables = array_merge(self::EXECUTABLES, InputFilter::FORBIDDEN_FILE_EXTENSIONS); // Remove allowed executables from array - if (count($allowedExecutables)) { + if (\count($allowedExecutables)) { $executables = array_diff($executables, $allowedExecutables); } - if (in_array($extension, $executables, true)) { + if (\in_array($extension, $executables, true)) { return false; } @@ -236,7 +236,7 @@ public function canUpload($file, $component = 'com_media', $allowedExecutables = $executables = array_merge(self::EXECUTABLES, InputFilter::FORBIDDEN_FILE_EXTENSIONS); // Remove allowed executables from array - if (count($allowedExecutables)) { + if (\count($allowedExecutables)) { $executables = array_diff($executables, $allowedExecutables); } @@ -444,7 +444,7 @@ public static function isValidLocalDirectory($directory) // Do a check if default settings are not saved by user // If not initialize them manually - if (is_string($directories)) { + if (\is_string($directories)) { $directories = json_decode($directories); } @@ -514,7 +514,7 @@ private static function isValidSvg($file, $shouldLogErrors = true): bool } } - if ($isValid === false || count($svgErrors)) { + if ($isValid === false || \count($svgErrors)) { if ($shouldLogErrors) { Factory::getApplication()->enqueueMessage(Text::_('JLIB_MEDIA_ERROR_WARNIEXSS'), 'error'); } diff --git a/libraries/src/Helper/TagsHelper.php b/libraries/src/Helper/TagsHelper.php index b938b0ca93757..92a22aa7fabaf 100644 --- a/libraries/src/Helper/TagsHelper.php +++ b/libraries/src/Helper/TagsHelper.php @@ -624,7 +624,7 @@ public function getTagItemsQuery( // Get the type data, limited to types in the request if there are any specified. $typesarray = self::getTypes('assocList', $typesr, false); - $typeAliases = \array_column($typesarray, 'type_alias'); + $typeAliases = array_column($typesarray, 'type_alias'); $query->whereIn($db->quoteName('m.type_alias'), $typeAliases, ParameterType::STRING); $groups = array_values(array_unique($user->getAuthorisedViewLevels())); @@ -973,7 +973,7 @@ public static function searchTags($filters = []) $tagTable = Factory::getApplication()->bootComponent('com_tags')->getMVCFactory()->createTable('Tag', 'Administrator'); if ($children = $tagTable->getTree($filters['parent_id'])) { - $childrenIds = \array_column($children, 'id'); + $childrenIds = array_column($children, 'id'); $query->whereIn($db->quoteName('a.id'), $childrenIds); } diff --git a/libraries/src/Image/Image.php b/libraries/src/Image/Image.php index 5ade75d3e4393..e28c4e55936ad 100644 --- a/libraries/src/Image/Image.php +++ b/libraries/src/Image/Image.php @@ -130,7 +130,7 @@ public function __construct($source = null) * @todo: Remove check for resource when we only support PHP 8 */ if ( - $source && (\is_object($source) && get_class($source) == 'GdImage') + $source && (\is_object($source) && \get_class($source) == 'GdImage') || (\is_resource($source) && get_resource_type($source) == 'gd') ) { $this->handle = $source; @@ -547,7 +547,7 @@ public function isLoaded() * @todo: Remove check for resource when we only support PHP 8 */ if ( - !((\is_object($this->handle) && get_class($this->handle) == 'GdImage') + !((\is_object($this->handle) && \get_class($this->handle) == 'GdImage') || (\is_resource($this->handle) && get_resource_type($this->handle) == 'gd')) ) { return false; diff --git a/libraries/src/Image/ImageFilter.php b/libraries/src/Image/ImageFilter.php index a5fb351c301e4..45d4f2e0bef43 100644 --- a/libraries/src/Image/ImageFilter.php +++ b/libraries/src/Image/ImageFilter.php @@ -47,7 +47,7 @@ public function __construct($handle) * @todo: Remove check for resource when we only support PHP 8 */ if ( - !((\is_object($handle) && get_class($handle) == 'GdImage') + !((\is_object($handle) && \get_class($handle) == 'GdImage') || (\is_resource($handle) && get_resource_type($handle) == 'gd')) ) { throw new \InvalidArgumentException('The image handle is invalid for the image filter.'); diff --git a/libraries/src/Input/Cookie.php b/libraries/src/Input/Cookie.php index 0959d9b8b4440..09acbdb351d09 100644 --- a/libraries/src/Input/Cookie.php +++ b/libraries/src/Input/Cookie.php @@ -76,7 +76,7 @@ public function __construct(array $source = null, array $options = []) public function set($name, $value, $options = []) { // BC layer to convert old method parameters. - if (is_array($options) === false) { + if (\is_array($options) === false) { trigger_deprecation( 'joomla/input', '1.4.0', @@ -87,7 +87,7 @@ public function set($name, $value, $options = []) __METHOD__ ); - $argList = func_get_args(); + $argList = \func_get_args(); $options = [ 'expires' => $argList[2] ?? 0, @@ -109,23 +109,23 @@ public function set($name, $value, $options = []) } } else { // Using the setcookie function before php 7.3, make sure we have default values. - if (array_key_exists('expires', $options) === false) { + if (\array_key_exists('expires', $options) === false) { $options['expires'] = 0; } - if (array_key_exists('path', $options) === false) { + if (\array_key_exists('path', $options) === false) { $options['path'] = ''; } - if (array_key_exists('domain', $options) === false) { + if (\array_key_exists('domain', $options) === false) { $options['domain'] = ''; } - if (array_key_exists('secure', $options) === false) { + if (\array_key_exists('secure', $options) === false) { $options['secure'] = false; } - if (array_key_exists('httponly', $options) === false) { + if (\array_key_exists('httponly', $options) === false) { $options['httponly'] = false; } diff --git a/libraries/src/Input/Json.php b/libraries/src/Input/Json.php index e67d02c82ea96..fa3cdba64455c 100644 --- a/libraries/src/Input/Json.php +++ b/libraries/src/Input/Json.php @@ -60,7 +60,7 @@ public function __construct(array $source = null, array $options = []) $this->_raw = file_get_contents('php://input'); $this->data = json_decode($this->_raw, true); - if (!is_array($this->data)) { + if (!\is_array($this->data)) { $this->data = []; } } else { diff --git a/libraries/src/Installer/Adapter/LibraryAdapter.php b/libraries/src/Installer/Adapter/LibraryAdapter.php index e0987eb37b9e8..1d9f0e6f8b441 100644 --- a/libraries/src/Installer/Adapter/LibraryAdapter.php +++ b/libraries/src/Installer/Adapter/LibraryAdapter.php @@ -323,7 +323,7 @@ protected function setupInstallPaths() // Don't install libraries which would override core folders $restrictedFolders = ['php-encryption', 'phpass', 'src', 'vendor']; - if (in_array($group, $restrictedFolders)) { + if (\in_array($group, $restrictedFolders)) { throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_CORE_FOLDER')); } diff --git a/libraries/src/Installer/Installer.php b/libraries/src/Installer/Installer.php index 176ec222afdc8..02a4868fe3ddc 100644 --- a/libraries/src/Installer/Installer.php +++ b/libraries/src/Installer/Installer.php @@ -1086,7 +1086,7 @@ public function parseSQLFiles($element) // Process each query in the $queries array (split out of sql file). foreach ($queries as $query) { - $canFail = strlen($query) > self::CAN_FAIL_MARKER_LENGTH + 1 && + $canFail = \strlen($query) > self::CAN_FAIL_MARKER_LENGTH + 1 && strtoupper(substr($query, -self::CAN_FAIL_MARKER_LENGTH - 1)) === (self::CAN_FAIL_MARKER . ';'); $query = $canFail ? (substr($query, 0, -self::CAN_FAIL_MARKER_LENGTH - 1) . ';') : $query; @@ -1275,7 +1275,7 @@ public function parseSchemaUpdates(\SimpleXMLElement $schema, $eid) // Process each query in the $queries array (split out of sql file). foreach ($queries as $query) { - $canFail = strlen($query) > self::CAN_FAIL_MARKER_LENGTH + 1 && + $canFail = \strlen($query) > self::CAN_FAIL_MARKER_LENGTH + 1 && strtoupper(substr($query, -self::CAN_FAIL_MARKER_LENGTH - 1)) === (self::CAN_FAIL_MARKER . ';'); $query = $canFail ? (substr($query, 0, -self::CAN_FAIL_MARKER_LENGTH - 1) . ';') : $query; diff --git a/libraries/src/Installer/LegacyInstallerScript.php b/libraries/src/Installer/LegacyInstallerScript.php index bcf40befa51be..24bdd11c6441a 100644 --- a/libraries/src/Installer/LegacyInstallerScript.php +++ b/libraries/src/Installer/LegacyInstallerScript.php @@ -155,7 +155,7 @@ public function __get(string $name) */ public function __call(string $name, array $arguments) { - return call_user_func_array([$this->installerScript, $name], $arguments); + return \call_user_func_array([$this->installerScript, $name], $arguments); } /** diff --git a/libraries/src/Language/Language.php b/libraries/src/Language/Language.php index cc9e198687c9b..33e03ae72b307 100644 --- a/libraries/src/Language/Language.php +++ b/libraries/src/Language/Language.php @@ -316,7 +316,7 @@ public function transliterate($string) // Check if all symbols were transliterated (contains only ASCII), // Otherwise try to use native php function if available - if (preg_match('/[\\x80-\\xff]/', $string) && function_exists('transliterator_transliterate') && function_exists('iconv')) { + if (preg_match('/[\\x80-\\xff]/', $string) && \function_exists('transliterator_transliterate') && \function_exists('iconv')) { return iconv("UTF-8", "ASCII//TRANSLIT//IGNORE", transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', $string)); } diff --git a/libraries/src/Language/LanguageHelper.php b/libraries/src/Language/LanguageHelper.php index 78743e2c726a1..d1bd3936ade61 100644 --- a/libraries/src/Language/LanguageHelper.php +++ b/libraries/src/Language/LanguageHelper.php @@ -114,7 +114,7 @@ public static function getLanguages($key = 'default') { static $languages = []; - if (!count($languages)) { + if (!\count($languages)) { // Installation uses available languages if (Factory::getApplication()->isClient('installation')) { $languages[$key] = []; diff --git a/libraries/src/Language/Text.php b/libraries/src/Language/Text.php index bc3539c03a99b..394648f944704 100644 --- a/libraries/src/Language/Text.php +++ b/libraries/src/Language/Text.php @@ -59,7 +59,7 @@ public static function _($string, $jsSafe = false, $interpretBackSlashes = true, $script = (bool) $jsSafe['script']; } - $jsSafe = !\empty($jsSafe['jsSafe']); + $jsSafe = !empty($jsSafe['jsSafe']); } if (self::passSprintf($string, $jsSafe, $interpretBackSlashes, $script)) { diff --git a/libraries/src/MVC/Controller/ApiController.php b/libraries/src/MVC/Controller/ApiController.php index 38b901e80f793..a450ee70436e7 100644 --- a/libraries/src/MVC/Controller/ApiController.php +++ b/libraries/src/MVC/Controller/ApiController.php @@ -255,7 +255,7 @@ public function displayList() $model->setState('list.limit', $this->itemsPerPage); } - if (!is_null($offset) && $offset > $model->getTotal()) { + if (!\is_null($offset) && $offset > $model->getTotal()) { throw new Exception\ResourceNotFound(); } @@ -408,7 +408,7 @@ protected function save($recordKey = null) $fields = $table->getFields(); foreach ($fields as $field) { - if (array_key_exists($field->Field, $data)) { + if (\array_key_exists($field->Field, $data)) { continue; } diff --git a/libraries/src/MVC/Controller/BaseController.php b/libraries/src/MVC/Controller/BaseController.php index d500cd939c527..bea00d23117e3 100644 --- a/libraries/src/MVC/Controller/BaseController.php +++ b/libraries/src/MVC/Controller/BaseController.php @@ -528,7 +528,7 @@ protected function checkEditId($context, $id) 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } @@ -642,7 +642,7 @@ public function display($cachable = false, $urlparams = []) 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } @@ -904,7 +904,7 @@ protected function holdEditId($context, $id) 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } @@ -947,7 +947,7 @@ public function redirect() 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } @@ -1033,7 +1033,7 @@ protected function releaseEditId($context, $id) 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } @@ -1138,7 +1138,7 @@ public function checkToken($method = 'post', $redirect = true) 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, - get_class($this->app) + \get_class($this->app) ) ); } diff --git a/libraries/src/MVC/Model/AdminModel.php b/libraries/src/MVC/Model/AdminModel.php index 22852bfde0e83..7531c4468570a 100644 --- a/libraries/src/MVC/Model/AdminModel.php +++ b/libraries/src/MVC/Model/AdminModel.php @@ -1675,7 +1675,7 @@ protected function redirectToAssociations($data) * load directly the associated target item in the side by side view * otherwise select already the target language */ - if (count($languages) === 2) { + if (\count($languages) === 2) { $lang_code = []; foreach ($languages as $language) { diff --git a/libraries/src/MVC/Model/WorkflowBehaviorTrait.php b/libraries/src/MVC/Model/WorkflowBehaviorTrait.php index c1d600990ad40..232f6bcabee96 100644 --- a/libraries/src/MVC/Model/WorkflowBehaviorTrait.php +++ b/libraries/src/MVC/Model/WorkflowBehaviorTrait.php @@ -76,7 +76,7 @@ public function setUpWorkflow($extension) $this->extension = array_shift($parts); - if (count($parts)) { + if (\count($parts)) { $this->section = array_shift($parts); } diff --git a/libraries/src/MVC/View/Event/OnGetApiFields.php b/libraries/src/MVC/View/Event/OnGetApiFields.php index 598eb18472ab7..fcacdf0f8d004 100644 --- a/libraries/src/MVC/View/Event/OnGetApiFields.php +++ b/libraries/src/MVC/View/Event/OnGetApiFields.php @@ -92,7 +92,7 @@ public function __construct($name, array $arguments = []) */ protected function setType($value) { - if (!in_array($value, [static::ITEM, static::LIST])) { + if (!\in_array($value, [static::ITEM, static::LIST])) { throw new \BadMethodCallException("Argument 'type' of event {$this->name} must be a valid value"); } @@ -110,7 +110,7 @@ protected function setType($value) */ protected function setFields($value) { - if (!\is_array($value) || is_array($value) && empty($value)) { + if (!\is_array($value) || \is_array($value) && empty($value)) { throw new \BadMethodCallException("Argument 'fields' of event {$this->name} must be be an array and not empty"); } diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index 42785c5dcab06..605c44339d07d 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -325,7 +325,7 @@ public function send() protected function replaceTags($text, $tags) { foreach ($tags as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $matches = []; $pregKey = preg_quote(strtoupper($key), '/'); @@ -334,11 +334,11 @@ protected function replaceTags($text, $tags) $replacement = ''; foreach ($value as $name => $subvalue) { - if (is_array($subvalue) && $name == $matches[1][$i]) { + if (\is_array($subvalue) && $name == $matches[1][$i]) { $replacement .= implode("\n", $subvalue); - } elseif (is_array($subvalue)) { + } elseif (\is_array($subvalue)) { $replacement .= $this->replaceTags($matches[1][$i], $subvalue); - } elseif (is_string($subvalue) && $name == $matches[1][$i]) { + } elseif (\is_string($subvalue) && $name == $matches[1][$i]) { $replacement .= $subvalue; } } diff --git a/libraries/src/Mail/language/phpmailer.lang-en_gb.php b/libraries/src/Mail/language/phpmailer.lang-en_gb.php index 4e65e84b609d7..3754faa58e000 100644 --- a/libraries/src/Mail/language/phpmailer.lang-en_gb.php +++ b/libraries/src/Mail/language/phpmailer.lang-en_gb.php @@ -7,7 +7,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Language\Text; diff --git a/libraries/src/Menu/MenuFactory.php b/libraries/src/Menu/MenuFactory.php index f725829ccb958..ede013e358a9e 100644 --- a/libraries/src/Menu/MenuFactory.php +++ b/libraries/src/Menu/MenuFactory.php @@ -48,7 +48,7 @@ public function createMenu(string $client, array $options = []): AbstractMenu throw new \InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_MENU_LOAD', $client), 500); } - if (!array_key_exists('db', $options)) { + if (!\array_key_exists('db', $options)) { $options['db'] = $this->getDatabase(); } diff --git a/libraries/src/Object/LegacyPropertyManagementTrait.php b/libraries/src/Object/LegacyPropertyManagementTrait.php index 0980ee8b221d7..f624b2f218066 100644 --- a/libraries/src/Object/LegacyPropertyManagementTrait.php +++ b/libraries/src/Object/LegacyPropertyManagementTrait.php @@ -107,7 +107,7 @@ public function getProperties($public = true) // Unset all none public properties, this is needed as get_object_vars returns now all vars // from the current object and not only the CMSObject and the public ones from the inheriting classes foreach ($nonePublicProperties as $prop) { - if (array_key_exists($prop->getName(), $vars)) { + if (\array_key_exists($prop->getName(), $vars)) { unset($vars[$prop->getName()]); } } diff --git a/libraries/src/Plugin/CMSPlugin.php b/libraries/src/Plugin/CMSPlugin.php index 800253ccee17b..0666323886331 100644 --- a/libraries/src/Plugin/CMSPlugin.php +++ b/libraries/src/Plugin/CMSPlugin.php @@ -284,7 +284,7 @@ function (AbstractEvent $event) use ($methodName) { } // Convert to indexed array for unpacking. - $arguments = \array_values($arguments); + $arguments = array_values($arguments); $result = $this->{$methodName}(...$arguments); @@ -344,13 +344,13 @@ private function parameterImplementsEventInterface(\ReflectionParameter $paramet // Handle standard typehints. if ($reflectionType instanceof \ReflectionNamedType) { - return \is_a($reflectionType->getName(), EventInterface::class, true); + return is_a($reflectionType->getName(), EventInterface::class, true); } // Handle PHP 8 union types. if ($reflectionType instanceof \ReflectionUnionType) { foreach ($reflectionType->getTypes() as $type) { - if (!\is_a($type->getName(), EventInterface::class, true)) { + if (!is_a($type->getName(), EventInterface::class, true)) { return false; } } diff --git a/libraries/src/Proxy/ArrayReadOnlyProxy.php b/libraries/src/Proxy/ArrayReadOnlyProxy.php index 8bb657de28a69..97421dd5d2e19 100644 --- a/libraries/src/Proxy/ArrayReadOnlyProxy.php +++ b/libraries/src/Proxy/ArrayReadOnlyProxy.php @@ -35,7 +35,7 @@ public function offsetGet(mixed $offset): mixed $value = $this->data[$offset] ?? null; // Ensure that the child also is a read-only - if (\is_scalar($value) || $value === null) { + if (is_scalar($value) || $value === null) { return $value; } diff --git a/libraries/src/Proxy/ObjectReadOnlyProxy.php b/libraries/src/Proxy/ObjectReadOnlyProxy.php index d61d7e6f6f304..3bbeb6851869f 100644 --- a/libraries/src/Proxy/ObjectReadOnlyProxy.php +++ b/libraries/src/Proxy/ObjectReadOnlyProxy.php @@ -35,7 +35,7 @@ public function __get($key): mixed $value = $this->data->$key ?? null; // Ensure that the child also is a read-only - if (\is_scalar($value) || $value === null) { + if (is_scalar($value) || $value === null) { return $value; } @@ -79,7 +79,7 @@ public function current(): mixed $value = $this->iterator->current(); // Ensure that the child also is a read-only - if (\is_scalar($value) || $value === null) { + if (is_scalar($value) || $value === null) { return $value; } diff --git a/libraries/src/Response/JsonResponse.php b/libraries/src/Response/JsonResponse.php index 561b574a3f4b5..2b7d470361daf 100644 --- a/libraries/src/Response/JsonResponse.php +++ b/libraries/src/Response/JsonResponse.php @@ -92,7 +92,7 @@ public function __construct($response = null, $message = null, $error = false, $ } // If messages exist add them to the output - if (count($lists)) { + if (\count($lists)) { $this->messages = $lists; } } diff --git a/libraries/src/Router/Route.php b/libraries/src/Router/Route.php index c68adb01ca882..e28a371610a4f 100644 --- a/libraries/src/Router/Route.php +++ b/libraries/src/Router/Route.php @@ -76,7 +76,7 @@ public static function _($url, $xhtml = true, $tls = self::TLS_IGNORE, $absolute * @deprecated 3.9 int conversion will be removed in 6.0 * Before 3.9.7 this method silently converted $tls to integer */ - if (!is_int($tls)) { + if (!\is_int($tls)) { @trigger_error( __METHOD__ . '() called with incompatible variable type on parameter $tls.', E_USER_DEPRECATED @@ -172,7 +172,7 @@ public static function link($client, $url, $xhtml = true, $tls = self::TLS_IGNOR $scheme_host_port = [$uri2->getScheme(), $uri2->getHost(), $uri2->getPort()]; } - if (is_null($uri->getScheme())) { + if (\is_null($uri->getScheme())) { $uri->setScheme($scheme_host_port[0]); } diff --git a/libraries/src/Schemaorg/SchemaorgPluginTrait.php b/libraries/src/Schemaorg/SchemaorgPluginTrait.php index 2d54a3f5f89a1..bbdd2e059234e 100755 --- a/libraries/src/Schemaorg/SchemaorgPluginTrait.php +++ b/libraries/src/Schemaorg/SchemaorgPluginTrait.php @@ -110,7 +110,7 @@ protected function convertToArray(array $schema, array $repeatableFields) $result = []; foreach ($field as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { $result[] = $v; } @@ -151,7 +151,7 @@ protected function isSupported($context) $parts = explode('.', $context); // We need at least the extension + view for loading the table fields - if (count($parts) < 2) { + if (\count($parts) < 2) { return false; } @@ -171,8 +171,8 @@ protected function isSupported($context) */ protected function checkAllowedAndForbiddenlist($context) { - $allowedlist = \array_filter((array) $this->params->get('allowedlist', [])); - $forbiddenlist = \array_filter((array) $this->params->get('forbiddenlist', [])); + $allowedlist = array_filter((array) $this->params->get('allowedlist', [])); + $forbiddenlist = array_filter((array) $this->params->get('forbiddenlist', [])); if (!empty($allowedlist)) { foreach ($allowedlist as $allowed) { diff --git a/libraries/src/Schemaorg/SchemaorgPrepareDateTrait.php b/libraries/src/Schemaorg/SchemaorgPrepareDateTrait.php index 3d7f7bcc2e78f..f2f61425b5032 100644 --- a/libraries/src/Schemaorg/SchemaorgPrepareDateTrait.php +++ b/libraries/src/Schemaorg/SchemaorgPrepareDateTrait.php @@ -33,9 +33,9 @@ trait SchemaorgPrepareDateTrait */ protected function prepareDate($date) { - if (is_array($date)) { + if (\is_array($date)) { // We don't handle references, they should be ok - if (count($date) === 1 && isset($date['@id'])) { + if (\count($date) === 1 && isset($date['@id'])) { return $date; } diff --git a/libraries/src/Schemaorg/SchemaorgPrepareDurationTrait.php b/libraries/src/Schemaorg/SchemaorgPrepareDurationTrait.php index 12f491135ab97..3a51799d2c37b 100644 --- a/libraries/src/Schemaorg/SchemaorgPrepareDurationTrait.php +++ b/libraries/src/Schemaorg/SchemaorgPrepareDurationTrait.php @@ -31,7 +31,7 @@ trait SchemaorgPrepareDurationTrait */ protected function prepareDuration($duration) { - if (!is_array($duration)) { + if (!\is_array($duration)) { return null; } diff --git a/libraries/src/Schemaorg/SchemaorgPrepareImageTrait.php b/libraries/src/Schemaorg/SchemaorgPrepareImageTrait.php index 94da86645ccc7..721cc7d6774c9 100644 --- a/libraries/src/Schemaorg/SchemaorgPrepareImageTrait.php +++ b/libraries/src/Schemaorg/SchemaorgPrepareImageTrait.php @@ -33,9 +33,9 @@ trait SchemaorgPrepareImageTrait */ protected function prepareImage($image) { - if (is_array($image)) { + if (\is_array($image)) { // We don't handle references, they should be ok - if (count($image) === 1 && isset($image['@id'])) { + if (\count($image) === 1 && isset($image['@id'])) { return $image; } diff --git a/libraries/src/Serializer/Events/OnGetApiAttributes.php b/libraries/src/Serializer/Events/OnGetApiAttributes.php index 1069aa8162b74..64107f417e0fe 100644 --- a/libraries/src/Serializer/Events/OnGetApiAttributes.php +++ b/libraries/src/Serializer/Events/OnGetApiAttributes.php @@ -47,7 +47,7 @@ public function __construct($name, array $arguments = []) { if ( !\array_key_exists('attributes', $arguments) - || \array_key_exists('attributes', $arguments) && !is_array($arguments['attributes']) + || \array_key_exists('attributes', $arguments) && !\is_array($arguments['attributes']) ) { throw new \BadMethodCallException("Argument 'attributes' as an array is required for event $name"); } diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index 62a9fb6ef09e1..109cff6d2ec4b 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -264,7 +264,7 @@ public function check() } // Check the publish down date is not earlier than publish up. - if (!is_null($this->publish_up) && !is_null($this->publish_down) && $this->publish_down < $this->publish_up) { + if (!\is_null($this->publish_up) && !\is_null($this->publish_down) && $this->publish_down < $this->publish_up) { // Swap the dates. $temp = $this->publish_up; $this->publish_up = $this->publish_down; diff --git a/libraries/src/Toolbar/Toolbar.php b/libraries/src/Toolbar/Toolbar.php index 694dd508e2d71..b52958404fe71 100644 --- a/libraries/src/Toolbar/Toolbar.php +++ b/libraries/src/Toolbar/Toolbar.php @@ -312,7 +312,7 @@ public function render(array $options = []) $html[] = $layout->render(['id' => $this->_name]); } - $len = count($this->_bar); + $len = \count($this->_bar); // Render each button in the toolbar. foreach ($this->_bar as $i => $button) { diff --git a/libraries/src/User/UserHelper.php b/libraries/src/User/UserHelper.php index 5fd5c907df018..df178918a61da 100644 --- a/libraries/src/User/UserHelper.php +++ b/libraries/src/User/UserHelper.php @@ -623,7 +623,7 @@ public static function destroyUserSessions($userId, $keepCurrent = false, $clien // Convert PostgreSQL Session IDs into strings (see GitHub #33822) foreach ($sessionIds as &$sessionId) { - if (is_resource($sessionId) && get_resource_type($sessionId) === 'stream') { + if (\is_resource($sessionId) && get_resource_type($sessionId) === 'stream') { $sessionId = stream_get_contents($sessionId); } } diff --git a/libraries/src/WebAsset/WebAssetItem.php b/libraries/src/WebAsset/WebAssetItem.php index aef3cd6e63d75..b7546a7b2afe5 100644 --- a/libraries/src/WebAsset/WebAssetItem.php +++ b/libraries/src/WebAsset/WebAssetItem.php @@ -96,19 +96,19 @@ public function __construct( $this->name = $name; $this->uri = $uri; - if (array_key_exists('version', $options)) { + if (\array_key_exists('version', $options)) { $this->version = $options['version']; unset($options['version']); } - if (array_key_exists('attributes', $options)) { + if (\array_key_exists('attributes', $options)) { $this->attributes = (array) $options['attributes']; unset($options['attributes']); } else { $this->attributes = $attributes; } - if (array_key_exists('dependencies', $options)) { + if (\array_key_exists('dependencies', $options)) { $this->dependencies = (array) $options['dependencies']; unset($options['dependencies']); } else { @@ -199,7 +199,7 @@ public function getUri($resolvePath = true): string */ public function getOption(string $key, $default = null) { - if (array_key_exists($key, $this->options)) { + if (\array_key_exists($key, $this->options)) { return $this->options[$key]; } @@ -247,7 +247,7 @@ public function getOptions(): array */ public function getAttribute(string $key, $default = null) { - if (array_key_exists($key, $this->attributes)) { + if (\array_key_exists($key, $this->attributes)) { return $this->attributes[$key]; } diff --git a/libraries/src/WebAsset/WebAssetManager.php b/libraries/src/WebAsset/WebAssetManager.php index ef9ead782df2a..23be148c2bbbf 100644 --- a/libraries/src/WebAsset/WebAssetManager.php +++ b/libraries/src/WebAsset/WebAssetManager.php @@ -237,7 +237,7 @@ public function __call($method, $arguments) return $this->registerAsset($type, ...$arguments); } - throw new \BadMethodCallException(sprintf('Undefined method %s in class %s', $method, get_class($this))); + throw new \BadMethodCallException(sprintf('Undefined method %s in class %s', $method, \get_class($this))); } /** @@ -502,7 +502,7 @@ public function registerAsset(string $type, $asset, string $uri = '', array $opt { if ($asset instanceof WebAssetItemInterface) { $this->registry->add($type, $asset); - } elseif (is_string($asset)) { + } elseif (\is_string($asset)) { $options['type'] = $type; $assetInstance = $this->registry->createAsset($asset, $uri, $options, $attributes, $dependencies); $this->registry->add($type, $assetInstance); @@ -661,7 +661,7 @@ public function addInline(string $type, $content, array $options = [], array $at { if ($content instanceof WebAssetItemInterface) { $assetInstance = $content; - } elseif (is_string($content)) { + } elseif (\is_string($content)) { $name = $options['name'] ?? ('inline.' . md5($content)); $assetInstance = $this->registry->createAsset($name, '', $options, $attributes, $dependencies); $assetInstance->setOption('content', $content); diff --git a/libraries/src/WebAsset/WebAssetRegistry.php b/libraries/src/WebAsset/WebAssetRegistry.php index 332c406137957..7067be73202e8 100644 --- a/libraries/src/WebAsset/WebAssetRegistry.php +++ b/libraries/src/WebAsset/WebAssetRegistry.php @@ -152,7 +152,7 @@ public function add(string $type, WebAssetItemInterface $asset): WebAssetRegistr { $type = strtolower($type); - if (!array_key_exists($type, $this->assets)) { + if (!\array_key_exists($type, $this->assets)) { $this->assets[$type] = []; } diff --git a/libraries/src/Workflow/Workflow.php b/libraries/src/Workflow/Workflow.php index 14a8b5f3a5bd6..88c4544ce80f1 100644 --- a/libraries/src/Workflow/Workflow.php +++ b/libraries/src/Workflow/Workflow.php @@ -351,7 +351,7 @@ public function executeTransition(array $pks, int $transitionId): bool $transition = $this->getValidTransition($pks, $transitionId); - if (is_null($transition)) { + if (\is_null($transition)) { return false; } diff --git a/libraries/src/Workflow/WorkflowPluginTrait.php b/libraries/src/Workflow/WorkflowPluginTrait.php index 85db1110cd6f3..0e9e74fc753c5 100644 --- a/libraries/src/Workflow/WorkflowPluginTrait.php +++ b/libraries/src/Workflow/WorkflowPluginTrait.php @@ -44,7 +44,7 @@ protected function enhanceWorkflowTransitionForm(Form $form, $data) } // Load XML file from "parent" plugin - $path = dirname((new \ReflectionClass(static::class))->getFileName()); + $path = \dirname((new \ReflectionClass(static::class))->getFileName()); if (!is_file($path . '/forms/action.xml')) { $path = JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name; @@ -71,7 +71,7 @@ protected function getWorkflow(int $workflowId = null) $app = $this->getApplication() ?? $this->app; $workflowId = !empty($workflowId) ? $workflowId : $app->getInput()->getInt('workflow_id'); - if (is_array($workflowId)) { + if (\is_array($workflowId)) { return false; } @@ -104,8 +104,8 @@ protected function isSupported($context) */ protected function checkAllowedAndForbiddenlist($context) { - $allowedlist = \array_filter((array) $this->params->get('allowedlist', [])); - $forbiddenlist = \array_filter((array) $this->params->get('forbiddenlist', [])); + $allowedlist = array_filter((array) $this->params->get('allowedlist', [])); + $forbiddenlist = array_filter((array) $this->params->get('forbiddenlist', [])); if (!empty($allowedlist)) { foreach ($allowedlist as $allowed) { diff --git a/libraries/src/Workflow/WorkflowServiceTrait.php b/libraries/src/Workflow/WorkflowServiceTrait.php index 7280c090485c2..a8e3a662d45b5 100644 --- a/libraries/src/Workflow/WorkflowServiceTrait.php +++ b/libraries/src/Workflow/WorkflowServiceTrait.php @@ -59,11 +59,11 @@ public function supportFunctionality($functionality, $context): bool return false; } - if (!is_array($this->supportedFunctionality[$functionality])) { + if (!\is_array($this->supportedFunctionality[$functionality])) { return true; } - return in_array($context, $this->supportedFunctionality[$functionality], true); + return \in_array($context, $this->supportedFunctionality[$functionality], true); } /** @@ -125,7 +125,7 @@ public function getModelName($context): string { $parts = explode('.', $context); - if (count($parts) < 2) { + if (\count($parts) < 2) { return ''; } diff --git a/modules/mod_articles_archive/services/provider.php b/modules/mod_articles_archive/services/provider.php index 9eb4ed7e2dad6..681f882ed37bb 100644 --- a/modules/mod_articles_archive/services/provider.php +++ b/modules/mod_articles_archive/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_articles_categories/services/provider.php b/modules/mod_articles_categories/services/provider.php index 8aaca5a002a8d..0d5d88c959168 100644 --- a/modules/mod_articles_categories/services/provider.php +++ b/modules/mod_articles_categories/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_articles_category/services/provider.php b/modules/mod_articles_category/services/provider.php index d5316e7cc4d6c..36ea1627fcc8a 100644 --- a/modules/mod_articles_category/services/provider.php +++ b/modules/mod_articles_category/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_articles_latest/services/provider.php b/modules/mod_articles_latest/services/provider.php index 3bbe02b6b3e93..39ae7012e2bfa 100644 --- a/modules/mod_articles_latest/services/provider.php +++ b/modules/mod_articles_latest/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_articles_news/services/provider.php b/modules/mod_articles_news/services/provider.php index df46f71efbf77..4d8cbdff1c3d6 100644 --- a/modules/mod_articles_news/services/provider.php +++ b/modules/mod_articles_news/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_articles_popular/services/provider.php b/modules/mod_articles_popular/services/provider.php index 03c26ccaf452f..2cedeb621f8cf 100644 --- a/modules/mod_articles_popular/services/provider.php +++ b/modules/mod_articles_popular/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_banners/mod_banners.php b/modules/mod_banners/mod_banners.php index d97440bedc823..6348f8941e0b4 100644 --- a/modules/mod_banners/mod_banners.php +++ b/modules/mod_banners/mod_banners.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\Helper\ModuleHelper; use Joomla\Component\Banners\Administrator\Helper\BannersHelper as BannersComponentHelper; diff --git a/modules/mod_breadcrumbs/services/provider.php b/modules/mod_breadcrumbs/services/provider.php index b749986cad7f1..7cf801fecc857 100644 --- a/modules/mod_breadcrumbs/services/provider.php +++ b/modules/mod_breadcrumbs/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php b/modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php index b6d8dd0cb7a38..54dc988af7e35 100644 --- a/modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php +++ b/modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php @@ -39,7 +39,7 @@ protected function getLayoutData(): array $data = parent::getLayoutData(); $data['list'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getBreadcrumbs($data['params'], $data['app']); - $data['count'] = count($data['list']); + $data['count'] = \count($data['list']); if (!$data['params']->get('showHome', 1)) { $data['homeCrumb'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getHomeItem($data['params'], $data['app']); diff --git a/modules/mod_custom/services/provider.php b/modules/mod_custom/services/provider.php index be24af4af9372..ddbb5942192f5 100644 --- a/modules/mod_custom/services/provider.php +++ b/modules/mod_custom/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\Extension\Service\Provider\Module; use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory; diff --git a/modules/mod_feed/mod_feed.php b/modules/mod_feed/mod_feed.php index 6494c6e0f80b4..3a74305b75911 100644 --- a/modules/mod_feed/mod_feed.php +++ b/modules/mod_feed/mod_feed.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\Helper\ModuleHelper; use Joomla\Module\Feed\Site\Helper\FeedHelper; diff --git a/modules/mod_finder/mod_finder.php b/modules/mod_finder/mod_finder.php index 24259a2742516..6a9b505898af7 100644 --- a/modules/mod_finder/mod_finder.php +++ b/modules/mod_finder/mod_finder.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\Component\ComponentHelper; use Joomla\CMS\Helper\ModuleHelper; diff --git a/modules/mod_footer/services/provider.php b/modules/mod_footer/services/provider.php index 0db22087a7b1d..f26cf89dae9cd 100644 --- a/modules/mod_footer/services/provider.php +++ b/modules/mod_footer/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\Extension\Service\Provider\Module; use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory; diff --git a/modules/mod_languages/mod_languages.php b/modules/mod_languages/mod_languages.php index c59728508106c..377a1352739c6 100644 --- a/modules/mod_languages/mod_languages.php +++ b/modules/mod_languages/mod_languages.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\Helper\ModuleHelper; use Joomla\Module\Languages\Site\Helper\LanguagesHelper; diff --git a/modules/mod_login/mod_login.php b/modules/mod_login/mod_login.php index a66b84e405838..98c89faea69f7 100644 --- a/modules/mod_login/mod_login.php +++ b/modules/mod_login/mod_login.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\Factory; use Joomla\CMS\Helper\AuthenticationHelper; diff --git a/modules/mod_menu/mod_menu.php b/modules/mod_menu/mod_menu.php index 16eea085dc5b0..f87e4cfbec556 100644 --- a/modules/mod_menu/mod_menu.php +++ b/modules/mod_menu/mod_menu.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\Helper\ModuleHelper; use Joomla\Module\Menu\Site\Helper\MenuHelper; diff --git a/modules/mod_random_image/mod_random_image.php b/modules/mod_random_image/mod_random_image.php index f572fbdd15f02..50ecd17754dd3 100644 --- a/modules/mod_random_image/mod_random_image.php +++ b/modules/mod_random_image/mod_random_image.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\Helper\ModuleHelper; use Joomla\Module\RandomImage\Site\Helper\RandomImageHelper; diff --git a/modules/mod_related_items/services/provider.php b/modules/mod_related_items/services/provider.php index 1066e3c3785b8..f1429c5011a39 100644 --- a/modules/mod_related_items/services/provider.php +++ b/modules/mod_related_items/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_stats/mod_stats.php b/modules/mod_stats/mod_stats.php index c8a852d89ed58..4728294702124 100644 --- a/modules/mod_stats/mod_stats.php +++ b/modules/mod_stats/mod_stats.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\Helper\ModuleHelper; use Joomla\Module\Stats\Site\Helper\StatsHelper; diff --git a/modules/mod_syndicate/mod_syndicate.php b/modules/mod_syndicate/mod_syndicate.php index 696c6995fe6b9..7f8821d8a20d8 100644 --- a/modules/mod_syndicate/mod_syndicate.php +++ b/modules/mod_syndicate/mod_syndicate.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\Helper\ModuleHelper; use Joomla\Module\Syndicate\Site\Helper\SyndicateHelper; diff --git a/modules/mod_tags_popular/mod_tags_popular.php b/modules/mod_tags_popular/mod_tags_popular.php index 1db4b2a585c27..a021ebfe8c6ba 100644 --- a/modules/mod_tags_popular/mod_tags_popular.php +++ b/modules/mod_tags_popular/mod_tags_popular.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\Helper\ModuleHelper; @@ -21,7 +21,7 @@ $list = ModuleHelper::moduleCache($module, $params, $cacheparams); -if (!count($list) && !$params->get('no_results_text')) { +if (!\count($list) && !$params->get('no_results_text')) { return; } diff --git a/modules/mod_tags_similar/mod_tags_similar.php b/modules/mod_tags_similar/mod_tags_similar.php index 23385305021fa..2fde45cd042a3 100644 --- a/modules/mod_tags_similar/mod_tags_similar.php +++ b/modules/mod_tags_similar/mod_tags_similar.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\Helper\ModuleHelper; diff --git a/modules/mod_users_latest/services/provider.php b/modules/mod_users_latest/services/provider.php index 6473a90d83083..55014da32833b 100644 --- a/modules/mod_users_latest/services/provider.php +++ b/modules/mod_users_latest/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\Extension\Service\Provider\HelperFactory; use Joomla\CMS\Extension\Service\Provider\Module; diff --git a/modules/mod_whosonline/mod_whosonline.php b/modules/mod_whosonline/mod_whosonline.php index 9f292eb308f97..5fd12368485c2 100644 --- a/modules/mod_whosonline/mod_whosonline.php +++ b/modules/mod_whosonline/mod_whosonline.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\Helper\ModuleHelper; use Joomla\Module\Whosonline\Site\Helper\WhosonlineHelper; diff --git a/modules/mod_wrapper/mod_wrapper.php b/modules/mod_wrapper/mod_wrapper.php index ea2e3d589fffa..43b7e17a894a2 100644 --- a/modules/mod_wrapper/mod_wrapper.php +++ b/modules/mod_wrapper/mod_wrapper.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\Helper\ModuleHelper; use Joomla\Module\Wrapper\Site\Helper\WrapperHelper; diff --git a/plugins/actionlog/joomla/services/provider.php b/plugins/actionlog/joomla/services/provider.php index 586f7350ad29f..08dd6fee295f7 100644 --- a/plugins/actionlog/joomla/services/provider.php +++ b/plugins/actionlog/joomla/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/actionlog/joomla/src/Extension/Joomla.php b/plugins/actionlog/joomla/src/Extension/Joomla.php index a95facd99078c..a5848c360e9f1 100644 --- a/plugins/actionlog/joomla/src/Extension/Joomla.php +++ b/plugins/actionlog/joomla/src/Extension/Joomla.php @@ -888,7 +888,7 @@ public function onUserLogout($user, $options = []) */ protected function checkLoggable($extension) { - return in_array($extension, $this->loggableExtensions); + return \in_array($extension, $this->loggableExtensions); } /** @@ -1066,7 +1066,7 @@ public function onAfterDispatch() $verb = $this->getApplication()->getInput()->getMethod(); - if (!in_array($verb, $this->loggableVerbs)) { + if (!\in_array($verb, $this->loggableVerbs)) { return; } diff --git a/plugins/api-authentication/basic/services/provider.php b/plugins/api-authentication/basic/services/provider.php index 36146c5d15c7e..6110f24b81b5f 100644 --- a/plugins/api-authentication/basic/services/provider.php +++ b/plugins/api-authentication/basic/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/api-authentication/token/services/provider.php b/plugins/api-authentication/token/services/provider.php index 00d600ff4e52d..b6cef2bf3393c 100644 --- a/plugins/api-authentication/token/services/provider.php +++ b/plugins/api-authentication/token/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/api-authentication/token/src/Extension/Token.php b/plugins/api-authentication/token/src/Extension/Token.php index 4e2b7ccab0576..db551d519eee2 100644 --- a/plugins/api-authentication/token/src/Extension/Token.php +++ b/plugins/api-authentication/token/src/Extension/Token.php @@ -118,11 +118,11 @@ public function onUserAuthenticate(AuthenticationEvent $event): void // Apache specific fixes. See https://github.com/symfony/symfony/issues/19693 if ( empty($authHeader) && \PHP_SAPI === 'apache2handler' - && function_exists('apache_request_headers') && apache_request_headers() !== false + && \function_exists('apache_request_headers') && apache_request_headers() !== false ) { $apacheHeaders = array_change_key_case(apache_request_headers(), CASE_LOWER); - if (array_key_exists('authorization', $apacheHeaders)) { + if (\array_key_exists('authorization', $apacheHeaders)) { $authHeader = $this->filter->clean($apacheHeaders['authorization'], 'STRING'); } } @@ -155,7 +155,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void */ $parts = explode(':', $authString, 3); - if (count($parts) != 3) { + if (\count($parts) != 3) { return; } @@ -164,7 +164,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void /** * Verify the HMAC algorithm requested in the token string is allowed */ - $allowedAlgo = in_array($algo, $this->allowedAlgos); + $allowedAlgo = \in_array($algo, $this->allowedAlgos); /** * Make sure the user ID is an integer @@ -354,7 +354,7 @@ private function getAllowedUserGroups(): array return []; } - if (!is_array($userGroups)) { + if (!\is_array($userGroups)) { $userGroups = [$userGroups]; } diff --git a/plugins/authentication/cookie/services/provider.php b/plugins/authentication/cookie/services/provider.php index 2332fa3b433a2..7e54ac4747021 100644 --- a/plugins/authentication/cookie/services/provider.php +++ b/plugins/authentication/cookie/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/authentication/cookie/src/Extension/Cookie.php b/plugins/authentication/cookie/src/Extension/Cookie.php index 910fdb1742bc1..1ff67aa985a8f 100644 --- a/plugins/authentication/cookie/src/Extension/Cookie.php +++ b/plugins/authentication/cookie/src/Extension/Cookie.php @@ -90,7 +90,7 @@ public function onUserAuthenticate($credentials, $options, &$response) $cookieArray = explode('.', $cookieValue); // Check for valid cookie value - if (count($cookieArray) !== 2) { + if (\count($cookieArray) !== 2) { // Destroy the cookie in the browser. $app->getInput()->cookie->set($cookieName, '', 1, $app->get('cookie_path', '/'), $app->get('cookie_domain', '')); Log::add('Invalid cookie detected.', Log::WARNING, 'error'); @@ -136,7 +136,7 @@ public function onUserAuthenticate($credentials, $options, &$response) return false; } - if (count($results) !== 1) { + if (\count($results) !== 1) { // Destroy the cookie in the browser. $app->getInput()->cookie->set($cookieName, '', 1, $app->get('cookie_path', '/'), $app->get('cookie_domain', '')); $response->status = Authentication::STATUS_FAILURE; diff --git a/plugins/authentication/joomla/services/provider.php b/plugins/authentication/joomla/services/provider.php index dc2465ef632bb..2cd702eee4b4b 100644 --- a/plugins/authentication/joomla/services/provider.php +++ b/plugins/authentication/joomla/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/authentication/ldap/services/provider.php b/plugins/authentication/ldap/services/provider.php index 5022a8844da5c..ded1cfb43a019 100644 --- a/plugins/authentication/ldap/services/provider.php +++ b/plugins/authentication/ldap/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/authentication/ldap/src/Extension/Ldap.php b/plugins/authentication/ldap/src/Extension/Ldap.php index ae0a3d74d35d2..68ebcbc66618c 100644 --- a/plugins/authentication/ldap/src/Extension/Ldap.php +++ b/plugins/authentication/ldap/src/Extension/Ldap.php @@ -80,7 +80,7 @@ public function onUserAuthenticate($credentials, $options, &$response) $response->type = $logcategory; // Strip null bytes from the password - $credentials['password'] = str_replace(chr(0), '', $credentials['password']); + $credentials['password'] = str_replace(\chr(0), '', $credentials['password']); // LDAP does not like Blank passwords (tries to Anon Bind which is bad) if (empty($credentials['password'])) { @@ -106,7 +106,7 @@ public function onUserAuthenticate($credentials, $options, &$response) $cacertfile = ""; } elseif (is_file($cacert)) { $cacertfile = $cacert; - $cacertdir = dirname($cacert); + $cacertdir = \dirname($cacert); } else { $cacertfile = $cacert; $cacertdir = $cacert; @@ -290,7 +290,7 @@ private function searchByString(string $search, LdapInterface $ldap) foreach (explode(';', $search) as $key => $result) { $results = $ldap->query($dn, '(' . str_replace('\3b', ';', $result) . ')')->execute(); - if (count($results)) { + if (\count($results)) { return $results[0]; } } diff --git a/plugins/behaviour/compat/services/provider.php b/plugins/behaviour/compat/services/provider.php index eddd49c6a7fb7..b239608b70959 100644 --- a/plugins/behaviour/compat/services/provider.php +++ b/plugins/behaviour/compat/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/behaviour/compat/src/Extension/Compat.php b/plugins/behaviour/compat/src/Extension/Compat.php index 7d6d11142baa1..3ce25b0b50873 100644 --- a/plugins/behaviour/compat/src/Extension/Compat.php +++ b/plugins/behaviour/compat/src/Extension/Compat.php @@ -73,7 +73,7 @@ public function __construct(DispatcherInterface $dispatcher, array $config = []) * likely be removed in Joomla 6.0 */ if ($this->params->get('classes_aliases', '1')) { - require_once dirname(__DIR__) . '/classmap/classmap.php'; + require_once \dirname(__DIR__) . '/classmap/classmap.php'; } } diff --git a/plugins/behaviour/compat/src/classmap/classmap.php b/plugins/behaviour/compat/src/classmap/classmap.php index 04156a1e5a931..03c7ebb795f1f 100644 --- a/plugins/behaviour/compat/src/classmap/classmap.php +++ b/plugins/behaviour/compat/src/classmap/classmap.php @@ -8,7 +8,7 @@ */ // No direct access. -defined('_JEXEC') or die; +\defined('_JEXEC') or die; require_once __DIR__ . '/extensions.classmap.php'; diff --git a/plugins/behaviour/compat/src/classmap/extensions.classmap.php b/plugins/behaviour/compat/src/classmap/extensions.classmap.php index 9a55810214c2f..956e9c4cb022f 100644 --- a/plugins/behaviour/compat/src/classmap/extensions.classmap.php +++ b/plugins/behaviour/compat/src/classmap/extensions.classmap.php @@ -8,7 +8,7 @@ */ // No direct access. -defined('_JEXEC') or die; +\defined('_JEXEC') or die; // Class map of the core extensions JLoader::registerAlias('ActionLogPlugin', '\\Joomla\\Component\\Actionlogs\\Administrator\\Plugin\\ActionLogPlugin', '5.0'); diff --git a/plugins/behaviour/taggable/services/provider.php b/plugins/behaviour/taggable/services/provider.php index 16656b4fdc2c9..ab99b82347cb2 100644 --- a/plugins/behaviour/taggable/services/provider.php +++ b/plugins/behaviour/taggable/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/behaviour/taggable/src/Extension/Taggable.php b/plugins/behaviour/taggable/src/Extension/Taggable.php index 72afea349cf6f..b721d8bd15dbe 100644 --- a/plugins/behaviour/taggable/src/Extension/Taggable.php +++ b/plugins/behaviour/taggable/src/Extension/Taggable.php @@ -79,7 +79,7 @@ public function onTableObjectCreate(ObjectCreateEvent $event) } // If the table already has a tags helper we have nothing to do - if (!is_null($table->getTagsHelper())) { + if (!\is_null($table->getTagsHelper())) { return; } @@ -117,7 +117,7 @@ public function onTableBeforeStore(BeforeStoreEvent $event) } // If the table doesn't have a tags helper we can't proceed - if (is_null($table->getTagsHelper())) { + if (\is_null($table->getTagsHelper())) { return; } @@ -154,12 +154,12 @@ public function onTableAfterStore(AfterStoreEvent $event) return; } - if (!is_object($table) || !($table instanceof TaggableTableInterface)) { + if (!\is_object($table) || !($table instanceof TaggableTableInterface)) { return; } // If the table doesn't have a tags helper we can't proceed - if (is_null($table->getTagsHelper())) { + if (\is_null($table->getTagsHelper())) { return; } @@ -173,9 +173,9 @@ public function onTableAfterStore(AfterStoreEvent $event) if (empty($newTags)) { $result = $tagsHelper->postStoreProcess($table); } else { - if (is_string($newTags) && (strpos($newTags, ',') !== false)) { + if (\is_string($newTags) && (strpos($newTags, ',') !== false)) { $newTags = explode(',', $newTags); - } elseif (!is_array($newTags)) { + } elseif (!\is_array($newTags)) { $newTags = (array) $newTags; } @@ -205,7 +205,7 @@ public function onTableBeforeDelete(BeforeDeleteEvent $event) } // If the table doesn't have a tags helper we can't proceed - if (is_null($table->getTagsHelper())) { + if (\is_null($table->getTagsHelper())) { return; } @@ -238,7 +238,7 @@ public function onTableSetNewTags(SetNewTagsEvent $event) } // If the table doesn't have a tags helper we can't proceed - if (is_null($table->getTagsHelper())) { + if (\is_null($table->getTagsHelper())) { return; } @@ -299,7 +299,7 @@ public function onTableAfterLoad(AfterLoadEvent $event) } // If the table doesn't have a tags helper we can't proceed - if (is_null($table->getTagsHelper())) { + if (\is_null($table->getTagsHelper())) { return; } diff --git a/plugins/behaviour/versionable/services/provider.php b/plugins/behaviour/versionable/services/provider.php index 66cdf88700da6..c3ad1000b9fd7 100644 --- a/plugins/behaviour/versionable/services/provider.php +++ b/plugins/behaviour/versionable/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/behaviour/versionable/src/Extension/Versionable.php b/plugins/behaviour/versionable/src/Extension/Versionable.php index 3a3cd79c79e02..3f5f5bc3b974d 100644 --- a/plugins/behaviour/versionable/src/Extension/Versionable.php +++ b/plugins/behaviour/versionable/src/Extension/Versionable.php @@ -103,7 +103,7 @@ public function onTableAfterStore(AfterStoreEvent $event) return; } - if (!(is_object($table) && $table instanceof VersionableTableInterface)) { + if (!(\is_object($table) && $table instanceof VersionableTableInterface)) { return; } @@ -143,7 +143,7 @@ public function onTableBeforeDelete(BeforeDeleteEvent $event) /** @var VersionableTableInterface $table */ $table = $event['subject']; - if (!(is_object($table) && $table instanceof VersionableTableInterface)) { + if (!(\is_object($table) && $table instanceof VersionableTableInterface)) { return; } diff --git a/plugins/content/confirmconsent/services/provider.php b/plugins/content/confirmconsent/services/provider.php index 61e50835a619f..edc2e8ddf404c 100644 --- a/plugins/content/confirmconsent/services/provider.php +++ b/plugins/content/confirmconsent/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/confirmconsent/src/Extension/ConfirmConsent.php b/plugins/content/confirmconsent/src/Extension/ConfirmConsent.php index 0c99b0dd88a16..99e9df14d0a93 100644 --- a/plugins/content/confirmconsent/src/Extension/ConfirmConsent.php +++ b/plugins/content/confirmconsent/src/Extension/ConfirmConsent.php @@ -57,7 +57,7 @@ final class ConfirmConsent extends CMSPlugin */ public function onContentPrepareForm(Form $form, $data) { - if ($this->getApplication()->isClient('administrator') || !in_array($form->getName(), $this->supportedContext)) { + if ($this->getApplication()->isClient('administrator') || !\in_array($form->getName(), $this->supportedContext)) { return true; } diff --git a/plugins/content/contact/services/provider.php b/plugins/content/contact/services/provider.php index 74a8dc4c1dd12..799e59318595c 100644 --- a/plugins/content/contact/services/provider.php +++ b/plugins/content/contact/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/contact/src/Extension/Contact.php b/plugins/content/contact/src/Extension/Contact.php index 3264457b39447..a67e782ad8472 100644 --- a/plugins/content/contact/src/Extension/Contact.php +++ b/plugins/content/contact/src/Extension/Contact.php @@ -45,7 +45,7 @@ public function onContentPrepare($context, &$row, $params, $page = 0) { $allowed_contexts = ['com_content.category', 'com_content.article', 'com_content.featured']; - if (!in_array($context, $allowed_contexts)) { + if (!\in_array($context, $allowed_contexts)) { return; } @@ -98,7 +98,7 @@ private function getContactData($userId) static $contacts = []; // Note: don't use isset() because value could be null. - if (array_key_exists($userId, $contacts)) { + if (\array_key_exists($userId, $contacts)) { return $contacts[$userId]; } diff --git a/plugins/content/emailcloak/services/provider.php b/plugins/content/emailcloak/services/provider.php index 7f8ed477ba47b..a0f7a4bfe14f4 100644 --- a/plugins/content/emailcloak/services/provider.php +++ b/plugins/content/emailcloak/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/emailcloak/src/Extension/EmailCloak.php b/plugins/content/emailcloak/src/Extension/EmailCloak.php index 6658a16226a92..1518df7fb5926 100644 --- a/plugins/content/emailcloak/src/Extension/EmailCloak.php +++ b/plugins/content/emailcloak/src/Extension/EmailCloak.php @@ -145,7 +145,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -166,7 +166,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -185,7 +185,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -204,7 +204,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -222,7 +222,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -240,7 +240,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -258,7 +258,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -276,7 +276,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -294,7 +294,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -316,7 +316,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -337,7 +337,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -356,7 +356,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -374,7 +374,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -396,7 +396,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -418,7 +418,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 1, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -440,7 +440,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $attribsBefore, $attribsAfter); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($regs[0][0])); } /* @@ -455,7 +455,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, 0, $mail); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($mail)); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($mail)); } /* @@ -469,7 +469,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, 0, $mail); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[0][1], strlen($mail)); + $text = substr_replace($text, $replacement, $regs[0][1], \strlen($mail)); } /* @@ -486,7 +486,7 @@ private function cloak($text) $replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mail); // Replace the found address with the js cloaked email - $text = substr_replace($text, $replacement, $regs[1][1], strlen($mail)); + $text = substr_replace($text, $replacement, $regs[1][1], \strlen($mail)); } return $text; diff --git a/plugins/content/fields/services/provider.php b/plugins/content/fields/services/provider.php index a29af5ab9bb7d..83ac648494aa1 100644 --- a/plugins/content/fields/services/provider.php +++ b/plugins/content/fields/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/content/fields/src/Extension/Fields.php b/plugins/content/fields/src/Extension/Fields.php index 517a880380baa..55546a35778cc 100644 --- a/plugins/content/fields/src/Extension/Fields.php +++ b/plugins/content/fields/src/Extension/Fields.php @@ -48,7 +48,7 @@ public function onContentPrepare($context, &$item, &$params, $page = 0) } // This plugin only works if $item is an object - if (!is_object($item)) { + if (!\is_object($item)) { return; } @@ -63,7 +63,7 @@ public function onContentPrepare($context, &$item, &$params, $page = 0) } // Prepare the intro text - if (property_exists($item, 'introtext') && is_string($item->introtext) && strpos($item->introtext, 'field') !== false) { + if (property_exists($item, 'introtext') && \is_string($item->introtext) && strpos($item->introtext, 'field') !== false) { $item->introtext = $this->prepare($item->introtext, $context, $item); } } @@ -91,7 +91,7 @@ private function prepare($string, $context, $item) $parts = FieldsHelper::extract($context); - if (!$parts || count($parts) < 2) { + if (!$parts || \count($parts) < 2) { return $string; } diff --git a/plugins/content/finder/services/provider.php b/plugins/content/finder/services/provider.php index 1db144de06be6..2625c3054ad40 100644 --- a/plugins/content/finder/services/provider.php +++ b/plugins/content/finder/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/joomla/services/provider.php b/plugins/content/joomla/services/provider.php index b01ac39f31ca5..73958756fb20a 100644 --- a/plugins/content/joomla/services/provider.php +++ b/plugins/content/joomla/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/joomla/src/Extension/Joomla.php b/plugins/content/joomla/src/Extension/Joomla.php index da15953506edf..7ef20a5518077 100644 --- a/plugins/content/joomla/src/Extension/Joomla.php +++ b/plugins/content/joomla/src/Extension/Joomla.php @@ -62,7 +62,7 @@ public function onContentBeforeSave($context, $table, $isNew, $data) } // Check we are handling the frontend edit form. - if (!in_array($context, ['com_workflow.stage', 'com_workflow.workflow']) || $isNew || !$table->hasField('published')) { + if (!\in_array($context, ['com_workflow.stage', 'com_workflow.workflow']) || $isNew || !$table->hasField('published')) { return true; } @@ -166,7 +166,7 @@ public function onContentAfterSave($context, $article, $isNew): void public function onContentBeforeDelete($context, $data) { // Skip plugin if we are deleting something other than categories - if (!in_array($context, ['com_categories.category', 'com_workflow.stage', 'com_workflow.workflow'])) { + if (!\in_array($context, ['com_categories.category', 'com_workflow.stage', 'com_workflow.workflow'])) { return true; } @@ -195,7 +195,7 @@ public function onContentBeforeDelete($context, $data) */ public function onContentBeforeChangeState($context, $pks, $value) { - if ($value > 0 || !in_array($context, ['com_workflow.workflow', 'com_workflow.stage'])) { + if ($value > 0 || !\in_array($context, ['com_workflow.workflow', 'com_workflow.stage'])) { return true; } @@ -263,7 +263,7 @@ private function injectContentSchema(string $context, Registry $schema) // Check if there is already a schema for the item, then skip it $mySchema = $schema->toArray(); - if (!isset($mySchema['@graph']) || !is_array($mySchema['@graph'])) { + if (!isset($mySchema['@graph']) || !\is_array($mySchema['@graph'])) { return; } @@ -305,7 +305,7 @@ private function injectContentSchema(string $context, Registry $schema) return [$articleSchema]; }, [$id]); - } elseif (in_array($view, ['category', 'featured', 'archive'])) { + } elseif (\in_array($view, ['category', 'featured', 'archive'])) { $additionalSchemas = $cache->get(function ($view, $id) use ($component, $baseId, $app, $db) { $menu = $app->getMenu()->getActive(); $schemaId = $baseId . 'com_content/' . $view . ($view == 'category' ? '/' . $id : ''); @@ -488,7 +488,7 @@ private function injectContactSchema(string $context, Registry $schema) // Check if there is already a schema for the item, then skip it $mySchema = $schema->toArray(); - if (!isset($mySchema['@graph']) || !is_array($mySchema['@graph'])) { + if (!isset($mySchema['@graph']) || !\is_array($mySchema['@graph'])) { return; } @@ -925,7 +925,7 @@ private function countItemsInChildren($table, $catid, $data) } // Make sure we only do the query if we have some categories to look in - if (count($childCategoryIds)) { + if (\count($childCategoryIds)) { // Count the items in this category $query = $db->getQuery(true) ->select('COUNT(' . $db->quoteName('id') . ')') diff --git a/plugins/content/loadmodule/services/provider.php b/plugins/content/loadmodule/services/provider.php index 439aeeea6e3aa..ce15a1ebe5137 100644 --- a/plugins/content/loadmodule/services/provider.php +++ b/plugins/content/loadmodule/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/loadmodule/src/Extension/LoadModule.php b/plugins/content/loadmodule/src/Extension/LoadModule.php index 14b5bffa26a19..758eb4be8067a 100644 --- a/plugins/content/loadmodule/src/Extension/LoadModule.php +++ b/plugins/content/loadmodule/src/Extension/LoadModule.php @@ -44,7 +44,7 @@ final class LoadModule extends CMSPlugin public function onContentPrepare($context, &$article, &$params, $page = 0) { // Only execute if $article is an object and has a text property - if (!is_object($article) || !property_exists($article, 'text') || is_null($article->text)) { + if (!\is_object($article) || !property_exists($article, 'text') || \is_null($article->text)) { return; } @@ -92,7 +92,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) $matcheslist = explode(',', $match[1]); // We may not have a module style so fall back to the plugin default. - if (!array_key_exists(1, $matcheslist)) { + if (!\array_key_exists(1, $matcheslist)) { $matcheslist[1] = $defaultStyle; } @@ -103,7 +103,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // We should replace only first occurrence in order to allow positions with the same name to regenerate their content: if (($start = strpos($article->text, $match[0])) !== false) { - $article->text = substr_replace($article->text, $output, $start, strlen($match[0])); + $article->text = substr_replace($article->text, $output, $start, \strlen($match[0])); } } } @@ -124,14 +124,14 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // Second parameter is the title $title = ''; - if (array_key_exists(1, $matchesmodlist)) { + if (\array_key_exists(1, $matchesmodlist)) { $title = htmlspecialchars_decode(trim($matchesmodlist[1])); } // Third parameter is the module style, (fallback is the plugin default set earlier). $stylemod = $defaultStyle; - if (array_key_exists(2, $matchesmodlist)) { + if (\array_key_exists(2, $matchesmodlist)) { $stylemod = trim($matchesmodlist[2]); } @@ -139,7 +139,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // We should replace only first occurrence in order to allow positions with the same name to regenerate their content: if (($start = strpos($article->text, $matchmod[0])) !== false) { - $article->text = substr_replace($article->text, $output, $start, strlen($matchmod[0])); + $article->text = substr_replace($article->text, $output, $start, \strlen($matchmod[0])); } } } @@ -157,7 +157,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) // We should replace only first occurrence in order to allow positions with the same name to regenerate their content: if (($start = strpos($article->text, $match[0])) !== false) { - $article->text = substr_replace($article->text, $output, $start, strlen($match[0])); + $article->text = substr_replace($article->text, $output, $start, \strlen($match[0])); } } } diff --git a/plugins/content/pagebreak/services/provider.php b/plugins/content/pagebreak/services/provider.php index 157a4ce85796e..8f03e7c6f1bd3 100644 --- a/plugins/content/pagebreak/services/provider.php +++ b/plugins/content/pagebreak/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/pagebreak/src/Extension/PageBreak.php b/plugins/content/pagebreak/src/Extension/PageBreak.php index 023c8976be381..3a279b2f555ea 100644 --- a/plugins/content/pagebreak/src/Extension/PageBreak.php +++ b/plugins/content/pagebreak/src/Extension/PageBreak.php @@ -141,7 +141,7 @@ public function onContentPrepare($context, &$row, &$params, $page = 0) } // Count the number of pages. - $n = count($text); + $n = \count($text); // We have found at least one plugin, therefore at least 2 pages. if ($n > 1) { diff --git a/plugins/content/pagenavigation/services/provider.php b/plugins/content/pagenavigation/services/provider.php index 53a3997fe1cbe..5ea2240690c95 100644 --- a/plugins/content/pagenavigation/services/provider.php +++ b/plugins/content/pagenavigation/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/content/pagenavigation/src/Extension/PageNavigation.php b/plugins/content/pagenavigation/src/Extension/PageNavigation.php index 7e17487525aa3..61e01f389bacf 100644 --- a/plugins/content/pagenavigation/src/Extension/PageNavigation.php +++ b/plugins/content/pagenavigation/src/Extension/PageNavigation.php @@ -70,7 +70,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0) */ $params_list = $params->toArray(); - if (array_key_exists('orderby_sec', $params_list)) { + if (\array_key_exists('orderby_sec', $params_list)) { $order_method = $params->get('orderby_sec', ''); } else { $order_method = $params->get('orderby', ''); @@ -81,7 +81,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0) $order_method = ''; } - if (in_array($order_method, ['date', 'rdate'])) { + if (\in_array($order_method, ['date', 'rdate'])) { // Get the order code $orderDate = $params->get('order_date'); @@ -188,7 +188,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0) $list = $db->loadObjectList('id'); // This check needed if incorrect Itemid is given resulting in an incorrect result. - if (!is_array($list)) { + if (!\is_array($list)) { $list = []; } @@ -206,7 +206,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0) $row->prev = $rows[$location - 1]; } - if (($location + 1) < count($rows)) { + if (($location + 1) < \count($rows)) { // The next content item cannot be in an array position greater than the number of array positions. $row->next = $rows[$location + 1]; } diff --git a/plugins/content/vote/services/provider.php b/plugins/content/vote/services/provider.php index 3fb91158e350b..5c64f931467c3 100644 --- a/plugins/content/vote/services/provider.php +++ b/plugins/content/vote/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/article/services/provider.php b/plugins/editors-xtd/article/services/provider.php index 4fcd223b88d0b..282174966158c 100644 --- a/plugins/editors-xtd/article/services/provider.php +++ b/plugins/editors-xtd/article/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/article/src/Extension/Article.php b/plugins/editors-xtd/article/src/Extension/Article.php index dc219aebaf5b4..d75f395194871 100644 --- a/plugins/editors-xtd/article/src/Extension/Article.php +++ b/plugins/editors-xtd/article/src/Extension/Article.php @@ -81,11 +81,11 @@ public function onDisplay($name) // Can create in any category (component permission) or at least in one category $canCreateRecords = $user->authorise('core.create', 'com_content') - || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0; + || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0; // Instead of checking edit on all records, we can use **same** check as the form editing view $values = (array) $this->getApplication()->getUserState('com_content.edit.article.id'); - $isEditingRecords = count($values); + $isEditingRecords = \count($values); // This ACL check is probably a double-check (form view already performed checks) $hasAccess = $canCreateRecords || $isEditingRecords; diff --git a/plugins/editors-xtd/contact/services/provider.php b/plugins/editors-xtd/contact/services/provider.php index 8f08d8b886083..ca60a759ed1fb 100644 --- a/plugins/editors-xtd/contact/services/provider.php +++ b/plugins/editors-xtd/contact/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/fields/services/provider.php b/plugins/editors-xtd/fields/services/provider.php index a19a59b64a4bc..f164457254ae8 100644 --- a/plugins/editors-xtd/fields/services/provider.php +++ b/plugins/editors-xtd/fields/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/image/services/provider.php b/plugins/editors-xtd/image/services/provider.php index 519ccdcf3657e..eaea7692a4c3a 100644 --- a/plugins/editors-xtd/image/services/provider.php +++ b/plugins/editors-xtd/image/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/image/src/Extension/Image.php b/plugins/editors-xtd/image/src/Extension/Image.php index bae69c3e3744c..63cc179a3714e 100644 --- a/plugins/editors-xtd/image/src/Extension/Image.php +++ b/plugins/editors-xtd/image/src/Extension/Image.php @@ -63,10 +63,10 @@ public function onDisplay($name, $asset, $author) if ( $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->authorise('core.edit.own', $asset) && $author === $user->id) - || (count($user->getAuthorisedCategories($extension, 'core.edit')) > 0) - || (count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author === $user->id) + || (\count($user->getAuthorisedCategories($extension, 'core.edit')) > 0) + || (\count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author === $user->id) ) { $doc->getWebAssetManager() ->useScript('webcomponent.media-select') @@ -76,7 +76,7 @@ public function onDisplay($name, $asset, $author) $doc->addScriptOptions('xtdImageModal', [$name . '_ImageModal']); $doc->addScriptOptions('media-picker-api', ['apiBaseUrl' => Uri::base() . 'index.php?option=com_media&format=json']); - if (count($doc->getScriptOptions('media-picker')) === 0) { + if (\count($doc->getScriptOptions('media-picker')) === 0) { $imagesExt = array_map( 'trim', explode( diff --git a/plugins/editors-xtd/menu/services/provider.php b/plugins/editors-xtd/menu/services/provider.php index b9a1bb609efe7..5afb2df74a9a5 100644 --- a/plugins/editors-xtd/menu/services/provider.php +++ b/plugins/editors-xtd/menu/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/module/services/provider.php b/plugins/editors-xtd/module/services/provider.php index 888e15bb5bb44..fcd5199f16590 100644 --- a/plugins/editors-xtd/module/services/provider.php +++ b/plugins/editors-xtd/module/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/pagebreak/services/provider.php b/plugins/editors-xtd/pagebreak/services/provider.php index 142ae9398792a..e7c1b733ccae5 100644 --- a/plugins/editors-xtd/pagebreak/services/provider.php +++ b/plugins/editors-xtd/pagebreak/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php b/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php index 8adf7f1b72887..4d7cf7107c29a 100644 --- a/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php +++ b/plugins/editors-xtd/pagebreak/src/Extension/PageBreak.php @@ -54,11 +54,11 @@ public function onDisplay($name) // Can create in any category (component permission) or at least in one category $canCreateRecords = $user->authorise('core.create', 'com_content') - || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0; + || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0; // Instead of checking edit on all records, we can use **same** check as the form editing view $values = (array) $app->getUserState('com_content.edit.article.id'); - $isEditingRecords = count($values); + $isEditingRecords = \count($values); // This ACL check is probably a double-check (form view already performed checks) $hasAccess = $canCreateRecords || $isEditingRecords; diff --git a/plugins/editors-xtd/readmore/services/provider.php b/plugins/editors-xtd/readmore/services/provider.php index 681850c482bd1..c713036c86def 100644 --- a/plugins/editors-xtd/readmore/services/provider.php +++ b/plugins/editors-xtd/readmore/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors/codemirror/services/provider.php b/plugins/editors/codemirror/services/provider.php index 44205bb649b9f..74ff09c3f2d16 100644 --- a/plugins/editors/codemirror/services/provider.php +++ b/plugins/editors/codemirror/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors/codemirror/src/Provider/CodeMirrorProvider.php b/plugins/editors/codemirror/src/Provider/CodeMirrorProvider.php index d533d10259a1d..80e0f47ebe7dd 100644 --- a/plugins/editors/codemirror/src/Provider/CodeMirrorProvider.php +++ b/plugins/editors/codemirror/src/Provider/CodeMirrorProvider.php @@ -122,7 +122,7 @@ public function display(string $name, string $content = '', array $attributes = $options->mode = $modeAlias[$options->mode] ?? $options->mode; // Special options for non-tagged modes. - if (!in_array($options->mode, ['xml', 'html'])) { + if (!\in_array($options->mode, ['xml', 'html'])) { // Autogenerate closing brackets. $options->autoCloseBrackets = (bool) $this->params->get('autoCloseBrackets', 1); } diff --git a/plugins/editors/none/services/provider.php b/plugins/editors/none/services/provider.php index bcca459625605..d4174182f11d3 100644 --- a/plugins/editors/none/services/provider.php +++ b/plugins/editors/none/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors/none/src/Extension/None.php b/plugins/editors/none/src/Extension/None.php index 828be0467a561..9c5f3afa263bc 100644 --- a/plugins/editors/none/src/Extension/None.php +++ b/plugins/editors/none/src/Extension/None.php @@ -98,7 +98,7 @@ public function onDisplay( */ private function displayButtons($name, $buttons, $asset, $author) { - if (is_array($buttons) || (is_bool($buttons) && $buttons)) { + if (\is_array($buttons) || (\is_bool($buttons) && $buttons)) { $buttonsEvent = new Event( 'getButtons', [ diff --git a/plugins/editors/tinymce/services/provider.php b/plugins/editors/tinymce/services/provider.php index 175d1f390ec97..b210f970f356f 100644 --- a/plugins/editors/tinymce/services/provider.php +++ b/plugins/editors/tinymce/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/editors/tinymce/src/PluginTraits/GlobalFilters.php b/plugins/editors/tinymce/src/PluginTraits/GlobalFilters.php index d9456d0ccfbdf..009ec84e12567 100644 --- a/plugins/editors/tinymce/src/PluginTraits/GlobalFilters.php +++ b/plugins/editors/tinymce/src/PluginTraits/GlobalFilters.php @@ -103,11 +103,11 @@ protected static function getGlobalFilters($user) * Each list is cumulative. * "BL" is deprecated in Joomla! 4, will be removed in Joomla! 5 */ - if (in_array($filterType, ['BL', 'FL'])) { + if (\in_array($filterType, ['BL', 'FL'])) { $forbiddenList = true; $forbiddenListTags = array_merge($forbiddenListTags, $tempTags); $forbiddenListAttributes = array_merge($forbiddenListAttributes, $tempAttributes); - } elseif (in_array($filterType, ['CBL', 'CFL'])) { + } elseif (\in_array($filterType, ['CBL', 'CFL'])) { // "CBL" is deprecated in Joomla! 4, will be removed in Joomla! 5 // Only set to true if Tags or Attributes were added if ($tempTags || $tempAttributes) { @@ -115,7 +115,7 @@ protected static function getGlobalFilters($user) $customListTags = array_merge($customListTags, $tempTags); $customListAttributes = array_merge($customListAttributes, $tempAttributes); } - } elseif (in_array($filterType, ['WL', 'AL'])) { + } elseif (\in_array($filterType, ['WL', 'AL'])) { // "WL" is deprecated in Joomla! 4, will be removed in Joomla! 5 $allowedList = true; $allowedListTags = array_merge($allowedListTags, $tempTags); diff --git a/plugins/extension/finder/services/provider.php b/plugins/extension/finder/services/provider.php index 698d4dd69e818..76cf69793b9a7 100644 --- a/plugins/extension/finder/services/provider.php +++ b/plugins/extension/finder/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/extension/joomla/services/provider.php b/plugins/extension/joomla/services/provider.php index 99be9c30c73b7..074a9475e31ef 100644 --- a/plugins/extension/joomla/services/provider.php +++ b/plugins/extension/joomla/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/extension/joomla/src/Extension/Joomla.php b/plugins/extension/joomla/src/Extension/Joomla.php index 7595150646f4c..46c49c0f7af1d 100644 --- a/plugins/extension/joomla/src/Extension/Joomla.php +++ b/plugins/extension/joomla/src/Extension/Joomla.php @@ -191,7 +191,7 @@ public function onExtensionAfterUninstall($installer, $eid, $removed) $db->setQuery($query); $results = $db->loadColumn(); - if (is_array($results)) { + if (\is_array($results)) { // So we need to delete the update sites and their associated updates $updatesite_delete = $db->getQuery(true); $updatesite_delete->delete($db->quoteName('#__update_sites')); @@ -201,7 +201,7 @@ public function onExtensionAfterUninstall($installer, $eid, $removed) ->from($db->quoteName('#__update_sites')); // If we get results back then we can exclude them - if (count($results)) { + if (\count($results)) { $updatesite_query->whereNotIn($db->quoteName('update_site_id'), $results); $updatesite_delete->whereNotIn($db->quoteName('update_site_id'), $results); } @@ -210,7 +210,7 @@ public function onExtensionAfterUninstall($installer, $eid, $removed) $db->setQuery($updatesite_query); $update_sites_pending_delete = $db->loadColumn(); - if (is_array($update_sites_pending_delete) && count($update_sites_pending_delete)) { + if (\is_array($update_sites_pending_delete) && \count($update_sites_pending_delete)) { // Nuke any pending updates with this site before we delete it // @todo: investigate alternative of using a query after the delete below with a query and not in like above $query->clear() @@ -276,7 +276,7 @@ private function processUpdateSites() $children = []; } - if (count($children)) { + if (\count($children)) { foreach ($children as $child) { $attrs = $child->attributes(); $this->addUpdateSite((string) $attrs['name'], (string) $attrs['type'], trim($child), true, $this->installer->extraQuery); diff --git a/plugins/extension/namespacemap/services/provider.php b/plugins/extension/namespacemap/services/provider.php index 54f7700a2d25b..ba5918d804c79 100644 --- a/plugins/extension/namespacemap/services/provider.php +++ b/plugins/extension/namespacemap/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/fields/calendar/services/provider.php b/plugins/fields/calendar/services/provider.php index e6bf51460b3a1..80018d57b9ec7 100644 --- a/plugins/fields/calendar/services/provider.php +++ b/plugins/fields/calendar/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/checkboxes/services/provider.php b/plugins/fields/checkboxes/services/provider.php index ded86277b6a77..e72fffcdf754c 100644 --- a/plugins/fields/checkboxes/services/provider.php +++ b/plugins/fields/checkboxes/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/checkboxes/src/Extension/Checkboxes.php b/plugins/fields/checkboxes/src/Extension/Checkboxes.php index 922f2f45eefe1..c0d80eb7620fc 100644 --- a/plugins/fields/checkboxes/src/Extension/Checkboxes.php +++ b/plugins/fields/checkboxes/src/Extension/Checkboxes.php @@ -52,7 +52,7 @@ public function onCustomFieldsBeforePrepareField($context, $item, $field) return; } - if (is_array($field->value)) { + if (\is_array($field->value)) { foreach ($field->value as $key => $value) { $field->apivalue[$value] = $options[$value]; } diff --git a/plugins/fields/color/services/provider.php b/plugins/fields/color/services/provider.php index aab8a0ef6032a..2e0da96d8f1b8 100644 --- a/plugins/fields/color/services/provider.php +++ b/plugins/fields/color/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/editor/services/provider.php b/plugins/fields/editor/services/provider.php index b952d589371bf..d584186f6256f 100644 --- a/plugins/fields/editor/services/provider.php +++ b/plugins/fields/editor/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/imagelist/services/provider.php b/plugins/fields/imagelist/services/provider.php index 64cb3c2c91b69..0c45fe6ee797a 100644 --- a/plugins/fields/imagelist/services/provider.php +++ b/plugins/fields/imagelist/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/integer/services/provider.php b/plugins/fields/integer/services/provider.php index ac06582bf405f..c66e1fe298128 100644 --- a/plugins/fields/integer/services/provider.php +++ b/plugins/fields/integer/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/list/services/provider.php b/plugins/fields/list/services/provider.php index f3fede65436ca..08a0135136d5f 100644 --- a/plugins/fields/list/services/provider.php +++ b/plugins/fields/list/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/list/src/Extension/ListPlugin.php b/plugins/fields/list/src/Extension/ListPlugin.php index 81dc3928c85ed..ee77513eb9d8b 100644 --- a/plugins/fields/list/src/Extension/ListPlugin.php +++ b/plugins/fields/list/src/Extension/ListPlugin.php @@ -47,7 +47,7 @@ public function onCustomFieldsBeforePrepareField($context, $item, $field) $options = $this->getOptionsFromField($field); $field->apivalue = []; - if (is_array($field->value)) { + if (\is_array($field->value)) { foreach ($field->value as $value) { $field->apivalue[$value] = $options[$value]; } @@ -73,7 +73,7 @@ public function onCustomFieldsPrepareField($context, $item, $field) } // The field's rawvalue should be an array - if (!is_array($field->rawvalue)) { + if (!\is_array($field->rawvalue)) { $field->rawvalue = (array) $field->rawvalue; } diff --git a/plugins/fields/media/services/provider.php b/plugins/fields/media/services/provider.php index 09a875e3a1fa2..fe6432758d89a 100644 --- a/plugins/fields/media/services/provider.php +++ b/plugins/fields/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/radio/services/provider.php b/plugins/fields/radio/services/provider.php index b55fd77d9f503..d7136857ac448 100644 --- a/plugins/fields/radio/services/provider.php +++ b/plugins/fields/radio/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/sql/services/provider.php b/plugins/fields/sql/services/provider.php index 19034e643dbfe..cd12b047ee08d 100644 --- a/plugins/fields/sql/services/provider.php +++ b/plugins/fields/sql/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/subform/services/provider.php b/plugins/fields/subform/services/provider.php index 4925891c7173a..29435a4ca7f43 100644 --- a/plugins/fields/subform/services/provider.php +++ b/plugins/fields/subform/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/subform/src/Extension/Subform.php b/plugins/fields/subform/src/Extension/Subform.php index b90ccdf603b32..cb79d3dd160c5 100644 --- a/plugins/fields/subform/src/Extension/Subform.php +++ b/plugins/fields/subform/src/Extension/Subform.php @@ -123,13 +123,13 @@ public function onCustomFieldsBeforePrepareField($context, $item, $field) return; } - if (is_array($field->value)) { + if (\is_array($field->value)) { return; } $decoded_value = json_decode($field->value, true); - if (!$decoded_value || !is_array($decoded_value)) { + if (!$decoded_value || !\is_array($decoded_value)) { return; } @@ -155,7 +155,7 @@ public function onCustomFieldsPrepareField($context, $item, $field) } // If we don't have any subfields (or values for them), nothing to do. - if (!is_array($field->value) || count($field->value) < 1) { + if (!\is_array($field->value) || \count($field->value) < 1) { return; } @@ -218,7 +218,7 @@ public function onCustomFieldsPrepareField($context, $item, $field) } // Flatten the value if it is an array (list, checkboxes, etc.) [independent of render_values] - if (is_array($subfield->value)) { + if (\is_array($subfield->value)) { $subfield->value = implode(' ', $subfield->value); } @@ -294,7 +294,7 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form $subfields = $this->getSubfieldsFromField($field); // If we have 5 or more of them, use the `repeatable` layout instead of the `repeatable-table` - if (count($subfields) >= 5) { + if (\count($subfields) >= 5) { $parent_field->setAttribute('layout', 'joomla.form.field.subform.repeatable'); } @@ -353,7 +353,7 @@ protected function getParamsFromField(\stdClass $field) { $params = (clone $this->params); - if (isset($field->fieldparams) && is_object($field->fieldparams)) { + if (isset($field->fieldparams) && \is_object($field->fieldparams)) { $params->merge($field->fieldparams); } diff --git a/plugins/fields/text/services/provider.php b/plugins/fields/text/services/provider.php index 0d22333f059b0..e1b2d6a341f08 100644 --- a/plugins/fields/text/services/provider.php +++ b/plugins/fields/text/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/textarea/services/provider.php b/plugins/fields/textarea/services/provider.php index 3cce1729b3cad..aba666dc1fbc1 100644 --- a/plugins/fields/textarea/services/provider.php +++ b/plugins/fields/textarea/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/url/services/provider.php b/plugins/fields/url/services/provider.php index 06fa255ee3ef0..8690edb5d05c9 100644 --- a/plugins/fields/url/services/provider.php +++ b/plugins/fields/url/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/user/services/provider.php b/plugins/fields/user/services/provider.php index 777166cac471e..786646c88f5f5 100644 --- a/plugins/fields/user/services/provider.php +++ b/plugins/fields/user/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/fields/usergrouplist/services/provider.php b/plugins/fields/usergrouplist/services/provider.php index db0f358fda688..e7e37bdfd29cf 100644 --- a/plugins/fields/usergrouplist/services/provider.php +++ b/plugins/fields/usergrouplist/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/filesystem/local/services/provider.php b/plugins/filesystem/local/services/provider.php index b00ea8515a285..21fa89e1a2d35 100644 --- a/plugins/filesystem/local/services/provider.php +++ b/plugins/filesystem/local/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/filesystem/local/src/Adapter/LocalAdapter.php b/plugins/filesystem/local/src/Adapter/LocalAdapter.php index c791175df52d1..c2a30d9481221 100644 --- a/plugins/filesystem/local/src/Adapter/LocalAdapter.php +++ b/plugins/filesystem/local/src/Adapter/LocalAdapter.php @@ -747,7 +747,7 @@ private function rglob(string $pattern, int $flags = 0): array { $files = glob($pattern, $flags); - foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { + foreach (glob(\dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { $files = array_merge($files, $this->rglob($dir . '/' . $this->getFileName($pattern), $flags)); } @@ -821,7 +821,7 @@ private function checkContent(string $localPath, string $mediaContent) $helper = new MediaHelper(); // @todo find a better way to check the input, by not writing the file to the disk - $tmpFile = Path::clean(dirname($localPath) . '/' . uniqid() . '.' . File::getExt($name)); + $tmpFile = Path::clean(\dirname($localPath) . '/' . uniqid() . '.' . File::getExt($name)); if (!File::write($tmpFile, $mediaContent)) { throw new \Exception(Text::_('JLIB_MEDIA_ERROR_UPLOAD_INPUT'), 500); @@ -926,7 +926,7 @@ private function getThumbnail(string $path): string return $this->getUrl($path); } - $dir = dirname($thumbnailPaths['fs']); + $dir = \dirname($thumbnailPaths['fs']); if (!is_dir($dir)) { Folder::create($dir); @@ -955,7 +955,7 @@ private function createThumbnail(string $path, string $thumbnailPath): bool $image = new Image($path); try { - $image->createThumbnails([$this->thumbnailSize[0] . 'x' . $this->thumbnailSize[1]], $image::SCALE_INSIDE, dirname($thumbnailPath), true); + $image->createThumbnails([$this->thumbnailSize[0] . 'x' . $this->thumbnailSize[1]], $image::SCALE_INSIDE, \dirname($thumbnailPath), true); } catch (\Exception $e) { return false; } diff --git a/plugins/filesystem/local/src/Extension/Local.php b/plugins/filesystem/local/src/Extension/Local.php index be19fb209a417..2a3d65ae7ed50 100644 --- a/plugins/filesystem/local/src/Extension/Local.php +++ b/plugins/filesystem/local/src/Extension/Local.php @@ -111,7 +111,7 @@ public function getAdapters() $directories = $this->params->get('directories', '[{"directory": "images", "thumbs": 0}]'); // Do a check if default settings are not saved by user, if not initialize them manually - if (is_string($directories)) { + if (\is_string($directories)) { $directories = json_decode($directories); } diff --git a/plugins/finder/categories/services/provider.php b/plugins/finder/categories/services/provider.php index df3cbc50be925..1098415ee1ce0 100644 --- a/plugins/finder/categories/services/provider.php +++ b/plugins/finder/categories/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/finder/categories/src/Extension/Categories.php b/plugins/finder/categories/src/Extension/Categories.php index f88305fcb3780..f8caaa8cd80b8 100644 --- a/plugins/finder/categories/src/Extension/Categories.php +++ b/plugins/finder/categories/src/Extension/Categories.php @@ -339,12 +339,12 @@ protected function index(Result $item) $taxonomies = $this->params->get('taxonomies', ['type', 'language']); // Add the type taxonomy data. - if (in_array('type', $taxonomies)) { + if (\in_array('type', $taxonomies)) { $item->addTaxonomy('Type', 'Category'); } // Add the language taxonomy data. - if (in_array('language', $taxonomies)) { + if (\in_array('language', $taxonomies)) { $item->addTaxonomy('Language', $item->language); } diff --git a/plugins/finder/contacts/services/provider.php b/plugins/finder/contacts/services/provider.php index 905fe019107f2..7331744e4f946 100644 --- a/plugins/finder/contacts/services/provider.php +++ b/plugins/finder/contacts/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/finder/contacts/src/Extension/Contacts.php b/plugins/finder/contacts/src/Extension/Contacts.php index 8dc00dba985f3..06d1f5a8209aa 100644 --- a/plugins/finder/contacts/src/Extension/Contacts.php +++ b/plugins/finder/contacts/src/Extension/Contacts.php @@ -343,7 +343,7 @@ protected function index(Result $item) $taxonomies = $this->params->get('taxonomies', ['type', 'category', 'language', 'region', 'country']); // Add the type taxonomy data. - if (in_array('type', $taxonomies)) { + if (\in_array('type', $taxonomies)) { $item->addTaxonomy('Type', 'Contact'); } @@ -356,22 +356,22 @@ protected function index(Result $item) } // Add the category taxonomy data. - if (in_array('category', $taxonomies)) { + if (\in_array('category', $taxonomies)) { $item->addNestedTaxonomy('Category', $category, $this->translateState($category->published), $category->access, $category->language); } // Add the language taxonomy data. - if (in_array('language', $taxonomies)) { + if (\in_array('language', $taxonomies)) { $item->addTaxonomy('Language', $item->language); } // Add the region taxonomy data. - if (in_array('region', $taxonomies) && !empty($item->region) && $this->params->get('tax_add_region', true)) { + if (\in_array('region', $taxonomies) && !empty($item->region) && $this->params->get('tax_add_region', true)) { $item->addTaxonomy('Region', $item->region); } // Add the country taxonomy data. - if (in_array('country', $taxonomies) && !empty($item->country) && $this->params->get('tax_add_country', true)) { + if (\in_array('country', $taxonomies) && !empty($item->country) && $this->params->get('tax_add_country', true)) { $item->addTaxonomy('Country', $item->country); } diff --git a/plugins/finder/content/services/provider.php b/plugins/finder/content/services/provider.php index 24c7ed69f0fab..5bff5b4ec2737 100644 --- a/plugins/finder/content/services/provider.php +++ b/plugins/finder/content/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/finder/content/src/Extension/Content.php b/plugins/finder/content/src/Extension/Content.php index 8b1da5d6190fb..11a94896e6004 100644 --- a/plugins/finder/content/src/Extension/Content.php +++ b/plugins/finder/content/src/Extension/Content.php @@ -334,12 +334,12 @@ protected function index(Result $item) $taxonomies = $this->params->get('taxonomies', ['type', 'author', 'category', 'language']); // Add the type taxonomy data. - if (in_array('type', $taxonomies)) { + if (\in_array('type', $taxonomies)) { $item->addTaxonomy('Type', 'Article'); } // Add the author taxonomy data. - if (in_array('author', $taxonomies) && (!empty($item->author) || !empty($item->created_by_alias))) { + if (\in_array('author', $taxonomies) && (!empty($item->author) || !empty($item->created_by_alias))) { $item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author, $item->state); } @@ -352,12 +352,12 @@ protected function index(Result $item) } // Add the category taxonomy data. - if (in_array('category', $taxonomies)) { + if (\in_array('category', $taxonomies)) { $item->addNestedTaxonomy('Category', $category, $this->translateState($category->published), $category->access, $category->language); } // Add the language taxonomy data. - if (in_array('language', $taxonomies)) { + if (\in_array('language', $taxonomies)) { $item->addTaxonomy('Language', $item->language); } diff --git a/plugins/finder/newsfeeds/services/provider.php b/plugins/finder/newsfeeds/services/provider.php index 80bdca70e75e8..11ba71f25230d 100644 --- a/plugins/finder/newsfeeds/services/provider.php +++ b/plugins/finder/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/finder/newsfeeds/src/Extension/Newsfeeds.php b/plugins/finder/newsfeeds/src/Extension/Newsfeeds.php index 1d92b7fd2e399..dffa5c9ba2033 100644 --- a/plugins/finder/newsfeeds/src/Extension/Newsfeeds.php +++ b/plugins/finder/newsfeeds/src/Extension/Newsfeeds.php @@ -285,7 +285,7 @@ protected function index(Result $item) $taxonomies = $this->params->get('taxonomies', ['type', 'category', 'language']); // Add the type taxonomy data. - if (in_array('type', $taxonomies)) { + if (\in_array('type', $taxonomies)) { $item->addTaxonomy('Type', 'News Feed'); } @@ -298,12 +298,12 @@ protected function index(Result $item) } // Add the category taxonomy data. - if (in_array('category', $taxonomies)) { + if (\in_array('category', $taxonomies)) { $item->addNestedTaxonomy('Category', $category, $this->translateState($category->published), $category->access, $category->language); } // Add the language taxonomy data. - if (in_array('language', $taxonomies)) { + if (\in_array('language', $taxonomies)) { $item->addTaxonomy('Language', $item->language); } diff --git a/plugins/finder/tags/services/provider.php b/plugins/finder/tags/services/provider.php index 101349ae829c8..89448c9e0cfb0 100644 --- a/plugins/finder/tags/services/provider.php +++ b/plugins/finder/tags/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/finder/tags/src/Extension/Tags.php b/plugins/finder/tags/src/Extension/Tags.php index aa5a7f3d8d3b4..f8a42ad6f214f 100644 --- a/plugins/finder/tags/src/Extension/Tags.php +++ b/plugins/finder/tags/src/Extension/Tags.php @@ -250,17 +250,17 @@ protected function index(Result $item) $taxonomies = $this->params->get('taxonomies', ['type', 'author', 'language']); // Add the type taxonomy data. - if (in_array('type', $taxonomies)) { + if (\in_array('type', $taxonomies)) { $item->addTaxonomy('Type', 'Tag'); } // Add the author taxonomy data. - if (in_array('author', $taxonomies) && (!empty($item->author) || !empty($item->created_by_alias))) { + if (\in_array('author', $taxonomies) && (!empty($item->author) || !empty($item->created_by_alias))) { $item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author); } // Add the language taxonomy data. - if (in_array('language', $taxonomies)) { + if (\in_array('language', $taxonomies)) { $item->addTaxonomy('Language', $item->language); } diff --git a/plugins/installer/folderinstaller/services/provider.php b/plugins/installer/folderinstaller/services/provider.php index e55ec41c70b33..1941398bb2424 100644 --- a/plugins/installer/folderinstaller/services/provider.php +++ b/plugins/installer/folderinstaller/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/installer/override/services/provider.php b/plugins/installer/override/services/provider.php index 4011828447813..57d9818834d06 100644 --- a/plugins/installer/override/services/provider.php +++ b/plugins/installer/override/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/installer/override/src/Extension/Override.php b/plugins/installer/override/src/Extension/Override.php index 55ceaeda111bd..af8a35ce45527 100644 --- a/plugins/installer/override/src/Extension/Override.php +++ b/plugins/installer/override/src/Extension/Override.php @@ -124,12 +124,12 @@ public function getUpdatedFiles($action) $before = $session->get('override.beforeEventFiles'); $result = []; - if (!is_array($after) || !is_array($before)) { + if (!\is_array($after) || !\is_array($before)) { return $result; } - $size1 = count($after); - $size2 = count($before); + $size1 = \count($after); + $size2 = \count($before); if ($size1 === $size2) { for ($i = 0; $i < $size1; $i++) { @@ -173,7 +173,7 @@ public function getOverrideCoreList() */ public function finalize($result) { - $num = count($result); + $num = \count($result); $link = 'index.php?option=com_templates&view=templates'; if ($num != 0) { @@ -291,7 +291,7 @@ public function load($id, $exid) $db->setQuery($query); $results = $db->loadObjectList(); - if (count($results) === 1) { + if (\count($results) === 1) { return true; } diff --git a/plugins/installer/packageinstaller/services/provider.php b/plugins/installer/packageinstaller/services/provider.php index 4f546e72ee503..3f492e7f70009 100644 --- a/plugins/installer/packageinstaller/services/provider.php +++ b/plugins/installer/packageinstaller/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/installer/urlinstaller/services/provider.php b/plugins/installer/urlinstaller/services/provider.php index bcac5c05d6f40..483fd6ba0bf59 100644 --- a/plugins/installer/urlinstaller/services/provider.php +++ b/plugins/installer/urlinstaller/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/installer/webinstaller/services/provider.php b/plugins/installer/webinstaller/services/provider.php index 3723e27f1f92f..d7e5d9102c1f9 100644 --- a/plugins/installer/webinstaller/services/provider.php +++ b/plugins/installer/webinstaller/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/media-action/crop/services/provider.php b/plugins/media-action/crop/services/provider.php index e6e1c8a40557b..8ce949af99d32 100644 --- a/plugins/media-action/crop/services/provider.php +++ b/plugins/media-action/crop/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/media-action/resize/services/provider.php b/plugins/media-action/resize/services/provider.php index cc3cf040a55d7..4cb4e3c57f8a5 100644 --- a/plugins/media-action/resize/services/provider.php +++ b/plugins/media-action/resize/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/media-action/resize/src/Extension/Resize.php b/plugins/media-action/resize/src/Extension/Resize.php index ff64728248616..6eed2284dcb24 100644 --- a/plugins/media-action/resize/src/Extension/Resize.php +++ b/plugins/media-action/resize/src/Extension/Resize.php @@ -46,7 +46,7 @@ public function onContentBeforeSave($context, $item, $isNew, $data = []) return; } - if (!in_array($item->extension, ['jpg', 'jpeg', 'png', 'gif'])) { + if (!\in_array($item->extension, ['jpg', 'jpeg', 'png', 'gif'])) { return; } diff --git a/plugins/media-action/rotate/services/provider.php b/plugins/media-action/rotate/services/provider.php index b2ce3c55dfb76..545b2af63403b 100644 --- a/plugins/media-action/rotate/services/provider.php +++ b/plugins/media-action/rotate/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/multifactorauth/email/services/provider.php b/plugins/multifactorauth/email/services/provider.php index b46dfdba3fb5d..ff683aff571e0 100644 --- a/plugins/multifactorauth/email/services/provider.php +++ b/plugins/multifactorauth/email/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/multifactorauth/email/src/Extension/Email.php b/plugins/multifactorauth/email/src/Extension/Email.php index 54690397beaa6..5da8e30933e4b 100644 --- a/plugins/multifactorauth/email/src/Extension/Email.php +++ b/plugins/multifactorauth/email/src/Extension/Email.php @@ -521,7 +521,7 @@ private function sendCode(string $key, ?User $user = null) static $alreadySent = false; // Make sure we have a user - if (!is_object($user) || !($user instanceof User)) { + if (!\is_object($user) || !($user instanceof User)) { $user = $this->getApplication()->getIdentity() ?: $this->getUserFactory()->loadUserById(0); } diff --git a/plugins/multifactorauth/fixed/services/provider.php b/plugins/multifactorauth/fixed/services/provider.php index ddb869d05ccda..dfff1eee57461 100644 --- a/plugins/multifactorauth/fixed/services/provider.php +++ b/plugins/multifactorauth/fixed/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/multifactorauth/totp/services/provider.php b/plugins/multifactorauth/totp/services/provider.php index d73d2af8b4117..9a6b7b0ab810c 100644 --- a/plugins/multifactorauth/totp/services/provider.php +++ b/plugins/multifactorauth/totp/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/multifactorauth/webauthn/services/provider.php b/plugins/multifactorauth/webauthn/services/provider.php index 5ff18227a28fb..8d7046be7168b 100644 --- a/plugins/multifactorauth/webauthn/services/provider.php +++ b/plugins/multifactorauth/webauthn/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/multifactorauth/webauthn/src/CredentialRepository.php b/plugins/multifactorauth/webauthn/src/CredentialRepository.php index 4d705980acb6a..85fd626d36fe7 100644 --- a/plugins/multifactorauth/webauthn/src/CredentialRepository.php +++ b/plugins/multifactorauth/webauthn/src/CredentialRepository.php @@ -115,7 +115,7 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre $results = MfaHelper::getUserMfaRecords($userId); - if (count($results) < 1) { + if (\count($results) < 1) { return $return; } @@ -123,7 +123,7 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre foreach ($results as $result) { $options = $result->options; - if (!is_array($options) || empty($options)) { + if (!\is_array($options) || empty($options)) { continue; } @@ -131,17 +131,17 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre continue; } - if (isset($options['attested']) && is_string($options['attested'])) { + if (isset($options['attested']) && \is_string($options['attested'])) { $options['attested'] = json_decode($options['attested'], true); $return[$result->id] = $this->attestedCredentialToPublicKeyCredentialSource( AttestedCredentialData::createFromArray($options['attested']), $userId ); - } elseif (isset($options['pubkeysource']) && is_string($options['pubkeysource'])) { + } elseif (isset($options['pubkeysource']) && \is_string($options['pubkeysource'])) { $options['pubkeysource'] = json_decode($options['pubkeysource'], true); $return[$result->id] = PublicKeyCredentialSource::createFromArray($options['pubkeysource']); - } elseif (isset($options['pubkeysource']) && is_array($options['pubkeysource'])) { + } elseif (isset($options['pubkeysource']) && \is_array($options['pubkeysource'])) { $return[$result->id] = PublicKeyCredentialSource::createFromArray($options['pubkeysource']); } } diff --git a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php index 5eef7a60a5232..4081ecfd1b468 100644 --- a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php +++ b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php @@ -139,7 +139,7 @@ public function onUserMultifactorGetSetup(GetSetup $event): void * If there are no authenticators set up yet I need to show a different message and take a different action when * my user clicks the submit button. */ - if (!is_array($record->options) || empty($record->options['credentialId'] ?? '')) { + if (!\is_array($record->options) || empty($record->options['credentialId'] ?? '')) { $document = $this->getApplication()->getDocument(); $wam = $document->getWebAssetManager(); $wam->getRegistry()->addExtensionRegistryFile('plg_multifactorauth_webauthn'); @@ -215,7 +215,7 @@ public function onUserMultifactorSaveSetup(SaveSetup $event): void } // Editing an existing authenticator: only the title is saved - if (is_array($record->options) && !empty($record->options['credentialId'] ?? '')) { + if (\is_array($record->options) && !empty($record->options['credentialId'] ?? '')) { $event->addResult($record->options); return; @@ -327,7 +327,7 @@ public function onUserMultifactorCaptive(Captive $event): void $serializedOptions = base64_decode($pkOptionsEncoded); $pkOptions = unserialize($serializedOptions); - if (!is_object($pkOptions) || empty($pkOptions) || !($pkOptions instanceof PublicKeyCredentialRequestOptions)) { + if (!\is_object($pkOptions) || empty($pkOptions) || !($pkOptions instanceof PublicKeyCredentialRequestOptions)) { throw new \RuntimeException('The pending key request is corrupt; a new one will be created'); } diff --git a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php index c9b53116e6d62..005e40f569a1c 100644 --- a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php +++ b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php @@ -111,7 +111,7 @@ public static function verifyAttestation(string $data): ?PublicKeyCredentialSour $publicKeyCredentialCreationOptions = null; } - if (!is_object($publicKeyCredentialCreationOptions) || !($publicKeyCredentialCreationOptions instanceof PublicKeyCredentialCreationOptions)) { + if (!\is_object($publicKeyCredentialCreationOptions) || !($publicKeyCredentialCreationOptions instanceof PublicKeyCredentialCreationOptions)) { throw new \RuntimeException(Text::_('PLG_MULTIFACTORAUTH_WEBAUTHN_ERR_CREATE_NO_PK')); } @@ -208,7 +208,7 @@ public static function verifyAssertion(string $response): void $publicKeyCredentialRequestOptions = unserialize($serializedOptions); if ( - !is_object($publicKeyCredentialRequestOptions) + !\is_object($publicKeyCredentialRequestOptions) || empty($publicKeyCredentialRequestOptions) || !($publicKeyCredentialRequestOptions instanceof PublicKeyCredentialRequestOptions) ) { @@ -294,7 +294,7 @@ private static function getWebauthnServer(?int $userId): Server $refConstructor = $refClass->getConstructor(); $params = $refConstructor->getParameters(); - if (count($params) === 3) { + if (\count($params) === 3) { // WebAuthn library 2, 3 $server = new Server($rpEntity, $repository, null); } else { @@ -303,7 +303,7 @@ private static function getWebauthnServer(?int $userId): Server } // Ed25519 is only available with libsodium - if (!function_exists('sodium_crypto_sign_seed_keypair')) { + if (!\function_exists('sodium_crypto_sign_seed_keypair')) { $server->setSelectedAlgorithms(['RS256', 'RS512', 'PS256', 'PS512', 'ES256', 'ES512']); } diff --git a/plugins/multifactorauth/yubikey/services/provider.php b/plugins/multifactorauth/yubikey/services/provider.php index 5c20fcf5ecbeb..cb3a9a1062128 100644 --- a/plugins/multifactorauth/yubikey/services/provider.php +++ b/plugins/multifactorauth/yubikey/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php index a1eae1b7a2c9d..6c39ee0ba7b70 100644 --- a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php +++ b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php @@ -253,14 +253,14 @@ public function onUserMultifactorSaveSetup(SaveSetup $event): void */ $code = $input->getString('code'); - if ($isKeyAlreadySetup || ((strlen($code) == 12) && ($code == $keyID))) { + if ($isKeyAlreadySetup || ((\strlen($code) == 12) && ($code == $keyID))) { $event->addResult($options); return; } // If an empty code or something other than 44 characters was submitted I'm not having any of this! - if (empty($code) || (strlen($code) != 44)) { + if (empty($code) || (\strlen($code) != 44)) { throw new \RuntimeException(Text::_('PLG_MULTIFACTORAUTH_YUBIKEY_ERR_VALIDATIONFAILED'), 500); } @@ -434,7 +434,7 @@ private function validateYubikeyOtp(string $otp): bool $line = trim($line); $parts = explode('=', $line, 2); - if (count($parts) < 2) { + if (\count($parts) < 2) { continue; } @@ -496,18 +496,18 @@ private function signRequest(Uri $uri, string $secret): void } // I will need base64 encoding and decoding - if (!function_exists('base64_encode') || !function_exists('base64_decode')) { + if (!\function_exists('base64_encode') || !\function_exists('base64_decode')) { return; } // I need HMAC-SHA-1 support. Therefore I check for HMAC and SHA1 support in the PHP 'hash' extension. - if (!function_exists('hash_hmac') || !function_exists('hash_algos')) { + if (!\function_exists('hash_hmac') || !\function_exists('hash_algos')) { return; } $algos = hash_algos(); - if (!in_array('sha1', $algos)) { + if (!\in_array('sha1', $algos)) { return; } @@ -608,7 +608,7 @@ private function validateAgainstRecord(MfaTable $record, string $code): bool } // If the submitted code length is wrong throw an error - if (strlen($code) != 44) { + if (\strlen($code) != 44) { return false; } diff --git a/plugins/privacy/actionlogs/services/provider.php b/plugins/privacy/actionlogs/services/provider.php index 4413b5fbaff65..1dbad56beab0b 100644 --- a/plugins/privacy/actionlogs/services/provider.php +++ b/plugins/privacy/actionlogs/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/actionlogs/src/Extension/Actionlogs.php b/plugins/privacy/actionlogs/src/Extension/Actionlogs.php index b9ff71439b062..2a17e70bed055 100644 --- a/plugins/privacy/actionlogs/src/Extension/Actionlogs.php +++ b/plugins/privacy/actionlogs/src/Extension/Actionlogs.php @@ -74,7 +74,7 @@ public function onPrivacyExportRequest(ExportRequestEvent $event) $data = $db->loadObjectList(); - if (!count($data)) { + if (!\count($data)) { return; } diff --git a/plugins/privacy/consents/services/provider.php b/plugins/privacy/consents/services/provider.php index a1a7101ed1693..abef011b6170e 100644 --- a/plugins/privacy/consents/services/provider.php +++ b/plugins/privacy/consents/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/contact/services/provider.php b/plugins/privacy/contact/services/provider.php index 43e04bbb1c037..498047ade2f37 100644 --- a/plugins/privacy/contact/services/provider.php +++ b/plugins/privacy/contact/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/content/services/provider.php b/plugins/privacy/content/services/provider.php index f84978061a5fe..b6778c6c1c608 100644 --- a/plugins/privacy/content/services/provider.php +++ b/plugins/privacy/content/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/message/services/provider.php b/plugins/privacy/message/services/provider.php index 7a4bd42a8dfcf..bd11c78482439 100644 --- a/plugins/privacy/message/services/provider.php +++ b/plugins/privacy/message/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/user/services/provider.php b/plugins/privacy/user/services/provider.php index 1ccc1652e9e24..8f35cfe21a4c8 100644 --- a/plugins/privacy/user/services/provider.php +++ b/plugins/privacy/user/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/privacy/user/src/Extension/UserPlugin.php b/plugins/privacy/user/src/Extension/UserPlugin.php index e264d149dbd05..cf627d563ff73 100644 --- a/plugins/privacy/user/src/Extension/UserPlugin.php +++ b/plugins/privacy/user/src/Extension/UserPlugin.php @@ -247,7 +247,7 @@ private function createItemForUserTable(TableUser $user) $exclude = ['password', 'otpKey', 'otep']; foreach (array_keys($user->getFields()) as $fieldName) { - if (!in_array($fieldName, $exclude)) { + if (!\in_array($fieldName, $exclude)) { $data[$fieldName] = $user->$fieldName; } } diff --git a/plugins/quickicon/downloadkey/services/provider.php b/plugins/quickicon/downloadkey/services/provider.php index bffae71d7610f..f6ebf73d7fc8c 100644 --- a/plugins/quickicon/downloadkey/services/provider.php +++ b/plugins/quickicon/downloadkey/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/downloadkey/src/Extension/Downloadkey.php b/plugins/quickicon/downloadkey/src/Extension/Downloadkey.php index 57f9a62b383d7..a2efc3e4720a8 100644 --- a/plugins/quickicon/downloadkey/src/Extension/Downloadkey.php +++ b/plugins/quickicon/downloadkey/src/Extension/Downloadkey.php @@ -136,14 +136,14 @@ private function getMissingDownloadKeyInfo(): array } $supported = ComInstallerHelper::getDownloadKeySupportedSites(true); - $ret['supported'] = count($supported); + $ret['supported'] = \count($supported); if ($ret['supported'] === 0) { return $ret; } $missing = ComInstallerHelper::getDownloadKeyExistsSites(false, true); - $ret['missing'] = count($missing); + $ret['missing'] = \count($missing); return $ret; } diff --git a/plugins/quickicon/eos/services/provider.php b/plugins/quickicon/eos/services/provider.php index cfc02522532ef..10f7afc54b321 100644 --- a/plugins/quickicon/eos/services/provider.php +++ b/plugins/quickicon/eos/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/extensionupdate/services/provider.php b/plugins/quickicon/extensionupdate/services/provider.php index 39a8234f093a8..4cf6b9ecad01c 100644 --- a/plugins/quickicon/extensionupdate/services/provider.php +++ b/plugins/quickicon/extensionupdate/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/joomlaupdate/services/provider.php b/plugins/quickicon/joomlaupdate/services/provider.php index b47bac01f8c43..8a9fd14d5f53a 100644 --- a/plugins/quickicon/joomlaupdate/services/provider.php +++ b/plugins/quickicon/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/overridecheck/services/provider.php b/plugins/quickicon/overridecheck/services/provider.php index c3d52a6cce74a..85412acdd8f73 100644 --- a/plugins/quickicon/overridecheck/services/provider.php +++ b/plugins/quickicon/overridecheck/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/phpversioncheck/services/provider.php b/plugins/quickicon/phpversioncheck/services/provider.php index 67c76c2a45468..e5970df3434ab 100644 --- a/plugins/quickicon/phpversioncheck/services/provider.php +++ b/plugins/quickicon/phpversioncheck/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/quickicon/privacycheck/services/provider.php b/plugins/quickicon/privacycheck/services/provider.php index 7648398600437..29b2c56178110 100644 --- a/plugins/quickicon/privacycheck/services/provider.php +++ b/plugins/quickicon/privacycheck/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/sampledata/blog/services/provider.php b/plugins/sampledata/blog/services/provider.php index f407dfd929b8c..877dfd09f62d9 100644 --- a/plugins/sampledata/blog/services/provider.php +++ b/plugins/sampledata/blog/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/sampledata/blog/src/Extension/Blog.php b/plugins/sampledata/blog/src/Extension/Blog.php index d69062bd0e005..6837ccc38dfb5 100644 --- a/plugins/sampledata/blog/src/Extension/Blog.php +++ b/plugins/sampledata/blog/src/Extension/Blog.php @@ -427,7 +427,7 @@ public function onAjaxSampledataApplyStep1() ]; // Create Transitions. - for ($i = 0; $i < count($fromTo); $i++) { + for ($i = 0; $i < \count($fromTo); $i++) { $trTable = new \Joomla\Component\Workflow\Administrator\Table\TransitionTable($this->getDatabase()); $trTable->from_stage_id = $fromTo[$i]['from_stage_id']; diff --git a/plugins/sampledata/multilang/services/provider.php b/plugins/sampledata/multilang/services/provider.php index 0cf5bff953812..2972f07592824 100644 --- a/plugins/sampledata/multilang/services/provider.php +++ b/plugins/sampledata/multilang/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php index dc11ad26126d1..e133e2cf2841a 100644 --- a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php +++ b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php @@ -100,7 +100,7 @@ public function onAjaxSampledataApplyStep1() $languages = LanguageHelper::getContentLanguages([0, 1]); - if (count($languages) < 2) { + if (\count($languages) < 2) { $response = []; $response['success'] = false; $response['message'] = $this->getApplication()->getLanguage()->_('PLG_SAMPLEDATA_MULTILANG_MISSING_LANGUAGE'); @@ -1154,7 +1154,7 @@ protected function getInstalledlangs($clientName = 'administrator') $row = new \stdClass(); $row->language = $lang; - if (!is_array($info)) { + if (!\is_array($info)) { continue; } diff --git a/plugins/sampledata/testing/services/provider.php b/plugins/sampledata/testing/services/provider.php index 7ed88f120cb9a..a37dc62f2c45b 100644 --- a/plugins/sampledata/testing/services/provider.php +++ b/plugins/sampledata/testing/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/sampledata/testing/src/Extension/Testing.php b/plugins/sampledata/testing/src/Extension/Testing.php index aabc6b06a7448..5f397a0037c27 100644 --- a/plugins/sampledata/testing/src/Extension/Testing.php +++ b/plugins/sampledata/testing/src/Extension/Testing.php @@ -938,7 +938,7 @@ public function onAjaxSampledataApplyStep4() ], [ 'catid' => $catIdsLevel5[0], - 'tags' => array_map('strval', array_slice($tagIds, 0, 3)), + 'tags' => array_map('strval', \array_slice($tagIds, 0, 3)), 'ordering' => 0, ], [ @@ -1072,7 +1072,7 @@ public function onAjaxSampledataApplyStep5() // Categories A-Z. for ($i = 65; $i <= 90; $i++) { $categories[] = [ - 'title' => chr($i), + 'title' => \chr($i), 'parent_id' => $catIdsLevel3[1], ]; } diff --git a/plugins/schemaorg/blogposting/services/provider.php b/plugins/schemaorg/blogposting/services/provider.php index 4963cd1282784..c554fd58861c7 100644 --- a/plugins/schemaorg/blogposting/services/provider.php +++ b/plugins/schemaorg/blogposting/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/book/services/provider.php b/plugins/schemaorg/book/services/provider.php index eec2591fc7001..b03ac97759bb5 100644 --- a/plugins/schemaorg/book/services/provider.php +++ b/plugins/schemaorg/book/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/event/services/provider.php b/plugins/schemaorg/event/services/provider.php index 015b48013356a..a88c453b20f93 100644 --- a/plugins/schemaorg/event/services/provider.php +++ b/plugins/schemaorg/event/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/jobposting/services/provider.php b/plugins/schemaorg/jobposting/services/provider.php index 3142b80c76548..e3380a1380a2f 100644 --- a/plugins/schemaorg/jobposting/services/provider.php +++ b/plugins/schemaorg/jobposting/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/organization/services/provider.php b/plugins/schemaorg/organization/services/provider.php index 42a8a05d00c27..de877cacd2ddd 100644 --- a/plugins/schemaorg/organization/services/provider.php +++ b/plugins/schemaorg/organization/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/person/services/provider.php b/plugins/schemaorg/person/services/provider.php index 1e7954d46b650..7597efd688e2e 100644 --- a/plugins/schemaorg/person/services/provider.php +++ b/plugins/schemaorg/person/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/recipe/services/provider.php b/plugins/schemaorg/recipe/services/provider.php index e38a1189486aa..950c4c15eea60 100644 --- a/plugins/schemaorg/recipe/services/provider.php +++ b/plugins/schemaorg/recipe/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/schemaorg/recipe/src/Extension/Recipe.php b/plugins/schemaorg/recipe/src/Extension/Recipe.php index 8a35d2623a8d4..e515a28b2e896 100755 --- a/plugins/schemaorg/recipe/src/Extension/Recipe.php +++ b/plugins/schemaorg/recipe/src/Extension/Recipe.php @@ -97,11 +97,11 @@ public function onSchemaBeforeCompileHead(BeforeCompileHeadEvent $event) } // Clean recipeIngredient - if (isset($entry['recipeIngredient']) && is_array($entry['recipeIngredient'])) { + if (isset($entry['recipeIngredient']) && \is_array($entry['recipeIngredient'])) { $result = []; foreach ($entry['recipeIngredient'] as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { $result[] = $v; } diff --git a/plugins/system/accessibility/services/provider.php b/plugins/system/accessibility/services/provider.php index 62ca8d2354184..5c93e84091827 100644 --- a/plugins/system/accessibility/services/provider.php +++ b/plugins/system/accessibility/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/actionlogs/services/provider.php b/plugins/system/actionlogs/services/provider.php index 57fe92a2ba06c..74933490bcfc4 100644 --- a/plugins/system/actionlogs/services/provider.php +++ b/plugins/system/actionlogs/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/actionlogs/src/Extension/ActionLogs.php b/plugins/system/actionlogs/src/Extension/ActionLogs.php index bcc2b85a2ebef..fd87a118fd0ea 100644 --- a/plugins/system/actionlogs/src/Extension/ActionLogs.php +++ b/plugins/system/actionlogs/src/Extension/ActionLogs.php @@ -73,7 +73,7 @@ public function onContentPrepareForm(Form $form, $data) 'com_users.user', ]; - if (!in_array($formName, $allowedFormNames, true)) { + if (!\in_array($formName, $allowedFormNames, true)) { return true; } @@ -97,7 +97,7 @@ public function onContentPrepareForm(Form $form, $data) $data = $jformData; } - if (is_array($data)) { + if (\is_array($data)) { $data = (object) $data; } @@ -134,11 +134,11 @@ public function onContentPrepareForm(Form $form, $data) */ public function onContentPrepareData($context, $data) { - if (!in_array($context, ['com_users.profile', 'com_users.user'])) { + if (!\in_array($context, ['com_users.profile', 'com_users.user'])) { return true; } - if (is_array($data)) { + if (\is_array($data)) { $data = (object) $data; } diff --git a/plugins/system/cache/services/provider.php b/plugins/system/cache/services/provider.php index 2e29dbae40e34..bd2b5377520ab 100644 --- a/plugins/system/cache/services/provider.php +++ b/plugins/system/cache/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\Cache\CacheControllerFactoryInterface; use Joomla\CMS\Extension\PluginInterface; @@ -39,7 +39,7 @@ function (Container $container) { $dispatcher = $container->get(DispatcherInterface::class); $documentFactory = $container->get('document.factory'); $cacheControllerFactory = $container->get(CacheControllerFactoryInterface::class); - $profiler = (defined('JDEBUG') && JDEBUG) ? Profiler::getInstance('Application') : null; + $profiler = (\defined('JDEBUG') && JDEBUG) ? Profiler::getInstance('Application') : null; $router = $container->has(SiteRouter::class) ? $container->get(SiteRouter::class) : null; $plugin = new Cache($dispatcher, (array) $plugin, $documentFactory, $cacheControllerFactory, $profiler, $router); diff --git a/plugins/system/cache/src/Extension/Cache.php b/plugins/system/cache/src/Extension/Cache.php index 6e0a2fb34ad53..f8248d710a1a6 100644 --- a/plugins/system/cache/src/Extension/Cache.php +++ b/plugins/system/cache/src/Extension/Cache.php @@ -153,7 +153,7 @@ public function onAfterRoute(Event $event) $results = $this->getApplication()->triggerEvent('onPageCacheSetCaching'); - $this->getCacheController()->setCaching(!in_array(false, $results, true)); + $this->getCacheController()->setCaching(!\in_array(false, $results, true)); $data = $this->getCacheController()->get($this->getCacheKey()); @@ -315,7 +315,7 @@ private function isExcluded(): bool // Get the current menu item. $active = $this->getApplication()->getMenu()->getActive(); - if ($active && $active->id && in_array((int) $active->id, (array) $excludedMenuItems)) { + if ($active && $active->id && \in_array((int) $active->id, (array) $excludedMenuItems)) { return true; } } @@ -358,7 +358,7 @@ private function isExcluded(): bool $results = $this->getApplication()->triggerEvent('onPageCacheIsExcluded'); - return in_array(true, $results, true); + return \in_array(true, $results, true); } /** diff --git a/plugins/system/debug/services/provider.php b/plugins/system/debug/services/provider.php index 8914623efe1e8..540d9f98f52a9 100644 --- a/plugins/system/debug/services/provider.php +++ b/plugins/system/debug/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/debug/src/DataFormatter.php b/plugins/system/debug/src/DataFormatter.php index 28c1cef09020c..404c1e4975339 100644 --- a/plugins/system/debug/src/DataFormatter.php +++ b/plugins/system/debug/src/DataFormatter.php @@ -80,7 +80,7 @@ public function formatCallerInfo(array $call): string } elseif (\is_object($call['args'][0])) { $string .= \get_class($call['args'][0]); } else { - $string .= gettype($call['args'][0]); + $string .= \gettype($call['args'][0]); } $string .= ')'; } else { diff --git a/plugins/system/debug/src/Extension/Debug.php b/plugins/system/debug/src/Extension/Debug.php index 2992c44f19bb9..fe503ec3d1947 100644 --- a/plugins/system/debug/src/Extension/Debug.php +++ b/plugins/system/debug/src/Extension/Debug.php @@ -480,7 +480,7 @@ public function onAfterDisconnect(ConnectionEvent $event) } } - if ($this->params->get('query_explains') && in_array($db->getServerType(), ['mysql', 'postgresql'], true)) { + if ($this->params->get('query_explains') && \in_array($db->getServerType(), ['mysql', 'postgresql'], true)) { $logs = $this->queryMonitor->getLogs(); $boundParams = $this->queryMonitor->getBoundParams(); @@ -695,7 +695,7 @@ public function onBeforeRespond(): void $metrics .= sprintf('%s;dur=%f;desc="%s", ', $index . $name, $mark->time, $desc); // Do not create too large headers, some web servers don't love them - if (strlen($metrics) > 3000) { + if (\strlen($metrics) > 3000) { $metrics .= 'System;dur=0;desc="Data truncated to 3000 characters", '; break; } diff --git a/plugins/system/debug/src/JoomlaHttpDriver.php b/plugins/system/debug/src/JoomlaHttpDriver.php index afdae2ea2880f..93fdb9dc3d3e6 100644 --- a/plugins/system/debug/src/JoomlaHttpDriver.php +++ b/plugins/system/debug/src/JoomlaHttpDriver.php @@ -103,7 +103,7 @@ public function setSessionValue($name, $value) */ public function hasSessionValue($name) { - return array_key_exists($name, $this->dummySession); + return \array_key_exists($name, $this->dummySession); } /** diff --git a/plugins/system/debug/src/Storage/FileStorage.php b/plugins/system/debug/src/Storage/FileStorage.php index 3f0d097c56ea9..7d0a09002f363 100644 --- a/plugins/system/debug/src/Storage/FileStorage.php +++ b/plugins/system/debug/src/Storage/FileStorage.php @@ -161,7 +161,7 @@ private function isSecureToReturnData($data): bool /** * We only started this collector in Joomla 4.2.4 - any older files we have to assume are insecure. */ - if (!array_key_exists('juser', $data)) { + if (!\array_key_exists('juser', $data)) { return false; } diff --git a/plugins/system/fields/services/provider.php b/plugins/system/fields/services/provider.php index aad32ffb11b5a..4d373ac287f6a 100644 --- a/plugins/system/fields/services/provider.php +++ b/plugins/system/fields/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/fields/src/Extension/Fields.php b/plugins/system/fields/src/Extension/Fields.php index 2ebe4c3cd3547..3f75cf9f36526 100644 --- a/plugins/system/fields/src/Extension/Fields.php +++ b/plugins/system/fields/src/Extension/Fields.php @@ -92,7 +92,7 @@ public function onContentNormaliseRequestData(Model\NormaliseRequestDataEvent $e public function onContentAfterSave($context, $item, $isNew, $data = []): void { // Check if data is an array and the item has an id - if (!is_array($data) || empty($item->id) || empty($data['com_fields'])) { + if (!\is_array($data) || empty($item->id) || empty($data['com_fields'])) { return; } @@ -130,7 +130,7 @@ public function onContentAfterSave($context, $item, $isNew, $data = []): void // Loop over the fields foreach ($fields as $field) { // Determine the value if it is (un)available from the data - if (array_key_exists($field->name, $data['com_fields'])) { + if (\array_key_exists($field->name, $data['com_fields'])) { $value = $data['com_fields'][$field->name] === false ? null : $data['com_fields'][$field->name]; } else { // Field not available on form, use stored value @@ -138,12 +138,12 @@ public function onContentAfterSave($context, $item, $isNew, $data = []): void } // If no value set (empty) remove value from database - if (is_array($value) ? !count($value) : !strlen($value)) { + if (\is_array($value) ? !\count($value) : !\strlen($value)) { $value = null; } // JSON encode value for complex fields - if (is_array($value) && (count($value, COUNT_NORMAL) !== count($value, COUNT_RECURSIVE) || !count(array_filter(array_keys($value), 'is_numeric')))) { + if (\is_array($value) && (\count($value, COUNT_NORMAL) !== \count($value, COUNT_RECURSIVE) || !\count(array_filter(array_keys($value), 'is_numeric')))) { $value = json_encode($value); } @@ -177,7 +177,7 @@ public function onUserAfterSave($userData, $isNew, $success, $msg): void $task = $this->getApplication()->getInput()->getCmd('task'); // Skip fields save when we activate a user, because we will lose the saved data - if (in_array($task, ['activate', 'block', 'unblock'])) { + if (\in_array($task, ['activate', 'block', 'unblock'])) { return; } @@ -256,11 +256,11 @@ public function onContentPrepareForm(Model\PrepareFormEvent $event) $data = $data ?: $this->getApplication()->getInput()->get('jform', [], 'array'); // Set the catid on the category to get only the fields which belong to this category - if (is_array($data) && array_key_exists('id', $data)) { + if (\is_array($data) && \array_key_exists('id', $data)) { $data['catid'] = $data['id']; } - if (is_object($data) && isset($data->id)) { + if (\is_object($data) && isset($data->id)) { $data->catid = $data->id; } } @@ -280,7 +280,7 @@ public function onContentPrepareForm(Model\PrepareFormEvent $event) $data = $jformData; } - if (is_array($data)) { + if (\is_array($data)) { $data = (object) $data; } @@ -364,7 +364,7 @@ private function display($context, $item, $params, $displayType) $item = $this->prepareTagItem($item); } - if (is_string($params) || !$params) { + if (\is_string($params) || !$params) { $params = new Registry($params); } diff --git a/plugins/system/guidedtours/services/provider.php b/plugins/system/guidedtours/services/provider.php index 10ebbfa80bc44..8e30afd6b0b47 100644 --- a/plugins/system/guidedtours/services/provider.php +++ b/plugins/system/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/guidedtours/src/Extension/GuidedTours.php b/plugins/system/guidedtours/src/Extension/GuidedTours.php index cc5e88ea5bb29..53e52d9bde1e1 100644 --- a/plugins/system/guidedtours/src/Extension/GuidedTours.php +++ b/plugins/system/guidedtours/src/Extension/GuidedTours.php @@ -199,7 +199,7 @@ private function processTour($item) $user = $app->getIdentity(); $factory = $app->bootComponent('com_guidedtours')->getMVCFactory(); - if (empty($item->id) || $item->published < 1 || !in_array($item->access, $user->getAuthorisedViewLevels())) { + if (empty($item->id) || $item->published < 1 || !\in_array($item->access, $user->getAuthorisedViewLevels())) { return null; } diff --git a/plugins/system/highlight/services/provider.php b/plugins/system/highlight/services/provider.php index dac70279823fe..a13d7073782ac 100644 --- a/plugins/system/highlight/services/provider.php +++ b/plugins/system/highlight/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/highlight/src/Extension/Highlight.php b/plugins/system/highlight/src/Extension/Highlight.php index 15cb84d5f3537..7fc43da4196d2 100644 --- a/plugins/system/highlight/src/Extension/Highlight.php +++ b/plugins/system/highlight/src/Extension/Highlight.php @@ -111,7 +111,7 @@ public function onFinderResult($item, $query) { static $params; - if (is_null($params)) { + if (\is_null($params)) { $params = ComponentHelper::getParams('com_finder'); } diff --git a/plugins/system/httpheaders/services/provider.php b/plugins/system/httpheaders/services/provider.php index 20d631c0b05a7..dd40240e00fc7 100644 --- a/plugins/system/httpheaders/services/provider.php +++ b/plugins/system/httpheaders/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/httpheaders/src/Extension/Httpheaders.php b/plugins/system/httpheaders/src/Extension/Httpheaders.php index 9adae69333661..ef78c5bd53643 100644 --- a/plugins/system/httpheaders/src/Extension/Httpheaders.php +++ b/plugins/system/httpheaders/src/Extension/Httpheaders.php @@ -187,7 +187,7 @@ public function applyHashesToCspRule(Event $event): void if ($scriptHashesEnabled) { // Generate the hashes for the script-src - $inlineScripts = is_array($headData['script']) ? $headData['script'] : []; + $inlineScripts = \is_array($headData['script']) ? $headData['script'] : []; foreach ($inlineScripts as $type => $scripts) { foreach ($scripts as $hash => $scriptContent) { @@ -198,7 +198,7 @@ public function applyHashesToCspRule(Event $event): void if ($styleHashesEnabled) { // Generate the hashes for the style-src - $inlineStyles = is_array($headData['style']) ? $headData['style'] : []; + $inlineStyles = \is_array($headData['style']) ? $headData['style'] : []; foreach ($inlineStyles as $type => $styles) { foreach ($styles as $hash => $styleContent) { @@ -286,7 +286,7 @@ private function setCspHeader(): void } // Handle non value directives - if (in_array($cspValue->directive, $this->noValueDirectives)) { + if (\in_array($cspValue->directive, $this->noValueDirectives)) { $newCspValues[] = trim($cspValue->directive); continue; @@ -294,10 +294,10 @@ private function setCspHeader(): void // We can only use this if this is a valid entry if ( - in_array($cspValue->directive, $this->validDirectives) + \in_array($cspValue->directive, $this->validDirectives) && !empty($cspValue->value) ) { - if (in_array($cspValue->directive, $this->nonceDirectives) && $nonceEnabled) { + if (\in_array($cspValue->directive, $this->nonceDirectives) && $nonceEnabled) { /** * That line is for B/C we do no longer require to add the nonce tag * but add it once the setting is enabled so this line here is needed @@ -403,7 +403,7 @@ private function getStaticHeaderConfiguration(): array } // Make sure the header is a valid and supported header - if (!in_array(strtolower($additionalHttpHeader->key), $this->supportedHttpHeaders)) { + if (!\in_array(strtolower($additionalHttpHeader->key), $this->supportedHttpHeaders)) { continue; } @@ -416,7 +416,7 @@ private function getStaticHeaderConfiguration(): array } // Allow the custom csp headers to use the random $cspNonce in the rules - if (in_array(strtolower($additionalHttpHeader->key), ['content-security-policy', 'content-security-policy-report-only'])) { + if (\in_array(strtolower($additionalHttpHeader->key), ['content-security-policy', 'content-security-policy-report-only'])) { $additionalHttpHeader->value = str_replace('{nonce}', "'nonce-" . $this->cspNonce . "'", $additionalHttpHeader->value); } diff --git a/plugins/system/jooa11y/services/provider.php b/plugins/system/jooa11y/services/provider.php index 156e063fd1191..4bf355dea9965 100644 --- a/plugins/system/jooa11y/services/provider.php +++ b/plugins/system/jooa11y/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/jooa11y/src/Extension/Jooa11y.php b/plugins/system/jooa11y/src/Extension/Jooa11y.php index 2c1c936d48166..c22dda5ca00d5 100644 --- a/plugins/system/jooa11y/src/Extension/Jooa11y.php +++ b/plugins/system/jooa11y/src/Extension/Jooa11y.php @@ -50,7 +50,7 @@ private function isAuthorisedDisplayChecker(): bool { static $result; - if (is_bool($result)) { + if (\is_bool($result)) { return $result; } diff --git a/plugins/system/languagecode/services/provider.php b/plugins/system/languagecode/services/provider.php index 4c0a5dd973100..4c9dc596d73a6 100644 --- a/plugins/system/languagecode/services/provider.php +++ b/plugins/system/languagecode/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/languagecode/src/Extension/LanguageCode.php b/plugins/system/languagecode/src/Extension/LanguageCode.php index 27420df0660d7..c5a6560f48063 100644 --- a/plugins/system/languagecode/src/Extension/LanguageCode.php +++ b/plugins/system/languagecode/src/Extension/LanguageCode.php @@ -50,8 +50,8 @@ public function onAfterRender() if ($new_code) { // Replace the new code in the HTML document. $patterns = [ - chr(1) . '()' . chr(1) . 'i', - chr(1) . '()' . chr(1) . 'i', + \chr(1) . '()' . \chr(1) . 'i', + \chr(1) . '()' . \chr(1) . 'i', ]; $replace = [ '${1}' . strtolower($new_code) . '${3}', @@ -63,36 +63,36 @@ public function onAfterRender() } // Replace codes in attributes. - preg_match_all(chr(1) . '()' . chr(1) . 'i', $body, $matches); + preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches); foreach ($matches[2] as $match) { $new_code = $this->params->get(strtolower($match)); if ($new_code) { - $patterns[] = chr(1) . '()' . chr(1) . 'i'; + $patterns[] = \chr(1) . '()' . \chr(1) . 'i'; $replace[] = '${1}' . $new_code . '${3}'; } } - preg_match_all(chr(1) . '()' . chr(1) . 'i', $body, $matches); + preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches); foreach ($matches[2] as $match) { $new_code = $this->params->get(strtolower($match)); if ($new_code) { - $patterns[] = chr(1) . '()' . chr(1) . 'i'; + $patterns[] = \chr(1) . '()' . \chr(1) . 'i'; $replace[] = '${1}' . $new_code . '${3}'; } } // Replace codes in itemprop content - preg_match_all(chr(1) . '()' . chr(1) . 'i', $body, $matches); + preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches); foreach ($matches[2] as $match) { $new_code = $this->params->get(strtolower($match)); if ($new_code) { - $patterns[] = chr(1) . '()' . chr(1) . 'i'; + $patterns[] = \chr(1) . '()' . \chr(1) . 'i'; $replace[] = '${1}' . $new_code . '${3}'; } } diff --git a/plugins/system/languagefilter/services/provider.php b/plugins/system/languagefilter/services/provider.php index f952f98ee621d..c72423242b9da 100644 --- a/plugins/system/languagefilter/services/provider.php +++ b/plugins/system/languagefilter/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/languagefilter/src/Extension/LanguageFilter.php b/plugins/system/languagefilter/src/Extension/LanguageFilter.php index 66716be0246e5..826a01543c81e 100644 --- a/plugins/system/languagefilter/src/Extension/LanguageFilter.php +++ b/plugins/system/languagefilter/src/Extension/LanguageFilter.php @@ -137,8 +137,8 @@ public function __construct( // @todo: In Joomla 2.5.4 and earlier access wasn't set. Non modified Content Languages got 0 as access value // we also check if frontend language exists and is enabled if ( - ($language->access && !in_array($language->access, $levels)) - || (!array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) + ($language->access && !\in_array($language->access, $levels)) + || (!\array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) ) { unset($this->lang_codes[$language->lang_code], $this->sefs[$language->sef]); } @@ -149,7 +149,7 @@ public function __construct( $this->current_lang = isset($this->lang_codes[$this->default_lang]) ? $this->default_lang : 'en-GB'; foreach ($this->sefs as $sef => $language) { - if (!array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) { + if (!\array_key_exists($language->lang_code, LanguageHelper::getInstalledLanguages(0))) { unset($this->lang_codes[$language->lang_code]); unset($this->sefs[$language->sef]); } @@ -351,7 +351,7 @@ public function parseRule(&$router, &$uri) array_shift($parts); // Empty parts array when "index.php" is the only part left. - if (count($parts) === 1 && $parts[0] === 'index.php') { + if (\count($parts) === 1 && $parts[0] === 'index.php') { $parts = []; } @@ -384,8 +384,8 @@ public function parseRule(&$router, &$uri) if ( $this->getApplication()->getInput()->getMethod() === 'POST' || $this->getApplication()->getInput()->get('nolangfilter', 0) == 1 - || count($this->getApplication()->getInput()->post) > 0 - || count($this->getApplication()->getInput()->files) > 0 + || \count($this->getApplication()->getInput()->post) > 0 + || \count($this->getApplication()->getInput()->files) > 0 ) { $found = true; @@ -527,7 +527,7 @@ public function onPrivacyCollectAdminCapabilities() */ public function onUserBeforeSave($user, $isnew, $new) { - if (array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) { + if (\array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) { $registry = new Registry($user['params']); $this->user_lang_code = $registry->get('language'); @@ -553,7 +553,7 @@ public function onUserBeforeSave($user, $isnew, $new) */ public function onUserAfterSave($user, $isnew, $success, $msg): void { - if ($success && array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) { + if ($success && \array_key_exists('params', $user) && $this->params->get('automatic_change', 1) == 1) { $registry = new Registry($user['params']); $lang_code = $registry->get('language'); @@ -604,8 +604,8 @@ public function onUserLogin($user, $options = []) // The language has been deleted/disabled or the related content language does not exist/has been unpublished // or the related home page does not exist/has been unpublished if ( - !array_key_exists($lang_code, $this->lang_codes) - || !array_key_exists($lang_code, Multilanguage::getSiteHomePages()) + !\array_key_exists($lang_code, $this->lang_codes) + || !\array_key_exists($lang_code, Multilanguage::getSiteHomePages()) || !Folder::exists(JPATH_SITE . '/language/' . $lang_code) ) { $lang_code = $this->current_lang; @@ -730,8 +730,8 @@ public function onAfterDispatch() $cName = ucfirst(substr($option, 4)) . 'HelperAssociation'; \JLoader::register($cName, Path::clean(JPATH_SITE . '/components/' . $option . '/helpers/association.php')); - if (class_exists($cName) && is_callable([$cName, 'getAssociations'])) { - $cassociations = call_user_func([$cName, 'getAssociations']); + if (class_exists($cName) && \is_callable([$cName, 'getAssociations'])) { + $cassociations = \call_user_func([$cName, 'getAssociations']); } } @@ -739,9 +739,9 @@ public function onAfterDispatch() foreach ($languages as $i => $language) { switch (true) { // Language without frontend UI || Language without specific home menu || Language without authorized access level - case !array_key_exists($i, LanguageHelper::getInstalledLanguages(0)): + case !\array_key_exists($i, LanguageHelper::getInstalledLanguages(0)): case !isset($homes[$i]): - case isset($language->access) && $language->access && !in_array($language->access, $levels): + case isset($language->access) && $language->access && !\in_array($language->access, $levels): unset($languages[$i]); break; @@ -773,7 +773,7 @@ public function onAfterDispatch() } // If there are at least 2 of them, add the rel="alternate" links to the - if (count($languages) > 1) { + if (\count($languages) > 1) { // Remove the sef from the default language if "Remove URL Language Code" is on if ($remove_default_prefix && isset($languages[$this->default_lang])) { $languages[$this->default_lang]->link @@ -847,7 +847,7 @@ private function getLanguageCookie() } // Let's be sure we got a valid language code. Fallback to null. - if (!array_key_exists($languageCode, $this->lang_codes)) { + if (!\array_key_exists($languageCode, $this->lang_codes)) { $languageCode = null; } diff --git a/plugins/system/log/services/provider.php b/plugins/system/log/services/provider.php index 7ac977585d111..d355f0484da14 100644 --- a/plugins/system/log/services/provider.php +++ b/plugins/system/log/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/logout/services/provider.php b/plugins/system/logout/services/provider.php index dc26ead1001f2..d4b52cba55f4a 100644 --- a/plugins/system/logout/services/provider.php +++ b/plugins/system/logout/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/privacyconsent/services/provider.php b/plugins/system/privacyconsent/services/provider.php index a400fce7f31e0..b2c1a95359598 100644 --- a/plugins/system/privacyconsent/services/provider.php +++ b/plugins/system/privacyconsent/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php index e8daed657f648..9eced6cba02fc 100644 --- a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php +++ b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php @@ -51,7 +51,7 @@ public function onContentPrepareForm(Form $form, $data) // Check we are manipulating a valid form - we only display this on user registration form and user profile form. $name = $form->getName(); - if (!in_array($name, ['com_users.profile', 'com_users.registration'])) { + if (!\in_array($name, ['com_users.profile', 'com_users.registration'])) { return true; } @@ -59,7 +59,7 @@ public function onContentPrepareForm(Form $form, $data) $this->loadLanguage(); // We only display this if user has not consented before - if (is_object($data)) { + if (\is_object($data)) { $userId = $data->id ?? 0; if ($userId > 0 && $this->isUserConsented($userId)) { @@ -117,7 +117,7 @@ public function onUserBeforeSave($user, $isNew, $data) $form = $input->post->get('jform', [], 'array'); if ( - $option == 'com_users' && in_array($task, ['registration.register', 'profile.save']) + $option == 'com_users' && \in_array($task, ['registration.register', 'profile.save']) && empty($form['privacyconsent']['privacy']) ) { throw new \InvalidArgumentException($this->getApplication()->getLanguage()->_('PLG_SYSTEM_PRIVACYCONSENT_FIELD_ERROR')); @@ -160,7 +160,7 @@ public function onUserAfterSave($data, $isNew, $result, $error): void if ( $option == 'com_users' - && in_array($task, ['registration.register', 'profile.save']) + && \in_array($task, ['registration.register', 'profile.save']) && !empty($form['privacyconsent']['privacy']) ) { $userId = ArrayHelper::getValue($data, 'id', 0, 'int'); @@ -279,7 +279,7 @@ public function onAfterRoute() 'profile.save', 'profile.apply', 'user.logout', 'user.menulogout', 'method', 'methods', 'captive', 'callback', ]; - $isAllowedUserTask = in_array($task, $allowedUserTasks) + $isAllowedUserTask = \in_array($task, $allowedUserTasks) || substr($task, 0, 8) === 'captive.' || substr($task, 0, 8) === 'methods.' || substr($task, 0, 7) === 'method.' diff --git a/plugins/system/redirect/services/provider.php b/plugins/system/redirect/services/provider.php index 4ca8dbc324bf2..27e073852c851 100644 --- a/plugins/system/redirect/services/provider.php +++ b/plugins/system/redirect/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/remember/services/provider.php b/plugins/system/remember/services/provider.php index 5a6fc0a333aad..b1528763a22c6 100644 --- a/plugins/system/remember/services/provider.php +++ b/plugins/system/remember/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/schedulerunner/services/provider.php b/plugins/system/schedulerunner/services/provider.php index 1c6d4cd76fc6d..a8ff358f768e1 100644 --- a/plugins/system/schedulerunner/services/provider.php +++ b/plugins/system/schedulerunner/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php index 655d970f8ba92..143272585d5f6 100644 --- a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php +++ b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php @@ -153,7 +153,7 @@ public function runLazyCron(EventInterface $e) } // Since the the request from the frontend may time out, try allowing execution after disconnect. - if (function_exists('ignore_user_abort')) { + if (\function_exists('ignore_user_abort')) { ignore_user_abort(true); } @@ -198,7 +198,7 @@ public function runWebCron(Event $event) throw new \Exception($this->getApplication()->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403); } - if (!strlen($hash) || $hash !== $this->getApplication()->getInput()->get('hash')) { + if (!\strlen($hash) || $hash !== $this->getApplication()->getInput()->get('hash')) { throw new \Exception($this->getApplication()->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403); } diff --git a/plugins/system/schemaorg/services/provider.php b/plugins/system/schemaorg/services/provider.php index 1185fe3b9a190..93c880743bcf9 100644 --- a/plugins/system/schemaorg/services/provider.php +++ b/plugins/system/schemaorg/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/schemaorg/src/Extension/Schemaorg.php b/plugins/system/schemaorg/src/Extension/Schemaorg.php index 43e8f839bdcc0..b099a2fce38b1 100644 --- a/plugins/system/schemaorg/src/Extension/Schemaorg.php +++ b/plugins/system/schemaorg/src/Extension/Schemaorg.php @@ -281,7 +281,7 @@ public function onBeforeCompileHead(): void $context = $option . '.' . $view; // We need the plugin configured at least once to add structured data - if (!$app->isClient('site') || !in_array($baseType, ['organization', 'person']) || !$this->isSupported($context)) { + if (!$app->isClient('site') || !\in_array($baseType, ['organization', 'person']) || !$this->isSupported($context)) { return; } @@ -461,7 +461,7 @@ private function cleanupSchema($schema) $result = []; foreach ($schema as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { // Subtypes need special handling if (!empty($value['@type'])) { if ($value['@type'] === 'ImageObject') { @@ -486,7 +486,7 @@ private function cleanupSchema($schema) $value = $this->cleanupSchema($value); // We don't save when the array contains only the @type - if (empty($value) || count($value) <= 1) { + if (empty($value) || \count($value) <= 1) { $value = null; } } elseif ($key == 'genericField') { diff --git a/plugins/system/sef/services/provider.php b/plugins/system/sef/services/provider.php index cf8309eddec61..f050dcd06515e 100644 --- a/plugins/system/sef/services/provider.php +++ b/plugins/system/sef/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/shortcut/services/provider.php b/plugins/system/shortcut/services/provider.php index 3b14700c509cb..d81da573e5f7c 100644 --- a/plugins/system/shortcut/services/provider.php +++ b/plugins/system/shortcut/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/skipto/services/provider.php b/plugins/system/skipto/services/provider.php index 9f740ae7cd88f..274dcebf053e4 100644 --- a/plugins/system/skipto/services/provider.php +++ b/plugins/system/skipto/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/stats/services/provider.php b/plugins/system/stats/services/provider.php index fdcc949901ca0..7e2eb12803c4a 100644 --- a/plugins/system/stats/services/provider.php +++ b/plugins/system/stats/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/stats/src/Extension/Stats.php b/plugins/system/stats/src/Extension/Stats.php index c9528b0697f7f..13f6cb16248d7 100644 --- a/plugins/system/stats/src/Extension/Stats.php +++ b/plugins/system/stats/src/Extension/Stats.php @@ -368,7 +368,7 @@ private function isAllowedUser() */ private function isDebugEnabled() { - return defined('PLG_SYSTEM_STATS_DEBUG'); + return \defined('PLG_SYSTEM_STATS_DEBUG'); } /** diff --git a/plugins/system/tasknotification/services/provider.php b/plugins/system/tasknotification/services/provider.php index 2c87edd79830c..c0cfbcd564d85 100644 --- a/plugins/system/tasknotification/services/provider.php +++ b/plugins/system/tasknotification/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/system/webauthn/services/provider.php b/plugins/system/webauthn/services/provider.php index 005dfaa464978..c9517c55385b2 100644 --- a/plugins/system/webauthn/services/provider.php +++ b/plugins/system/webauthn/services/provider.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') || die; +\defined('_JEXEC') || die; use Joomla\Application\ApplicationInterface; use Joomla\Application\SessionAwareWebApplicationInterface; diff --git a/plugins/system/webauthn/src/Authentication.php b/plugins/system/webauthn/src/Authentication.php index 9d15b856d5947..7d6a28874f6c0 100644 --- a/plugins/system/webauthn/src/Authentication.php +++ b/plugins/system/webauthn/src/Authentication.php @@ -254,7 +254,7 @@ public function validateAssertionResponse(string $data, User $user): PublicKeyCr $publicKeyCredentialRequestOptions = unserialize($serializedOptions); if ( - !is_object($publicKeyCredentialRequestOptions) + !\is_object($publicKeyCredentialRequestOptions) || empty($publicKeyCredentialRequestOptions) || !($publicKeyCredentialRequestOptions instanceof PublicKeyCredentialRequestOptions) ) { @@ -314,7 +314,7 @@ public function validateAttestationResponse(string $data): PublicKeyCredentialSo $publicKeyCredentialCreationOptions = null; } - if (!is_object($publicKeyCredentialCreationOptions) || !($publicKeyCredentialCreationOptions instanceof PublicKeyCredentialCreationOptions)) { + if (!\is_object($publicKeyCredentialCreationOptions) || !($publicKeyCredentialCreationOptions instanceof PublicKeyCredentialCreationOptions)) { throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_NO_PK')); } @@ -509,7 +509,7 @@ private function getPKCredentialRequestOptions(): PublicKeyCredentialRequestOpti throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); } - if (!is_object($publicKeyCredentialRequestOptions) || !($publicKeyCredentialRequestOptions instanceof PublicKeyCredentialRequestOptions)) { + if (!\is_object($publicKeyCredentialRequestOptions) || !($publicKeyCredentialRequestOptions instanceof PublicKeyCredentialRequestOptions)) { throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); } @@ -540,7 +540,7 @@ private function getWebauthnServer(): Server $server = new Server($rpEntity, $repository, $this->metadataRepository); // Ed25519 is only available with libsodium - if (!function_exists('sodium_crypto_sign_seed_keypair')) { + if (!\function_exists('sodium_crypto_sign_seed_keypair')) { $server->setSelectedAlgorithms(['RS256', 'RS512', 'PS256', 'PS512', 'ES256', 'ES512']); } diff --git a/plugins/system/webauthn/src/CredentialRepository.php b/plugins/system/webauthn/src/CredentialRepository.php index 42275e25ebcbf..eef333de8084a 100644 --- a/plugins/system/webauthn/src/CredentialRepository.php +++ b/plugins/system/webauthn/src/CredentialRepository.php @@ -477,7 +477,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int return null; } - if (is_null($numRecords) || ($numRecords < 1)) { + if (\is_null($numRecords) || ($numRecords < 1)) { return null; } @@ -617,7 +617,7 @@ private function formatDate($date, ?string $format = null, bool $tzAware = true) $tz = null; if ($tzAware !== false) { - $userId = is_bool($tzAware) ? null : (int) $tzAware; + $userId = \is_bool($tzAware) ? null : (int) $tzAware; try { $tzDefault = Factory::getApplication()->get('offset'); diff --git a/plugins/system/webauthn/src/MetadataRepository.php b/plugins/system/webauthn/src/MetadataRepository.php index 6010a68925eaa..4d61056780c13 100644 --- a/plugins/system/webauthn/src/MetadataRepository.php +++ b/plugins/system/webauthn/src/MetadataRepository.php @@ -121,7 +121,7 @@ private function load(): void $jwtFilename = JPATH_PLUGINS . '/system/webauthn/fido.jwt'; $rawJwt = file_get_contents($jwtFilename); - if (!is_string($rawJwt) || strlen($rawJwt) < 1024) { + if (!\is_string($rawJwt) || \strlen($rawJwt) < 1024) { return; } diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerInitCreate.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerInitCreate.php index 781cafe564aba..34aed19e92778 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerInitCreate.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerInitCreate.php @@ -51,7 +51,7 @@ public function onAjaxWebauthnInitcreate(AjaxInitCreate $event): void } // I need the server to have either GMP or BCComp support to attest new authenticators - if (function_exists('gmp_intval') === false && function_exists('bccomp') === false) { + if (\function_exists('gmp_intval') === false && \function_exists('bccomp') === false) { $event->addResult(new \stdClass()); return; diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php index afa7b308f9c85..e661e6415df48 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php @@ -77,7 +77,7 @@ public function onAjaxWebauthnLogin(AjaxLogin $event): void // Validate the authenticator response and get the user handle $userHandle = $this->getUserHandleFromResponse($user); - if (is_null($userHandle)) { + if (\is_null($userHandle)) { Log::add('Cannot retrieve the user handle from the request; the browser did not assert our request.', Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); @@ -205,7 +205,7 @@ class_exists('Joomla\\CMS\\Authentication\\Authentication', true); $results = !isset($result['result']) || \is_null($result['result']) ? [] : $result['result']; // If there is no boolean FALSE result from any plugin the login is successful. - if (in_array(false, $results, true) === false) { + if (\in_array(false, $results, true) === false) { // Set the user in the session, letting Joomla! know that we are logged in. $this->getApplication()->getSession()->set('user', $user); diff --git a/plugins/system/webauthn/src/PluginTraits/EventReturnAware.php b/plugins/system/webauthn/src/PluginTraits/EventReturnAware.php index 6b6417c03e5fe..617badf195bac 100644 --- a/plugins/system/webauthn/src/PluginTraits/EventReturnAware.php +++ b/plugins/system/webauthn/src/PluginTraits/EventReturnAware.php @@ -42,7 +42,7 @@ private function returnFromEvent(Event $event, $value = null): void $result = $event->getArgument('result') ?: []; - if (!is_array($result)) { + if (!\is_array($result)) { $result = [$result]; } diff --git a/plugins/task/checkfiles/services/provider.php b/plugins/task/checkfiles/services/provider.php index 2503863a1ffb3..1afafe3051cb6 100644 --- a/plugins/task/checkfiles/services/provider.php +++ b/plugins/task/checkfiles/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/deleteactionlogs/services/provider.php b/plugins/task/deleteactionlogs/services/provider.php index d97d1edde426c..83e33b9e94439 100644 --- a/plugins/task/deleteactionlogs/services/provider.php +++ b/plugins/task/deleteactionlogs/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/globalcheckin/services/provider.php b/plugins/task/globalcheckin/services/provider.php index 19dc39ccf95f1..03733ecf8fe31 100644 --- a/plugins/task/globalcheckin/services/provider.php +++ b/plugins/task/globalcheckin/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\Extension\PluginInterface; use Joomla\CMS\Plugin\PluginHelper; diff --git a/plugins/task/privacyconsent/services/provider.php b/plugins/task/privacyconsent/services/provider.php index 7e80bed48284a..59520ef4f211d 100644 --- a/plugins/task/privacyconsent/services/provider.php +++ b/plugins/task/privacyconsent/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/requests/services/provider.php b/plugins/task/requests/services/provider.php index 9c5baaf17b5be..2d11ccb9e9142 100644 --- a/plugins/task/requests/services/provider.php +++ b/plugins/task/requests/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/rotatelogs/services/provider.php b/plugins/task/rotatelogs/services/provider.php index 35aac029d969d..d55575b387a7d 100644 --- a/plugins/task/rotatelogs/services/provider.php +++ b/plugins/task/rotatelogs/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/rotatelogs/src/Extension/RotateLogs.php b/plugins/task/rotatelogs/src/Extension/RotateLogs.php index 51cf1999d8d4c..9ed3bea05eebf 100644 --- a/plugins/task/rotatelogs/src/Extension/RotateLogs.php +++ b/plugins/task/rotatelogs/src/Extension/RotateLogs.php @@ -165,7 +165,7 @@ private function getLogFiles($path) * Rotated log file has this filename format [VERSION].[FILENAME].php. So if $parts has at least 3 elements * and the first element is a number, we know that it's a rotated file and can get it's current version */ - if (count($parts) >= 3 && is_numeric($parts[0])) { + if (\count($parts) >= 3 && is_numeric($parts[0])) { $version = (int) $parts[0]; } else { $version = 0; diff --git a/plugins/task/sessiongc/services/provider.php b/plugins/task/sessiongc/services/provider.php index 9380b557f93f6..36a22a926df38 100644 --- a/plugins/task/sessiongc/services/provider.php +++ b/plugins/task/sessiongc/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/sitestatus/services/provider.php b/plugins/task/sitestatus/services/provider.php index 52241f8829c55..ac478bf487ace 100644 --- a/plugins/task/sitestatus/services/provider.php +++ b/plugins/task/sitestatus/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/task/sitestatus/src/Extension/SiteStatus.php b/plugins/task/sitestatus/src/Extension/SiteStatus.php index be5ed0f41ac88..d28b5cae6ed0a 100644 --- a/plugins/task/sitestatus/src/Extension/SiteStatus.php +++ b/plugins/task/sitestatus/src/Extension/SiteStatus.php @@ -123,7 +123,7 @@ public function __construct(DispatcherInterface $dispatcher, array $config, arra */ public function alterSiteStatus(ExecuteTaskEvent $event): void { - if (!array_key_exists($event->getRoutineId(), self::TASKS_MAP)) { + if (!\array_key_exists($event->getRoutineId(), self::TASKS_MAP)) { return; } @@ -178,7 +178,7 @@ private function writeConfigFile(Registry $config): int } // Invalidates the cached configuration file - if (function_exists('opcache_invalidate')) { + if (\function_exists('opcache_invalidate')) { opcache_invalidate($file); } diff --git a/plugins/task/updatenotification/services/provider.php b/plugins/task/updatenotification/services/provider.php index c5003abd0cf9f..376ce1ce9dddf 100644 --- a/plugins/task/updatenotification/services/provider.php +++ b/plugins/task/updatenotification/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/contactcreator/services/provider.php b/plugins/user/contactcreator/services/provider.php index 30c41aea18850..f7bdde68af52f 100644 --- a/plugins/user/contactcreator/services/provider.php +++ b/plugins/user/contactcreator/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/joomla/services/provider.php b/plugins/user/joomla/services/provider.php index d887469f2eff5..b78611c23ebe0 100644 --- a/plugins/user/joomla/services/provider.php +++ b/plugins/user/joomla/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/joomla/src/Extension/Joomla.php b/plugins/user/joomla/src/Extension/Joomla.php index 3e5d4b57c02b6..8bf037f41f7be 100644 --- a/plugins/user/joomla/src/Extension/Joomla.php +++ b/plugins/user/joomla/src/Extension/Joomla.php @@ -61,7 +61,7 @@ public function onContentPrepareForm($form, $data) $data = $this->getApplication()->getInput()->get('jform', [], 'array'); } - if (is_array($data)) { + if (\is_array($data)) { $data = (object) $data; } @@ -434,7 +434,7 @@ private function disableMfaOnSilentLogin(array $options): void /** @var User $user */ $user = $options['user']; - if (!is_object($user) || !($user instanceof User) || $user->guest) { + if (!\is_object($user) || !($user instanceof User) || $user->guest) { return; } @@ -445,7 +445,7 @@ private function disableMfaOnSilentLogin(array $options): void $silentResponseTypes = $silentResponseTypes ?: ['cookie', 'passwordless']; // Only proceed if this is not a silent login - if (!in_array(strtolower($options['responseType'] ?? ''), $silentResponseTypes)) { + if (!\in_array(strtolower($options['responseType'] ?? ''), $silentResponseTypes)) { return; } diff --git a/plugins/user/profile/services/provider.php b/plugins/user/profile/services/provider.php index e16963afa8fe5..ba7439d66e156 100644 --- a/plugins/user/profile/services/provider.php +++ b/plugins/user/profile/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/profile/src/Extension/Profile.php b/plugins/user/profile/src/Extension/Profile.php index f7dc37a35f2cc..7a42081ad121d 100644 --- a/plugins/user/profile/src/Extension/Profile.php +++ b/plugins/user/profile/src/Extension/Profile.php @@ -57,14 +57,14 @@ final class Profile extends CMSPlugin public function onContentPrepareData($context, $data) { // Check we are manipulating a valid form. - if (!in_array($context, ['com_users.profile', 'com_users.user', 'com_users.registration'])) { + if (!\in_array($context, ['com_users.profile', 'com_users.user', 'com_users.registration'])) { return true; } // Load plugin language files $this->loadLanguage(); - if (is_object($data)) { + if (\is_object($data)) { $userId = $data->id ?? 0; if (!isset($data->profile) && $userId > 0) { @@ -205,7 +205,7 @@ public function onContentPrepareForm(Form $form, $data) // Check we are manipulating a valid form. $name = $form->getName(); - if (!in_array($name, ['com_users.user', 'com_users.profile', 'com_users.registration'])) { + if (!\in_array($name, ['com_users.user', 'com_users.profile', 'com_users.registration'])) { return true; } @@ -279,7 +279,7 @@ public function onContentPrepareForm(Form $form, $data) // Drop the profile form entirely if there aren't any fields to display. $remainingfields = $form->getGroup('profile'); - if (!count($remainingfields)) { + if (!\count($remainingfields)) { $form->removeGroup('profile'); } @@ -346,7 +346,7 @@ public function onUserAfterSave($data, $isNew, $result, $error): void { $userId = ArrayHelper::getValue($data, 'id', 0, 'int'); - if ($userId && $result && isset($data['profile']) && count($data['profile'])) { + if ($userId && $result && isset($data['profile']) && \count($data['profile'])) { $db = $this->getDatabase(); // Sanitize the date @@ -381,7 +381,7 @@ public function onUserAfterSave($data, $isNew, $result, $error): void ->insert($db->quoteName('#__user_profiles')); foreach ($data['profile'] as $k => $v) { - while (in_array($order, $usedOrdering)) { + while (\in_array($order, $usedOrdering)) { $order++; } diff --git a/plugins/user/terms/services/provider.php b/plugins/user/terms/services/provider.php index d19592facdd86..3f2570da357a0 100644 --- a/plugins/user/terms/services/provider.php +++ b/plugins/user/terms/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/terms/src/Extension/Terms.php b/plugins/user/terms/src/Extension/Terms.php index 2ee3156dcbb64..1485f7822bfbe 100644 --- a/plugins/user/terms/src/Extension/Terms.php +++ b/plugins/user/terms/src/Extension/Terms.php @@ -42,7 +42,7 @@ public function onContentPrepareForm(Form $form, $data) // Check we are manipulating a valid form - we only display this on user registration form. $name = $form->getName(); - if (!in_array($name, ['com_users.registration'])) { + if (!\in_array($name, ['com_users.registration'])) { return true; } @@ -97,7 +97,7 @@ public function onUserBeforeSave($user, $isNew, $data) $task = $input->post->get('task'); $form = $input->post->get('jform', [], 'array'); - if ($option == 'com_users' && in_array($task, ['registration.register']) && empty($form['terms']['terms'])) { + if ($option == 'com_users' && \in_array($task, ['registration.register']) && empty($form['terms']['terms'])) { throw new \InvalidArgumentException($this->getApplication()->getLanguage()->_('PLG_USER_TERMS_FIELD_ERROR')); } diff --git a/plugins/user/token/services/provider.php b/plugins/user/token/services/provider.php index d255df74460a3..6c520737c8d03 100644 --- a/plugins/user/token/services/provider.php +++ b/plugins/user/token/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/user/token/src/Extension/Token.php b/plugins/user/token/src/Extension/Token.php index 17c0f9baf647a..80369d4a976ff 100644 --- a/plugins/user/token/src/Extension/Token.php +++ b/plugins/user/token/src/Extension/Token.php @@ -79,12 +79,12 @@ public function onContentPrepareData(string $context, &$data): bool } // Check we are manipulating a valid form. - if (!in_array($context, $this->allowedContexts)) { + if (!\in_array($context, $this->allowedContexts)) { return true; } // $data must be an object - if (!is_object($data)) { + if (!\is_object($data)) { return true; } @@ -94,7 +94,7 @@ public function onContentPrepareData(string $context, &$data): bool } // Get the user ID - $userId = intval($data->id); + $userId = \intval($data->id); // Make sure we have a positive integer user ID if ($userId <= 0) { @@ -185,7 +185,7 @@ public function onContentPrepareForm(Form $form, $data): bool } // Check we are manipulating a valid form. - if (!in_array($form->getName(), $this->allowedContexts)) { + if (!\in_array($form->getName(), $this->allowedContexts)) { return true; } @@ -196,12 +196,12 @@ public function onContentPrepareForm(Form $form, $data): bool $data = $jformData; } - if (is_array($data)) { + if (\is_array($data)) { $data = (object) $data; } // Check if the user belongs to an allowed user group - $userId = (is_object($data) && isset($data->id)) ? $data->id : 0; + $userId = (\is_object($data) && isset($data->id)) ? $data->id : 0; if (!empty($userId) && !$this->isInAllowedUserGroup($userId)) { return true; @@ -260,7 +260,7 @@ public function onContentPrepareForm(Form $form, $data): bool */ public function onUserAfterSave($data, bool $isNew, bool $result, ?string $error): void { - if (!is_array($data)) { + if (!\is_array($data)) { return; } @@ -468,7 +468,7 @@ private function getAllowedUserGroups(): array return []; } - if (!is_array($userGroups)) { + if (!\is_array($userGroups)) { $userGroups = [$userGroups]; } @@ -583,7 +583,7 @@ private function getAlgorithmFromFormFile(): string */ private function hasTokenProfileFields(?int $userId): bool { - if (is_null($userId) || ($userId <= 0)) { + if (\is_null($userId) || ($userId <= 0)) { return false; } diff --git a/plugins/webservices/banners/services/provider.php b/plugins/webservices/banners/services/provider.php index 3c07d5c4a7abb..105a7f634636e 100644 --- a/plugins/webservices/banners/services/provider.php +++ b/plugins/webservices/banners/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/config/services/provider.php b/plugins/webservices/config/services/provider.php index 0ba121418245d..51546c4846991 100644 --- a/plugins/webservices/config/services/provider.php +++ b/plugins/webservices/config/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/contact/services/provider.php b/plugins/webservices/contact/services/provider.php index 4d018a71320dd..387e2dd44ad49 100644 --- a/plugins/webservices/contact/services/provider.php +++ b/plugins/webservices/contact/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/content/services/provider.php b/plugins/webservices/content/services/provider.php index 875a1f81bcf48..88adc5ff3c9f2 100644 --- a/plugins/webservices/content/services/provider.php +++ b/plugins/webservices/content/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/installer/services/provider.php b/plugins/webservices/installer/services/provider.php index f987f23c72d80..0f25b85a9d701 100644 --- a/plugins/webservices/installer/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/languages/services/provider.php b/plugins/webservices/languages/services/provider.php index 9362ff782b9d3..e44589215c155 100644 --- a/plugins/webservices/languages/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/media/services/provider.php b/plugins/webservices/media/services/provider.php index 53149f5df4f34..93bf2800a84aa 100644 --- a/plugins/webservices/media/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/menus/services/provider.php b/plugins/webservices/menus/services/provider.php index 429e4b560d52e..a9d079e7b0dc5 100644 --- a/plugins/webservices/menus/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/messages/services/provider.php b/plugins/webservices/messages/services/provider.php index cc5a30c8b3e50..5e72c1095b008 100644 --- a/plugins/webservices/messages/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/modules/services/provider.php b/plugins/webservices/modules/services/provider.php index d46ee93f8981b..96de439c504d8 100644 --- a/plugins/webservices/modules/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/newsfeeds/services/provider.php b/plugins/webservices/newsfeeds/services/provider.php index f9882fc32fe95..3f9445f9c5e3a 100644 --- a/plugins/webservices/newsfeeds/services/provider.php +++ b/plugins/webservices/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/plugins/services/provider.php b/plugins/webservices/plugins/services/provider.php index ab32c66ad4590..48a4a2ecc8ddb 100644 --- a/plugins/webservices/plugins/services/provider.php +++ b/plugins/webservices/plugins/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/privacy/services/provider.php b/plugins/webservices/privacy/services/provider.php index cedac8b092839..9577bedafa89b 100644 --- a/plugins/webservices/privacy/services/provider.php +++ b/plugins/webservices/privacy/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/redirect/services/provider.php b/plugins/webservices/redirect/services/provider.php index 780c83d0b7d7b..efd5d4a1d2b01 100644 --- a/plugins/webservices/redirect/services/provider.php +++ b/plugins/webservices/redirect/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/tags/services/provider.php b/plugins/webservices/tags/services/provider.php index d5de8fa376c47..e126db661907e 100644 --- a/plugins/webservices/tags/services/provider.php +++ b/plugins/webservices/tags/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/templates/services/provider.php b/plugins/webservices/templates/services/provider.php index d863558a01a0a..1f1f9b32ef218 100644 --- a/plugins/webservices/templates/services/provider.php +++ b/plugins/webservices/templates/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/webservices/users/services/provider.php b/plugins/webservices/users/services/provider.php index 0b4f96112b720..9a94684d9a41c 100644 --- a/plugins/webservices/users/services/provider.php +++ b/plugins/webservices/users/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/workflow/featuring/services/provider.php b/plugins/workflow/featuring/services/provider.php index 418712f22b966..c5b3ef4ef9167 100644 --- a/plugins/workflow/featuring/services/provider.php +++ b/plugins/workflow/featuring/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/workflow/featuring/src/Extension/Featuring.php b/plugins/workflow/featuring/src/Extension/Featuring.php index 3b7f5d922d755..2ceab781e80a9 100644 --- a/plugins/workflow/featuring/src/Extension/Featuring.php +++ b/plugins/workflow/featuring/src/Extension/Featuring.php @@ -495,7 +495,7 @@ protected function isSupported($context) $parts = explode('.', $context); // We need at least the extension + view for loading the table fields - if (count($parts) < 2) { + if (\count($parts) < 2) { return false; } diff --git a/plugins/workflow/notification/services/provider.php b/plugins/workflow/notification/services/provider.php index 7aa7335324c97..172091cf85f62 100644 --- a/plugins/workflow/notification/services/provider.php +++ b/plugins/workflow/notification/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/workflow/notification/src/Extension/Notification.php b/plugins/workflow/notification/src/Extension/Notification.php index 1c10d1adea177..c6c38e03234cd 100644 --- a/plugins/workflow/notification/src/Extension/Notification.php +++ b/plugins/workflow/notification/src/Extension/Notification.php @@ -160,7 +160,7 @@ public function onWorkflowAfterTransition(WorkflowTransitionEvent $event) // Don't send the notification to the active user $key = array_search($user->id, $userIds); - if (is_int($key)) { + if (\is_int($key)) { unset($userIds[$key]); } @@ -302,7 +302,7 @@ protected function isSupported($context) $parts = explode('.', $context); // We need at least the extension + view for loading the table fields - if (count($parts) < 2) { + if (\count($parts) < 2) { return false; } diff --git a/plugins/workflow/publishing/services/provider.php b/plugins/workflow/publishing/services/provider.php index e210d89f79d6d..0f861d5950d93 100644 --- a/plugins/workflow/publishing/services/provider.php +++ b/plugins/workflow/publishing/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\Extension\PluginInterface; use Joomla\CMS\Factory; diff --git a/plugins/workflow/publishing/src/Extension/Publishing.php b/plugins/workflow/publishing/src/Extension/Publishing.php index e58d62635be03..954bc4f52eeb2 100644 --- a/plugins/workflow/publishing/src/Extension/Publishing.php +++ b/plugins/workflow/publishing/src/Extension/Publishing.php @@ -291,7 +291,7 @@ public function onWorkflowBeforeTransition(WorkflowTransitionEvent $event) // Release allowed pks, the job is done $this->getApplication()->set('plgWorkflowPublishing.' . $context, []); - if (in_array(false, $result, true)) { + if (\in_array(false, $result, true)) { $event->setStopTransition(); return false; @@ -500,7 +500,7 @@ protected function isSupported($context) $parts = explode('.', $context); // We need at least the extension + view for loading the table fields - if (count($parts) < 2) { + if (\count($parts) < 2) { return false; } diff --git a/templates/system/component.php b/templates/system/component.php index a5b26225bc0ce..201e943687d0a 100644 --- a/templates/system/component.php +++ b/templates/system/component.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; /** @var Joomla\CMS\Document\HtmlDocument $this */ diff --git a/templates/system/error.php b/templates/system/error.php index 03ebf7d72e783..cedc2669dd948 100644 --- a/templates/system/error.php +++ b/templates/system/error.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\Language\Text; use Joomla\CMS\Uri\Uri; diff --git a/templates/system/fatal.php b/templates/system/fatal.php index 92c640ff6fa69..6dfa1d167114a 100644 --- a/templates/system/fatal.php +++ b/templates/system/fatal.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 Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer; diff --git a/templates/system/index.php b/templates/system/index.php index a01b13c985a8c..b0fd6a9442d3a 100644 --- a/templates/system/index.php +++ b/templates/system/index.php @@ -8,6 +8,6 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -defined('_JEXEC') or die; +\defined('_JEXEC') or die; include __DIR__ . '/component.php'; diff --git a/templates/system/offline.php b/templates/system/offline.php index 87ea687533464..66d3b6826cd1e 100644 --- a/templates/system/offline.php +++ b/templates/system/offline.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\Factory; use Joomla\CMS\HTML\HTMLHelper; diff --git a/tests/Integration/DBTestHelper.php b/tests/Integration/DBTestHelper.php index 5ac553a24eeb5..57dfce0aaedac 100644 --- a/tests/Integration/DBTestHelper.php +++ b/tests/Integration/DBTestHelper.php @@ -63,14 +63,14 @@ public static function setupTest(IntegrationTestCase $test): void $files = $test->getSchemasToLoad(); foreach ($files as $file) { - if (in_array($file, self::$loadedFiles)) { + if (\in_array($file, self::$loadedFiles)) { continue; } $sql = file_get_contents(JPATH_ROOT . '/tests/Integration/datasets/' . strtolower(JTEST_DB_ENGINE) . '/' . $file); $queries = self::splitQueries($sql); - if (!count($queries)) { + if (!\count($queries)) { continue; } @@ -112,7 +112,7 @@ protected static function splitQueries($query) $query = $funct[0]; // Parse the schema file to break up queries. - for ($i = 0; $i < strlen($query) - 1; $i++) { + for ($i = 0; $i < \strlen($query) - 1; $i++) { if ($query[$i] == ';' && !$in_string) { $queries[] = substr($query, 0, $i); $query = substr($query, $i + 1); @@ -138,7 +138,7 @@ protected static function splitQueries($query) } // Add function part as is. - for ($f = 1, $fMax = count($funct); $f < $fMax; $f++) { + for ($f = 1, $fMax = \count($funct); $f < $fMax; $f++) { $queries[] = 'CREATE OR REPLACE FUNCTION ' . $funct[$f]; } diff --git a/tests/Unit/Libraries/Cms/Feed/FeedFactoryTest.php b/tests/Unit/Libraries/Cms/Feed/FeedFactoryTest.php index fdf85ea75b37b..53c3c3a2e2525 100644 --- a/tests/Unit/Libraries/Cms/Feed/FeedFactoryTest.php +++ b/tests/Unit/Libraries/Cms/Feed/FeedFactoryTest.php @@ -95,9 +95,9 @@ public function testRegisterParser() { $tagName = 'parser-mock'; $parseMock = $this->createMock(FeedParser::class); - $defaultParserCount = count($this->feedFactory->getParsers()); + $defaultParserCount = \count($this->feedFactory->getParsers()); - $this->feedFactory->registerParser($tagName, get_class($parseMock)); + $this->feedFactory->registerParser($tagName, \get_class($parseMock)); $feedParsers = $this->feedFactory->getParsers(); $this->assertCount($defaultParserCount + 1, $feedParsers); @@ -126,7 +126,7 @@ public function testRegisterParserWithInvalidTag() { $this->expectException(\InvalidArgumentException::class); $parseMock = $this->createMock(FeedParser::class); - $this->feedFactory->registerParser('42tag', get_class($parseMock)); + $this->feedFactory->registerParser('42tag', \get_class($parseMock)); } /** @@ -140,7 +140,7 @@ public function testFetchFeedParser() { $tagName = 'parser-mock'; $parseMock = $this->createMock(FeedParser::class); - $this->feedFactory->registerParser($tagName, get_class($parseMock)); + $this->feedFactory->registerParser($tagName, \get_class($parseMock)); // Use reflection to test private method $reflectionClass = new \ReflectionClass($this->feedFactory); @@ -149,7 +149,7 @@ public function testFetchFeedParser() $parser = $method->invoke($this->feedFactory, $tagName, new \XMLReader()); $this->assertInstanceOf(FeedParser::class, $parser); - $this->assertSame(get_class($parseMock), get_class($parser)); + $this->assertSame(\get_class($parseMock), \get_class($parser)); } /** diff --git a/tests/Unit/Libraries/Cms/Feed/Parser/RssParserTest.php b/tests/Unit/Libraries/Cms/Feed/Parser/RssParserTest.php index 6872a2bcd2874..9f553b9871ebf 100644 --- a/tests/Unit/Libraries/Cms/Feed/Parser/RssParserTest.php +++ b/tests/Unit/Libraries/Cms/Feed/Parser/RssParserTest.php @@ -88,7 +88,7 @@ public function testHandleCloud() 'cloud', $this->callback( function ($value) use ($cloud) { - return is_object($value) + return \is_object($value) && $value->domain === $cloud['domain'] && $value->port === $cloud['port'] && $value->path === $cloud['path'] diff --git a/tests/Unit/Libraries/Cms/Image/Filter/FilterBackgroundfillTest.php b/tests/Unit/Libraries/Cms/Image/Filter/FilterBackgroundfillTest.php index 186fbd104bc76..97992d4b25d19 100644 --- a/tests/Unit/Libraries/Cms/Image/Filter/FilterBackgroundfillTest.php +++ b/tests/Unit/Libraries/Cms/Image/Filter/FilterBackgroundfillTest.php @@ -30,7 +30,7 @@ protected function setup(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } } diff --git a/tests/Unit/Libraries/Cms/Image/Filter/FilterBrightnessTest.php b/tests/Unit/Libraries/Cms/Image/Filter/FilterBrightnessTest.php index 5c43d3077a62e..e5dab233818b3 100644 --- a/tests/Unit/Libraries/Cms/Image/Filter/FilterBrightnessTest.php +++ b/tests/Unit/Libraries/Cms/Image/Filter/FilterBrightnessTest.php @@ -29,7 +29,7 @@ protected function setup(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } } diff --git a/tests/Unit/Libraries/Cms/Image/Filter/FilterContrastTest.php b/tests/Unit/Libraries/Cms/Image/Filter/FilterContrastTest.php index e894070f3ff47..914b13be924f2 100644 --- a/tests/Unit/Libraries/Cms/Image/Filter/FilterContrastTest.php +++ b/tests/Unit/Libraries/Cms/Image/Filter/FilterContrastTest.php @@ -29,7 +29,7 @@ protected function setup(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } } diff --git a/tests/Unit/Libraries/Cms/Image/Filter/FilterEdgedetectTest.php b/tests/Unit/Libraries/Cms/Image/Filter/FilterEdgedetectTest.php index 577e2e1a51350..e4e3d960d1d08 100644 --- a/tests/Unit/Libraries/Cms/Image/Filter/FilterEdgedetectTest.php +++ b/tests/Unit/Libraries/Cms/Image/Filter/FilterEdgedetectTest.php @@ -29,7 +29,7 @@ protected function setup(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } } diff --git a/tests/Unit/Libraries/Cms/Image/ImageFilterTest.php b/tests/Unit/Libraries/Cms/Image/ImageFilterTest.php index 37ca99180563b..abe1b3ea65d20 100644 --- a/tests/Unit/Libraries/Cms/Image/ImageFilterTest.php +++ b/tests/Unit/Libraries/Cms/Image/ImageFilterTest.php @@ -30,7 +30,7 @@ protected function setUp(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } } diff --git a/tests/Unit/Libraries/Cms/Image/ImageTest.php b/tests/Unit/Libraries/Cms/Image/ImageTest.php index fb4b065817670..916d7b297830f 100644 --- a/tests/Unit/Libraries/Cms/Image/ImageTest.php +++ b/tests/Unit/Libraries/Cms/Image/ImageTest.php @@ -72,7 +72,7 @@ protected function setUp(): void parent::setUp(); // Verify that GD support for PHP is available. - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped('No GD support so skipping Image tests.'); } @@ -1073,13 +1073,13 @@ public function testCrop($startHeight, $startWidth, $cropHeight, $cropWidth, $cr $actualCropTop = $cropTop; - if (is_null($cropTop)) { + if (\is_null($cropTop)) { $cropTop = round(($startHeight - $cropHeight) / 2); } $actualCropLeft = $cropLeft; - if (is_null($cropLeft)) { + if (\is_null($cropLeft)) { $cropLeft = round(($startWidth - $cropWidth) / 2); } diff --git a/tests/Unit/Libraries/Cms/MVC/Controller/BaseControllerTest.php b/tests/Unit/Libraries/Cms/MVC/Controller/BaseControllerTest.php index 2f23a80263e85..98af821321650 100644 --- a/tests/Unit/Libraries/Cms/MVC/Controller/BaseControllerTest.php +++ b/tests/Unit/Libraries/Cms/MVC/Controller/BaseControllerTest.php @@ -424,7 +424,7 @@ public function getUser(): User */ public function testInjectViewPath() { - $path = dirname(__DIR__); + $path = \dirname(__DIR__); $controller = new class (['view_path' => $path, 'base_path' => __DIR__], $this->createStub(MVCFactoryInterface::class), $this->createStub(CMSApplicationInterface::class)) extends BaseController { public function getPaths() { diff --git a/tests/Unit/Libraries/Cms/Proxy/ProxyArrayTest.php b/tests/Unit/Libraries/Cms/Proxy/ProxyArrayTest.php index 4e653ecebc68d..2365162228bfb 100644 --- a/tests/Unit/Libraries/Cms/Proxy/ProxyArrayTest.php +++ b/tests/Unit/Libraries/Cms/Proxy/ProxyArrayTest.php @@ -67,7 +67,7 @@ public function testArrayCountable() $proxy = new ArrayProxy($data); - $this->assertEquals(count($proxy), 2, 'Countable implementation should count correctly'); + $this->assertEquals(\count($proxy), 2, 'Countable implementation should count correctly'); } /** diff --git a/tests/Unit/Libraries/Cms/Toolbar/ToolbarTest.php b/tests/Unit/Libraries/Cms/Toolbar/ToolbarTest.php index facfcefe405a4..8061b6ac2d363 100644 --- a/tests/Unit/Libraries/Cms/Toolbar/ToolbarTest.php +++ b/tests/Unit/Libraries/Cms/Toolbar/ToolbarTest.php @@ -79,7 +79,7 @@ public function testGetItemsReturnsArray() { $toolbar = $this->createToolbar(); - $this->assertTrue(is_array($toolbar->getItems())); + $this->assertTrue(\is_array($toolbar->getItems())); } /** @@ -254,7 +254,7 @@ public function testAddButtonPathWithArray() $toolbar = $this->createToolbar(); $initialValue = $toolbar->getButtonPath(); - $initialCount = count($initialValue); + $initialCount = \count($initialValue); $toolbar->addButtonPath(['MyTestPath1', 'MyTestPath2']); $newValue = $toolbar->getButtonPath(); @@ -278,7 +278,7 @@ public function testAddButtonPathWithString() $toolbar = $this->createToolbar(); $initialValue = $toolbar->getButtonPath(); - $initialCount = count($initialValue); + $initialCount = \count($initialValue); $toolbar->addButtonPath('MyTestPath'); $newValue = $toolbar->getButtonPath(); diff --git a/tests/Unit/bootstrap.php b/tests/Unit/bootstrap.php index 74bc974394c1f..c506928078569 100644 --- a/tests/Unit/bootstrap.php +++ b/tests/Unit/bootstrap.php @@ -12,7 +12,7 @@ // phpcs:disable PSR1.Files.SideEffects -define('_JEXEC', 1); +\define('_JEXEC', 1); // Maximise error reporting. error_reporting(E_ALL); @@ -27,63 +27,63 @@ */ $rootDirectory = getcwd(); -if (!defined('JPATH_BASE')) { - define('JPATH_BASE', $rootDirectory); +if (!\defined('JPATH_BASE')) { + \define('JPATH_BASE', $rootDirectory); } -if (!defined('JPATH_ROOT')) { - define('JPATH_ROOT', JPATH_BASE); +if (!\defined('JPATH_ROOT')) { + \define('JPATH_ROOT', JPATH_BASE); } /** * @deprecated 4.4.0 will be removed in 6.0 **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); +if (!\defined('JPATH_PLATFORM')) { + \define('JPATH_PLATFORM', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); } -if (!defined('JPATH_LIBRARIES')) { - define('JPATH_LIBRARIES', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); +if (!\defined('JPATH_LIBRARIES')) { + \define('JPATH_LIBRARIES', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); } -if (!defined('JPATH_CONFIGURATION')) { - define('JPATH_CONFIGURATION', JPATH_BASE); +if (!\defined('JPATH_CONFIGURATION')) { + \define('JPATH_CONFIGURATION', JPATH_BASE); } -if (!defined('JPATH_SITE')) { - define('JPATH_SITE', JPATH_ROOT); +if (!\defined('JPATH_SITE')) { + \define('JPATH_SITE', JPATH_ROOT); } -if (!defined('JPATH_ADMINISTRATOR')) { - define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); +if (!\defined('JPATH_ADMINISTRATOR')) { + \define('JPATH_ADMINISTRATOR', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); } -if (!defined('JPATH_CACHE')) { - define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); +if (!\defined('JPATH_CACHE')) { + \define('JPATH_CACHE', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'cache'); } -if (!defined('JPATH_API')) { - define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); +if (!\defined('JPATH_API')) { + \define('JPATH_API', JPATH_ROOT . DIRECTORY_SEPARATOR . 'api'); } -if (!defined('JPATH_INSTALLATION')) { - define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); +if (!\defined('JPATH_INSTALLATION')) { + \define('JPATH_INSTALLATION', JPATH_ROOT . DIRECTORY_SEPARATOR . 'installation'); } -if (!defined('JPATH_MANIFESTS')) { - define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); +if (!\defined('JPATH_MANIFESTS')) { + \define('JPATH_MANIFESTS', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'manifests'); } -if (!defined('JPATH_PLUGINS')) { - define('JPATH_PLUGINS', JPATH_BASE . DIRECTORY_SEPARATOR . 'plugins'); +if (!\defined('JPATH_PLUGINS')) { + \define('JPATH_PLUGINS', JPATH_BASE . DIRECTORY_SEPARATOR . 'plugins'); } -if (!defined('JPATH_THEMES')) { - define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); +if (!\defined('JPATH_THEMES')) { + \define('JPATH_THEMES', JPATH_BASE . DIRECTORY_SEPARATOR . 'templates'); } -if (!defined('JDEBUG')) { - define('JDEBUG', false); +if (!\defined('JDEBUG')) { + \define('JDEBUG', false); } // Import the library loader if necessary. @@ -117,4 +117,4 @@ class_exists('\\Joomla\\CMS\\Autoload\\ClassLoader'); $extensionPsr4Loader->load(); // Define the Joomla version if not already defined. -defined('JVERSION') or define('JVERSION', (new \Joomla\CMS\Version())->getShortVersion()); +\defined('JVERSION') or \define('JVERSION', (new \Joomla\CMS\Version())->getShortVersion());