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

git-svn-id: https://develop.svn.wordpress.org/trunk@18001 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-05-23 00:08:51 +00:00
parent e53a69b9d3
commit 891be1229a
1 changed files with 15 additions and 10 deletions

View File

@ -27,9 +27,9 @@ function wp_credits() {
global $wp_version; global $wp_version;
$locale = get_locale(); $locale = get_locale();
$results = get_site_transient( 'wordpress_credits' ); $results = get_site_transient( 'wordpress_credits_' . $locale );
if ( !is_array( $results ) || !isset( $results['people'] ) ) { if ( ! is_array( $results ) || ! isset( $results['people'] ) || ! isset( $results['lists'] ) ) {
$response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" ); $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" );
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
@ -37,10 +37,10 @@ function wp_credits() {
$results = unserialize( wp_remote_retrieve_body( $response ) ); $results = unserialize( wp_remote_retrieve_body( $response ) );
if ( !is_array( $results ) ) if ( ! is_array( $results ) )
return false; return false;
set_site_transient( 'wordpress_credits', $results, 604800 ); // One week. set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // @todo Set to one week.
} }
return $results; return $results;
@ -60,7 +60,7 @@ include( './admin-header.php' );
$results = wp_credits(); $results = wp_credits();
if ( !isset( $results['people'] ) ) { if ( ! $results ) {
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>.' ), 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>.' ),
'http://wordpress.org/about/', 'http://wordpress.org/about/',
_x( 'http://codex.wordpress.org/Contributing_to_WordPress', 'Url to the codex documentation on contributing to WordPress used on the credits page' ) ) . '</p>'; _x( 'http://codex.wordpress.org/Contributing_to_WordPress', 'Url to the codex documentation on contributing to WordPress used on the credits page' ) ) . '</p>';
@ -85,11 +85,14 @@ foreach ( (array) $results['people'] as $group_slug => $members ) {
echo "</ul>\n"; echo "</ul>\n";
} }
if ( isset( $results['props'] ) ) { foreach ( (array) $results['lists'] as $group_slug => $members ) {
echo '<h3 class="wp-props-group">' . sprintf( translate( $results['groups']['props'] ), $results['data']['version'] ) . "</h3>\n\n"; $title = translate( $results['groups'][ $group_slug ] );
array_walk( $results['props'], '_wp_credits_add_profile_link', $results['data']['profile_prefix'] ); if ( isset( $results['data']['placeholders'][ $group_slug ] ) )
shuffle( $results['props'] ); $title = vsprintf( $title, $results['data']['placeholders'][ $group_slug ] );
echo wp_sprintf( '%l.', $results['props'] ); echo '<h3 class="wp-props-group">' . $title . "</h3>\n\n";
array_walk( $members, '_wp_credits_add_profile_link', $results['data']['profile_prefix'] );
shuffle( $members );
echo wp_sprintf( '%l.', $members );
} }
?> ?>
@ -107,6 +110,7 @@ __( 'Project Leaders' );
__( 'Extended Core Team' ); __( 'Extended Core Team' );
__( 'Recent Rockstars' ); __( 'Recent Rockstars' );
__( 'Core Contributors to WordPress %s' ); __( 'Core Contributors to WordPress %s' );
__( 'Translators for %s' );
__( 'Cofounder, Project Lead' ); __( 'Cofounder, Project Lead' );
__( 'Lead Developer' ); __( 'Lead Developer' );
__( 'UI/UX and Community Lead' ); __( 'UI/UX and Community Lead' );
@ -115,5 +119,6 @@ __( 'Developer' );
__( 'Designer' ); __( 'Designer' );
__( 'XML-RPC Developer' ); __( 'XML-RPC Developer' );
__( 'Internationalization' ); __( 'Internationalization' );
__( 'Twenty Eleven' );
?> ?>