WordPress.org

Make WordPress Core

Changeset 18001


Ignore:
Timestamp:
05/23/2011 12:08:51 AM (7 years ago)
Author:
nacin
Message:

Update the Credits page for changes in the API. see #17532.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/credits.php

    r17980 r18001  
    2828    $locale = get_locale();
    2929
    30     $results = get_site_transient( 'wordpress_credits' );
     30    $results = get_site_transient( 'wordpress_credits_' . $locale );
    3131
    32     if ( !is_array( $results ) || !isset( $results['people'] ) ) {
     32    if ( ! is_array( $results ) || ! isset( $results['people'] ) || ! isset( $results['lists'] ) ) {
    3333        $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" );
    3434
     
    3838        $results = unserialize( wp_remote_retrieve_body( $response ) );
    3939
    40         if ( !is_array( $results ) )
     40        if ( ! is_array( $results ) )
    4141            return false;
    4242
    43         set_site_transient( 'wordpress_credits', $results, 604800 ); // One week.
     43        set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // @todo Set to one week.
    4444    }
    4545
     
    6161$results = wp_credits();
    6262
    63 if ( !isset( $results['people'] ) ) {
     63if ( ! $results ) {
    6464    echo '<p>' . sprintf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
    6565        'http://wordpress.org/about/',
     
    8686}
    8787
    88 if ( isset( $results['props'] ) ) {
    89     echo '<h3 class="wp-props-group">' . sprintf( translate( $results['groups']['props'] ), $results['data']['version'] ) . "</h3>\n\n";
    90     array_walk( $results['props'], '_wp_credits_add_profile_link', $results['data']['profile_prefix'] );
    91     shuffle( $results['props'] );
    92     echo wp_sprintf( '%l.', $results['props'] );
     88foreach ( (array) $results['lists'] as $group_slug => $members ) {
     89    $title = translate( $results['groups'][ $group_slug ] );
     90    if ( isset( $results['data']['placeholders'][ $group_slug ] ) )
     91        $title = vsprintf( $title, $results['data']['placeholders'][ $group_slug ] );
     92    echo '<h3 class="wp-props-group">' . $title . "</h3>\n\n";
     93    array_walk( $members, '_wp_credits_add_profile_link', $results['data']['profile_prefix'] );
     94    shuffle( $members );
     95    echo wp_sprintf( '%l.', $members );
    9396}
    9497
     
    108111__( 'Recent Rockstars' );
    109112__( 'Core Contributors to WordPress %s' );
     113__( 'Translators for %s' );
    110114__( 'Cofounder, Project Lead' );
    111115__( 'Lead Developer' );
     
    116120__( 'XML-RPC Developer' );
    117121__( 'Internationalization' );
     122__( 'Twenty Eleven' );
    118123
    119124?>
Note: See TracChangeset for help on using the changeset viewer.