web/wp-admin/credits.php
changeset 194 32102edaa81b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
       
     1 <?php
       
     2 /**
       
     3  * Credits administration panel.
       
     4  *
       
     5  * @package WordPress
       
     6  * @subpackage Administration
       
     7  */
       
     8 
       
     9 /** WordPress Administration Bootstrap */
       
    10 require_once( './admin.php' );
       
    11 
       
    12 $title = __( 'Credits' );
       
    13 
       
    14 function wp_credits() {
       
    15 	global $wp_version;
       
    16 	$locale = get_locale();
       
    17 
       
    18 	$results = get_site_transient( 'wordpress_credits_' . $locale );
       
    19 
       
    20 	if ( ! is_array( $results )
       
    21 		|| ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
       
    22 	) {
       
    23 		$response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" );
       
    24 
       
    25 		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
       
    26 			return false;
       
    27 
       
    28 		$results = maybe_unserialize( wp_remote_retrieve_body( $response ) );
       
    29 
       
    30 		if ( ! is_array( $results ) )
       
    31 			return false;
       
    32 
       
    33 		set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // One day
       
    34 	}
       
    35 
       
    36 	return $results;
       
    37 }
       
    38 
       
    39 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
       
    40 	$display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
       
    41 }
       
    42 
       
    43 function _wp_credits_build_object_link( &$data ) {
       
    44 	$data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>';
       
    45 }
       
    46 
       
    47 list( $display_version ) = explode( '-', $wp_version );
       
    48 
       
    49 include( ABSPATH . 'wp-admin/admin-header.php' );
       
    50 ?>
       
    51 <div class="wrap about-wrap">
       
    52 
       
    53 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
       
    54 
       
    55 <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! WordPress %s is already making your website better, faster, and more attractive, just like you!' ), $display_version ); ?></div>
       
    56 
       
    57 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
       
    58 
       
    59 <h2 class="nav-tab-wrapper">
       
    60 	<a href="about.php" class="nav-tab">
       
    61 		<?php _e( 'What&#8217;s New' ); ?>
       
    62 	</a><a href="credits.php" class="nav-tab nav-tab-active">
       
    63 		<?php _e( 'Credits' ); ?>
       
    64 	</a><a href="freedoms.php" class="nav-tab">
       
    65 		<?php _e( 'Freedoms' ); ?>
       
    66 	</a>
       
    67 </h2>
       
    68 
       
    69 <?php
       
    70 
       
    71 $credits = wp_credits();
       
    72 
       
    73 if ( ! $credits ) {
       
    74 	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>.' ),
       
    75 		'http://wordpress.org/about/',
       
    76 		/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
       
    77 		__( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>';
       
    78 	include( ABSPATH . 'wp-admin/admin-footer.php' );
       
    79 	exit;
       
    80 }
       
    81 
       
    82 echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
       
    83 
       
    84 $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
       
    85 
       
    86 foreach ( $credits['groups'] as $group_slug => $group_data ) {
       
    87 	if ( $group_data['name'] ) {
       
    88 		if ( 'Translators' == $group_data['name'] ) {
       
    89 			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
       
    90 			$title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
       
    91 		} elseif ( isset( $group_data['placeholders'] ) ) {
       
    92 			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
       
    93 		} else {
       
    94 			$title = translate( $group_data['name'] );
       
    95 		}
       
    96 
       
    97 		echo '<h4 class="wp-people-group">' . $title . "</h4>\n";
       
    98 	}
       
    99 
       
   100 	if ( ! empty( $group_data['shuffle'] ) )
       
   101 		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
       
   102 
       
   103 	switch ( $group_data['type'] ) {
       
   104 		case 'list' :
       
   105 			array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] );
       
   106 			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
       
   107 			break;
       
   108 		case 'libraries' :
       
   109 			array_walk( $group_data['data'], '_wp_credits_build_object_link' );
       
   110 			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
       
   111 			break;
       
   112 		default:
       
   113 			$compact = 'compact' == $group_data['type'];
       
   114 			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
       
   115 			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
       
   116 			foreach ( $group_data['data'] as $person_data ) {
       
   117 				echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t";
       
   118 				echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">';
       
   119 				$size = 'compact' == $group_data['type'] ? '30' : '60';
       
   120 				echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";
       
   121 				echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t";
       
   122 				if ( ! $compact )
       
   123 					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
       
   124 				echo "</li>\n";
       
   125 			}
       
   126 			echo "</ul>\n";
       
   127 		break;
       
   128 	}
       
   129 }
       
   130 
       
   131 ?>
       
   132 <p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
       
   133 	/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
       
   134 	__( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ); ?></p>
       
   135 
       
   136 </div>
       
   137 <?php
       
   138 
       
   139 include( ABSPATH . 'wp-admin/admin-footer.php' );
       
   140 
       
   141 return;
       
   142 
       
   143 // These are strings returned by the API that we want to be translatable
       
   144 __( 'Project Leaders' );
       
   145 __( 'Extended Core Team' );
       
   146 __( 'Core Developers' );
       
   147 __( 'Recent Rockstars' );
       
   148 __( 'Core Contributors to WordPress %s' );
       
   149 __( 'Contributing Developers' );
       
   150 __( 'Cofounder, Project Lead' );
       
   151 __( 'Lead Developer' );
       
   152 __( 'User Experience Lead' );
       
   153 __( 'Core Developer' );
       
   154 __( 'Core Committer' );
       
   155 __( 'Guest Committer' );
       
   156 __( 'Developer' );
       
   157 __( 'Designer' );
       
   158 __( 'XML-RPC' );
       
   159 __( 'Internationalization' );
       
   160 __( 'External Libraries' );
       
   161 __( 'Icon Design' );