]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/credits.php
WordPress 3.8.1
[autoinstalls/wordpress.git] / wp-admin / credits.php
1 <?php
2 /**
3  * Credits administration panel.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** WordPress Administration Bootstrap */
10 require_once( dirname( __FILE__ ) . '/admin.php' );
11
12 $title = __( 'Credits' );
13
14 /**
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                 || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
31         ) {
32                 $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" );
33
34                 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
35                         return false;
36
37                 $results = json_decode( wp_remote_retrieve_body( $response ), true );
38
39                 if ( ! is_array( $results ) )
40                         return false;
41
42                 set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
43         }
44
45         return $results;
46 }
47
48 /**
49  * Retrieve the link to a contributor's WordPress.org profile page.
50  *
51  * @access private
52  * @since 3.2.0
53  *
54  * @param string &$display_name The contributor's display name, passed by reference.
55  * @param string $username      The contributor's username.
56  * @param string $profiles      URL to the contributor's WordPress.org profile page.
57  * @return string A contributor's display name, hyperlinked to a WordPress.org profile page.
58  */
59 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
60         $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
61 }
62
63 /**
64  * Retrieve the link to an external library used in WordPress.
65  *
66  * @access private
67  * @since 3.2.0
68  *
69  * @param string &$data External library data, passed by reference.
70  * @return string Link to the external library.
71  */
72 function _wp_credits_build_object_link( &$data ) {
73         $data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>';
74 }
75
76 list( $display_version ) = explode( '-', $wp_version );
77
78 include( ABSPATH . 'wp-admin/admin-header.php' );
79 ?>
80 <div class="wrap about-wrap">
81
82 <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
83
84 <div class="about-text"><?php printf( __( 'Thank you for updating to WordPress %s, the most beautiful WordPress&nbsp;yet.' ), $display_version ); ?></div>
85
86 <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
87
88 <h2 class="nav-tab-wrapper">
89         <a href="about.php" class="nav-tab">
90                 <?php _e( 'What&#8217;s New' ); ?>
91         </a><a href="credits.php" class="nav-tab nav-tab-active">
92                 <?php _e( 'Credits' ); ?>
93         </a><a href="freedoms.php" class="nav-tab">
94                 <?php _e( 'Freedoms' ); ?>
95         </a>
96 </h2>
97
98 <?php
99
100 $credits = wp_credits();
101
102 if ( ! $credits ) {
103         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>.' ),
104                 'http://wordpress.org/about/',
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         include( ABSPATH . 'wp-admin/admin-footer.php' );
108         exit;
109 }
110
111 echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
112
113 $gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
114
115 foreach ( $credits['groups'] as $group_slug => $group_data ) {
116         if ( $group_data['name'] ) {
117                 if ( 'Translators' == $group_data['name'] ) {
118                         // Considered a special slug in the API response. (Also, will never be returned for en_US.)
119                         $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
120                 } elseif ( isset( $group_data['placeholders'] ) ) {
121                         $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
122                 } else {
123                         $title = translate( $group_data['name'] );
124                 }
125
126                 echo '<h4 class="wp-people-group">' . $title . "</h4>\n";
127         }
128
129         if ( ! empty( $group_data['shuffle'] ) )
130                 shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
131
132         switch ( $group_data['type'] ) {
133                 case 'list' :
134                         array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] );
135                         echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
136                         break;
137                 case 'libraries' :
138                         array_walk( $group_data['data'], '_wp_credits_build_object_link' );
139                         echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
140                         break;
141                 default:
142                         $compact = 'compact' == $group_data['type'];
143                         $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
144                         echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
145                         foreach ( $group_data['data'] as $person_data ) {
146                                 echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t";
147                                 echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">';
148                                 $size = 'compact' == $group_data['type'] ? '30' : '60';
149                                 echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";
150                                 echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t";
151                                 if ( ! $compact )
152                                         echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
153                                 echo "</li>\n";
154                         }
155                         echo "</ul>\n";
156                 break;
157         }
158 }
159
160 ?>
161 <p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
162         /* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */
163         __( 'http://make.wordpress.org/' ) ); ?></p>
164
165 </div>
166 <?php
167
168 include( ABSPATH . 'wp-admin/admin-footer.php' );
169
170 return;
171
172 // These are strings returned by the API that we want to be translatable
173 __( 'Project Leaders' );
174 __( 'Extended Core Team' );
175 __( 'Core Developers' );
176 __( 'Recent Rockstars' );
177 __( 'Core Contributors to WordPress %s' );
178 __( 'Contributing Developers' );
179 __( 'Cofounder, Project Lead' );
180 __( 'Lead Developer' );
181 __( 'User Experience Lead' );
182 __( 'Core Developer' );
183 __( 'Core Committer' );
184 __( 'Guest Committer' );
185 __( 'Developer' );
186 __( 'Designer' );
187 __( 'XML-RPC' );
188 __( 'Internationalization' );
189 __( 'External Libraries' );
190 __( 'Icon Design' );