WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/27/2009 09:22:49 PM (12 years ago)
Author:
ryan
Message:

Display more theme info. see #8652

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/theme-install.php

    r10667 r10668  
    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/**
     
    6875 */
    6976function 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.
     
    7381    if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
    7482        return $cache->cached;
     83
     84    $args['fields'] = $theme_field_defaults;
    7585
    7686    $tags = themes_api('hot_tags', $args);
     
    116126
    117127    $args['page'] = $page;
     128    $args['fields'] = $theme_field_defaults;
    118129
    119130    $api = themes_api('query_themes', $args);
     
    195206 */
    196207function 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) )
     
    211223 */
    212224function 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']);
     
    225238 */
    226239function 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) )
     
    241255 */
    242256function 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']);
     
    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 }
Note: See TracChangeset for help on using the changeset viewer.