diff --git a/administrator/components/com_admin/src/Model/SysinfoModel.php b/administrator/components/com_admin/src/Model/SysinfoModel.php index 52c7fc3720f40..8ee0519c37f8d 100644 --- a/administrator/components/com_admin/src/Model/SysinfoModel.php +++ b/administrator/components/com_admin/src/Model/SysinfoModel.php @@ -32,7 +32,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $php_settings = array(); + protected $php_settings = []; /** * Config values @@ -40,7 +40,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $config = array(); + protected $config = []; /** * Some system values @@ -48,7 +48,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $info = array(); + protected $info = []; /** * PHP info @@ -74,8 +74,8 @@ class SysinfoModel extends BaseDatabaseModel * * @since 3.5 */ - protected $privateSettings = array( - 'phpInfoArray' => array( + protected $privateSettings = [ + 'phpInfoArray' => [ 'CONTEXT_DOCUMENT_ROOT', 'Cookie', 'DOCUMENT_ROOT', @@ -111,8 +111,8 @@ class SysinfoModel extends BaseDatabaseModel 'upload_tmp_dir', 'User/Group', 'open_basedir', - ), - 'other' => array( + ], + 'other' => [ 'db', 'dbprefix', 'fromname', @@ -137,8 +137,8 @@ class SysinfoModel extends BaseDatabaseModel 'smtphost', 'tmp_path', 'open_basedir', - ) - ); + ] + ]; /** * System values that can be "safely" shared @@ -155,7 +155,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $directories = array(); + protected $directories = []; /** * The current editor. @@ -175,7 +175,7 @@ class SysinfoModel extends BaseDatabaseModel * * @since 3.5 */ - protected function cleanPrivateData($dataArray, $dataType = 'other') + protected function cleanPrivateData(array $dataArray, string $dataType = 'other'): array { $dataType = isset($this->privateSettings[$dataType]) ? $dataType : 'other'; @@ -188,12 +188,12 @@ protected function cleanPrivateData($dataArray, $dataType = 'other') foreach ($dataArray as $section => $values) { - if (is_array($values)) + if (\is_array($values)) { $dataArray[$section] = $this->cleanPrivateData($values, $dataType); } - if (in_array($section, $privateSettings, true)) + if (\in_array($section, $privateSettings, true)) { $dataArray[$section] = $this->cleanSectionPrivateData($values); } @@ -207,13 +207,13 @@ protected function cleanPrivateData($dataArray, $dataType = 'other') * * @param mixed $sectionValues Section data * - * @return mixed + * @return string|array * * @since 3.5 */ protected function cleanSectionPrivateData($sectionValues) { - if (!is_array($sectionValues)) + if (!\is_array($sectionValues)) { if (strstr($sectionValues, JPATH_ROOT)) { @@ -238,14 +238,14 @@ protected function cleanSectionPrivateData($sectionValues) * * @since 1.6 */ - public function &getPhpSettings() + public function &getPhpSettings(): array { if (!empty($this->php_settings)) { return $this->php_settings; } - $this->php_settings = array( + $this->php_settings = [ 'memory_limit' => ini_get('memory_limit'), 'upload_max_filesize' => ini_get('upload_max_filesize'), 'post_max_size' => ini_get('post_max_size'), @@ -262,8 +262,9 @@ public function &getPhpSettings() 'zip' => function_exists('zip_open') && function_exists('zip_read'), 'mbstring' => extension_loaded('mbstring'), 'iconv' => function_exists('iconv'), + 'intl' => function_exists('transliterator_transliterate'), 'max_input_vars' => ini_get('max_input_vars'), - ); + ]; return $this->php_settings; } @@ -275,7 +276,7 @@ public function &getPhpSettings() * * @since 1.6 */ - public function &getConfig() + public function &getConfig(): array { if (!empty($this->config)) { @@ -284,11 +285,11 @@ public function &getConfig() $registry = new Registry(new \JConfig); $this->config = $registry->toArray(); - $hidden = array( + $hidden = [ 'host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass', 'redis_server_auth', 'session_redis_server_auth', 'proxy_user', 'proxy_pass', 'secret' - ); + ]; foreach ($hidden as $key) { @@ -305,7 +306,7 @@ public function &getConfig() * * @since 1.6 */ - public function &getInfo() + public function &getInfo(): array { if (!empty($this->info)) { @@ -314,7 +315,7 @@ public function &getInfo() $db = $this->getDbo(); - $this->info = array( + $this->info = [ 'php' => php_uname(), 'dbserver' => $db->getServerType(), 'dbversion' => $db->getVersion(), @@ -327,7 +328,7 @@ public function &getInfo() 'sapi_name' => PHP_SAPI, 'version' => (new Version)->getLongVersion(), 'useragent' => $_SERVER['HTTP_USER_AGENT'] ?? '', - ); + ]; return $this->info; } @@ -339,9 +340,9 @@ public function &getInfo() * * @since 3.4.1 */ - public function phpinfoEnabled() + public function phpinfoEnabled(): bool { - return !in_array('phpinfo', explode(',', ini_get('disable_functions'))); + return !\in_array('phpinfo', explode(',', ini_get('disable_functions'))); } /** @@ -354,7 +355,7 @@ public function phpinfoEnabled() * * @since 3.5 */ - public function getSafeData($dataType, $public = true) + public function getSafeData(string $dataType, bool $public = true): array { if (isset($this->safeData[$dataType])) { @@ -365,7 +366,7 @@ public function getSafeData($dataType, $public = true) if (!method_exists($this, $methodName)) { - return array(); + return []; } $data = $this->$methodName($public); @@ -382,7 +383,7 @@ public function getSafeData($dataType, $public = true) * * @since 1.6 */ - public function &getPHPInfo() + public function &getPHPInfo(): string { if (!$this->phpinfoEnabled()) { @@ -406,7 +407,7 @@ public function &getPHPInfo() $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); $output = preg_replace('#
#', '', $output); $output = str_replace('
', '', $output); - $output = preg_replace('#(.*)<\/tr>#', '$1', $output); + $output = preg_replace('#(.*)#', '$1', $output); $output = str_replace('', '', $output); $output = str_replace('
', '', $output); $this->php_info = $output; @@ -421,7 +422,7 @@ public function &getPHPInfo() * * @since 3.5 */ - public function getPhpInfoArray() + public function getPhpInfoArray(): array { // Already cached if (null !== $this->phpInfoArray) @@ -443,10 +444,10 @@ public function getPhpInfoArray() * * @since 3.5 */ - public function getExtensions() + public function getExtensions(): array { - $installed = array(); - $db = Factory::getDbo(); + $installed = []; + $db = Factory::getContainer()->get('DatabaseDriver'); $query = $db->getQuery(true) ->select('*') ->from($db->quoteName('#__extensions')); @@ -485,7 +486,7 @@ public function getExtensions() continue; } - $installed[$extension->name] = array( + $installed[$extension->name] = [ 'name' => $extension->name, 'type' => $extension->type, 'state' => $extension->enabled ? Text::_('JENABLED') : Text::_('JDISABLED'), @@ -493,16 +494,16 @@ public function getExtensions() 'version' => 'unknown', 'creationDate' => 'unknown', 'authorUrl' => 'unknown', - ); + ]; $manifest = new Registry($extension->manifest_cache); - $extraData = array( + $extraData = [ 'author' => $manifest->get('author', ''), 'version' => $manifest->get('version', ''), 'creationDate' => $manifest->get('creationDate', ''), 'authorUrl' => $manifest->get('authorUrl', '') - ); + ]; $installed[$extension->name] = array_merge($installed[$extension->name], $extraData); } @@ -513,20 +514,21 @@ public function getExtensions() /** * Method to get the directory states * - * @param bool $public If true no information is going to be removed + * @param bool $public If true no information is going to be removed * * @return array States of directories * + * @throws \Exception * @since 1.6 */ - public function getDirectory($public = false) + public function getDirectory(bool $public = false): array { if (!empty($this->directories)) { return $this->directories; } - $this->directories = array(); + $this->directories = []; $registry = Factory::getApplication()->getConfig(); $cparams = ComponentHelper::getParams('com_media'); @@ -679,9 +681,9 @@ public function getDirectory($public = false) * * @since 1.6 */ - private function addDirectory($name, $path, $message = '') + private function addDirectory(string $name, string $path, string $message = ''): void { - $this->directories[$name] = array('writable' => is_writable($path), 'message' => $message,); + $this->directories[$name] = ['writable' => is_writable($path), 'message' => $message,]; } /** @@ -692,7 +694,7 @@ private function addDirectory($name, $path, $message = '') * @note Has to be removed (it is present in the config...) * @since 1.6 */ - public function &getEditor() + public function &getEditor(): string { if (!is_null($this->editor)) { @@ -714,14 +716,14 @@ public function &getEditor() * * @since 3.5 */ - protected function parsePhpInfo($html) + protected function parsePhpInfo(string $html): array { $html = strip_tags($html, '

'); $html = preg_replace('/]*>([^<]+)<\/th>/', '\1', $html); $html = preg_replace('/]*>([^<]+)<\/td>/', '\1', $html); $t = preg_split('/(]*>[^<]+<\/h2>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE); - $r = array(); - $count = count($t); + $r = []; + $count = \count($t); $p1 = '([^<]+)<\/info>'; $p2 = '/' . $p1 . '\s*' . $p1 . '\s*' . $p1 . '/'; $p3 = '/' . $p1 . '\s*' . $p1 . '/'; @@ -738,7 +740,7 @@ protected function parsePhpInfo($html) // 3cols if (preg_match($p2, $val, $matchs)) { - $r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3]),); + $r[$name][trim($matchs[1])] = [trim($matchs[2]), trim($matchs[3]),]; } // 2cols elseif (preg_match($p3, $val, $matchs)) diff --git a/administrator/components/com_admin/tmpl/sysinfo/default_phpsettings.php b/administrator/components/com_admin/tmpl/sysinfo/default_phpsettings.php index 4c132796ffa20..4e89e0a6e3878 100644 --- a/administrator/components/com_admin/tmpl/sysinfo/default_phpsettings.php +++ b/administrator/components/com_admin/tmpl/sysinfo/default_phpsettings.php @@ -153,12 +153,20 @@ - + iconv phpSettings['iconv']); ?> + + + intl + + + phpSettings['intl']); ?> + + diff --git a/administrator/language/en-GB/com_admin.ini b/administrator/language/en-GB/com_admin.ini index 8c630a1a48a5d..2f552c27552cb 100644 --- a/administrator/language/en-GB/com_admin.ini +++ b/administrator/language/en-GB/com_admin.ini @@ -24,6 +24,7 @@ COM_ADMIN_DISABLED_FUNCTIONS="Disabled Functions" COM_ADMIN_DISPLAY_ERRORS="Display Errors" COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON="Download as JSON" COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT="Download as text" +COM_ADMIN_EXTENSION_AVAILABLE="Available" COM_ADMIN_EXTENSIONS="Extensions" COM_ADMIN_FILE_UPLOADS="File Uploads" COM_ADMIN_GLOSSARY="Glossary" @@ -118,7 +119,6 @@ COM_ADMIN_HELP_USERS_USER_MANAGER="Users" COM_ADMIN_HELP_USERS_USER_MANAGER_EDIT="Users: New/Edit" COM_ADMIN_HELP_USERS_USER_NOTES="Users: User Notes" COM_ADMIN_HELP_USERS_USER_NOTES_EDIT="Users: User Notes - New/Edit" -COM_ADMIN_ICONV_AVAILABLE="Iconv Available" COM_ADMIN_JOOMLA_VERSION="Joomla! Version" COM_ADMIN_LICENSE="License" COM_ADMIN_LOG_DIRECTORY="(Log folder)"