Make WordPress Core


Ignore:
Timestamp:
09/11/2015 04:54:20 AM (9 years ago)
Author:
wonderboymusic
Message:

Move ad hoc functions from wp-admin/credits.php to wp-admin/includes/credits.php, which is only included by the former.

See #33813.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/credits.php

    r33695 r34036  
    99/** WordPress Administration Bootstrap */
    1010require_once( dirname( __FILE__ ) . '/admin.php' );
     11require_once( dirname( __FILE__ ) . '/includes/credits.php' );
    1112
    1213$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|false 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         || false !== strpos( $wp_version, '-' )
    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.
    56  * @param string $username      The contributor's username.
    57  * @param string $profiles      URL to the contributor's 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  */
    71 function _wp_credits_build_object_link( &$data ) {
    72     $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>';
    73 }
    7414
    7515list( $display_version ) = explode( '-', $wp_version );
Note: See TracChangeset for help on using the changeset viewer.