many updates 😁

This commit is contained in:
Paul Spenke
2023-07-02 21:30:29 +08:00
parent 788a6b323c
commit a529852fd8
29 changed files with 353 additions and 204 deletions
+29
View File
@@ -297,6 +297,9 @@ if (! function_exists('phpb_current_language')) {
return $languageCode;
}
}
if ('/'.explode('?', $urlComponents[0])[0] === phpb_config('website_manager.url')) {
return phpb_config('general.language');
}
}
$languageCode = phpb_config('general.language');
if (in_array($languageCode, array_keys(phpb_active_languages()))) {
@@ -324,6 +327,32 @@ if (! function_exists('phpb_in_module')) {
}
}
if (! function_exists('phpb_themes')) {
/**
* Return all theme configs.
*
* @return array
*/
function phpb_themes()
{
$themes = [];
if (file_exists('themes') && is_dir('themes')) {
$themesDirectory = new DirectoryIterator('themes');
foreach ($themesDirectory as $entry) {
$themeFolder = $entry->getFilename();
$configFile = 'themes/' . $themeFolder . '/config.php';
if ($entry->isDir() && !$entry->isDot() && file_exists($configFile)) {
$themeConfig = include($configFile);
$themes[$themeFolder] = $themeConfig;
}
}
}
return $themes;
}
}
if (! function_exists('phpb_on_url')) {
/**
* Return whether we are currently on the given URL.