Changeset 34036
- Timestamp:
- 09/11/2015 04:54:20 AM (8 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/credits.php
r33695 r34036 9 9 /** WordPress Administration Bootstrap */ 10 10 require_once( dirname( __FILE__ ) . '/admin.php' ); 11 require_once( dirname( __FILE__ ) . '/includes/credits.php' ); 11 12 12 13 $title = __( 'Credits' ); 13 14 /**15 * Retrieve the contributor credits.16 *17 * @global string $wp_version The current WordPress version.18 *19 * @since 3.2.020 *21 * @return array|false A list of all of the contributors, or false on error.22 */23 function wp_credits() {24 global $wp_version;25 $locale = get_locale();26 27 $results = get_site_transient( 'wordpress_credits_' . $locale );28 29 if ( ! is_array( $results )30 || false !== strpos( $wp_version, '-' )31 || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )32 ) {33 $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" );34 35 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )36 return false;37 38 $results = json_decode( wp_remote_retrieve_body( $response ), true );39 40 if ( ! is_array( $results ) )41 return false;42 43 set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );44 }45 46 return $results;47 }48 49 /**50 * Retrieve the link to a contributor's WordPress.org profile page.51 *52 * @access private53 * @since 3.2.054 *55 * @param string &$display_name The contributor's display name, passed by reference.56 * @param string $username The contributor's username.57 * @param string $profiles URL to the contributor's WordPress.org profile page.58 */59 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {60 $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';61 }62 63 /**64 * Retrieve the link to an external library used in WordPress.65 *66 * @access private67 * @since 3.2.068 *69 * @param string &$data External library data, passed by reference.70 */71 function _wp_credits_build_object_link( &$data ) {72 $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>';73 }74 14 75 15 list( $display_version ) = explode( '-', $wp_version ); -
trunk/src/wp-admin/includes/credits.php
r34035 r34036 1 1 <?php 2 2 /** 3 * Credits administration panel.3 * WordPress Credits Administration API. 4 4 * 5 5 * @package WordPress 6 6 * @subpackage Administration 7 * @since 4.4.0 7 8 */ 8 9 /** WordPress Administration Bootstrap */10 require_once( dirname( __FILE__ ) . '/admin.php' );11 12 $title = __( 'Credits' );13 9 14 10 /** … … 72 68 $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>'; 73 69 } 74 75 list( $display_version ) = explode( '-', $wp_version );76 77 include( ABSPATH . 'wp-admin/admin-header.php' );78 ?>79 <div class="wrap about-wrap">80 81 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>82 83 <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.' ), $display_version ); ?></div>84 85 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>86 87 <h2 class="nav-tab-wrapper">88 <a href="about.php" class="nav-tab">89 <?php _e( 'What’s New' ); ?>90 </a><a href="credits.php" class="nav-tab nav-tab-active">91 <?php _e( 'Credits' ); ?>92 </a><a href="freedoms.php" class="nav-tab">93 <?php _e( 'Freedoms' ); ?>94 </a>95 </h2>96 97 <?php98 99 $credits = wp_credits();100 101 if ( ! $credits ) {102 echo '<p class="about-description">' . 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>.' ),103 'https://wordpress.org/about/',104 /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */105 __( 'https://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>';106 include( ABSPATH . 'wp-admin/admin-footer.php' );107 exit;108 }109 110 echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";111 112 foreach ( $credits['groups'] as $group_slug => $group_data ) {113 if ( $group_data['name'] ) {114 if ( 'Translators' == $group_data['name'] ) {115 // Considered a special slug in the API response. (Also, will never be returned for en_US.)116 $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );117 } elseif ( isset( $group_data['placeholders'] ) ) {118 $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );119 } else {120 $title = translate( $group_data['name'] );121 }122 123 echo '<h4 class="wp-people-group">' . esc_html( $title ) . "</h4>\n";124 }125 126 if ( ! empty( $group_data['shuffle'] ) )127 shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.128 129 switch ( $group_data['type'] ) {130 case 'list' :131 array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] );132 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";133 break;134 case 'libraries' :135 array_walk( $group_data['data'], '_wp_credits_build_object_link' );136 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";137 break;138 default:139 $compact = 'compact' == $group_data['type'];140 $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );141 echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";142 foreach ( $group_data['data'] as $person_data ) {143 echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t";144 echo '<a href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '">';145 $size = 'compact' == $group_data['type'] ? 30 : 60;146 $data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );147 $size *= 2;148 $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );149 echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";150 echo '<a class="web" href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '">' . esc_html( $person_data[0] ) . "</a>\n\t";151 if ( ! $compact )152 echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";153 echo "</li>\n";154 }155 echo "</ul>\n";156 break;157 }158 }159 160 ?>161 <p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),162 /* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */163 __( 'https://make.wordpress.org/' ) ); ?></p>164 165 </div>166 <?php167 168 include( ABSPATH . 'wp-admin/admin-footer.php' );169 170 return;171 172 // These are strings returned by the API that we want to be translatable173 __( 'Project Leaders' );174 __( 'Extended Core Team' );175 __( 'Core Developers' );176 __( 'Recent Rockstars' );177 __( 'Core Contributors to WordPress %s' );178 __( 'Contributing Developers' );179 __( 'Cofounder, Project Lead' );180 __( 'Lead Developer' );181 __( 'Release Lead' );182 __( 'User Experience Lead' );183 __( 'Core Developer' );184 __( 'Core Committer' );185 __( 'Guest Committer' );186 __( 'Developer' );187 __( 'Designer' );188 __( 'Docs Committer' );189 __( 'XML-RPC' );190 __( 'Internationalization' );191 __( 'External Libraries' );192 __( 'Icon Design' );
Note: See TracChangeset
for help on using the changeset viewer.