Habari\Themes::get_all_data PHP Метод

get_all_data() публичный статический Метод

Returns all theme information -- dir, path, theme.xml, screenshot url
public static get_all_data ( ) : array
Результат array An array of Theme data
    public static function get_all_data()
    {
        if (!isset(self::$all_data)) {
            foreach (self::get_all() as $theme_dir => $theme_path) {
                $themedata = array();
                $themedata['dir'] = $theme_dir;
                $themedata['path'] = $theme_path;
                $themedata['theme_dir'] = $theme_path;
                $themedata['info'] = simplexml_load_file($theme_path . '/theme.xml');
                $themedata['info']['filename'] = $theme_path . '/theme.xml';
                if ($themedata['info']->getName() != 'pluggable' || (string) $themedata['info']->attributes()->type != 'theme') {
                    $themedata['screenshot'] = Site::get_url('admin_theme') . "/images/screenshot_default.png";
                    $themedata['info']->description = '<span class="error">' . _t('This theme is a legacy theme that is not compatible with Habari ') . Version::get_habariversion() . '. <br><br>Please update your theme.</span>';
                    $themedata['info']->license = '';
                } else {
                    foreach ($themedata['info'] as $name => $value) {
                        if ($value->count() == 0) {
                            $themedata[$name] = (string) $value;
                        } else {
                            $themedata[$name] = $value->children();
                        }
                    }
                    if ($screenshot = Utils::glob($theme_path . '/screenshot.{png,jpg,gif}', GLOB_BRACE)) {
                        $themedata['screenshot'] = Site::get_url('habari') . dirname(str_replace(HABARI_PATH, '', $theme_path)) . '/' . basename($theme_path) . "/" . basename(reset($screenshot));
                    } else {
                        $themedata['screenshot'] = Site::get_url('admin_theme') . "/images/screenshot_default.png";
                    }
                }
                self::$all_data[$theme_dir] = $themedata;
            }
        }
        return self::$all_data;
    }