示例#1
0
 /**
  * Sets a theme to be the current user's preview theme
  *
  * @param string $theme_name The name of the theme to preview
  * @param string $theme_dir The directory of the theme to preview
  */
 public static function preview_theme($theme_name, $theme_dir)
 {
     $ok = Themes::validate_theme($theme_dir);
     if ($ok) {
         $_SESSION['user_theme_name'] = $theme_name;
         $_SESSION['user_theme_dir'] = $theme_dir;
         // Execute the theme's activated action
         $preview_theme = Themes::create();
         Plugins::act_id('theme_activated', $preview_theme->plugin_id(), $theme_name, $preview_theme);
         EventLog::log(_t('Previewed Theme: %s', array($theme_name)), 'notice', 'theme', 'habari');
     }
     return $ok;
 }