Changeset 18162
- Timestamp:
- 06/06/2011 06:38:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/credits.php
r18149 r18162 25 25 function _wp_credits_add_css() { ?> 26 26 <style type="text/css"> 27 h3.wp-people-group, h3.wp-props-group { clear: both; } 27 div.wrap { max-width: 750px } 28 h3.wp-people-group, p.wp-credits-list { clear: both; } 29 ul.compact { margin-bottom: 0 } 30 28 31 <?php if ( is_rtl() ) { ?> 29 32 ul.wp-people-group { margin-bottom: 30px; float: right; clear: both; } 30 33 li.wp-person { float: right; height: 70px; width: 220px; margin-left: 10px; } 31 li.wp-person img.gravatar { float: right; margin-left: 10px; margin-bottom: 10px; width: 60px; height: 60px}34 li.wp-person img.gravatar { float: right; margin-left: 10px; margin-bottom: 10px; } 32 35 <?php } else { ?> 33 ul.wp-people-group { margin-bottom: 30px; float: left; clear: both; } 34 li.wp-person { float: left; height: 70px; width: 220px; margin-right: 10px; } 35 li.wp-person img.gravatar { float: left; margin-right: 10px; margin-bottom: 10px; width: 60px; height: 60px } 36 li.wp-person { float: left; margin-right: 10px; } 37 li.wp-person img.gravatar { float: left; margin-right: 10px; margin-bottom: 10px; } 36 38 <?php } ?> 39 li.wp-person img.gravatar { width: 60px; height: 60px; } 40 ul.compact li.wp-person img.gravatar { width: 30px; height: 30px; } 41 li.wp-person { height: 70px; width: 220px; } 42 ul.compact li.wp-person { height: 40px; width: auto; white-space: nowrap } 37 43 li.wp-person a.web { font-size: 16px; text-decoration: none; } 38 44 </style> … … 45 51 $results = get_site_transient( 'wordpress_credits_' . $locale ); 46 52 47 if ( ! is_array( $results ) || ! isset( $results['people'] ) || ! isset( $results['lists'] )) {48 $response = wp_remote_get( "http://api.wordpress.org/core/credits/1. 0/?version=$wp_version&locale=$locale" );53 if ( ! is_array( $results ) ) { 54 $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" ); 49 55 50 56 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 51 57 return false; 52 58 53 $results = unserialize( wp_remote_retrieve_body( $response ) );59 $results = maybe_unserialize( wp_remote_retrieve_body( $response ) ); 54 60 55 61 if ( ! is_array( $results ) ) … … 62 68 } 63 69 64 function _wp_credits_add_profile_link( &$display_name, $username, $prefix ) { 65 $display_name = '<a href="' . esc_url( $prefix . $username ) . '">' . esc_html( $display_name ) . '</a>'; 70 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { 71 $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; 72 } 73 74 function _wp_credits_build_object_link( &$data ) { 75 $data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>'; 66 76 } 67 77 … … 74 84 <?php 75 85 76 $ results = wp_credits();86 $credits = wp_credits(); 77 87 78 if ( ! $ results ) {88 if ( ! $credits ) { 79 89 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>.' ), 80 90 'http://wordpress.org/about/', … … 89 99 $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/'; 90 100 91 foreach ( (array) $results['people'] as $group_slug => $members ) { 92 echo '<h3 class="wp-people-group">' . translate( $results['groups'][ $group_slug ] ) . "</h3>\n"; 93 echo '<ul class="wp-people-group" id="wp-people-group-' . $group_slug . '">' . "\n"; 94 shuffle( $members ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. 95 foreach ( $members as $member_slug => $member ) { 96 echo '<li class="wp-person" id="wp-person-' . $member_slug . '">' . "\n\t"; 97 echo '<a href="' . $results['data']['profile_prefix'] . $member[2] . '"><img src="' . $gravatar . $member[3] . '?s=60" class="gravatar" alt="' . esc_attr( $member[0] ) . '" /></a>' . "\n\t"; 98 echo '<a class="web" href="' . $results['data']['profile_prefix'] . $member[2] . '">' . $member[0] . "</a>\n\t"; 99 echo '<br /><span class="title">' . translate( $member[1] ) . "</span>\n</li>\n"; 100 } 101 echo "</ul>\n"; 102 } 101 foreach ( $credits['groups'] as $group_slug => $group_data ) { 102 if ( $group_data['name'] ) { 103 if ( 'Translators' == $group_data['name'] ) { 104 // Considered a special slug in the API response. (Also, will never be returned for en_US.) 105 $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); 106 } elseif ( isset( $group_data['placeholders'] ) ) { 107 $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); 108 } else { 109 $title = $group_data['name']; 110 } 103 111 104 foreach ( (array) $results['lists'] as $group_slug => $members ) { 105 if ( $group_slug === 'translators' ) { 106 // Considered a special slug in the API response. (Also, will never be returned for en_US.) 107 $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); 108 } else { 109 $title = translate( $results['groups'][ $group_slug ] ); 110 if ( isset( $results['data']['placeholders'][ $group_slug ] ) ) 111 $title = vsprintf( $title, $results['data']['placeholders'][ $group_slug ] ); 112 echo '<h3 class="wp-people-group">' . $title . "</h3>\n"; 112 113 } 113 114 114 echo '<h3 class="wp-props-group">' . $title . "</h3>\n\n"; 115 array_walk( $members, '_wp_credits_add_profile_link', $results['data']['profile_prefix'] ); 116 shuffle( $members ); 117 echo '<p>' . wp_sprintf( '%l.', $members ) . "</p>\n\n"; 115 if ( ! empty( $group_data['shuffle'] ) ) 116 shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. 117 118 switch ( $group_data['type'] ) { 119 case 'list' : 120 array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] ); 121 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 122 break; 123 case 'libraries' : 124 array_walk( $group_data['data'], '_wp_credits_build_object_link' ); 125 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 126 break; 127 default: 128 $compact = 'compact' == $group_data['type']; 129 $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); 130 echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n"; 131 foreach ( $group_data['data'] as $person_data ) { 132 echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t"; 133 echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">'; 134 $size = 'compact' == $group_data['type'] ? '30' : '60'; 135 echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t"; 136 echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t"; 137 if ( ! $compact ) 138 echo '<br /><span class="title">' . translate( $person_data[3] ) . "</span>\n"; 139 echo "</li>\n"; 140 } 141 echo "</ul>\n"; 142 break; 143 } 118 144 } 119 145 … … 138 164 __( 'Lead Developer' ); 139 165 __( 'User Experience Lead' ); 140 __( 'Developer, Core Committer' ); 166 __( 'Core Committer' ); 167 __( 'Guest Committer' ); 141 168 __( 'Developer' ); 142 169 __( 'Designer' ); 143 170 __( 'XML-RPC Developer' ); 144 171 __( 'Internationalization' ); 172 __( 'External Libraries' ); 145 173 146 174 ?>
Note: See TracChangeset
for help on using the changeset viewer.