equal
deleted
inserted
replaced
6 * @subpackage Administration |
6 * @subpackage Administration |
7 * @since 4.4.0 |
7 * @since 4.4.0 |
8 */ |
8 */ |
9 |
9 |
10 /** |
10 /** |
11 * Retrieve the contributor credits. |
11 * Retrieves the contributor credits. |
12 * |
12 * |
13 * @since 3.2.0 |
13 * @since 3.2.0 |
14 * @since 5.6.0 Added the `$version` and `$locale` parameters. |
14 * @since 5.6.0 Added the `$version` and `$locale` parameters. |
15 * |
15 * |
16 * @param string $version WordPress version. Defaults to the current version. |
16 * @param string $version WordPress version. Defaults to the current version. |
30 } |
30 } |
31 |
31 |
32 $results = get_site_transient( 'wordpress_credits_' . $locale ); |
32 $results = get_site_transient( 'wordpress_credits_' . $locale ); |
33 |
33 |
34 if ( ! is_array( $results ) |
34 if ( ! is_array( $results ) |
35 || false !== strpos( $version, '-' ) |
35 || str_contains( $version, '-' ) |
36 || ( isset( $results['data']['version'] ) && strpos( $version, $results['data']['version'] ) !== 0 ) |
36 || ( isset( $results['data']['version'] ) && ! str_starts_with( $version, $results['data']['version'] ) ) |
37 ) { |
37 ) { |
38 $url = "http://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}"; |
38 $url = "http://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}"; |
39 $options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) ); |
39 $options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) ); |
40 |
40 |
41 if ( wp_http_supports( array( 'ssl' ) ) ) { |
41 if ( wp_http_supports( array( 'ssl' ) ) ) { |
59 |
59 |
60 return $results; |
60 return $results; |
61 } |
61 } |
62 |
62 |
63 /** |
63 /** |
64 * Retrieve the link to a contributor's WordPress.org profile page. |
64 * Retrieves the link to a contributor's WordPress.org profile page. |
65 * |
65 * |
66 * @access private |
66 * @access private |
67 * @since 3.2.0 |
67 * @since 3.2.0 |
68 * |
68 * |
69 * @param string $display_name The contributor's display name (passed by reference). |
69 * @param string $display_name The contributor's display name (passed by reference). |
73 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { |
73 function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { |
74 $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; |
74 $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; |
75 } |
75 } |
76 |
76 |
77 /** |
77 /** |
78 * Retrieve the link to an external library used in WordPress. |
78 * Retrieves the link to an external library used in WordPress. |
79 * |
79 * |
80 * @access private |
80 * @access private |
81 * @since 3.2.0 |
81 * @since 3.2.0 |
82 * |
82 * |
83 * @param string $data External library data (passed by reference). |
83 * @param string $data External library data (passed by reference). |