From 0e3ffd10954d803c7dda230effdeea29291d2f3e Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 27 Feb 2009 21:22:49 +0000 Subject: [PATCH] Display more theme info. see #8652 git-svn-id: http://svn.automattic.com/wordpress/trunk@10668 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/theme-install.css | 39 +++++++++++++++++++++++ wp-admin/includes/theme-install.php | 49 +++++++++++++++++++++++------ wp-includes/script-loader.php | 1 + 3 files changed, 80 insertions(+), 9 deletions(-) diff --git a/wp-admin/css/theme-install.css b/wp-admin/css/theme-install.css index 013494941e..53a0d14f57 100644 --- a/wp-admin/css/theme-install.css +++ b/wp-admin/css/theme-install.css @@ -1,3 +1,42 @@ +/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */ +div.star-holder { + position: relative; + height: 19px; + width: 100px; + font-size: 19px; +} + +div.star { + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: transparent; + letter-spacing: 1ex; + border: none; +} + +.star1 { width: 20%; } +.star2 { width: 40%; } +.star3 { width: 60%; } +.star4 { width: 80%; } +.star5 { width: 100%; } + +.star img, div.star a, div.star a:hover, div.star a:visited { + display: block; + position: absolute; + right: 0; + border: none; + text-decoration: none; +} + +div.star img { + width: 19px; + height: 19px; + border-left: 1px solid #fff; + border-right: 1px solid #fff; +} + .theme-listing .theme-item { display: inline-block; width: 200px; diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index 4e6182bb56..9c5149f457 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -7,11 +7,18 @@ */ $themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), - 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), - 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), - 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), - 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), - 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); + 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), + 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), + 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), + 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), + 'img' => array('src' => array(), 'class' => array(), 'alt' => array()) +); + +$theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true, + 'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true, + 'tags' => true, 'num_ratings' => true +); + /** * Retrieve theme installer pages from WordPress Themes API. @@ -67,12 +74,15 @@ function themes_api($action, $args = null) { * @return array */ function install_themes_popular_tags( $args = array() ) { + global $theme_field_defaults; if ( !$cache = get_option('wporg_theme_popular_tags') ) add_option('wporg_theme_popular_tags', array(), '', 'no'); ///No autoload. if ( $cache && $cache->timeout + 3 * 60 * 60 > time() ) return $cache->cached; + $args['fields'] = $theme_field_defaults; + $tags = themes_api('hot_tags', $args); if ( is_wp_error($tags) ) @@ -115,6 +125,7 @@ function install_theme_search($page) { } $args['page'] = $page; + $args['fields'] = $theme_field_defaults; $api = themes_api('query_themes', $args); @@ -194,7 +205,8 @@ add_action('install_themes_featured', 'install_themes_featured', 10, 1); * @param string $page */ function install_themes_featured($page = 1) { - $args = array('browse' => 'featured', 'page' => $page); + global $theme_field_defaults; + $args = array('browse' => 'featured', 'page' => $page, 'fields' => $theme_field_defaults); $api = themes_api('query_themes', $args); if ( is_wp_error($api) ) wp_die($api); @@ -210,7 +222,8 @@ add_action('install_thems_popular', 'install_themes_popular', 10, 1); * @param string $page */ function install_themes_popular($page = 1) { - $args = array('browse' => 'popular', 'page' => $page); + global $theme_field_defaults; + $args = array('browse' => 'popular', 'page' => $page, 'fields' => $theme_field_defaults); $api = themes_api('query_themes', $args); display_themes($api->themes, $api->info['page'], $api->info['pages']); } @@ -224,7 +237,8 @@ add_action('install_themes_new', 'install_themes_new', 10, 1); * @param string $page */ function install_themes_new($page = 1) { - $args = array('browse' => 'new', 'page' => $page); + global $theme_field_defaults; + $args = array('browse' => 'new', 'page' => $page, 'fields' => $theme_field_defaults); $api = themes_api('query_themes', $args); if ( is_wp_error($api) ) wp_die($api); @@ -240,7 +254,8 @@ add_action('install_themes_updated', 'install_themes_updated', 10, 1); * @param string $page */ function install_themes_updated($page = 1) { - $args = array('browse' => 'updated', 'page' => $page); + global $theme_field_defaults; + $args = array('browse' => 'updated', 'page' => $page, 'fields' => $theme_field_defaults); $api = themes_api('query_themes', $args); display_themes($api->themes, $api->info['page'], $api->info['pages']); } @@ -291,6 +306,22 @@ function display_theme($theme, $actions = null, $show_details = true) {

version, $themes_allowedtags) ?>

author, $themes_allowedtags) ?>

+

last_updated)) ) ?>

+requires) ) : ?> +

requires) ?>

+tested) ) : ?> +

tested ?>

+downloaded) ) : ?> +

downloaded), number_format_i18n($theme->downloaded)) ?>

+ +
+
+
<?php _e('5 stars') ?>
+
<?php _e('4 stars') ?>
+
<?php _e('3 stars') ?>
+
<?php _e('2 stars') ?>
+
<?php _e('1 star') ?>
+
add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20081210' ); $styles->add( 'login', '/wp-admin/css/login.css', array(), '20081210' ); $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20081210' ); + $styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090227' ); $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' ); foreach ( $rtl_styles as $rtl_style )