. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Theme\ThemeInterface; /** * Provide access to the current theme. */ class Theme { /** * PHP 5.3.2 requires a constructor when there is also a method * called theme() */ private function __construct() { } /** @var ThemeInterface The current theme*/ private static $theme; /** @var ThemeInterface[] All currently installed themes */ private static $installed_themes; /** * Create a list of all themes available on the system, including * any custom themes. * * @return ThemeInterface[] */ public static function installedThemes() { if (self::$installed_themes === null) { self::$installed_themes = array(); foreach (glob(WT_ROOT . '/themes/*/theme.php') as $theme_path) { try { $theme = include $theme_path; // Themes beginning with an underscore are reserved for special use. if (substr_compare($theme->themeId(), '_', 0, 1) !== 0) { self::$installed_themes[] = $theme; } } catch (\Exception $ex) { // Broken theme? Ignore it. } } } return self::$installed_themes; } /** * An associative array of theme names, for