+ /**
+ * Provides theme information by parsing theme.ini file if present in the theme's root directory.
+ * In all cases, the following data will be returned:
+ * - name: theme's name, or key if the theme is unnamed,
+ * - current: boolean informing if the theme is the current user theme.
+ *
+ * @param string $theme Theme key (directory name)
+ * @return array|boolean Theme information, or false if the theme doesn't exist.
+ */
+ public function getThemeInfo($theme) {
+ if (!is_dir(THEME . '/' . $theme)) {
+ return false;
+ }
+
+ $themeIniFile = THEME . '/' . $theme . '/theme.ini';
+ $themeInfo = array();
+
+ if (is_file($themeIniFile) && is_readable($themeIniFile)) {
+ $themeInfo = parse_ini_file($themeIniFile);
+ }
+
+ if ($themeInfo === false) {
+ $themeInfo = array();
+ }
+ if (!isset($themeInfo['name'])) {
+ $themeInfo['name'] = $theme;
+ }
+ $themeInfo['current'] = ($theme === $this->getTheme());
+
+ return $themeInfo;