Skip to content

Commit

Permalink
[4.0] Call functions from global namespace, Part 1 (#25660)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored and wilsonge committed Jul 24, 2019
1 parent 838fc48 commit 1e8198a
Show file tree
Hide file tree
Showing 97 changed files with 257 additions and 257 deletions.
12 changes: 6 additions & 6 deletions libraries/src/Access/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Access/Exception/AuthenticationFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Access/Exception/NotAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions libraries/src/Access/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Joomla\CMS\Access;

defined('JPATH_PLATFORM') or die;
\defined('JPATH_PLATFORM') or die;

/**
* Rule class.
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public function mergeIdentities($identities)
$identities = $identities->getData();
}

if (is_array($identities))
if (\is_array($identities))
{
foreach ($identities as $identity => $allow)
{
Expand Down Expand Up @@ -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);
}
Expand Down
14 changes: 7 additions & 7 deletions libraries/src/Access/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Joomla\CMS\Access;

defined('JPATH_PLATFORM') or die;
\defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Object\CMSObject;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
10 changes: 5 additions & 5 deletions libraries/src/Application/AdministratorApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)), '/\\'));
}

/**
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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';
}
Expand Down Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions libraries/src/Application/ApiApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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'];
}
Expand All @@ -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()];
}
Expand Down
8 changes: 4 additions & 4 deletions libraries/src/Application/ApplicationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/BaseApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/CLI/CliInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Joomla\CMS\Application\CLI;

defined('JPATH_PLATFORM') or die;
\defined('JPATH_PLATFORM') or die;

/**
* Class CliInput
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/CLI/CliOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions libraries/src/Application/CLI/ColorStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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]]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/CLI/Output/Stdout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/CLI/Output/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 1e8198a

Please sign in to comment.