/** * Retrieve current theme display name. * * If the 'current_theme' option has already been set, then it will be returned * instead. If it is not set, then each theme will be iterated over until both * the current stylesheet and current template name. * * @since 1.5.0 * * @return string */ static function get_current_ai1ec_theme() { if ($theme = Ai1ec_Meta::get_option('ai1ec_current_theme')) { return $theme; } $self_instance = new Ai1ec_Themes_List_Table(); $themes = $self_instance->get_themes(); $current_theme = 'Vortex'; if ($themes) { $theme_names = array_keys($themes); $current_template = Ai1ec_Meta::get_option('ai1ec_template'); $current_stylesheet = Ai1ec_Meta::get_option('ai1ec_stylesheet'); foreach ((array) $theme_names as $theme_name) { if ($themes[$theme_name]['Stylesheet'] == $current_stylesheet && $themes[$theme_name]['Template'] == $current_template) { $current_theme = $themes[$theme_name]['Name']; break; } } } update_option('ai1ec_current_theme', $current_theme); return $current_theme; }
/** * get_ai1ec_themes method * * Get a list of AI1EC themes installed (with detailed information) and the * name of currently active theme, as well as detailed sheets information. * * @return array Map with three elements: 'installed', 'activated' * and 'outdated', later indicating outdatedness of themes */ public function get_ai1ec_themes() { global $ai1ec_themes_controller; $themes = array('installed' => array(), 'activated' => array('template' => Ai1ec_Meta::get_option('ai1ec_template'), 'stylesheet' => Ai1ec_Meta::get_option('ai1ec_stylesheet'), 'current_theme' => Ai1ec_Meta::get_option('ai1ec_current_theme')), 'outdated' => (int) $ai1ec_themes_controller->are_themes_outdated()); $ai1ec_theme_list = new Ai1ec_Themes_List_Table(array('inhibit' => true)); $installed = $ai1ec_theme_list->get_themes(); foreach ($installed as $theme) { $themes['installed'][$theme->get_stylesheet()] = $this->_theme_to_array($theme); } unset($ai1ec_theme_list, $installed); return $themes; }