wp/wp-admin/credits.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
       
    11 require_once( dirname( __FILE__ ) . '/includes/credits.php' );
    11 
    12 
    12 $title = __( 'Credits' );
    13 $title = __( 'Credits' );
    13 
    14 
    14 /**
    15 list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
    15  * Retrieve the contributor credits.
       
    16  *
       
    17  * @global string $wp_version The current WordPress version.
       
    18  *
       
    19  * @since 3.2.0
       
    20  *
       
    21  * @return array|bool 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 private
       
    53  * @since 3.2.0
       
    54  *
       
    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  * @return string A contributor's display name, hyperlinked to a WordPress.org profile page.
       
    59  */
       
    60 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
       
    61 	$display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
       
    62 }
       
    63 
       
    64 /**
       
    65  * Retrieve the link to an external library used in WordPress.
       
    66  *
       
    67  * @access private
       
    68  * @since 3.2.0
       
    69  *
       
    70  * @param string &$data External library data, passed by reference.
       
    71  * @return string Link to the external library.
       
    72  */
       
    73 function _wp_credits_build_object_link( &$data ) {
       
    74 	$data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>';
       
    75 }
       
    76 
       
    77 list( $display_version ) = explode( '-', $wp_version );
       
    78 
    16 
    79 include( ABSPATH . 'wp-admin/admin-header.php' );
    17 include( ABSPATH . 'wp-admin/admin-header.php' );
    80 ?>
    18 ?>
    81 <div class="wrap about-wrap">
    19 <div class="wrap about-wrap full-width-layout">
    82 
    20 
    83 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
    21 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
    84 
    22 
    85 <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s helps you communicate and share, globally.' ), $display_version ); ?></div>
    23 <p class="about-text"><?php printf( __( 'Thank you for updating to the latest version! WordPress %s will smooth your design workflow and keep you safe from coding errors.' ), $display_version ); ?></p>
    86 
    24 
    87 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
    25 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
    88 
    26 
    89 <h2 class="nav-tab-wrapper">
    27 <h2 class="nav-tab-wrapper wp-clearfix">
    90 	<a href="about.php" class="nav-tab">
    28 	<a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
    91 		<?php _e( 'What&#8217;s New' ); ?>
    29 	<a href="credits.php" class="nav-tab nav-tab-active"><?php _e( 'Credits' ); ?></a>
    92 	</a><a href="credits.php" class="nav-tab nav-tab-active">
    30 	<a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
    93 		<?php _e( 'Credits' ); ?>
    31 	<a href="freedoms.php?privacy-notice" class="nav-tab"><?php _e( 'Privacy' ); ?></a>
    94 	</a><a href="freedoms.php" class="nav-tab">
       
    95 		<?php _e( 'Freedoms' ); ?>
       
    96 	</a>
       
    97 </h2>
    32 </h2>
    98 
    33 
       
    34 <div class="about-wrap-content">
    99 <?php
    35 <?php
   100 
    36 
   101 $credits = wp_credits();
    37 $credits = wp_credits();
   102 
    38 
   103 if ( ! $credits ) {
    39 if ( ! $credits ) {
   104 	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>.' ),
    40 	echo '<p class="about-description">';
       
    41 	/* translators: 1: https://wordpress.org/about/, 2: https://make.wordpress.org/ */
       
    42 	printf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
   105 		'https://wordpress.org/about/',
    43 		'https://wordpress.org/about/',
   106 		/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
    44 		__( 'https://make.wordpress.org/' )
   107 		__( 'https://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>';
    45 	);
       
    46 	echo '</p>';
       
    47 	echo '</div>';
       
    48 	echo '</div>';
   108 	include( ABSPATH . 'wp-admin/admin-footer.php' );
    49 	include( ABSPATH . 'wp-admin/admin-footer.php' );
   109 	exit;
    50 	exit;
   110 }
    51 }
   111 
    52 
   112 echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
    53 echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
   113 
    54 
   114 $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
    55 echo '<p>' . sprintf(
       
    56 	/* translators: %s: https://make.wordpress.org/ */
       
    57 	__( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
       
    58 	__( 'https://make.wordpress.org/' )
       
    59 ) . '</p>';
   115 
    60 
   116 foreach ( $credits['groups'] as $group_slug => $group_data ) {
    61 foreach ( $credits['groups'] as $group_slug => $group_data ) {
   117 	if ( $group_data['name'] ) {
    62 	if ( $group_data['name'] ) {
   118 		if ( 'Translators' == $group_data['name'] ) {
    63 		if ( 'Translators' == $group_data['name'] ) {
   119 			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
    64 			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
   122 			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
    67 			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
   123 		} else {
    68 		} else {
   124 			$title = translate( $group_data['name'] );
    69 			$title = translate( $group_data['name'] );
   125 		}
    70 		}
   126 
    71 
   127 		echo '<h4 class="wp-people-group">' . $title . "</h4>\n";
    72 		echo '<h3 class="wp-people-group">' . esc_html( $title ) . "</h3>\n";
   128 	}
    73 	}
   129 
    74 
   130 	if ( ! empty( $group_data['shuffle'] ) )
    75 	if ( ! empty( $group_data['shuffle'] ) )
   131 		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
    76 		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
   132 
    77 
   142 		default:
    87 		default:
   143 			$compact = 'compact' == $group_data['type'];
    88 			$compact = 'compact' == $group_data['type'];
   144 			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
    89 			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
   145 			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
    90 			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
   146 			foreach ( $group_data['data'] as $person_data ) {
    91 			foreach ( $group_data['data'] as $person_data ) {
   147 				echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t";
    92 				echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t";
   148 				echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">';
    93 				echo '<a href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '" class="web">';
   149 				$size = 'compact' == $group_data['type'] ? '30' : '60';
    94 				$size = 'compact' == $group_data['type'] ? 30 : 60;
   150 				echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" srcset="' . $gravatar . $person_data[1] . '?s=' . $size * 2 . ' 2x" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";
    95 				$data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );
   151 				echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t";
    96 				$size *= 2;
       
    97 				$data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );
       
    98 				echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" />' . "\n";
       
    99 				echo esc_html( $person_data[0] ) . "</a>\n\t";
   152 				if ( ! $compact )
   100 				if ( ! $compact )
   153 					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
   101 					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
   154 				echo "</li>\n";
   102 				echo "</li>\n";
   155 			}
   103 			}
   156 			echo "</ul>\n";
   104 			echo "</ul>\n";
   157 		break;
   105 		break;
   158 	}
   106 	}
   159 }
   107 }
   160 
   108 
   161 ?>
   109 ?>
   162 <p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
   110 </div>
   163 	/* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */
       
   164 	__( 'https://make.wordpress.org/' ) ); ?></p>
       
   165 
       
   166 </div>
   111 </div>
   167 <?php
   112 <?php
   168 
   113 
   169 include( ABSPATH . 'wp-admin/admin-footer.php' );
   114 include( ABSPATH . 'wp-admin/admin-footer.php' );
   170 
   115 
   171 return;
   116 return;
   172 
   117 
   173 // These are strings returned by the API that we want to be translatable
   118 // These are strings returned by the API that we want to be translatable
   174 __( 'Project Leaders' );
   119 __( 'Project Leaders' );
   175 __( 'Extended Core Team' );
       
   176 __( 'Core Developers' );
       
   177 __( 'Recent Rockstars' );
       
   178 __( 'Core Contributors to WordPress %s' );
   120 __( 'Core Contributors to WordPress %s' );
   179 __( 'Contributing Developers' );
   121 __( 'Noteworthy Contributors' );
   180 __( 'Cofounder, Project Lead' );
   122 __( 'Cofounder, Project Lead' );
   181 __( 'Lead Developer' );
   123 __( 'Lead Developer' );
   182 __( 'Release Lead' );
   124 __( 'Release Lead' );
   183 __( 'User Experience Lead' );
   125 __( 'Release Design Lead' );
       
   126 __( 'Release Deputy' );
   184 __( 'Core Developer' );
   127 __( 'Core Developer' );
   185 __( 'Core Committer' );
       
   186 __( 'Guest Committer' );
       
   187 __( 'Developer' );
       
   188 __( 'Designer' );
       
   189 __( 'XML-RPC' );
       
   190 __( 'Internationalization' );
       
   191 __( 'External Libraries' );
   128 __( 'External Libraries' );
   192 __( 'Icon Design' );