Make sure we have an array on the Credits page. Handles situations where non-array data is sometimes cached.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2011-05-17 16:36:37 +00:00
parent 9d72f52bab
commit 4eaf5b3ed9

View File

@ -29,7 +29,7 @@ function wp_credits() {
$results = get_site_transient( 'wordpress_credits' ); $results = get_site_transient( 'wordpress_credits' );
if ( false === $results ) { if ( !is_array( $results ) ) {
$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,7 +37,7 @@ function wp_credits() {
$results = unserialize( wp_remote_retrieve_body( $response ) ); $results = unserialize( wp_remote_retrieve_body( $response ) );
if ( ! $results ) if ( !is_array( $results ) )
return false; return false;
set_site_transient( 'wordpress_credits', $results, 604800 ); // One week. set_site_transient( 'wordpress_credits', $results, 604800 ); // One week.
@ -60,7 +60,7 @@ include( './admin-header.php' );
$results = wp_credits(); $results = wp_credits();
if ( ! $results ) { if ( !isset( $results['people'] ) ) {
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/',
'http://codex.wordpress.org/Contributing_to_WordPress' ) . '</p>'; 'http://codex.wordpress.org/Contributing_to_WordPress' ) . '</p>';
@ -72,7 +72,7 @@ echo '<p>' . __( "WordPress is created by a worldwide team of passionate individ
$gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/'; $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
foreach ( $results['people'] as $group_slug => $members ) { foreach ( (array) $results['people'] as $group_slug => $members ) {
echo '<h3 class="wp-people-group">' . translate( $results['groups'][ $group_slug ] ) . "</h3>\n"; echo '<h3 class="wp-people-group">' . translate( $results['groups'][ $group_slug ] ) . "</h3>\n";
echo '<ul class="wp-people-group" id="wp-people-group-' . $group_slug . '">' . "\n"; echo '<ul class="wp-people-group" id="wp-people-group-' . $group_slug . '">' . "\n";
shuffle( $members ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. shuffle( $members ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.