PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-admin/credits.php

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