Merge pull request #15255 from Tithugues/feature/replace-class-name-as-string
Replace class name as string by ":class"
This commit is contained in:
commit
5b9ad4ebd3
@ -18,6 +18,7 @@ use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Utils\HttpRequest;
|
||||
use PhpMyAdmin\Config;
|
||||
|
||||
/**
|
||||
* Indication for error handler (see end of this file).
|
||||
@ -1750,5 +1751,5 @@ class Config
|
||||
}
|
||||
|
||||
if (! defined('TESTSUITE')) {
|
||||
register_shutdown_function(['PhpMyAdmin\Config', 'fatalErrorHandler']);
|
||||
register_shutdown_function([Config::class, 'fatalErrorHandler']);
|
||||
}
|
||||
|
||||
@ -1512,8 +1512,8 @@ class Qbe
|
||||
if (empty($from_clause)) {
|
||||
// Create cartesian product
|
||||
$from_clause = implode(
|
||||
", ",
|
||||
array_map(['PhpMyAdmin\Util', 'backquote'], $search_tables)
|
||||
', ',
|
||||
array_map([Util::class, 'backquote'], $search_tables)
|
||||
);
|
||||
}
|
||||
|
||||
@ -1622,7 +1622,7 @@ class Qbe
|
||||
// Add these tables as cartesian product before joined tables
|
||||
$join .= implode(
|
||||
', ',
|
||||
array_map(['PhpMyAdmin\Util', 'backquote'], $unfinalized)
|
||||
array_map([Util::class, 'backquote'], $unfinalized)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use \stdClass;
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
use PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Json;
|
||||
use PhpMyAdmin\Plugins\Transformations\Output\Text_Octetstream_Sql;
|
||||
use PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Sql;
|
||||
|
||||
/**
|
||||
* Handle all the functionalities related to displaying results
|
||||
@ -262,22 +265,22 @@ class Results
|
||||
{
|
||||
$json_highlighting_data = [
|
||||
'libraries/classes/Plugins/Transformations/Output/Text_Plain_Json.php',
|
||||
'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Json',
|
||||
Text_Plain_Json::class,
|
||||
'Text_Plain',
|
||||
];
|
||||
$sql_highlighting_data = [
|
||||
'libraries/classes/Plugins/Transformations/Output/Text_Plain_Sql.php',
|
||||
'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Sql',
|
||||
Text_Plain_Sql::class,
|
||||
'Text_Plain',
|
||||
];
|
||||
$blob_sql_highlighting_data = [
|
||||
'libraries/classes/Plugins/Transformations/Output/Text_Octetstream_Sql.php',
|
||||
'PhpMyAdmin\Plugins\Transformations\Output\Text_Octetstream_Sql',
|
||||
Text_Octetstream_Sql::class,
|
||||
'Text_Octetstream',
|
||||
];
|
||||
$link_data = [
|
||||
'libraries/classes/Plugins/Transformations/Text_Plain_Link.php',
|
||||
'PhpMyAdmin\Plugins\Transformations\Text_Plain_Link',
|
||||
Text_Plain_Link::class,
|
||||
'Text_Plain',
|
||||
];
|
||||
$this->transformation_info = [
|
||||
|
||||
@ -21,6 +21,7 @@ use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Navigation\NavigationTree;
|
||||
|
||||
/**
|
||||
* Displays a collapsible of database objects in the navigation frame
|
||||
@ -880,7 +881,7 @@ class NavigationTree
|
||||
$this->groupTree();
|
||||
$children = $this->_tree->children;
|
||||
usort($children, [
|
||||
'PhpMyAdmin\\Navigation\\NavigationTree',
|
||||
NavigationTree::class,
|
||||
'sortNode',
|
||||
]);
|
||||
$this->_setVisibility();
|
||||
@ -922,7 +923,7 @@ class NavigationTree
|
||||
$listContent .= $this->_getPageSelector($node);
|
||||
$children = $node->children;
|
||||
usort($children, [
|
||||
'PhpMyAdmin\\Navigation\\NavigationTree',
|
||||
NavigationTree::class,
|
||||
'sortNode',
|
||||
]);
|
||||
|
||||
@ -1228,7 +1229,7 @@ class NavigationTree
|
||||
usort(
|
||||
$children,
|
||||
[
|
||||
'PhpMyAdmin\\Navigation\\NavigationTree',
|
||||
NavigationTree::class,
|
||||
'sortNode',
|
||||
]
|
||||
);
|
||||
@ -1314,7 +1315,7 @@ class NavigationTree
|
||||
|
||||
$children = $this->_tree->children;
|
||||
usort($children, [
|
||||
'PhpMyAdmin\\Navigation\\NavigationTree',
|
||||
NavigationTree::class,
|
||||
'sortNode',
|
||||
]);
|
||||
$this->_setVisibility();
|
||||
|
||||
@ -14,6 +14,14 @@ use PhpMyAdmin\Properties\Options\OptionsPropertyItem;
|
||||
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
|
||||
use PhpMyAdmin\Properties\Plugins\PluginPropertyItem;
|
||||
use PhpMyAdmin\Properties\Plugins\SchemaPluginProperties;
|
||||
use PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\NumberPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\MessageOnlyPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\DocPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
|
||||
/**
|
||||
* PhpMyAdmin\Plugins class
|
||||
@ -418,7 +426,7 @@ class Plugins
|
||||
$ret = null;
|
||||
$property_class = get_class($propertyItem);
|
||||
switch ($property_class) {
|
||||
case 'PhpMyAdmin\Properties\Options\Items\BoolPropertyItem':
|
||||
case BoolPropertyItem::class:
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<input type="checkbox" name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
@ -445,10 +453,10 @@ class Plugins
|
||||
. $propertyItem->getName() . '">'
|
||||
. self::getString($propertyItem->getText()) . '</label>';
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\DocPropertyItem':
|
||||
echo 'PhpMyAdmin\Properties\Options\Items\DocPropertyItem';
|
||||
case DocPropertyItem::class:
|
||||
echo DocPropertyItem::class;
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem':
|
||||
case HiddenPropertyItem::class:
|
||||
$ret .= '<li><input type="hidden" name="' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '"'
|
||||
. ' value="' . self::getDefault(
|
||||
@ -457,11 +465,11 @@ class Plugins
|
||||
)
|
||||
. '"' . '></li>';
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\MessageOnlyPropertyItem':
|
||||
case MessageOnlyPropertyItem::class:
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<p>' . self::getString($propertyItem->getText()) . '</p>';
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\RadioPropertyItem':
|
||||
case RadioPropertyItem::class:
|
||||
/**
|
||||
* @var \PhpMyAdmin\Properties\Options\Items\RadioPropertyItem $pitem
|
||||
*/
|
||||
@ -485,7 +493,7 @@ class Plugins
|
||||
. self::getString($val) . '</label></li>';
|
||||
}
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\SelectPropertyItem':
|
||||
case SelectPropertyItem::class:
|
||||
/**
|
||||
* @var \PhpMyAdmin\Properties\Options\Items\SelectPropertyItem $pitem
|
||||
*/
|
||||
@ -512,7 +520,7 @@ class Plugins
|
||||
|
||||
$ret .= '</select>';
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\TextPropertyItem':
|
||||
case TextPropertyItem::class:
|
||||
/**
|
||||
* @var \PhpMyAdmin\Properties\Options\Items\TextPropertyItem $pitem
|
||||
*/
|
||||
@ -537,7 +545,7 @@ class Plugins
|
||||
: '')
|
||||
. '>';
|
||||
break;
|
||||
case 'PhpMyAdmin\Properties\Options\Items\NumberPropertyItem':
|
||||
case NumberPropertyItem::class:
|
||||
$ret .= '<li>' . "\n";
|
||||
$ret .= '<label for="number_' . $plugin_name . '_'
|
||||
. $propertyItem->getName() . '" class="desc">'
|
||||
@ -600,7 +608,7 @@ class Plugins
|
||||
// check for hidden properties
|
||||
$no_options = true;
|
||||
foreach ($propertyMainGroup->getProperties() as $propertyItem) {
|
||||
if (strcmp('PhpMyAdmin\Properties\Options\Items\HiddenPropertyItem', get_class($propertyItem))) {
|
||||
if (strcmp(HiddenPropertyItem::class, get_class($propertyItem))) {
|
||||
$no_options = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Url;
|
||||
use phpseclib\Crypt;
|
||||
use ReCaptcha;
|
||||
use phpseclib\Crypt\Random;
|
||||
|
||||
/**
|
||||
* Remember where to redirect the user
|
||||
@ -57,7 +58,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_use_openssl = ! class_exists('phpseclib\Crypt\Random');
|
||||
$this->_use_openssl = ! class_exists(Random::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -10,6 +10,10 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
use PhpMyAdmin\Plugins\TwoFactor\Invalid;
|
||||
use PhpMyAdmin\Plugins\TwoFactorPlugin;
|
||||
use Samyoul\U2F\U2FServer\U2FServer;
|
||||
use PragmaRX\Google2FAQRCode\Google2FA;
|
||||
|
||||
/**
|
||||
* Two factor authentication wrapper class
|
||||
@ -118,10 +122,10 @@ class TwoFactor
|
||||
if ($GLOBALS['cfg']['DBG']['simple2fa']) {
|
||||
$result[] = 'simple';
|
||||
}
|
||||
if (class_exists('PragmaRX\Google2FAQRCode\Google2FA')) {
|
||||
if (class_exists(Google2FA::class)) {
|
||||
$result[] = 'application';
|
||||
}
|
||||
if (class_exists('Samyoul\U2F\U2FServer\U2FServer')) {
|
||||
if (class_exists(U2FServer::class)) {
|
||||
$result[] = 'key';
|
||||
}
|
||||
return $result;
|
||||
@ -135,7 +139,7 @@ class TwoFactor
|
||||
public function getMissingDeps()
|
||||
{
|
||||
$result = [];
|
||||
if (! class_exists('PragmaRX\Google2FAQRCode\Google2FA')) {
|
||||
if (! class_exists(Google2FA::class)) {
|
||||
$result[] = [
|
||||
'class' => \PhpMyAdmin\Plugins\TwoFactor\Application::getName(),
|
||||
'dep' => 'pragmarx/google2fa-qrcode',
|
||||
@ -147,7 +151,7 @@ class TwoFactor
|
||||
'dep' => 'bacon/bacon-qr-code',
|
||||
];
|
||||
}
|
||||
if (! class_exists('Samyoul\U2F\U2FServer\U2FServer')) {
|
||||
if (! class_exists(U2FServer::class)) {
|
||||
$result[] = [
|
||||
'class' => \PhpMyAdmin\Plugins\TwoFactor\Key::getName(),
|
||||
'dep' => 'samyoul/u2f-php-server',
|
||||
@ -165,11 +169,11 @@ class TwoFactor
|
||||
*/
|
||||
public function getBackendClass($name)
|
||||
{
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactorPlugin';
|
||||
$result = TwoFactorPlugin::class;
|
||||
if (in_array($name, $this->_available)) {
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactor\\' . ucfirst($name);
|
||||
} elseif (! empty($name)) {
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactor\\Invalid';
|
||||
$result = Invalid::class;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
use Williamdes\MariaDBMySQLKBS\Search as KBSearch;
|
||||
use Williamdes\MariaDBMySQLKBS\KBException;
|
||||
use phpseclib\Crypt\Random;
|
||||
|
||||
/**
|
||||
* Misc functions used all over the scripts.
|
||||
@ -4797,9 +4798,9 @@ class Util
|
||||
public static function generateRandom($length)
|
||||
{
|
||||
$result = '';
|
||||
if (class_exists('phpseclib\\Crypt\\Random')) {
|
||||
if (class_exists(Random::class)) {
|
||||
$random_func = [
|
||||
'phpseclib\\Crypt\\Random',
|
||||
Random::class,
|
||||
'string',
|
||||
];
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user