Add argument to get_theme_feature_list() to allow the tags to be returned without hitting the WP.org API. We'll be using this to translate tags. Remove trailing space in the 'Light' string. see #20103.

git-svn-id: https://develop.svn.wordpress.org/trunk@20025 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-02-28 20:38:09 +00:00
parent e6411302f0
commit 11c4081aaf
1 changed files with 8 additions and 7 deletions

View File

@ -270,9 +270,10 @@ function theme_update_available( $theme ) {
* *
* @since 3.1.0 * @since 3.1.0
* *
* @param bool $api Optional. Whether try to fetch tags from the WP.org API. Defaults to true.
* @return array Array of features keyed by category with translations keyed by slug. * @return array Array of features keyed by category with translations keyed by slug.
*/ */
function get_theme_feature_list() { function get_theme_feature_list( $api = true ) {
// Hard-coded list is used if api not accessible. // Hard-coded list is used if api not accessible.
$features = array( $features = array(
__('Colors') => array( __('Colors') => array(
@ -290,7 +291,7 @@ function get_theme_feature_list() {
'white' => __( 'White' ), 'white' => __( 'White' ),
'yellow' => __( 'Yellow' ), 'yellow' => __( 'Yellow' ),
'dark' => __( 'Dark' ), 'dark' => __( 'Dark' ),
'light' => __( 'Light ') 'light' => __( 'Light' ),
), ),
__('Columns') => array( __('Columns') => array(
@ -299,12 +300,12 @@ function get_theme_feature_list() {
'three-columns' => __( 'Three Columns' ), 'three-columns' => __( 'Three Columns' ),
'four-columns' => __( 'Four Columns' ), 'four-columns' => __( 'Four Columns' ),
'left-sidebar' => __( 'Left Sidebar' ), 'left-sidebar' => __( 'Left Sidebar' ),
'right-sidebar' => __( 'Right Sidebar' ) 'right-sidebar' => __( 'Right Sidebar' ),
), ),
__('Width') => array( __('Width') => array(
'fixed-width' => __( 'Fixed Width' ), 'fixed-width' => __( 'Fixed Width' ),
'flexible-width' => __( 'Flexible Width' ) 'flexible-width' => __( 'Flexible Width' ),
), ),
__( 'Features' ) => array( __( 'Features' ) => array(
@ -325,17 +326,17 @@ function get_theme_feature_list() {
'sticky-post' => __( 'Sticky Post' ), 'sticky-post' => __( 'Sticky Post' ),
'theme-options' => __( 'Theme Options' ), 'theme-options' => __( 'Theme Options' ),
'threaded-comments' => __( 'Threaded Comments' ), 'threaded-comments' => __( 'Threaded Comments' ),
'translation-ready' => __( 'Translation Ready' ) 'translation-ready' => __( 'Translation Ready' ),
), ),
__( 'Subject' ) => array( __( 'Subject' ) => array(
'holiday' => __( 'Holiday' ), 'holiday' => __( 'Holiday' ),
'photoblogging' => __( 'Photoblogging' ), 'photoblogging' => __( 'Photoblogging' ),
'seasonal' => __( 'Seasonal' ) 'seasonal' => __( 'Seasonal' ),
) )
); );
if ( !current_user_can('install_themes') ) if ( ! $api || ! current_user_can( 'install_themes' ) )
return $features; return $features;
if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) )