essences['show_1'] = new ThemaMobile($_POST); $this->essences['show_2'] = new ThemaPages($_POST); $this->essences['show_3'] = new ThemaPosts($_POST); $this->essences['show_4'] = new ThemaCategories($_POST); $this->essences['show_5'] = new ThemaExpressions($_POST); $this->essences['show_6'] = new ThemaMain($_POST); if (is_admin()) { add_action('admin_menu', array(&$this, 'cd_switch_theme_add_pages')); add_action('admin_enqueue_scripts', array(&$this, 'thema_scripts'), 1); add_filter("plugin_action_links_" . plugin_basename(__FILE__), array(&$this, "thema_plugin_actions")); /* * Save post data in each thema's essences settings * */ $this->setup_themes(); } add_action('setup_theme', array(&$this, 'cd_switch_theme'), 1); } public function thema_plugin_actions($actions) { array_unshift($actions, "" . __("Settings") . ""); return $actions; } /* * Comparing each thema's essences validation for showing rightly theme. */ public function cd_switch_theme() { $show_essences = $this->essences; ksort($show_essences); foreach ($show_essences as $essence) { // return array of theme template, stylesheet if ($ret_thema = $essence->ret_thema()) { list($template, $stylesheet) = $ret_thema; break; } } $new_theme = wp_get_theme($template); if ($new_theme->exists()) { add_filter( 'template', function() use ($template) { return $template; } ); add_filter( 'stylesheet', function() use ($stylesheet) { return $stylesheet; } ); } else { $def_theme = wp_get_theme(); add_filter( 'template', function() use ($def_theme) { return $def_theme->template; } ); add_filter( 'stylesheet', function() use ($def_theme) { return $def_theme->stylesheet; } ); } } public function cd_switch_theme_add_pages() { add_options_page( self::PAGE_TITLE, self::MENU_TITLE, 'read', 'at_theme_settings', array(&$this, 'at_theme_settings') ); } /* * Viewing all theme's essences settings */ public function at_theme_settings() { ?>

A.T. many themes. Plugin Settings

essences; ksort($show_essences); ?>
show_me(); ?>
essences as $essence) { $essence->setup_me(); } } } new ATManyThemes();