public function get_themes()
{
$all_themes = Themes::get_all_data();
$theme_names = Utils::array_map_field($all_themes, 'name');
$available_updates = Options::get('updates_available', array());
foreach ($all_themes as $name => $theme) {
// only themes with a guid can be checked for updates
if (isset($theme['info']->guid)) {
if (isset($available_updates[(string) $theme['info']->guid])) {
// @todo this doesn't use the URL and is therefore worthless
$all_themes[$name]['info']->update = $available_updates[(string) $theme['info']->guid]['latest_version'];
}
}
// If this theme requires a parent to be present and it's not, send an error
if (isset($theme['info']->parent) && !in_array((string) $theme['info']->parent, $theme_names)) {
$all_themes[$name]['req_parent'] = $theme['info']->parent;
}
}
$this->theme->all_themes = $all_themes;
$this->theme->active_theme = Themes::get_active_data(true);
$this->theme->active_theme_dir = $this->theme->active_theme['path'];
// If the active theme is configurable, allow it to configure
$this->theme->active_theme_name = $this->theme->active_theme['info']->name;
$this->theme->configurable = Plugins::filter('theme_config', false, $this->active_theme);
$this->theme->assign('configure', Controller::get_var('configure'));
$this->theme->areas = $this->get_areas(0);
$this->theme->previewed = Themes::get_theme_dir(false);
$this->theme->help = isset($this->theme->active_theme['info']->help) ? $this->theme->active_theme['info']->help : false;
$this->theme->help_active = Controller::get_var('help') == $this->theme->active_theme['dir'];
$this->prepare_block_list();
$blocks_areas_t = DB::get_results('SELECT b.*, ba.scope_id, ba.area, ba.display_order FROM {blocks} b INNER JOIN {blocks_areas} ba ON ba.block_id = b.id ORDER BY ba.scope_id ASC, ba.area ASC, ba.display_order ASC', array());
$blocks_areas = array();
foreach ($blocks_areas_t as $block) {
if (!isset($blocks_areas[$block->scope_id])) {
$blocks_areas[$block->scope_id] = array();
}
$blocks_areas[$block->scope_id][$block->area][$block->display_order] = $block;
}
$this->theme->blocks_areas = $blocks_areas;
$scopes = DB::get_results('SELECT * FROM {scopes} ORDER BY name ASC;');
$scopes = Plugins::filter('get_scopes', $scopes);
$this->theme->scopes = $scopes;
$this->theme->scopeid = 0;
$this->theme->theme_loader = Plugins::filter('theme_loader', '', $this->theme);
$this->theme->display('themes');
}