[ XREF Home ] [ Index ]

PHP Cross Reference of WordPress Trunk

Provided by Yoast

title

Body

[close]

/wp-admin/ -> credits.php (source)

   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  $parent_file = 'index.php';
  14  
  15  add_action( 'admin_head', '_wp_credits_add_css' );
  16  function _wp_credits_add_css() { ?>
  17  <style type="text/css">
  18  h3.wp-people-group, h3.wp-props-group { clear: both; }
  19  ul.wp-people-group { margin-bottom: 50px; }
  20  li.wp-person { float: left; height: 100px; width: 240px; margin-right: 20px; }
  21  li.wp-person img.gravatar { float: left; margin-right: 10px; margin-bottom: 10px; width: 60px; height: 60px }
  22  li.wp-person a.web { font-size: 16px; text-decoration: none; }
  23  </style>
  24  <?php }
  25  
  26  function wp_credits() {
  27      global $wp_version;
  28      $locale = get_locale();
  29  
  30      $results = get_site_transient( 'wordpress_credits_' . $locale );
  31  
  32      if ( ! is_array( $results ) || ! isset( $results['people'] ) || ! isset( $results['lists'] ) ) {
  33          $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?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 = unserialize( wp_remote_retrieve_body( $response ) );
  39  
  40          if ( ! is_array( $results ) )
  41              return false;
  42  
  43          set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // @todo Set to one week.
  44      }
  45  
  46      return $results;
  47  }
  48  
  49  function _wp_credits_add_profile_link( &$display_name, $username, $prefix ) {
  50      $display_name = '<a href="' . esc_url( $prefix . $username ) . '">' . esc_html( $display_name ) . '</a>';
  51  }
  52  
  53  include ( './admin-header.php' );
  54  ?>
  55  <div class="wrap">
  56  <?php screen_icon(); ?>
  57  <h2><?php _e( 'WordPress Credits' ); ?></h2>
  58  
  59  <?php
  60  
  61  $results = wp_credits();
  62  
  63  if ( ! $results ) {
  64      echo '<p>' . 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>.' ),
  65          'http://wordpress.org/about/',
  66          /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
  67          __( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>';
  68      include ( './admin-footer.php' );
  69      exit;
  70  }
  71  
  72  echo '<p>' . __( 'WordPress is created by a worldwide team of passionate individuals. We couldn&#8217;t possibly list them all, but here some of the most influential people currently involved with the project:' ) . "</p>\n";
  73  
  74  $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
  75  
  76  foreach ( (array) $results['people'] as $group_slug => $members ) {
  77      echo '<h3 class="wp-people-group">' . translate( $results['groups'][ $group_slug ] ) . "</h3>\n";
  78      echo '<ul class="wp-people-group" id="wp-people-group-' . $group_slug . '">' . "\n";
  79      shuffle( $members ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
  80      foreach ( $members as $member_slug => $member ) {
  81          echo '<li class="wp-person" id="wp-person-' . $member_slug . '">' . "\n\t";
  82          echo '<a href="' . $results['data']['profile_prefix'] . $member[2] . '"><img src="' . $gravatar . $member[3] . '?s=60" class="gravatar" alt="' . esc_attr( $member[0] ) . '" /></a>' . "\n\t";
  83          echo '<a class="web" href="' . $results['data']['profile_prefix'] . $member[2] . '">' . $member[0] . "</a>\n\t";
  84          echo '<br /><span class="title">' . translate( $member[1] ) . "</span>\n</li>\n";
  85      }
  86      echo "</ul>\n";
  87  }
  88  
  89  foreach ( (array) $results['lists'] as $group_slug => $members ) {
  90      if ( $group_slug === 'translators' ) {
  91          // Considered a special slug in the API response. (Also, will never be returned for en_US.)
  92          $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
  93      } else {
  94          $title = translate( $results['groups'][ $group_slug ] );
  95          if ( isset( $results['data']['placeholders'][ $group_slug ] ) )
  96              $title = vsprintf( $title, $results['data']['placeholders'][ $group_slug ] );
  97      }
  98  
  99      echo '<h3 class="wp-props-group">' . $title . "</h3>\n\n";
 100      array_walk( $members, '_wp_credits_add_profile_link', $results['data']['profile_prefix'] );
 101      shuffle( $members );
 102      echo '<p>' . wp_sprintf( '%l.', $members ) . "</p>\n\n";
 103  }
 104  
 105  ?>
 106  <p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
 107      /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
 108      __( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ); ?></p>
 109  
 110  </div>
 111  <?php
 112  
 113  include ( './admin-footer.php' );
 114  
 115  return;
 116  
 117  // These are strings returned by the API that we want to be translatable
 118  __( 'Project Leaders' );
 119  __( 'Extended Core Team' );
 120  __( 'Recent Rockstars' );
 121  __( 'Core Contributors to WordPress %s' );
 122  __( 'Cofounder, Project Lead' );
 123  __( 'Lead Developer' );
 124  __( 'User Experience Lead' );
 125  __( 'Developer, Core Committer' );
 126  __( 'Developer' );
 127  __( 'Designer' );
 128  __( 'XML-RPC Developer' );
 129  __( 'Internationalization' );
 130  
 131  ?>


Generated: Wed Jun 1 08:30:02 2011 Cross-referenced by PHPXref 0.7
Provided by Yoast and awesome WordPress Hosting