Skip to content

Commit 6ce7b43

Browse files
committed
Display more theme info. see WordPress#8652
git-svn-id: https://develop.svn.wordpress.org/trunk@10668 602fd350-edb4-49c9-b593-d223f7449a82
1 parent eebd7df commit 6ce7b43

3 files changed

Lines changed: 80 additions & 9 deletions

File tree

wp-admin/css/theme-install.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */
2+
div.star-holder {
3+
position: relative;
4+
height: 19px;
5+
width: 100px;
6+
font-size: 19px;
7+
}
8+
9+
div.star {
10+
height: 100%;
11+
position: absolute;
12+
top: 0;
13+
left: 0;
14+
background-color: transparent;
15+
letter-spacing: 1ex;
16+
border: none;
17+
}
18+
19+
.star1 { width: 20%; }
20+
.star2 { width: 40%; }
21+
.star3 { width: 60%; }
22+
.star4 { width: 80%; }
23+
.star5 { width: 100%; }
24+
25+
.star img, div.star a, div.star a:hover, div.star a:visited {
26+
display: block;
27+
position: absolute;
28+
right: 0;
29+
border: none;
30+
text-decoration: none;
31+
}
32+
33+
div.star img {
34+
width: 19px;
35+
height: 19px;
36+
border-left: 1px solid #fff;
37+
border-right: 1px solid #fff;
38+
}
39+
140
.theme-listing .theme-item {
241
display: inline-block;
342
width: 200px;

wp-admin/includes/theme-install.php

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
*/
88

99
$themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
10-
'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
11-
'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
12-
'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
13-
'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
14-
'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
10+
'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
11+
'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
12+
'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
13+
'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
14+
'img' => array('src' => array(), 'class' => array(), 'alt' => array())
15+
);
16+
17+
$theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true,
18+
'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true,
19+
'tags' => true, 'num_ratings' => true
20+
);
21+
1522

1623
/**
1724
* Retrieve theme installer pages from WordPress Themes API.
@@ -67,12 +74,15 @@ function themes_api($action, $args = null) {
6774
* @return array
6875
*/
6976
function install_themes_popular_tags( $args = array() ) {
77+
global $theme_field_defaults;
7078
if ( !$cache = get_option('wporg_theme_popular_tags') )
7179
add_option('wporg_theme_popular_tags', array(), '', 'no'); ///No autoload.
7280

7381
if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
7482
return $cache->cached;
7583

84+
$args['fields'] = $theme_field_defaults;
85+
7686
$tags = themes_api('hot_tags', $args);
7787

7888
if ( is_wp_error($tags) )
@@ -115,6 +125,7 @@ function install_theme_search($page) {
115125
}
116126

117127
$args['page'] = $page;
128+
$args['fields'] = $theme_field_defaults;
118129

119130
$api = themes_api('query_themes', $args);
120131

@@ -194,7 +205,8 @@ class="button" /></form>
194205
* @param string $page
195206
*/
196207
function install_themes_featured($page = 1) {
197-
$args = array('browse' => 'featured', 'page' => $page);
208+
global $theme_field_defaults;
209+
$args = array('browse' => 'featured', 'page' => $page, 'fields' => $theme_field_defaults);
198210
$api = themes_api('query_themes', $args);
199211
if ( is_wp_error($api) )
200212
wp_die($api);
@@ -210,7 +222,8 @@ function install_themes_featured($page = 1) {
210222
* @param string $page
211223
*/
212224
function install_themes_popular($page = 1) {
213-
$args = array('browse' => 'popular', 'page' => $page);
225+
global $theme_field_defaults;
226+
$args = array('browse' => 'popular', 'page' => $page, 'fields' => $theme_field_defaults);
214227
$api = themes_api('query_themes', $args);
215228
display_themes($api->themes, $api->info['page'], $api->info['pages']);
216229
}
@@ -224,7 +237,8 @@ function install_themes_popular($page = 1) {
224237
* @param string $page
225238
*/
226239
function install_themes_new($page = 1) {
227-
$args = array('browse' => 'new', 'page' => $page);
240+
global $theme_field_defaults;
241+
$args = array('browse' => 'new', 'page' => $page, 'fields' => $theme_field_defaults);
228242
$api = themes_api('query_themes', $args);
229243
if ( is_wp_error($api) )
230244
wp_die($api);
@@ -240,7 +254,8 @@ function install_themes_new($page = 1) {
240254
* @param string $page
241255
*/
242256
function install_themes_updated($page = 1) {
243-
$args = array('browse' => 'updated', 'page' => $page);
257+
global $theme_field_defaults;
258+
$args = array('browse' => 'updated', 'page' => $page, 'fields' => $theme_field_defaults);
244259
$api = themes_api('query_themes', $args);
245260
display_themes($api->themes, $api->info['page'], $api->info['pages']);
246261
}
@@ -291,6 +306,22 @@ function display_theme($theme, $actions = null, $show_details = true) {
291306
<div id="themedetaildiv" class="hide-if-js">
292307
<p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p>
293308
<p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p>
309+
<p><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $theme->last_updated ?>"><?php printf( __('%s ago'), human_time_diff(strtotime($theme->last_updated)) ) ?></span></p>
310+
<?php if ( ! empty($theme->requires) ) : ?>
311+
<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
312+
<?php endif; if ( ! empty($theme->tested) ) : ?>
313+
<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
314+
<?php endif; if ( !empty($theme->downloaded) ) : ?>
315+
<p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p>
316+
<?php endif; ?>
317+
<div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $theme->num_ratings), number_format_i18n($theme->num_ratings)) ?>">
318+
<div class="star star-rating" style="width: <?php echo attribute_escape($theme->rating) ?>px"></div>
319+
<div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
320+
<div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
321+
<div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
322+
<div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
323+
<div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
324+
</div>
294325
</div>
295326
<?php }
296327
/*

wp-includes/script-loader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ function wp_default_styles( &$styles ) {
445445
$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20081210' );
446446
$styles->add( 'login', '/wp-admin/css/login.css', array(), '20081210' );
447447
$styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20081210' );
448+
$styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090227' );
448449
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
449450

450451
foreach ( $rtl_styles as $rtl_style )

0 commit comments

Comments
 (0)