PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/wp-admin/credits.php

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