3 * WordPress Credits Administration API.
6 * @subpackage Administration
11 * Retrieve the contributor credits.
13 * @global string $wp_version The current WordPress version.
17 * @return array|false A list of all of the contributors, or false on error.
19 function wp_credits() {
21 $locale = get_locale();
23 $results = get_site_transient( 'wordpress_credits_' . $locale );
25 if ( ! is_array( $results )
26 || false !== strpos( $wp_version, '-' )
27 || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
29 $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" );
31 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
34 $results = json_decode( wp_remote_retrieve_body( $response ), true );
36 if ( ! is_array( $results ) )
39 set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
46 * Retrieve the link to a contributor's WordPress.org profile page.
51 * @param string $display_name The contributor's display name, passed by reference.
52 * @param string $username The contributor's username.
53 * @param string $profiles URL to the contributor's WordPress.org profile page.
55 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
56 $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
60 * Retrieve the link to an external library used in WordPress.
65 * @param string $data External library data, passed by reference.
67 function _wp_credits_build_object_link( &$data ) {
68 $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>';