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 */
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.
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 */
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 ) )
200212 wp_die ($ api );
@@ -210,7 +222,8 @@ function install_themes_featured($page = 1) {
210222 * @param string $page
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 ' ]);
216229}
@@ -224,7 +237,8 @@ function install_themes_popular($page = 1) {
224237 * @param string $page
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 ) )
230244 wp_die ($ api );
@@ -240,7 +254,8 @@ function install_themes_new($page = 1) {
240254 * @param string $page
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 ' ]);
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 /*
0 commit comments