0
|
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 |
* |
5
|
21 |
* @return array|bool A list of all of the contributors, or false on error. |
0
|
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 ) |
5
|
30 |
|| false !== strpos( $wp_version, '-' ) |
0
|
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. |
5
|
56 |
* @param string $username The contributor's username. |
0
|
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 |
|
|
79 |
include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
80 |
?> |
|
81 |
<div class="wrap about-wrap"> |
|
82 |
|
|
83 |
<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
84 |
|
5
|
85 |
<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s helps you communicate and share, globally.' ), $display_version ); ?></div> |
0
|
86 |
|
|
87 |
<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
88 |
|
|
89 |
<h2 class="nav-tab-wrapper"> |
|
90 |
<a href="about.php" class="nav-tab"> |
|
91 |
<?php _e( 'What’s New' ); ?> |
|
92 |
</a><a href="credits.php" class="nav-tab nav-tab-active"> |
|
93 |
<?php _e( 'Credits' ); ?> |
|
94 |
</a><a href="freedoms.php" class="nav-tab"> |
|
95 |
<?php _e( 'Freedoms' ); ?> |
|
96 |
</a> |
|
97 |
</h2> |
|
98 |
|
|
99 |
<?php |
|
100 |
|
|
101 |
$credits = wp_credits(); |
|
102 |
|
|
103 |
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>.' ), |
5
|
105 |
'https://wordpress.org/about/', |
0
|
106 |
/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */ |
5
|
107 |
__( 'https://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>'; |
0
|
108 |
include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
109 |
exit; |
|
110 |
} |
|
111 |
|
|
112 |
echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n"; |
|
113 |
|
|
114 |
$gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/'; |
|
115 |
|
|
116 |
foreach ( $credits['groups'] as $group_slug => $group_data ) { |
|
117 |
if ( $group_data['name'] ) { |
|
118 |
if ( 'Translators' == $group_data['name'] ) { |
|
119 |
// Considered a special slug in the API response. (Also, will never be returned for en_US.) |
|
120 |
$title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); |
|
121 |
} elseif ( isset( $group_data['placeholders'] ) ) { |
|
122 |
$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); |
|
123 |
} else { |
|
124 |
$title = translate( $group_data['name'] ); |
|
125 |
} |
|
126 |
|
|
127 |
echo '<h4 class="wp-people-group">' . $title . "</h4>\n"; |
|
128 |
} |
|
129 |
|
|
130 |
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. |
|
132 |
|
|
133 |
switch ( $group_data['type'] ) { |
|
134 |
case 'list' : |
|
135 |
array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] ); |
|
136 |
echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; |
|
137 |
break; |
|
138 |
case 'libraries' : |
|
139 |
array_walk( $group_data['data'], '_wp_credits_build_object_link' ); |
|
140 |
echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; |
|
141 |
break; |
|
142 |
default: |
|
143 |
$compact = 'compact' == $group_data['type']; |
|
144 |
$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); |
|
145 |
echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n"; |
|
146 |
foreach ( $group_data['data'] as $person_data ) { |
|
147 |
echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t"; |
|
148 |
echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">'; |
|
149 |
$size = 'compact' == $group_data['type'] ? '30' : '60'; |
5
|
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"; |
0
|
151 |
echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t"; |
|
152 |
if ( ! $compact ) |
|
153 |
echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; |
|
154 |
echo "</li>\n"; |
|
155 |
} |
|
156 |
echo "</ul>\n"; |
|
157 |
break; |
|
158 |
} |
|
159 |
} |
|
160 |
|
|
161 |
?> |
|
162 |
<p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ), |
5
|
163 |
/* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */ |
|
164 |
__( 'https://make.wordpress.org/' ) ); ?></p> |
0
|
165 |
|
|
166 |
</div> |
|
167 |
<?php |
|
168 |
|
|
169 |
include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
170 |
|
|
171 |
return; |
|
172 |
|
|
173 |
// These are strings returned by the API that we want to be translatable |
|
174 |
__( 'Project Leaders' ); |
|
175 |
__( 'Extended Core Team' ); |
|
176 |
__( 'Core Developers' ); |
|
177 |
__( 'Recent Rockstars' ); |
|
178 |
__( 'Core Contributors to WordPress %s' ); |
|
179 |
__( 'Contributing Developers' ); |
|
180 |
__( 'Cofounder, Project Lead' ); |
|
181 |
__( 'Lead Developer' ); |
5
|
182 |
__( 'Release Lead' ); |
0
|
183 |
__( 'User Experience Lead' ); |
|
184 |
__( 'Core Developer' ); |
|
185 |
__( 'Core Committer' ); |
|
186 |
__( 'Guest Committer' ); |
|
187 |
__( 'Developer' ); |
|
188 |
__( 'Designer' ); |
|
189 |
__( 'XML-RPC' ); |
|
190 |
__( 'Internationalization' ); |
|
191 |
__( 'External Libraries' ); |
|
192 |
__( 'Icon Design' ); |