diff --git a/libraries/src/Access/Access.php b/libraries/src/Access/Access.php index 2dbdf6669d209..3dc92b06a7dfd 100644 --- a/libraries/src/Access/Access.php +++ b/libraries/src/Access/Access.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Access; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; @@ -186,7 +186,7 @@ public static function preload($assetTypes = 'components', $reload = false) } // Check for default case: - $isDefault = is_string($assetTypes) && in_array($assetTypes, array('components', 'component')); + $isDefault = \is_string($assetTypes) && \in_array($assetTypes, array('components', 'component')); // Preload the rules for all of the components. if ($isDefault) @@ -197,7 +197,7 @@ public static function preload($assetTypes = 'components', $reload = false) } // If we get to this point, this is a regular asset type and we'll proceed with the preloading process. - if (!is_array($assetTypes)) + if (!\is_array($assetTypes)) { $assetTypes = (array) $assetTypes; } @@ -1028,7 +1028,7 @@ public static function getAuthorisedViewLevels($userId) break; } // Check to see if the group is mapped to the level. - elseif (($id >= 0) && in_array($id, $groups)) + elseif (($id >= 0) && \in_array($id, $groups)) { $authorised[] = $level; break; @@ -1078,13 +1078,13 @@ public static function getActionsFromFile($file, $xpath = "/access/section[@name public static function getActionsFromData($data, $xpath = "/access/section[@name='component']/") { // If the data to load isn't already an XML element or string return false. - if ((!($data instanceof \SimpleXMLElement)) && (!is_string($data))) + if ((!($data instanceof \SimpleXMLElement)) && (!\is_string($data))) { return false; } // Attempt to load the XML if a string. - if (is_string($data)) + if (\is_string($data)) { try { diff --git a/libraries/src/Access/Exception/AuthenticationFailed.php b/libraries/src/Access/Exception/AuthenticationFailed.php index 7d6fa9d5a4a15..402bb9519909e 100644 --- a/libraries/src/Access/Exception/AuthenticationFailed.php +++ b/libraries/src/Access/Exception/AuthenticationFailed.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Access\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception class defining an authentication failed event diff --git a/libraries/src/Access/Exception/NotAllowed.php b/libraries/src/Access/Exception/NotAllowed.php index 28e656ba6a700..d927fd0d79bcb 100644 --- a/libraries/src/Access/Exception/NotAllowed.php +++ b/libraries/src/Access/Exception/NotAllowed.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Access\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception class defining a not allowed access diff --git a/libraries/src/Access/Rule.php b/libraries/src/Access/Rule.php index 6a134a059aab5..5004df0db3e7e 100644 --- a/libraries/src/Access/Rule.php +++ b/libraries/src/Access/Rule.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Access; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Rule class. @@ -38,7 +38,7 @@ class Rule public function __construct($identities) { // Convert string input to an array. - if (is_string($identities)) + if (\is_string($identities)) { $identities = json_decode($identities, true); } @@ -74,7 +74,7 @@ public function mergeIdentities($identities) $identities = $identities->getData(); } - if (is_array($identities)) + if (\is_array($identities)) { foreach ($identities as $identity => $allow) { @@ -133,7 +133,7 @@ public function allow($identities) // Check that the inputs are valid. if (!empty($identities)) { - if (!is_array($identities)) + if (!\is_array($identities)) { $identities = array($identities); } diff --git a/libraries/src/Access/Rules.php b/libraries/src/Access/Rules.php index 575563141dab1..41d34bc9c77df 100644 --- a/libraries/src/Access/Rules.php +++ b/libraries/src/Access/Rules.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Access; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Object\CMSObject; @@ -40,16 +40,16 @@ class Rules public function __construct($input = '') { // Convert in input to an array. - if (is_string($input)) + if (\is_string($input)) { $input = json_decode($input, true); } - elseif (is_object($input)) + elseif (\is_object($input)) { $input = (array) $input; } - if (is_array($input)) + if (\is_array($input)) { // Top level keys represent the actions. foreach ($input as $action => $identities) @@ -83,7 +83,7 @@ public function getData() public function mergeCollection($input) { // Check if the input is an array. - if (is_array($input)) + if (\is_array($input)) { foreach ($input as $actions) { @@ -103,12 +103,12 @@ public function mergeCollection($input) */ public function merge($actions) { - if (is_string($actions)) + if (\is_string($actions)) { $actions = json_decode($actions, true); } - if (is_array($actions)) + if (\is_array($actions)) { foreach ($actions as $action => $identities) { diff --git a/libraries/src/Application/AdministratorApplication.php b/libraries/src/Application/AdministratorApplication.php index f2d4eeaf5d119..5e805fbe6f481 100644 --- a/libraries/src/Application/AdministratorApplication.php +++ b/libraries/src/Application/AdministratorApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\Web\WebClient; use Joomla\CMS\Component\ComponentHelper; @@ -58,7 +58,7 @@ public function __construct(Input $input = null, Registry $config = null, WebCli parent::__construct($input, $config, $client, $container); // Set the root in the URI based on the application name - Uri::root(null, rtrim(dirname(Uri::base(true)), '/\\')); + Uri::root(null, rtrim(\dirname(Uri::base(true)), '/\\')); } /** @@ -189,7 +189,7 @@ public static function getRouter($name = 'administrator', array $options = array */ public function getTemplate($params = false) { - if (is_object($this->template)) + if (\is_object($this->template)) { if ($params) { @@ -320,7 +320,7 @@ public function login($credentials, $options = array()) $options['autoregister'] = false; // Set the application login entry point - if (!array_key_exists('entry_url', $options)) + if (!\array_key_exists('entry_url', $options)) { $options['entry_url'] = Uri::base() . 'index.php?option=com_users&task=login'; } @@ -368,7 +368,7 @@ public static function purgeMessages() $config = $db->loadObject(); // Check if auto_purge value set - if (is_object($config) && $config->cfg_name === 'auto_purge') + if (\is_object($config) && $config->cfg_name === 'auto_purge') { $purge = $config->cfg_value; } diff --git a/libraries/src/Application/ApiApplication.php b/libraries/src/Application/ApiApplication.php index d801772aaeaa9..6897e75953402 100644 --- a/libraries/src/Application/ApiApplication.php +++ b/libraries/src/Application/ApiApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\Web\WebClient; use Joomla\CMS\Access\Exception\AuthenticationFailed; @@ -125,7 +125,7 @@ protected function doExecute() */ public function addFormatMap($contentHeader, $format) { - if (!array_key_exists($contentHeader, $this->formatMapper)) + if (!\array_key_exists($contentHeader, $this->formatMapper)) { $this->formatMapper[$contentHeader] = $format; } @@ -162,7 +162,7 @@ protected function respond($options = array()) // Set the Joomla! API signature $this->setHeader('X-Powered-By', 'JoomlaAPI/1.0', true); - if (array_key_exists('cors', $options)) + if (\array_key_exists('cors', $options)) { // Enable CORS (Cross-origin resource sharing) $this->setHeader('Access-Control-Allow-Origin', '*', true); @@ -225,7 +225,7 @@ protected function route() */ $priorities = array('application/vnd.api+json'); - if (!$caught404 && array_key_exists('format', $route['vars'])) + if (!$caught404 && \array_key_exists('format', $route['vars'])) { $priorities = $route['vars']['format']; } @@ -250,7 +250,7 @@ protected function route() /** @var $mediaType Accept */ $format = $mediaType->getValue(); - if (array_key_exists($mediaType->getValue(), $this->formatMapper)) + if (\array_key_exists($mediaType->getValue(), $this->formatMapper)) { $format = $this->formatMapper[$mediaType->getValue()]; } diff --git a/libraries/src/Application/ApplicationHelper.php b/libraries/src/Application/ApplicationHelper.php index 879bde7159fc1..dbc6d38d903dd 100644 --- a/libraries/src/Application/ApplicationHelper.php +++ b/libraries/src/Application/ApplicationHelper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; @@ -197,12 +197,12 @@ public static function getClientInfo($id = null, $byName = false) */ public static function addClientInfo($client) { - if (is_array($client)) + if (\is_array($client)) { $client = (object) $client; } - if (!is_object($client)) + if (!\is_object($client)) { return false; } @@ -211,7 +211,7 @@ public static function addClientInfo($client) if (!isset($client->id)) { - $client->id = count($info); + $client->id = \count($info); } self::$_clients[$client->id] = clone $client; diff --git a/libraries/src/Application/BaseApplication.php b/libraries/src/Application/BaseApplication.php index 38ec28db1cee3..72d22ec8c8cf9 100644 --- a/libraries/src/Application/BaseApplication.php +++ b/libraries/src/Application/BaseApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\AbstractApplication; use Joomla\CMS\Input\Input; diff --git a/libraries/src/Application/CLI/CliInput.php b/libraries/src/Application/CLI/CliInput.php index 942e28c780592..b6e3c69c0f64f 100644 --- a/libraries/src/Application/CLI/CliInput.php +++ b/libraries/src/Application/CLI/CliInput.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Class CliInput diff --git a/libraries/src/Application/CLI/CliOutput.php b/libraries/src/Application/CLI/CliOutput.php index 80da0343bcb99..aed0527c9a122 100644 --- a/libraries/src/Application/CLI/CliOutput.php +++ b/libraries/src/Application/CLI/CliOutput.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CLI\Output\Processor\ProcessorInterface; diff --git a/libraries/src/Application/CLI/ColorStyle.php b/libraries/src/Application/CLI/ColorStyle.php index 5f98fbad6afc6..a246ae6bdbfd5 100644 --- a/libraries/src/Application/CLI/ColorStyle.php +++ b/libraries/src/Application/CLI/ColorStyle.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Class defining ANSI-color styles for command line output @@ -102,7 +102,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ { if ($fg) { - if (array_key_exists($fg, static::$knownColors) == false) + if (\array_key_exists($fg, static::$knownColors) == false) { throw new \InvalidArgumentException( sprintf( @@ -118,7 +118,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ if ($bg) { - if (array_key_exists($bg, static::$knownColors) == false) + if (\array_key_exists($bg, static::$knownColors) == false) { throw new \InvalidArgumentException( sprintf( @@ -134,7 +134,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ foreach ($options as $option) { - if (array_key_exists($option, static::$knownOptions) == false) + if (\array_key_exists($option, static::$knownOptions) == false) { throw new \InvalidArgumentException( sprintf( diff --git a/libraries/src/Application/CLI/Output/Processor/ColorProcessor.php b/libraries/src/Application/CLI/Output/Processor/ColorProcessor.php index ff399a16c4038..955b902cb04c7 100644 --- a/libraries/src/Application/CLI/Output/Processor/ColorProcessor.php +++ b/libraries/src/Application/CLI/Output/Processor/ColorProcessor.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI\Output\Processor; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CLI\ColorStyle; @@ -126,7 +126,7 @@ public function process($string) foreach ($matches[0] as $i => $m) { - if (array_key_exists($matches[1][$i], $this->styles)) + if (\array_key_exists($matches[1][$i], $this->styles)) { $string = $this->replaceColors($string, $matches[1][$i], $matches[2][$i], $this->styles[$matches[1][$i]]); } diff --git a/libraries/src/Application/CLI/Output/Processor/ProcessorInterface.php b/libraries/src/Application/CLI/Output/Processor/ProcessorInterface.php index 9093fc654e712..419ee4c9f7db1 100644 --- a/libraries/src/Application/CLI/Output/Processor/ProcessorInterface.php +++ b/libraries/src/Application/CLI/Output/Processor/ProcessorInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI\Output\Processor; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Interface for a command line output processor diff --git a/libraries/src/Application/CLI/Output/Stdout.php b/libraries/src/Application/CLI/Output/Stdout.php index 3bd86d97f63c8..95a3d9de57fc3 100644 --- a/libraries/src/Application/CLI/Output/Stdout.php +++ b/libraries/src/Application/CLI/Output/Stdout.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI\Output; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CLI\CliOutput; diff --git a/libraries/src/Application/CLI/Output/Xml.php b/libraries/src/Application/CLI/Output/Xml.php index 40d1063065bc7..126ca3ab9f00f 100644 --- a/libraries/src/Application/CLI/Output/Xml.php +++ b/libraries/src/Application/CLI/Output/Xml.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\CLI\Output; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CLI\CliOutput; diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 0b34119fe57b2..757dd13f1db00 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\Web\WebClient; use Joomla\CMS\Authentication\Authentication; @@ -149,7 +149,7 @@ public function __construct(Input $input = null, Registry $config = null, WebCli parent::__construct($input, $config, $client); // If JDEBUG is defined, load the profiler instance - if (defined('JDEBUG') && JDEBUG) + if (\defined('JDEBUG') && JDEBUG) { $this->profiler = Profiler::getInstance('Application'); } @@ -206,7 +206,7 @@ public function enqueueMessage($msg, $type = self::MSG_INFO) $message = array('message' => $msg, 'type' => strtolower($type)); - if (!in_array($message, $this->messageQueue)) + if (!\in_array($message, $this->messageQueue)) { // Enqueue the message. $this->messageQueue[] = $message; @@ -465,7 +465,7 @@ public function getMenu($name = null, $options = array()) public function getMessageQueue($clear = false) { // For empty queue, if messages exists in the session, enqueue them. - if (!count($this->messageQueue)) + if (!\count($this->messageQueue)) { $sessionQueue = $this->getSession()->get('application.queue', []); @@ -816,7 +816,7 @@ public function login($credentials, $options = array()) $user->set('cookieLogin', true); } - if (in_array(false, $results, true) == false) + if (\in_array(false, $results, true) == false) { $options['user'] = $user; $options['responseType'] = $response->type; @@ -885,7 +885,7 @@ public function logout($userid = null, $options = array()) $results = $this->triggerEvent('onUserLogout', array($parameters, $options)); // Check if any of the plugins failed. If none did, success. - if (!in_array(false, $results, true)) + if (!\in_array(false, $results, true)) { $options['username'] = $user->get('username'); $this->triggerEvent('onUserAfterLogout', array($options)); @@ -916,7 +916,7 @@ public function logout($userid = null, $options = array()) public function redirect($url, $status = 303) { // Persist messages if they exist. - if (count($this->messageQueue)) + if (\count($this->messageQueue)) { $this->getSession()->set('application.queue', $this->messageQueue); } @@ -949,7 +949,7 @@ protected function render() // Fall back to constants. else { - $this->docOptions['directory'] = defined('JPATH_THEMES') ? JPATH_THEMES : (defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; + $this->docOptions['directory'] = \defined('JPATH_THEMES') ? JPATH_THEMES : (\defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; } // Parse the document. @@ -1004,7 +1004,7 @@ protected function route() if ($active !== null && $active->type === 'alias' && $active->params->get('alias_redirect') - && in_array($this->input->getMethod(), array('GET', 'HEAD'), true)) + && \in_array($this->input->getMethod(), array('GET', 'HEAD'), true)) { $item = $this->getMenu()->getItem($active->params->get('aliasoptions')); @@ -1018,14 +1018,14 @@ protected function route() } $base = Uri::base(true); - $oldPath = StringHelper::strtolower(substr($oldUri->getPath(), strlen($base) + 1)); + $oldPath = StringHelper::strtolower(substr($oldUri->getPath(), \strlen($base) + 1)); $activePathPrefix = StringHelper::strtolower($active->route); $position = strpos($oldPath, $activePathPrefix); if ($position !== false) { - $oldUri->setPath($base . '/' . substr_replace($oldPath, $item->route, $position, strlen($activePathPrefix))); + $oldUri->setPath($base . '/' . substr_replace($oldPath, $item->route, $position, \strlen($activePathPrefix))); $this->setHeader('Expires', 'Wed, 17 Aug 2005 00:00:00 GMT', true); $this->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true); diff --git a/libraries/src/Application/CliApplication.php b/libraries/src/Application/CliApplication.php index 74d3eaa5bbe0b..1a1bde534793f 100644 --- a/libraries/src/Application/CliApplication.php +++ b/libraries/src/Application/CliApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\AbstractApplication; use Joomla\CMS\Application\CLI\CliInput; @@ -85,7 +85,7 @@ public function __construct(Input $input = null, Registry $config = null, CliOut ) { // Close the application if we are not executed from the command line. - if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv'])) + if (!\defined('STDOUT') || !\defined('STDIN') || !isset($_SERVER['argv'])) { $this->close(); } @@ -243,7 +243,7 @@ public function setOutput(CliOutput $output) */ 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/ConsoleApplication.php b/libraries/src/Application/ConsoleApplication.php index 7b734f4c0fd9a..5d2984c82444b 100644 --- a/libraries/src/Application/ConsoleApplication.php +++ b/libraries/src/Application/ConsoleApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Console; use Joomla\CMS\Extension\ExtensionManagerTrait; diff --git a/libraries/src/Application/DaemonApplication.php b/libraries/src/Application/DaemonApplication.php index 0cc228402f257..5498a1e58e4bb 100644 --- a/libraries/src/Application/DaemonApplication.php +++ b/libraries/src/Application/DaemonApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Event\BeforeExecuteEvent; use Joomla\CMS\Filesystem\Folder; @@ -114,14 +114,14 @@ abstract class DaemonApplication extends CliApplication public function __construct(Cli $input = null, Registry $config = null, DispatcherInterface $dispatcher = null) { // Verify that the process control extension for PHP is available. - if (!defined('SIGHUP')) + if (!\defined('SIGHUP')) { Log::add('The PCNTL extension for PHP is not available.', Log::ERROR); throw new \RuntimeException('The PCNTL extension for PHP is not available.'); } // Verify that POSIX support for PHP is available. - if (!function_exists('posix_getpid')) + if (!\function_exists('posix_getpid')) { Log::add('The POSIX extension for PHP is not available.', Log::ERROR); throw new \RuntimeException('The POSIX extension for PHP is not available.'); @@ -277,7 +277,7 @@ public function loadConfiguration($data) // The application author name. This string is used in generating startup scripts and has // a maximum of 50 characters. $tmp = (string) $this->config->get('author_name', 'Joomla Platform'); - $this->config->set('author_name', (strlen($tmp) > 50) ? substr($tmp, 0, 50) : $tmp); + $this->config->set('author_name', (\strlen($tmp) > 50) ? substr($tmp, 0, 50) : $tmp); // The application author email. This string is used in generating startup scripts. $tmp = (string) $this->config->get('author_email', 'admin@joomla.org'); @@ -301,7 +301,7 @@ public function loadConfiguration($data) $this->config->set('application_executable', $tmp); // The home directory of the daemon. - $tmp = (string) $this->config->get('application_directory', dirname($this->input->executable)); + $tmp = (string) $this->config->get('application_directory', \dirname($this->input->executable)); $this->config->set('application_directory', $tmp); // The pid file location. This defaults to a path inside the /tmp directory. @@ -696,18 +696,18 @@ protected function setupSignalHandlers() foreach (self::$signals as $signal) { // Ignore signals that are not defined. - if (!defined($signal) || !is_int(constant($signal)) || (constant($signal) === 0)) + if (!\defined($signal) || !\is_int(\constant($signal)) || (\constant($signal) === 0)) { // Define the signal to avoid notices. Log::add('Signal "' . $signal . '" not defined. Defining it as null.', Log::DEBUG); - define($signal, null); + \define($signal, null); // Don't listen for signal. continue; } // Attach the signal handler for the signal. - if (!$this->pcntlSignal(constant($signal), array('DaemonApplication', 'signal'))) + if (!$this->pcntlSignal(\constant($signal), array('DaemonApplication', 'signal'))) { Log::add(sprintf('Unable to reroute signal handler: %s', $signal), Log::EMERGENCY); @@ -801,7 +801,7 @@ protected function writeProcessIdFile() } // Make sure that the folder where we are writing the process id file exists. - $folder = dirname($file); + $folder = \dirname($file); if (!is_dir($folder) && !Folder::create($folder)) { diff --git a/libraries/src/Application/EventAware.php b/libraries/src/Application/EventAware.php index dddd102e4f1d3..3fc94c936a978 100644 --- a/libraries/src/Application/EventAware.php +++ b/libraries/src/Application/EventAware.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Event\DispatcherInterface; use Joomla\Event\Event; @@ -90,7 +90,7 @@ public function triggerEvent($eventName, $args = []) } catch (\UnexpectedValueException $exception) { - $this->getLogger()->error(sprintf('Dispatcher not set in %s, cannot trigger events.', get_class($this))); + $this->getLogger()->error(sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this))); return []; } @@ -99,7 +99,7 @@ public function triggerEvent($eventName, $args = []) { $event = $args; } - elseif (is_array($args)) + elseif (\is_array($args)) { $event = new Event($eventName, $args); } @@ -111,6 +111,6 @@ public function triggerEvent($eventName, $args = []) $result = $dispatcher->dispatch($eventName, $event); // TODO - There are still test cases where the result isn't defined, temporarily leave the isset check in place - return !isset($result['result']) || is_null($result['result']) ? [] : $result['result']; + return !isset($result['result']) || \is_null($result['result']) ? [] : $result['result']; } } diff --git a/libraries/src/Application/Exception/NotAcceptable.php b/libraries/src/Application/Exception/NotAcceptable.php index fdb13c14ea1f7..14da7ed2c489e 100644 --- a/libraries/src/Application/Exception/NotAcceptable.php +++ b/libraries/src/Application/Exception/NotAcceptable.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception class defining a not acceptable class diff --git a/libraries/src/Application/ExtensionNamespaceMapper.php b/libraries/src/Application/ExtensionNamespaceMapper.php index 72e3d57f22756..49f9c8927a1ec 100644 --- a/libraries/src/Application/ExtensionNamespaceMapper.php +++ b/libraries/src/Application/ExtensionNamespaceMapper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use JLoader; diff --git a/libraries/src/Application/IdentityAware.php b/libraries/src/Application/IdentityAware.php index 7281b5833e348..823ed92caf21c 100644 --- a/libraries/src/Application/IdentityAware.php +++ b/libraries/src/Application/IdentityAware.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\User\User; use Joomla\CMS\User\UserFactoryInterface; diff --git a/libraries/src/Application/SiteApplication.php b/libraries/src/Application/SiteApplication.php index 6a7298ca8194e..e34a27d903d60 100644 --- a/libraries/src/Application/SiteApplication.php +++ b/libraries/src/Application/SiteApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\Web\WebClient; use Joomla\CMS\Cache\CacheControllerFactoryInterface; @@ -328,7 +328,7 @@ public function getParams($option = null) $temp = clone ComponentHelper::getParams('com_menus'); // Lets cascade the parameters if we have menu item parameters - if (is_object($menu)) + if (\is_object($menu)) { // Get show_page_heading from com_menu global settings $params[$hash]->def('show_page_heading', $temp->get('show_page_heading')); @@ -396,7 +396,7 @@ public static function getRouter($name = 'site', array $options = array()) */ public function getTemplate($params = false) { - if (is_object($this->template)) + if (\is_object($this->template)) { if (!file_exists(JPATH_THEMES . '/' . $this->template->template . '/index.php')) { @@ -422,7 +422,7 @@ public function getTemplate($params = false) $id = 0; - if (is_object($item)) + if (\is_object($item)) { // Valid item retrieved $id = $item->template_style_id; @@ -682,7 +682,7 @@ protected function loadLibraryLanguage() public function login($credentials, $options = array()) { // Set the application login entry point - if (!array_key_exists('entry_url', $options)) + if (!\array_key_exists('entry_url', $options)) { $options['entry_url'] = Uri::base() . 'index.php?option=com_users&task=user.login'; } diff --git a/libraries/src/Application/WebApplication.php b/libraries/src/Application/WebApplication.php index 3d433e7d3763b..d63a0a2f3eec5 100644 --- a/libraries/src/Application/WebApplication.php +++ b/libraries/src/Application/WebApplication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Application; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\AbstractWebApplication; use Joomla\Application\Web\WebClient; @@ -198,7 +198,7 @@ protected function render() // Fall back to constants. else { - $options['directory'] = defined('JPATH_THEMES') ? JPATH_THEMES : (defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; + $options['directory'] = \defined('JPATH_THEMES') ? JPATH_THEMES : (\defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; } // Parse the document. @@ -374,12 +374,12 @@ protected function loadSystemUris($requestUri = null) if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI'])) { // We aren't expecting PATH_INFO within PHP_SELF so this should work. - $path = dirname($_SERVER['PHP_SELF']); + $path = \dirname($_SERVER['PHP_SELF']); } // Pretty much everything else should be handled with SCRIPT_NAME. else { - $path = dirname($_SERVER['SCRIPT_NAME']); + $path = \dirname($_SERVER['SCRIPT_NAME']); } } @@ -402,7 +402,7 @@ protected function loadSystemUris($requestUri = null) // Set the extended (non-base) part of the request URI as the route. if (stripos($this->get('uri.request'), $this->get('uri.base.full')) === 0) { - $this->set('uri.route', substr_replace($this->get('uri.request'), '', 0, strlen($this->get('uri.base.full')))); + $this->set('uri.route', substr_replace($this->get('uri.request'), '', 0, \strlen($this->get('uri.base.full')))); } // Get an explicitly set media URI is present. diff --git a/libraries/src/Association/AssociationExtensionHelper.php b/libraries/src/Association/AssociationExtensionHelper.php index 95b706c25df56..7330a83bacfa9 100644 --- a/libraries/src/Association/AssociationExtensionHelper.php +++ b/libraries/src/Association/AssociationExtensionHelper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Association; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Utilities\ArrayHelper; @@ -189,7 +189,7 @@ public function getTypeTitle($typeName) { $type = $this->getType($typeName); - if (!array_key_exists('title', $type)) + if (!\array_key_exists('title', $type)) { return ''; } @@ -211,7 +211,7 @@ private function getTypeInformation($typeName, $part = 'support') { $type = $this->getType($typeName); - if (!array_key_exists($part, $type)) + if (!\array_key_exists($part, $type)) { return array(); } @@ -233,7 +233,7 @@ public function getTypeFieldName($typeName, $fieldName) { $fields = $this->getTypeFields($typeName); - if (!array_key_exists($fieldName, $fields)) + if (!\array_key_exists($fieldName, $fields)) { return ''; } diff --git a/libraries/src/Association/AssociationExtensionInterface.php b/libraries/src/Association/AssociationExtensionInterface.php index 33802a0bbcc2b..6f935750aa1f8 100644 --- a/libraries/src/Association/AssociationExtensionInterface.php +++ b/libraries/src/Association/AssociationExtensionInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Association; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Association Extension Interface for the helper classes diff --git a/libraries/src/Association/AssociationServiceInterface.php b/libraries/src/Association/AssociationServiceInterface.php index b6b2b863dedfd..d4b932381d0c4 100644 --- a/libraries/src/Association/AssociationServiceInterface.php +++ b/libraries/src/Association/AssociationServiceInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Association; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * The association service. diff --git a/libraries/src/Association/AssociationServiceTrait.php b/libraries/src/Association/AssociationServiceTrait.php index 70e79ef5979cc..fd821a54717a2 100644 --- a/libraries/src/Association/AssociationServiceTrait.php +++ b/libraries/src/Association/AssociationServiceTrait.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Association; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Trait to implement AssociationServiceInterface diff --git a/libraries/src/Authentication/Authentication.php b/libraries/src/Authentication/Authentication.php index aca42d78db98c..9ee4f9fe6929f 100644 --- a/libraries/src/Authentication/Authentication.php +++ b/libraries/src/Authentication/Authentication.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; @@ -99,7 +99,7 @@ class Authentication public function __construct(string $pluginType = 'authentication', DispatcherInterface $dispatcher = null) { // Set the dispatcher - if (!is_object($dispatcher)) + if (!\is_object($dispatcher)) { $dispatcher = Factory::getContainer()->get('dispatcher'); } diff --git a/libraries/src/Authentication/AuthenticationResponse.php b/libraries/src/Authentication/AuthenticationResponse.php index 8ef3a04ab9153..14b71ee40c7fd 100644 --- a/libraries/src/Authentication/AuthenticationResponse.php +++ b/libraries/src/Authentication/AuthenticationResponse.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Authentication response class, provides an object for storing user and error details diff --git a/libraries/src/Authentication/Password/Argon2iHandler.php b/libraries/src/Authentication/Password/Argon2iHandler.php index c27bced5d4ca6..a03d188d142b1 100644 --- a/libraries/src/Authentication/Password/Argon2iHandler.php +++ b/libraries/src/Authentication/Password/Argon2iHandler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\Argon2iHandler as BaseArgon2iHandler; diff --git a/libraries/src/Authentication/Password/Argon2idHandler.php b/libraries/src/Authentication/Password/Argon2idHandler.php index f3fe2df21dfc6..a104b04c2590d 100644 --- a/libraries/src/Authentication/Password/Argon2idHandler.php +++ b/libraries/src/Authentication/Password/Argon2idHandler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\Argon2idHandler as BaseArgon2idHandler; diff --git a/libraries/src/Authentication/Password/BCryptHandler.php b/libraries/src/Authentication/Password/BCryptHandler.php index eae75813aa9ef..8e81294b3f044 100644 --- a/libraries/src/Authentication/Password/BCryptHandler.php +++ b/libraries/src/Authentication/Password/BCryptHandler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\BCryptHandler as BaseBCryptHandler; diff --git a/libraries/src/Authentication/Password/ChainedHandler.php b/libraries/src/Authentication/Password/ChainedHandler.php index 38a3941f7d028..85606e8a7eafa 100644 --- a/libraries/src/Authentication/Password/ChainedHandler.php +++ b/libraries/src/Authentication/Password/ChainedHandler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\HandlerInterface; diff --git a/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php b/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php index 3e0219bd2ef14..edab3c59a95ea 100644 --- a/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php +++ b/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Interface for a password handler which supports checking if the password requires rehashing diff --git a/libraries/src/Authentication/Password/MD5Handler.php b/libraries/src/Authentication/Password/MD5Handler.php index b036f5c606b27..b2fd674ba5ea6 100644 --- a/libraries/src/Authentication/Password/MD5Handler.php +++ b/libraries/src/Authentication/Password/MD5Handler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\HandlerInterface; use Joomla\CMS\Crypt\Crypt; diff --git a/libraries/src/Authentication/Password/PHPassHandler.php b/libraries/src/Authentication/Password/PHPassHandler.php index 273cff54c8934..a09ff9f8d5389 100644 --- a/libraries/src/Authentication/Password/PHPassHandler.php +++ b/libraries/src/Authentication/Password/PHPassHandler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\HandlerInterface; diff --git a/libraries/src/Authentication/Password/SHA256Handler.php b/libraries/src/Authentication/Password/SHA256Handler.php index af3704dc9575a..23217a206c83e 100644 --- a/libraries/src/Authentication/Password/SHA256Handler.php +++ b/libraries/src/Authentication/Password/SHA256Handler.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Authentication\Password; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Authentication\Password\HandlerInterface; use Joomla\CMS\Crypt\Crypt; diff --git a/libraries/src/Autoload/ClassLoader.php b/libraries/src/Autoload/ClassLoader.php index d7885bfb4da49..bb2821164e71c 100644 --- a/libraries/src/Autoload/ClassLoader.php +++ b/libraries/src/Autoload/ClassLoader.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Autoload; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Composer\Autoload\ClassLoader as ComposerClassLoader; diff --git a/libraries/src/Cache/Cache.php b/libraries/src/Cache/Cache.php index 7d672fcb0422d..bb04f42e2d9dc 100644 --- a/libraries/src/Cache/Cache.php +++ b/libraries/src/Cache/Cache.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Application\Web\WebClient; use Joomla\CMS\Cache\Exception\CacheExceptionInterface; @@ -548,7 +548,7 @@ public static function getWorkarounds($data, $options = array()) } // If the pathway buffer is set in the cache data, get it. - if (isset($data['pathway']) && is_array($data['pathway'])) + if (isset($data['pathway']) && \is_array($data['pathway'])) { // Push the pathway data into the pathway object. $app->getPathway()->setPathway($data['pathway']); @@ -556,7 +556,7 @@ public static function getWorkarounds($data, $options = array()) // @todo check if the following is needed, seems like it should be in page cache // If a module buffer is set in the cache data, get it. - if (isset($data['module']) && is_array($data['module'])) + if (isset($data['module']) && \is_array($data['module'])) { // Iterate through the module positions and push them into the document buffer. foreach ($data['module'] as $name => $contents) @@ -636,13 +636,13 @@ public static function setWorkarounds($data, $options = array()) // Get the modules buffer before component execution. $buffer1 = $document->getBuffer(); - if (!is_array($buffer1)) + if (!\is_array($buffer1)) { $buffer1 = array(); } // Make sure the module buffer is an array. - if (!isset($buffer1['module']) || !is_array($buffer1['module'])) + if (!isset($buffer1['module']) || !\is_array($buffer1['module'])) { $buffer1['module'] = array(); } @@ -680,7 +680,7 @@ public static function setWorkarounds($data, $options = array()) $newvalue = array_map('unserialize', $newvalue); // Special treatment for script and style declarations. - if (($now == 'script' || $now == 'style') && is_array($newvalue) && is_array($options['headerbefore'][$now])) + if (($now == 'script' || $now == 'style') && \is_array($newvalue) && \is_array($options['headerbefore'][$now])) { foreach ($newvalue as $type => $currentScriptStr) { @@ -720,7 +720,7 @@ public static function setWorkarounds($data, $options = array()) // Pathway data if ($app->isClient('site') && $loptions['nopathway'] != 1) { - $cached['pathway'] = is_array($data) && isset($data['pathway']) ? $data['pathway'] : $app->getPathway()->getPathway(); + $cached['pathway'] = \is_array($data) && isset($data['pathway']) ? $data['pathway'] : $app->getPathway()->getPathway(); } if ($loptions['nomodules'] != 1) @@ -729,13 +729,13 @@ public static function setWorkarounds($data, $options = array()) // Get the module buffer after component execution. $buffer2 = $document->getBuffer(); - if (!is_array($buffer2)) + if (!\is_array($buffer2)) { $buffer2 = array(); } // Make sure the module buffer is an array. - if (!isset($buffer2['module']) || !is_array($buffer2['module'])) + if (!isset($buffer2['module']) || !\is_array($buffer2['module'])) { $buffer2['module'] = array(); } @@ -844,7 +844,7 @@ public static function addIncludePath($path = '') $paths = array(); } - if (!empty($path) && !in_array($path, $paths)) + if (!empty($path) && !\in_array($path, $paths)) { array_unshift($paths, Path::clean($path)); } diff --git a/libraries/src/Cache/CacheController.php b/libraries/src/Cache/CacheController.php index 4abe45af7ad1f..bfa0e67e129cd 100644 --- a/libraries/src/Cache/CacheController.php +++ b/libraries/src/Cache/CacheController.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\Path; @@ -71,7 +71,7 @@ public function __construct($options) */ public function __call($name, $arguments) { - return call_user_func_array(array($this->cache, $name), $arguments); + return \call_user_func_array(array($this->cache, $name), $arguments); } /** @@ -152,7 +152,7 @@ public static function addIncludePath($path = '') $paths = array(); } - if (!empty($path) && !in_array($path, $paths)) + if (!empty($path) && !\in_array($path, $paths)) { // Only trigger a deprecation notice when adding a lookup path @trigger_error( diff --git a/libraries/src/Cache/CacheControllerFactory.php b/libraries/src/Cache/CacheControllerFactory.php index 133c7013f37aa..b215984a8bee8 100644 --- a/libraries/src/Cache/CacheControllerFactory.php +++ b/libraries/src/Cache/CacheControllerFactory.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; /** * Default factory for creating CacheController objects diff --git a/libraries/src/Cache/CacheControllerFactoryInterface.php b/libraries/src/Cache/CacheControllerFactoryInterface.php index 2118dcebf7196..4dd7ba0c939cb 100644 --- a/libraries/src/Cache/CacheControllerFactoryInterface.php +++ b/libraries/src/Cache/CacheControllerFactoryInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; /** * Interface defining a factory which can create CacheController objects diff --git a/libraries/src/Cache/CacheStorage.php b/libraries/src/Cache/CacheStorage.php index 94eb1d16ab88a..539b77ab9dbf3 100644 --- a/libraries/src/Cache/CacheStorage.php +++ b/libraries/src/Cache/CacheStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\Exception\UnsupportedCacheException; use Joomla\CMS\Factory; @@ -135,7 +135,7 @@ public static function getInstance($handler = null, $options = array()) } } - if (is_null($now)) + if (\is_null($now)) { $now = time(); } @@ -376,7 +376,7 @@ public static function addIncludePath($path = '') $paths = array(); } - if (!empty($path) && !in_array($path, $paths)) + if (!empty($path) && !\in_array($path, $paths)) { array_unshift($paths, Path::clean($path)); } diff --git a/libraries/src/Cache/Controller/CallbackController.php b/libraries/src/Cache/Controller/CallbackController.php index 8574a03028354..34b5911924340 100644 --- a/libraries/src/Cache/Controller/CallbackController.php +++ b/libraries/src/Cache/Controller/CallbackController.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Controller; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\Cache; use Joomla\CMS\Cache\CacheController; @@ -81,7 +81,7 @@ public function get($callback, $args = array(), $id = false, $wrkarounds = false return $data['result']; } - if (!is_array($args)) + if (!\is_array($args)) { $referenceArgs = !empty($args) ? array(&$args) : array(); } @@ -93,7 +93,7 @@ public function get($callback, $args = array(), $id = false, $wrkarounds = false if ($locktest->locked === false && $locktest->locklooped === true) { // We can not store data because another process is in the middle of saving - return call_user_func_array($callback, $referenceArgs); + return \call_user_func_array($callback, $referenceArgs); } $coptions = array(); @@ -121,7 +121,7 @@ public function get($callback, $args = array(), $id = false, $wrkarounds = false ob_start(); ob_implicit_flush(false); - $result = call_user_func_array($callback, $referenceArgs); + $result = \call_user_func_array($callback, $referenceArgs); $output = ob_get_clean(); $data = array('result' => $result); @@ -192,10 +192,10 @@ public function store($data, $id, $group = null, $wrkarounds = true) */ protected function _makeId($callback, $args) { - if (is_array($callback) && is_object($callback[0])) + if (\is_array($callback) && \is_object($callback[0])) { $vars = get_object_vars($callback[0]); - $vars[] = strtolower(get_class($callback[0])); + $vars[] = strtolower(\get_class($callback[0])); $callback[0] = $vars; } diff --git a/libraries/src/Cache/Controller/OutputController.php b/libraries/src/Cache/Controller/OutputController.php index 2ac5067045a92..f06ee7aa53b68 100644 --- a/libraries/src/Cache/Controller/OutputController.php +++ b/libraries/src/Cache/Controller/OutputController.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Controller; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\CacheController; diff --git a/libraries/src/Cache/Controller/PageController.php b/libraries/src/Cache/Controller/PageController.php index 252a1af8a6ffe..004ff4aa17622 100644 --- a/libraries/src/Cache/Controller/PageController.php +++ b/libraries/src/Cache/Controller/PageController.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Controller; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\Cache; use Joomla\CMS\Cache\CacheController; diff --git a/libraries/src/Cache/Controller/ViewController.php b/libraries/src/Cache/Controller/ViewController.php index 0bb45e8b22054..491a08c428885 100644 --- a/libraries/src/Cache/Controller/ViewController.php +++ b/libraries/src/Cache/Controller/ViewController.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Controller; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\Cache; use Joomla\CMS\Cache\CacheController; @@ -168,6 +168,6 @@ public function store($data, $id, $group = null, $wrkarounds = true) */ protected function _makeId($view, $method) { - return md5(serialize(array(Cache::makeId(), get_class($view), $method))); + return md5(serialize(array(Cache::makeId(), \get_class($view), $method))); } } diff --git a/libraries/src/Cache/Exception/CacheConnectingException.php b/libraries/src/Cache/Exception/CacheConnectingException.php index 9acb2b0119f02..e5bc341d0812d 100644 --- a/libraries/src/Cache/Exception/CacheConnectingException.php +++ b/libraries/src/Cache/Exception/CacheConnectingException.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception class defining an error connecting to the cache storage engine diff --git a/libraries/src/Cache/Exception/CacheExceptionInterface.php b/libraries/src/Cache/Exception/CacheExceptionInterface.php index a4f944f95239a..9186f20341a21 100644 --- a/libraries/src/Cache/Exception/CacheExceptionInterface.php +++ b/libraries/src/Cache/Exception/CacheExceptionInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception interface defining a cache storage error diff --git a/libraries/src/Cache/Exception/UnsupportedCacheException.php b/libraries/src/Cache/Exception/UnsupportedCacheException.php index 0430f2e21402d..b6492ae2c880a 100644 --- a/libraries/src/Cache/Exception/UnsupportedCacheException.php +++ b/libraries/src/Cache/Exception/UnsupportedCacheException.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Exception class defining an unsupported cache storage object diff --git a/libraries/src/Cache/Storage/ApcuStorage.php b/libraries/src/Cache/Storage/ApcuStorage.php index 86b37cd4b31aa..549f64591472a 100644 --- a/libraries/src/Cache/Storage/ApcuStorage.php +++ b/libraries/src/Cache/Storage/ApcuStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\CacheStorage; @@ -242,7 +242,7 @@ public function gc() */ public static function isSupported() { - $supported = extension_loaded('apcu') && ini_get('apc.enabled'); + $supported = \extension_loaded('apcu') && ini_get('apc.enabled'); // If on the CLI interface, the `apc.enable_cli` option must also be enabled if ($supported && PHP_SAPI === 'cli') diff --git a/libraries/src/Cache/Storage/CacheStorageHelper.php b/libraries/src/Cache/Storage/CacheStorageHelper.php index 762abb45cd51a..8f3939c39bd1d 100644 --- a/libraries/src/Cache/Storage/CacheStorageHelper.php +++ b/libraries/src/Cache/Storage/CacheStorageHelper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Cache storage helper functions. diff --git a/libraries/src/Cache/Storage/FileStorage.php b/libraries/src/Cache/Storage/FileStorage.php index 25008679ac0c7..f6e0cf1f20f35 100644 --- a/libraries/src/Cache/Storage/FileStorage.php +++ b/libraries/src/Cache/Storage/FileStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\CacheStorage; use Joomla\CMS\Factory; @@ -60,7 +60,7 @@ public function __construct($options = array()) { foreach ($locked_files as $path => $handle) { - if (is_resource($handle)) + if (\is_resource($handle)) { @flock($handle, LOCK_UN); @fclose($handle); @@ -213,7 +213,7 @@ public function store($id, $group, $data) if ($_fileopen) { - $length = strlen($data); + $length = \strlen($data); $result = @fwrite($_fileopen, $data, $length); if ($close) @@ -277,7 +277,7 @@ public function clean($group, $mode = null) case 'notgroup' : $folders = $this->_folders($this->_root); - for ($i = 0, $n = count($folders); $i < $n; $i++) + for ($i = 0, $n = \count($folders); $i < $n; $i++) { if ($folders[$i] != $folder) { @@ -522,14 +522,14 @@ protected function _deleteFolder($path) // Remove all the files in folder if they exist; disable all filtering $files = $this->_filesInFolder($path, '.', false, true, array(), array()); - if (!empty($files) && !is_array($files)) + if (!empty($files) && !\is_array($files)) { if (@unlink($files) !== true) { return false; } } - elseif (!empty($files) && is_array($files)) + elseif (!empty($files) && \is_array($files)) { foreach ($files as $file) { @@ -636,7 +636,7 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp return $arr; } - if (count($excludefilter)) + if (\count($excludefilter)) { $excludefilter = '/(' . implode('|', $excludefilter) . ')/'; } @@ -647,7 +647,7 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp while (($file = readdir($handle)) !== false) { - if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)) && (!$excludefilter || !preg_match($excludefilter, $file))) + if (($file != '.') && ($file != '..') && (!\in_array($file, $exclude)) && (!$excludefilter || !preg_match($excludefilter, $file))) { $dir = $path . '/' . $file; $isDir = is_dir($dir); @@ -656,7 +656,7 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp { if ($recurse) { - if (is_int($recurse)) + if (\is_int($recurse)) { $arr2 = $this->_filesInFolder($dir, $filter, $recurse - 1, $fullpath); } @@ -726,7 +726,7 @@ protected function _folders($path, $filter = '.', $recurse = false, $fullpath = return $arr; } - if (count($excludefilter)) + if (\count($excludefilter)) { $excludefilter_string = '/(' . implode('|', $excludefilter) . ')/'; } @@ -738,7 +738,7 @@ protected function _folders($path, $filter = '.', $recurse = false, $fullpath = while (($file = readdir($handle)) !== false) { if (($file != '.') && ($file != '..') - && (!in_array($file, $exclude)) + && (!\in_array($file, $exclude)) && (empty($excludefilter_string) || !preg_match($excludefilter_string, $file))) { $dir = $path . '/' . $file; @@ -761,7 +761,7 @@ protected function _folders($path, $filter = '.', $recurse = false, $fullpath = if ($recurse) { - if (is_int($recurse)) + if (\is_int($recurse)) { $arr2 = $this->_folders($dir, $filter, $recurse - 1, $fullpath, $exclude, $excludefilter); } diff --git a/libraries/src/Cache/Storage/MemcachedStorage.php b/libraries/src/Cache/Storage/MemcachedStorage.php index 67da648b7fa42..d215c9a708ed2 100644 --- a/libraries/src/Cache/Storage/MemcachedStorage.php +++ b/libraries/src/Cache/Storage/MemcachedStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\Cache; use Joomla\CMS\Cache\CacheStorage; @@ -129,7 +129,7 @@ protected function getConnection() protected function _getCacheId($id, $group) { $prefix = Cache::getPlatformPrefix(); - $length = strlen($prefix); + $length = \strlen($prefix); $cache_id = parent::_getCacheId($id, $group); if ($length) @@ -188,7 +188,7 @@ public function getAll() $data = array(); - if (is_array($keys)) + if (\is_array($keys)) { foreach ($keys as $key) { @@ -244,14 +244,14 @@ public function store($id, $group, $data) $index = static::$_db->get($this->_hash . '-index'); - if (!is_array($index)) + if (!\is_array($index)) { $index = array(); } $tmparr = new \stdClass; $tmparr->name = $cache_id; - $tmparr->size = strlen($data); + $tmparr->size = \strlen($data); $index[] = $tmparr; static::$_db->set($this->_hash . '-index', $index, 0); @@ -283,7 +283,7 @@ public function remove($id, $group) $index = static::$_db->get($this->_hash . '-index'); - if (is_array($index)) + if (\is_array($index)) { foreach ($index as $key => $value) { @@ -323,7 +323,7 @@ public function clean($group, $mode = null) $index = static::$_db->get($this->_hash . '-index'); - if (is_array($index)) + if (\is_array($index)) { $prefix = $this->_hash . '-cache-' . $group . '-'; diff --git a/libraries/src/Cache/Storage/RedisStorage.php b/libraries/src/Cache/Storage/RedisStorage.php index 02a83cb7a9c45..b85f43113dd89 100644 --- a/libraries/src/Cache/Storage/RedisStorage.php +++ b/libraries/src/Cache/Storage/RedisStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\CacheStorage; use Joomla\CMS\Cache\Exception\CacheConnectingException; @@ -231,7 +231,7 @@ public function getAll() $item = $data[$group]; } - $item->updateSize(strlen($key)*8); + $item->updateSize(\strlen($key)*8); $data[$group] = $item; } } diff --git a/libraries/src/Cache/Storage/WincacheStorage.php b/libraries/src/Cache/Storage/WincacheStorage.php index a5f4b7ddfc1b2..37e06690d73ab 100644 --- a/libraries/src/Cache/Storage/WincacheStorage.php +++ b/libraries/src/Cache/Storage/WincacheStorage.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Cache\Storage; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Cache\CacheStorage; @@ -194,6 +194,6 @@ public function gc() */ public static function isSupported() { - return extension_loaded('wincache') && function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), '1'); + return \extension_loaded('wincache') && \function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), '1'); } } diff --git a/libraries/src/Captcha/Captcha.php b/libraries/src/Captcha/Captcha.php index 3f514aea5620a..b46ef5f802c70 100644 --- a/libraries/src/Captcha/Captcha.php +++ b/libraries/src/Captcha/Captcha.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Captcha; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\CMS\Filter\InputFilter; diff --git a/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php b/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php index 888e52a8d86da..4147b68dfc886 100644 --- a/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php +++ b/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Captcha\Google; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Http\HttpFactory; use Joomla\Http\Exception\InvalidResponseCodeException; diff --git a/libraries/src/Categories/Categories.php b/libraries/src/Categories/Categories.php index 8809520a84f93..9780d53c4efd4 100644 --- a/libraries/src/Categories/Categories.php +++ b/libraries/src/Categories/Categories.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; @@ -145,7 +145,7 @@ public static function getInstance($extension, $options = array()) if ($component instanceof CategoryServiceInterface) { - $categories = $component->getCategory($options, count($parts) > 1 ? $parts[1] : ''); + $categories = $component->getCategory($options, \count($parts) > 1 ? $parts[1] : ''); } } catch (SectionNotFoundException $e) @@ -321,7 +321,7 @@ protected function _load($id) $results = $db->loadObjectList('id'); $childrenLoaded = false; - if (count($results)) + if (\count($results)) { // Foreach categories foreach ($results as $result) diff --git a/libraries/src/Categories/CategoryFactory.php b/libraries/src/Categories/CategoryFactory.php index 93cd899ac00e9..6a9926d4af0cb 100644 --- a/libraries/src/Categories/CategoryFactory.php +++ b/libraries/src/Categories/CategoryFactory.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; /** * Option based categories factory. diff --git a/libraries/src/Categories/CategoryFactoryInterface.php b/libraries/src/Categories/CategoryFactoryInterface.php index 953f68aeec246..5586ccb8098ea 100644 --- a/libraries/src/Categories/CategoryFactoryInterface.php +++ b/libraries/src/Categories/CategoryFactoryInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; /** * Category factory interface diff --git a/libraries/src/Categories/CategoryInterface.php b/libraries/src/Categories/CategoryInterface.php index e431959082db0..5145fd3808799 100644 --- a/libraries/src/Categories/CategoryInterface.php +++ b/libraries/src/Categories/CategoryInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * The category interface. diff --git a/libraries/src/Categories/CategoryNode.php b/libraries/src/Categories/CategoryNode.php index f0eb020e4bc23..41c7d27b6af8c 100644 --- a/libraries/src/Categories/CategoryNode.php +++ b/libraries/src/Categories/CategoryNode.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\CMS\Object\CMSObject; @@ -311,7 +311,7 @@ public function __construct($category = null, $constructor = null) */ public function setParent(NodeInterface $parent) { - if (!is_null($this->_parent)) + if (!\is_null($this->_parent)) { $key = array_search($this, $this->_parent->_children); unset($this->_parent->_children[$key]); @@ -321,7 +321,7 @@ public function setParent(NodeInterface $parent) $this->_parent->_children[] = & $this; - if (count($this->_parent->_children) > 1) + if (\count($this->_parent->_children) > 1) { end($this->_parent->_children); $this->_leftSibling = prev($this->_parent->_children); diff --git a/libraries/src/Categories/CategoryServiceInterface.php b/libraries/src/Categories/CategoryServiceInterface.php index 6f5a126b26a6d..29d6ea35f103f 100644 --- a/libraries/src/Categories/CategoryServiceInterface.php +++ b/libraries/src/Categories/CategoryServiceInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Form\Form; diff --git a/libraries/src/Categories/CategoryServiceTrait.php b/libraries/src/Categories/CategoryServiceTrait.php index c913ca0c722ca..ca6d58ae7dfc8 100644 --- a/libraries/src/Categories/CategoryServiceTrait.php +++ b/libraries/src/Categories/CategoryServiceTrait.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Categories; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Form\Form; use Joomla\CMS\Helper\ContentHelper; @@ -95,7 +95,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) array( 'related_tbl' => $this->getTableNameForSection($section), diff --git a/libraries/src/Changelog/Changelog.php b/libraries/src/Changelog/Changelog.php index 6d3461dabb3cc..fc46ccc6c49e3 100644 --- a/libraries/src/Changelog/Changelog.php +++ b/libraries/src/Changelog/Changelog.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Changelog; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Http\HttpFactory; use Joomla\CMS\Language\Text; @@ -174,7 +174,7 @@ protected function getStackLocation() */ protected function getLastTag() { - return $this->stack[count($this->stack) - 1]; + return $this->stack[\count($this->stack) - 1]; } /** diff --git a/libraries/src/Client/ClientHelper.php b/libraries/src/Client/ClientHelper.php index a6b839f786fdd..85122adc0410b 100644 --- a/libraries/src/Client/ClientHelper.php +++ b/libraries/src/Client/ClientHelper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Client; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; diff --git a/libraries/src/Client/FtpClient.php b/libraries/src/Client/FtpClient.php index 43dc0184f75c8..b4f4f26675878 100644 --- a/libraries/src/Client/FtpClient.php +++ b/libraries/src/Client/FtpClient.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Client; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Language\Text; use Joomla\CMS\Log\Log; @@ -26,7 +26,7 @@ * - 38 : Local filesystem error */ -if (!defined('CRLF')) +if (!\defined('CRLF')) { /** * Constant defining a line break @@ -34,10 +34,10 @@ * @var string * @since 1.5 */ - define('CRLF', "\r\n"); + \define('CRLF', "\r\n"); } -if (!defined('FTP_AUTOASCII')) +if (!\defined('FTP_AUTOASCII')) { /** * Constant defining whether the FTP connection type will automatically determine ASCII support based on a file extension @@ -45,10 +45,10 @@ * @var integer * @since 1.5 */ - define('FTP_AUTOASCII', -1); + \define('FTP_AUTOASCII', -1); } -if (!defined('FTP_BINARY')) +if (!\defined('FTP_BINARY')) { /** * Stub of the native FTP_BINARY constant if PHP is running without the ftp extension enabled @@ -56,10 +56,10 @@ * @var integer * @since 1.5 */ - define('FTP_BINARY', 1); + \define('FTP_BINARY', 1); } -if (!defined('FTP_ASCII')) +if (!\defined('FTP_ASCII')) { /** * Stub of the native FTP_ASCII constant if PHP is running without the ftp extension enabled @@ -67,10 +67,10 @@ * @var integer * @since 1.5 */ - define('FTP_ASCII', 0); + \define('FTP_ASCII', 0); } -if (!defined('FTP_NATIVE')) +if (!\defined('FTP_NATIVE')) { /** * Constant defining whether native FTP support is available on the platform @@ -78,7 +78,7 @@ * @var integer * @since 1.5 */ - define('FTP_NATIVE', function_exists('ftp_connect') ? 1 : 0); + \define('FTP_NATIVE', \function_exists('ftp_connect') ? 1 : 0); } /** @@ -198,7 +198,7 @@ public function __construct(array $options = array()) */ public function __destruct() { - if (is_resource($this->_conn)) + if (\is_resource($this->_conn)) { $this->quit(); } @@ -228,7 +228,7 @@ public static function getInstance($host = '127.0.0.1', $port = '21', array $opt $signature = $user . ':' . $pass . '@' . $host . ':' . $port; // Create a new instance, or set the options of an existing one - if (!isset(static::$instances[$signature]) || !is_object(static::$instances[$signature])) + if (!isset(static::$instances[$signature]) || !\is_object(static::$instances[$signature])) { static::$instances[$signature] = new static($options); } @@ -291,7 +291,7 @@ public function connect($host = '127.0.0.1', $port = 21) $err = null; // If already connected, return - if (is_resource($this->_conn)) + if (\is_resource($this->_conn)) { return true; } @@ -347,7 +347,7 @@ public function connect($host = '127.0.0.1', $port = 21) */ public function isConnected() { - return is_resource($this->_conn); + return \is_resource($this->_conn); } /** @@ -392,7 +392,7 @@ public function login($user = 'anonymous', $pass = 'jftp@joomla.org') // Send the password if (!$this->_putCmd('PASS ' . $pass, 230)) { - Log::add(Text::sprintf('JLIB_CLIENT_ERROR_JFTP_BAD_PASSWORD', $this->_response, str_repeat('*', strlen($pass))), Log::WARNING, 'jerror'); + Log::add(Text::sprintf('JLIB_CLIENT_ERROR_JFTP_BAD_PASSWORD', $this->_response, str_repeat('*', \strlen($pass))), Log::WARNING, 'jerror'); return false; } @@ -646,7 +646,7 @@ public function chmod($path, $mode) } // Convert the mode to a string - if (is_int($mode)) + if (\is_int($mode)) { $mode = decoct($mode); } @@ -1672,7 +1672,7 @@ public function listDetails($path = null, $type = 'all') continue; } - if (is_array($tmp_array) && $tmp_array['name'] != '.' && $tmp_array['name'] != '..') + if (\is_array($tmp_array) && $tmp_array['name'] != '.' && $tmp_array['name'] != '..') { $dir_list[] = $tmp_array; } @@ -1714,7 +1714,7 @@ public function listDetails($path = null, $type = 'all') continue; } - if (is_array($tmp_array) && $tmp_array['name'] != '.' && $tmp_array['name'] != '..') + if (\is_array($tmp_array) && $tmp_array['name'] != '.' && $tmp_array['name'] != '..') { $dir_list[] = $tmp_array; } @@ -1737,7 +1737,7 @@ public function listDetails($path = null, $type = 'all') protected function _putCmd($cmd, $expectedResponse) { // Make sure we have a connection to the server - if (!is_resource($this->_conn)) + if (!\is_resource($this->_conn)) { Log::add(Text::_('JLIB_CLIENT_ERROR_JFTP_PUTCMD_UNCONNECTED'), Log::WARNING, 'jerror'); @@ -1789,9 +1789,9 @@ protected function _verifyResponse($expected) $this->_responseMsg = $parts[0]; // Did the server respond with the code we wanted? - if (is_array($expected)) + if (\is_array($expected)) { - if (in_array($this->_responseCode, $expected)) + if (\in_array($this->_responseCode, $expected)) { $retval = true; } @@ -1830,7 +1830,7 @@ protected function _passive() $err = null; // Make sure we have a connection to the server - if (!is_resource($this->_conn)) + if (!\is_resource($this->_conn)) { Log::add(Text::_('JLIB_CLIENT_ERROR_JFTP_PASSIVE_CONNECT_PORT'), Log::WARNING, 'jerror'); @@ -1917,7 +1917,7 @@ protected function _findMode($fileName) $dot = strrpos($fileName, '.') + 1; $ext = substr($fileName, $dot); - if (in_array($ext, $this->_autoAscii)) + if (\in_array($ext, $this->_autoAscii)) { $mode = FTP_ASCII; } diff --git a/libraries/src/Component/ComponentHelper.php b/libraries/src/Component/ComponentHelper.php index 30d0967246a35..35a02bb56b37e 100644 --- a/libraries/src/Component/ComponentHelper.php +++ b/libraries/src/Component/ComponentHelper.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Access\Access; use Joomla\CMS\Cache\CacheControllerFactoryInterface; @@ -335,7 +335,7 @@ public static function renderComponent($option, $params = array()) // Define component path. - if (!defined('JPATH_COMPONENT')) + if (!\defined('JPATH_COMPONENT')) { /** * Defines the path to the active component for the request @@ -346,10 +346,10 @@ public static function renderComponent($option, $params = array()) * @since 1.5 * @deprecated 5.0 without replacement */ - define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option); + \define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option); } - if (!defined('JPATH_COMPONENT_SITE')) + if (!\defined('JPATH_COMPONENT_SITE')) { /** * Defines the path to the site element of the active component for the request @@ -358,10 +358,10 @@ public static function renderComponent($option, $params = array()) * @since 1.5 * @deprecated 5.0 without replacement */ - define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option); + \define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option); } - if (!defined('JPATH_COMPONENT_ADMINISTRATOR')) + if (!\defined('JPATH_COMPONENT_ADMINISTRATOR')) { /** * Defines the path to the admin element of the active component for the request @@ -370,7 +370,7 @@ public static function renderComponent($option, $params = array()) * @since 1.5 * @deprecated 5.0 without replacement */ - define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option); + \define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option); } // If component is disabled throw error @@ -464,7 +464,7 @@ public static function getComponentName($object, string $alternativeName): strin { $reflect = new \ReflectionClass($object); - if (!$reflect->getNamespaceName() || get_class($object) == ComponentDispatcher::class) + if (!$reflect->getNamespaceName() || \get_class($object) == ComponentDispatcher::class) { return 'com_' . strtolower($alternativeName); } diff --git a/libraries/src/Component/ComponentRecord.php b/libraries/src/Component/ComponentRecord.php index 5aa0caafbe4ea..edef74f26a390 100644 --- a/libraries/src/Component/ComponentRecord.php +++ b/libraries/src/Component/ComponentRecord.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Registry\Registry; diff --git a/libraries/src/Component/Exception/MissingComponentException.php b/libraries/src/Component/Exception/MissingComponentException.php index f7e7e5db05aa4..91a45a0272def 100644 --- a/libraries/src/Component/Exception/MissingComponentException.php +++ b/libraries/src/Component/Exception/MissingComponentException.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Exception; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Router\Exception\RouteNotFoundException; diff --git a/libraries/src/Component/Router/RouterBase.php b/libraries/src/Component/Router/RouterBase.php index 0ed72c9ca4ae3..b8247963b6441 100644 --- a/libraries/src/Component/Router/RouterBase.php +++ b/libraries/src/Component/Router/RouterBase.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; diff --git a/libraries/src/Component/Router/RouterFactory.php b/libraries/src/Component/Router/RouterFactory.php index faf59a4bcf93c..7485ce0aae729 100644 --- a/libraries/src/Component/Router/RouterFactory.php +++ b/libraries/src/Component/Router/RouterFactory.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Application\CMSApplicationInterface; use Joomla\CMS\Categories\CategoryFactoryInterface; diff --git a/libraries/src/Component/Router/RouterFactoryInterface.php b/libraries/src/Component/Router/RouterFactoryInterface.php index e01cf0ceb1f84..2ca92902a160e 100644 --- a/libraries/src/Component/Router/RouterFactoryInterface.php +++ b/libraries/src/Component/Router/RouterFactoryInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('_JEXEC') or die; +\defined('_JEXEC') or die; use Joomla\CMS\Application\CMSApplicationInterface; use Joomla\CMS\Menu\AbstractMenu; diff --git a/libraries/src/Component/Router/RouterInterface.php b/libraries/src/Component/Router/RouterInterface.php index 893de8e22e411..e8cc41ce4746d 100644 --- a/libraries/src/Component/Router/RouterInterface.php +++ b/libraries/src/Component/Router/RouterInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Component routing interface diff --git a/libraries/src/Component/Router/RouterLegacy.php b/libraries/src/Component/Router/RouterLegacy.php index 33e1225629d86..8f9647ddf5ea2 100644 --- a/libraries/src/Component/Router/RouterLegacy.php +++ b/libraries/src/Component/Router/RouterLegacy.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Default routing class for missing or legacy component routers @@ -64,10 +64,10 @@ public function build(&$query) { $function = $this->component . 'BuildRoute'; - if (function_exists($function)) + if (\function_exists($function)) { $segments = $function($query); - $total = count($segments); + $total = \count($segments); for ($i = 0; $i < $total; $i++) { @@ -93,9 +93,9 @@ public function parse(&$segments) { $function = $this->component . 'ParseRoute'; - if (function_exists($function)) + if (\function_exists($function)) { - $total = count($segments); + $total = \count($segments); for ($i = 0; $i < $total; $i++) { diff --git a/libraries/src/Component/Router/RouterServiceInterface.php b/libraries/src/Component/Router/RouterServiceInterface.php index d4469dbbfd406..1db67503dbf2e 100644 --- a/libraries/src/Component/Router/RouterServiceInterface.php +++ b/libraries/src/Component/Router/RouterServiceInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CMSApplicationInterface; use Joomla\CMS\Menu\AbstractMenu; diff --git a/libraries/src/Component/Router/RouterServiceTrait.php b/libraries/src/Component/Router/RouterServiceTrait.php index acb2f16585305..6cf04fe34ba7a 100644 --- a/libraries/src/Component/Router/RouterServiceTrait.php +++ b/libraries/src/Component/Router/RouterServiceTrait.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Application\CMSApplicationInterface; use Joomla\CMS\Menu\AbstractMenu; diff --git a/libraries/src/Component/Router/RouterView.php b/libraries/src/Component/Router/RouterView.php index 808c9a4cfd15f..8862223ce8065 100644 --- a/libraries/src/Component/Router/RouterView.php +++ b/libraries/src/Component/Router/RouterView.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Component\Router\Rules\RulesInterface; @@ -114,15 +114,15 @@ public function getPath($query) $childkey = $view->parent_key; - if (($key || $view->key) && is_callable(array($this, 'get' . ucfirst($view->name) . 'Segment'))) + if (($key || $view->key) && \is_callable(array($this, 'get' . ucfirst($view->name) . 'Segment'))) { if (isset($query[$key])) { - $result[$view->name] = call_user_func_array(array($this, 'get' . ucfirst($view->name) . 'Segment'), array($query[$key], $query)); + $result[$view->name] = \call_user_func_array(array($this, 'get' . ucfirst($view->name) . 'Segment'), array($query[$key], $query)); } elseif (isset($query[$view->key])) { - $result[$view->name] = call_user_func_array(array($this, 'get' . ucfirst($view->name) . 'Segment'), array($query[$view->key], $query)); + $result[$view->name] = \call_user_func_array(array($this, 'get' . ucfirst($view->name) . 'Segment'), array($query[$view->key], $query)); } else { @@ -283,7 +283,7 @@ public function getName() { $r = null; - if (!preg_match('/(.*)Router/i', get_class($this), $r)) + if (!preg_match('/(.*)Router/i', \get_class($this), $r)) { throw new \Exception('JLIB_APPLICATION_ERROR_ROUTER_GET_NAME', 500); } diff --git a/libraries/src/Component/Router/RouterViewConfiguration.php b/libraries/src/Component/Router/RouterViewConfiguration.php index e2cacf1feca62..92d13740ffe57 100644 --- a/libraries/src/Component/Router/RouterViewConfiguration.php +++ b/libraries/src/Component/Router/RouterViewConfiguration.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * View-configuration class for the view-based component router diff --git a/libraries/src/Component/Router/Rules/MenuRules.php b/libraries/src/Component/Router/Rules/MenuRules.php index 2622fae4aaa79..c676cee7f5982 100644 --- a/libraries/src/Component/Router/Rules/MenuRules.php +++ b/libraries/src/Component/Router/Rules/MenuRules.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router\Rules; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Component\Router\RouterView; @@ -98,7 +98,7 @@ public function preprocess(&$query) if (isset($query[$k]) && $v !== $query[$k]) { // Compare again without alias - if (is_string($v) && $v == current(explode(':', $query[$k], 2))) + if (\is_string($v) && $v == current(explode(':', $query[$k], 2))) { continue; } @@ -127,7 +127,7 @@ public function preprocess(&$query) if ($layout && isset($this->lookup[$language][$viewLayout])) { - if (is_bool($ids)) + if (\is_bool($ids)) { $query['Itemid'] = $this->lookup[$language][$viewLayout]; @@ -147,7 +147,7 @@ public function preprocess(&$query) if (isset($this->lookup[$language][$view])) { - if (is_bool($ids)) + if (\is_bool($ids)) { $query['Itemid'] = $this->lookup[$language][$view]; @@ -169,7 +169,7 @@ public function preprocess(&$query) // Check if the active menuitem matches the requested language if ($active && $active->component === 'com_' . $this->router->getName() - && ($language === '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) + && ($language === '*' || \in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) { $query['Itemid'] = $active->id; diff --git a/libraries/src/Component/Router/Rules/NomenuRules.php b/libraries/src/Component/Router/Rules/NomenuRules.php index 0f76012a5cda6..cd0d1ead754fb 100644 --- a/libraries/src/Component/Router/Rules/NomenuRules.php +++ b/libraries/src/Component/Router/Rules/NomenuRules.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router\Rules; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\Router\RouterView; @@ -67,7 +67,7 @@ public function parse(&$segments, &$vars) { $active = $this->router->menu->getActive(); - if (!is_object($active)) + if (!\is_object($active)) { $views = $this->router->getViews(); @@ -118,9 +118,9 @@ public function build(&$query, &$segments) if ($view->key && isset($query[$view->key])) { - if (is_callable(array($this->router, 'get' . ucfirst($view->name) . 'Segment'))) + if (\is_callable(array($this->router, 'get' . ucfirst($view->name) . 'Segment'))) { - $result = call_user_func_array(array($this->router, 'get' . ucfirst($view->name) . 'Segment'), array($query[$view->key], $query)); + $result = \call_user_func_array(array($this->router, 'get' . ucfirst($view->name) . 'Segment'), array($query[$view->key], $query)); $segments[] = str_replace(':', '-', array_shift($result)); } else diff --git a/libraries/src/Component/Router/Rules/RulesInterface.php b/libraries/src/Component/Router/Rules/RulesInterface.php index a520bd487d0de..278cf29381f25 100644 --- a/libraries/src/Component/Router/Rules/RulesInterface.php +++ b/libraries/src/Component/Router/Rules/RulesInterface.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router\Rules; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * RouterRules interface for Joomla diff --git a/libraries/src/Component/Router/Rules/StandardRules.php b/libraries/src/Component/Router/Rules/StandardRules.php index a4043f6058ea4..d2bcbb0e9eefb 100644 --- a/libraries/src/Component/Router/Rules/StandardRules.php +++ b/libraries/src/Component/Router/Rules/StandardRules.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Component\Router\Rules; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\Router\RouterView; @@ -88,9 +88,9 @@ public function parse(&$segments, &$vars) // Our current view is nestable. We need to check first if the segment fits to that if ($views[$vars['view']]->nestable) { - if (is_callable(array($this->router, 'get' . ucfirst($views[$vars['view']]->name) . 'Id'))) + if (\is_callable(array($this->router, 'get' . ucfirst($views[$vars['view']]->name) . 'Id'))) { - $key = call_user_func_array(array($this->router, 'get' . ucfirst($views[$vars['view']]->name) . 'Id'), array($segment, $vars)); + $key = \call_user_func_array(array($this->router, 'get' . ucfirst($views[$vars['view']]->name) . 'Id'), array($segment, $vars)); // Did we get a proper key? If not, we need to look in the child-views if ($key) @@ -134,10 +134,10 @@ public function parse(&$segments, &$vars) break; } } - elseif (is_callable(array($this->router, 'get' . ucfirst($view->name) . 'Id'))) + elseif (\is_callable(array($this->router, 'get' . ucfirst($view->name) . 'Id'))) { // Hand the data over to the router specific method and see if there is a content item that fits - $key = call_user_func_array(array($this->router, 'get' . ucfirst($view->name) . 'Id'), array($segment, $vars)); + $key = \call_user_func_array(array($this->router, 'get' . ucfirst($view->name) . 'Id'), array($segment, $vars)); if ($key) { diff --git a/libraries/src/Console/CheckUpdatesCommand.php b/libraries/src/Console/CheckUpdatesCommand.php index 4c0b4049ec23d..bfdaa1276299a 100644 --- a/libraries/src/Console/CheckUpdatesCommand.php +++ b/libraries/src/Console/CheckUpdatesCommand.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Console; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Updater\Updater; diff --git a/libraries/src/Console/CleanCacheCommand.php b/libraries/src/Console/CleanCacheCommand.php index cc78cc0dc5835..d5fb1909492cd 100644 --- a/libraries/src/Console/CleanCacheCommand.php +++ b/libraries/src/Console/CleanCacheCommand.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Console; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Factory; use Joomla\Console\Command\AbstractCommand; diff --git a/libraries/src/Console/Loader/WritableContainerLoader.php b/libraries/src/Console/Loader/WritableContainerLoader.php index 7b723c86874b6..9a1b46ac46955 100644 --- a/libraries/src/Console/Loader/WritableContainerLoader.php +++ b/libraries/src/Console/Loader/WritableContainerLoader.php @@ -12,7 +12,7 @@ use Psr\Container\ContainerInterface; use Symfony\Component\Console\Exception\CommandNotFoundException; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * PSR-11 compatible writable command loader. diff --git a/libraries/src/Console/Loader/WritableLoaderInterface.php b/libraries/src/Console/Loader/WritableLoaderInterface.php index 91f11dd139169..0bfe671a48281 100644 --- a/libraries/src/Console/Loader/WritableLoaderInterface.php +++ b/libraries/src/Console/Loader/WritableLoaderInterface.php @@ -10,7 +10,7 @@ use Joomla\Console\Loader\LoaderInterface; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; /** * Interface defining a writable command loader. diff --git a/libraries/src/Console/RemoveOldFilesCommand.php b/libraries/src/Console/RemoveOldFilesCommand.php index d26b52d5f2643..8a15a91ee1310 100644 --- a/libraries/src/Console/RemoveOldFilesCommand.php +++ b/libraries/src/Console/RemoveOldFilesCommand.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Console; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Console\Command\AbstractCommand; use Symfony\Component\Console\Input\InputInterface; diff --git a/libraries/src/Console/SessionGcCommand.php b/libraries/src/Console/SessionGcCommand.php index d27c7ee7672be..e93a36e859fb3 100644 --- a/libraries/src/Console/SessionGcCommand.php +++ b/libraries/src/Console/SessionGcCommand.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Console; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Console\Command\AbstractCommand; use Joomla\DI\ContainerAwareInterface; diff --git a/libraries/src/Console/SessionMetadataGcCommand.php b/libraries/src/Console/SessionMetadataGcCommand.php index 0c9298c7f8f25..afcfd0ae6b268 100644 --- a/libraries/src/Console/SessionMetadataGcCommand.php +++ b/libraries/src/Console/SessionMetadataGcCommand.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Console; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\CMS\Session\MetadataManager; use Joomla\Console\Command\AbstractCommand; diff --git a/libraries/src/Crypt/Cipher/CryptoCipher.php b/libraries/src/Crypt/Cipher/CryptoCipher.php index 5f038845af136..0ffd1299b6f3a 100644 --- a/libraries/src/Crypt/Cipher/CryptoCipher.php +++ b/libraries/src/Crypt/Cipher/CryptoCipher.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Crypt\Cipher; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Crypt\CipherInterface; use Joomla\Crypt\Key; diff --git a/libraries/src/Crypt/Cipher/SodiumCipher.php b/libraries/src/Crypt/Cipher/SodiumCipher.php index 259d963319add..767154a42beab 100644 --- a/libraries/src/Crypt/Cipher/SodiumCipher.php +++ b/libraries/src/Crypt/Cipher/SodiumCipher.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Crypt\Cipher; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Crypt\CipherInterface; use Joomla\Crypt\Key; diff --git a/libraries/src/Crypt/Crypt.php b/libraries/src/Crypt/Crypt.php index 7d02f4de0a80b..2327d3b5e15c5 100644 --- a/libraries/src/Crypt/Crypt.php +++ b/libraries/src/Crypt/Crypt.php @@ -8,7 +8,7 @@ namespace Joomla\CMS\Crypt; -defined('JPATH_PLATFORM') or die; +\defined('JPATH_PLATFORM') or die; use Joomla\Crypt\Crypt as JCrypt; @@ -57,7 +57,7 @@ public static function safeStrlen($str) if ($exists === null) { - $exists = function_exists('mb_strlen'); + $exists = \function_exists('mb_strlen'); } if ($exists) @@ -95,7 +95,7 @@ public static function safeSubstr($str, $start, $length = null) if ($exists === null) { - $exists = function_exists('mb_substr'); + $exists = \function_exists('mb_substr'); } if ($exists)