mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
ee121a076e
commit
d2e83e3d2c
@ -1399,4 +1399,20 @@ function get_importers() {
|
||||
return $wp_importers;
|
||||
}
|
||||
|
||||
?>
|
||||
function current_theme_info() {
|
||||
$themes = get_themes();
|
||||
$current_theme = get_current_theme();
|
||||
$ct->title = $themes[$current_theme]['Title'];
|
||||
$ct->version = $themes[$current_theme]['Version'];
|
||||
$ct->parent_theme = $themes[$current_theme]['Parent Theme'];
|
||||
$ct->template_dir = $themes[$current_theme]['Template Dir'];
|
||||
$ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
|
||||
$ct->template = $themes[$current_theme]['Template'];
|
||||
$ct->stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
$ct->screenshot = $themes[$current_theme]['Screenshot'];
|
||||
$ct->description = $themes[$current_theme]['Description'];
|
||||
$ct->author = $themes[$current_theme]['Author'];
|
||||
return $ct;
|
||||
}
|
||||
|
||||
?>
|
@ -26,7 +26,7 @@ foreach ($menu as $item) {
|
||||
// Sub-menu
|
||||
if ( isset($submenu["$parent_file"]) ) :
|
||||
?>
|
||||
<ul id="adminmenu2">
|
||||
<ul id="submenu">
|
||||
<?php
|
||||
foreach ($submenu["$parent_file"] as $item) :
|
||||
if ( !current_user_can($item[1]) )
|
||||
|
@ -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'); ?>
|
@ -161,19 +161,27 @@ textarea, input, select {
|
||||
}
|
||||
|
||||
.available-theme {
|
||||
width: 250px;
|
||||
margin-right: 2.5em;
|
||||
width: 30%;
|
||||
margin: 0 1em;
|
||||
float: left;
|
||||
text-align: center;
|
||||
height: 28em;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.available-theme span {
|
||||
.available-theme a.screenshot {
|
||||
width: 250px;
|
||||
height: 187px;
|
||||
height: 200px;
|
||||
display: block;
|
||||
margin: auto;
|
||||
background: #f1f1f1;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.available-theme a.screenshot:hover {
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
.available-theme img {
|
||||
@ -301,7 +309,7 @@ table .vers, table .name {
|
||||
padding: .2em .2em .2em 2em;
|
||||
}
|
||||
|
||||
#adminmenu .current, #adminmenu2 .current {
|
||||
#adminmenu .current, #submenu .current {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@ -319,40 +327,40 @@ table .vers, table .name {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#adminmenu li, #adminmenu2 li {
|
||||
#adminmenu li, #submenu li {
|
||||
display: inline;
|
||||
line-height: 200%;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#adminmenu2 {
|
||||
#submenu {
|
||||
background: #0d324f;;
|
||||
border-bottom: none;
|
||||
margin: 0;
|
||||
padding: 3px 2em 0 3em;
|
||||
}
|
||||
|
||||
#adminmenu2 .current {
|
||||
#submenu .current {
|
||||
background: #ddeaf4;
|
||||
border-top: 1px solid #045290;
|
||||
border-right: 2px solid #045290;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#adminmenu2 a {
|
||||
#submenu a {
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
padding: .3em .4em .33em;
|
||||
}
|
||||
|
||||
#adminmenu2 a:hover {
|
||||
#submenu a:hover {
|
||||
background: #ddeaf4;
|
||||
color: #393939;
|
||||
}
|
||||
|
||||
#adminmenu2 li {
|
||||
#submenu li {
|
||||
line-height: 170%;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user