Fix menu annoyance. Clean up themes.php code.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -3,57 +3,49 @@ require_once('admin.php');
|
||||
|
||||
if ( isset($_GET['action']) ) {
|
||||
check_admin_referer();
|
||||
|
||||
|
||||
if ('activate' == $_GET['action']) {
|
||||
if (isset($_GET['template'])) {
|
||||
update_option('template', $_GET['template']);
|
||||
}
|
||||
|
||||
if (isset($_GET['stylesheet'])) {
|
||||
update_option('stylesheet', $_GET['stylesheet']);
|
||||
}
|
||||
|
||||
if ( isset($_GET['template']) )
|
||||
update_option('template', $_GET['template']);
|
||||
|
||||
if ( isset($_GET['stylesheet']) )
|
||||
update_option('stylesheet', $_GET['stylesheet']);
|
||||
|
||||
do_action('switch_theme', get_current_theme());
|
||||
|
||||
header('Location: themes.php?activated=true');
|
||||
|
||||
header('Location: themes.php?activated=true');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$title = __('Manage Themes');
|
||||
$parent_file = 'themes.php';
|
||||
require_once('admin-header.php');
|
||||
?>
|
||||
|
||||
<?php if ( ! validate_current_theme() ) : ?>
|
||||
<div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
|
||||
<?php elseif ( isset($activated) ) : ?>
|
||||
<?php elseif ( isset($_GET['activated']) ) : ?>
|
||||
<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site »</a>'), get_bloginfo('home')); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$themes = get_themes();
|
||||
$current_theme = get_current_theme();
|
||||
$current_title = $themes[$current_theme]['Title'];
|
||||
$current_version = $themes[$current_theme]['Version'];
|
||||
$current_parent_theme = $themes[$current_theme]['Parent Theme'];
|
||||
$current_template_dir = $themes[$current_theme]['Template Dir'];
|
||||
$current_stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
|
||||
$current_template = $themes[$current_theme]['Template'];
|
||||
$current_stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
$current_screenshot = $themes[$current_theme]['Screenshot'];
|
||||
$ct = current_theme_info();
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Current Theme'); ?></h2>
|
||||
<div id="currenttheme">
|
||||
<?php if ( $current_screenshot ) : ?>
|
||||
<img src="<?php echo get_option('siteurl') . '/' . $current_stylesheet_dir . '/' . $current_screenshot; ?>" alt="Current theme preview" />
|
||||
<?php if ( $ct->screenshot ) : ?>
|
||||
<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
|
||||
<?php endif; ?>
|
||||
<h3><?php printf(__('%1$s %2$s by %3$s'), $current_title, $current_version, $themes[$current_theme]['Author']) ; ?></h3>
|
||||
<p><?php echo $themes[$current_theme]['Description']; ?></p>
|
||||
<?php if ($current_parent_theme) { ?>
|
||||
<p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $current_theme, $current_template_dir, $current_stylesheet_dir, $current_theme, $current_parent_theme); ?></p>
|
||||
<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3>
|
||||
<p><?php echo $ct->description; ?></p>
|
||||
<?php if ($ct->parent_theme) { ?>
|
||||
<p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
|
||||
<?php } else { ?>
|
||||
<p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $current_theme, $current_template_dir, $current_stylesheet_dir); ?></p>
|
||||
<p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -77,55 +69,27 @@ foreach ($theme_names as $theme_name) {
|
||||
$author = $themes[$theme_name]['Author'];
|
||||
$screenshot = $themes[$theme_name]['Screenshot'];
|
||||
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
|
||||
$activate_link = "themes.php?action=activate&template=$template&stylesheet=$stylesheet";
|
||||
?>
|
||||
<div class="available-theme">
|
||||
<h3><a href="<?php echo "themes.php?action=activate&template=$template&stylesheet=$stylesheet"; ?>"><?php echo "$title $version"; ?>
|
||||
<span>
|
||||
<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3>
|
||||
|
||||
<a href="<?php echo $activate_link; ?>" class="screenshot">
|
||||
<?php if ( $screenshot ) : ?>
|
||||
<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</a></h3>
|
||||
</a>
|
||||
|
||||
<p><?php echo $description; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
/*
|
||||
if ($template == $current_template && $stylesheet == $current_stylesheet) {
|
||||
$action = '<strong>' . __('Active Theme') . '</strong>';
|
||||
$current = true;
|
||||
} else {
|
||||
$action = "<a href='' title='" . __('Select this theme') . "' class='edit'>" . __('Select') . '</a>';
|
||||
$current = false;
|
||||
}
|
||||
<?php } // end foreach theme_names ?>
|
||||
|
||||
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
|
||||
if ($current) $style .= $style == 'alternate' ? ' active' : 'active';
|
||||
if ($style != '') $style = 'class="' . $style . '"';
|
||||
|
||||
echo "
|
||||
<tr $style>";
|
||||
if ( $current )
|
||||
echo "<td><strong>$title $version</strong></td>";
|
||||
else
|
||||
echo "<td></td>";
|
||||
echo "
|
||||
<td class=\"auth\">$author</td>
|
||||
<td class=\"desc\">$description</td>
|
||||
<td class=\"togl\">$action</td>
|
||||
</tr>";
|
||||
*/
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
// List broken themes, if any.
|
||||
$broken_themes = get_broken_themes();
|
||||
if (count($broken_themes)) {
|
||||
if ( count($broken_themes) ) {
|
||||
?>
|
||||
|
||||
<h2><?php _e('Broken Themes'); ?></h2>
|
||||
@@ -160,10 +124,8 @@ if (count($broken_themes)) {
|
||||
?>
|
||||
|
||||
<h2><?php _e('Get More Themes'); ?></h2>
|
||||
<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you may activate it on this page.'); ?></p>
|
||||
<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include('admin-footer.php');
|
||||
?>
|
||||
<?php require('admin-footer.php'); ?>
|
||||
Reference in New Issue
Block a user