Changeset 15655 for trunk/wp-admin/includes/theme.php
- Timestamp:
- 09/24/2010 03:28:28 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/theme.php
r15300 r15655 251 251 } 252 252 253 /** 254 * Retrieve list of WordPress theme features (aka theme tags) 255 * 256 * @since 3.1.0 257 * 258 * @return array Array of features keyed by category with translations keyed by slug. 259 */ 260 function get_theme_feature_list() { 261 // Hard-coded list is used if api not accessible. 262 $features = array( 263 __('Colors') => array( 264 'black' => __( 'Black' ), 265 'blue' => __( 'Blue' ), 266 'brown' => __( 'Brown' ), 267 'green' => __( 'Green' ), 268 'orange' => __( 'Orange' ), 269 'pink' => __( 'Pink' ), 270 'purple' => __( 'Purple' ), 271 'red' => __( 'Red' ), 272 'silver' => __( 'Silver' ), 273 'tan' => __( 'Tan' ), 274 'white' => __( 'White' ), 275 'yellow' => __( 'Yellow' ), 276 'dark' => __( 'Dark' ), 277 'light' => __( 'Light ') 278 ), 279 280 __('Columns') => array( 281 'one-column' => __( 'One Column' ), 282 'two-columns' => __( 'Two Columns' ), 283 'three-columns' => __( 'Three Columns' ), 284 'four-columns' => __( 'Four Columns' ), 285 'left-sidebar' => __( 'Left Sidebar' ), 286 'right-sidebar' => __( 'Right Sidebar' ) 287 ), 288 289 __('Width') => array( 290 'fixed-width' => __( 'Fixed Width' ), 291 'flexible-width' => __( 'Flexible Width' ) 292 ), 293 294 __( 'Features' ) => array( 295 'blavatar' => __( 'Blavatar' ), 296 'buddypress' => __( 'BuddyPress' ), 297 'custom-background' => __( 'Custom Background' ), 298 'custom-colors' => __( 'Custom Colors' ), 299 'custom-header' => __( 'Custom Header' ), 300 'custom-menu' => __( 'Custom Menu' ), 301 'editor-style' => __( 'Editor Style' ), 302 'front-page-post-form' => __( 'Front Page Posting' ), 303 'microformats' => __( 'Microformats' ), 304 'sticky-post' => __( 'Sticky Post' ), 305 'theme-options' => __( 'Theme Options' ), 306 'threaded-comments' => __( 'Threaded Comments' ), 307 'translation-ready' => __( 'Translation Ready' ), 308 'rtl-language-support' => __( 'RTL Language Support' ) 309 ), 310 311 __( 'Subject' ) => array( 312 'holiday' => __( 'Holiday' ), 313 'photoblogging' => __( 'Photoblogging' ), 314 'seasonal' => __( 'Seasonal' ) 315 ) 316 ); 317 318 if ( !current_user_can('install_themes') ) 319 return $features; 320 321 if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) 322 set_site_transient( 'wporg_theme_feature_list', array( ), 10800); 323 324 if ( !$feature_list ) { 325 $feature_list = themes_api( 'feature_list', array( ) ); 326 if ( is_wp_error( $feature_list ) ) 327 return $features; 328 } 329 330 if ( !$feature_list ) 331 return $features; 332 333 set_site_transient( 'wporg_theme_feature_list', $feature_list, 10800 ); 334 335 $category_translations = array( 'Colors' => __('Colors'), 'Columns' => __('Columns'), 'Width' => __('Width'), 336 'Features' => __('Features'), 'Subject' => __('Subject') ); 337 338 // Loop over the wporg canonical list and apply translations 339 $wporg_features = array(); 340 foreach ( (array) $feature_list as $feature_category => $feature_items ) { 341 if ( isset($category_translations[$feature_category]) ) 342 $feature_category = $category_translations[$feature_category]; 343 $wporg_features[$feature_category] = array(); 344 345 foreach ( $feature_items as $feature ) { 346 if ( isset($features[$feature_category][$feature]) ) 347 $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature]; 348 else 349 $wporg_features[$feature_category][$feature] = $feature; 350 } 351 } 352 353 return $wporg_features; 354 } 355 253 356 ?>
Note: See TracChangeset
for help on using the changeset viewer.