PHP 8.2.29
Preview: credits.php Size: 5.73 KB
/home/medyaist/hurdamakara.com.tr/wp-admin/includes/credits.php
<?php
/**
 * WordPress Credits Administration API.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 4.4.0
 */

/**
 * Retrieves the contributor credits.
 *
 * @since 3.2.0
 * @since 5.6.0 Added the `$version` and `$locale` parameters.
 *
 * @param string $version WordPress version. Defaults to the current version.
 * @param string $locale  WordPress locale. Defaults to the current user's locale.
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits( $version = '', $locale = '' ) {
	if ( ! $version ) {
		$version = wp_get_wp_version();
	}

	if ( ! $locale ) {
		$locale = get_user_locale();
	}

	$results = get_site_transient( 'wordpress_credits_' . $locale );

	if ( ! is_array( $results )
		|| str_contains( $version, '-' )
		|| ( isset( $results['data']['version'] ) && ! str_starts_with( $version, $results['data']['version'] ) )
	) {
		$url     = "http://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}";
		$options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) );

		if ( wp_http_supports( array( 'ssl' ) ) ) {
			$url = set_url_scheme( $url, 'https' );
		}

		$response = wp_remote_get( $url, $options );

		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return false;
		}

		$results = json_decode( wp_remote_retrieve_body( $response ), true );

		if ( ! is_array( $results ) ) {
			return false;
		}

		set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
	}

	return $results;
}

/**
 * Retrieves the link to a contributor's WordPress.org profile page.
 *
 * @access private
 * @since 3.2.0
 *
 * @param string $display_name  The contributor's display name (passed by reference).
 * @param string $username      The contributor's username.
 * @param string $profiles      URL to the contributor's WordPress.org profile page.
 */
function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
	$display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
}

/**
 * Retrieves the link to an external library used in WordPress.
 *
 * @access private
 * @since 3.2.0
 *
 * @param string $data External library data (passed by reference).
 */
function _wp_credits_build_object_link( &$data ) {
	$data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>';
}

/**
 * Displays the title for a given group of contributors.
 *
 * @since 5.3.0
 *
 * @param array $group_data The current contributor group.
 */
function wp_credits_section_title( $group_data = array() ) {
	if ( ! count( $group_data ) ) {
		return;
	}

	if ( $group_data['name'] ) {
		if ( 'Translators' === $group_data['name'] ) {
			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
			$title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
		} elseif ( isset( $group_data['placeholders'] ) ) {
			// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
		} else {
			// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
			$title = translate( $group_data['name'] );
		}

		echo '<h2 class="wp-people-group-title">' . esc_html( $title ) . "</h2>\n";
	}
}

/**
 * Displays a list of contributors for a given group.
 *
 * @since 5.3.0
 *
 * @param array  $credits The credits groups returned from the API.
 * @param string $slug    The current group to display.
 */
function wp_credits_section_list( $credits = array(), $slug = '' ) {
	$group_data   = isset( $credits['groups'][ $slug ] ) ? $credits['groups'][ $slug ] : array();
	$credits_data = $credits['data'];
	if ( ! count( $group_data ) ) {
		return;
	}

	if ( ! empty( $group_data['shuffle'] ) ) {
		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
	}

	switch ( $group_data['type'] ) {
		case 'list':
			array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits_data['profiles'] );
			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
			break;
		case 'libraries':
			array_walk( $group_data['data'], '_wp_credits_build_object_link' );
			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
			break;
		default:
			$compact = 'compact' === $group_data['type'];
			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
			echo '<ul class="' . $classes . '" id="wp-people-group-' . $slug . '">' . "\n";
			foreach ( $group_data['data'] as $person_data ) {
				echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t";
				echo '<a href="' . esc_url( sprintf( $credits_data['profiles'], $person_data[2] ) ) . '" class="web">';
				$size   = $compact ? 80 : 160;
				$data   = get_avatar_data( $person_data[1] . '@sha256.gravatar.com', array( 'size' => $size ) );
				$data2x = get_avatar_data( $person_data[1] . '@sha256.gravatar.com', array( 'size' => $size * 2 ) );
				echo '<span class="wp-person-avatar"><img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" /></span>' . "\n";
				echo esc_html( $person_data[0] ) . "</a>\n\t";
				if ( ! $compact && ! empty( $person_data[3] ) ) {
					// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
				}
				echo "</li>\n";
			}
			echo "</ul>\n";
			break;
	}
}

Directory Contents

Dirs: 0 × Files: 58
Name Size Perms Modified Actions
7.85 KB lrw-r--r-- 2025-10-21 10:46:24
Edit Download
3.54 KB lrw-r--r-- 2023-07-11 02:03:24
Edit Download
148.33 KB lrw-r--r-- 2025-08-15 08:01:30
Edit Download
8.28 KB lrw-r--r-- 2022-03-22 13:25:04
Edit Download
4.97 KB lrw-r--r-- 2024-08-13 20:37:16
Edit Download
4.09 KB lrw-r--r-- 2023-06-22 11:36:26
Edit Download
6.79 KB lrw-r--r-- 2024-02-16 18:47:12
Edit Download
60.45 KB lrw-r--r-- 2025-06-03 13:51:34
Edit Download
32.35 KB lrw-r--r-- 2025-11-07 15:56:32
Edit Download
18.24 KB lrw-r--r-- 2025-06-02 12:00:28
Edit Download
66.01 KB lrw-r--r-- 2025-06-05 05:16:28
Edit Download
23.84 KB lrw-r--r-- 2024-02-16 18:47:12
Edit Download
17.72 KB lrw-r--r-- 2024-02-16 18:47:12
Edit Download
22.71 KB lrw-r--r-- 2025-11-03 18:38:34
Edit Download
18.05 KB lrw-r--r-- 2025-06-03 13:51:34
Edit Download
22.76 KB lrw-r--r-- 2024-02-16 18:47:12
Edit Download
7.34 KB lrw-r--r-- 2025-03-25 15:36:26
Edit Download
4.51 KB lrw-r--r-- 2025-08-27 07:34:28
Edit Download
9.02 KB lrw-r--r-- 2024-07-17 12:43:16
Edit Download
1.46 KB lrw-r--r-- 2020-11-14 13:54:08
Edit Download
51.76 KB lrw-r--r-- 2025-08-27 07:34:28
Edit Download
25.29 KB lrw-r--r-- 2025-03-17 15:54:28
Edit Download
21.61 KB lrw-r--r-- 2025-06-27 12:09:32
Edit Download
27.77 KB lrw-r--r-- 2025-03-10 15:16:28
Edit Download
15.35 KB lrw-r--r-- 2025-02-26 21:09:24
Edit Download
24.54 KB lrw-r--r-- 2025-07-31 19:49:34
Edit Download
56.44 KB lrw-r--r-- 2025-09-08 17:58:38
Edit Download
1.42 KB lrw-r--r-- 2022-10-04 00:47:16
Edit Download
63.66 KB lrw-r--r-- 2025-07-25 12:17:22
Edit Download
5.43 KB lrw-r--r-- 2022-03-10 16:22:02
Edit Download
5.58 KB lrw-r--r-- 2023-09-08 06:32:24
Edit Download
31.90 KB lrw-r--r-- 2025-08-27 07:34:28
Edit Download
14.44 KB lrw-r--r-- 2025-10-02 18:48:36
Edit Download
36.47 KB lrw-r--r-- 2025-08-24 10:44:32
Edit Download
14.00 KB lrw-r--r-- 2024-11-04 12:25:18
Edit Download
121.89 KB lrw-r--r-- 2025-11-04 05:50:36
Edit Download
6.26 KB lrw-r--r-- 2024-03-02 17:15:14
Edit Download
20.73 KB lrw-r--r-- 2025-07-23 14:00:42
Edit Download
15.23 KB lrw-r--r-- 2025-01-21 18:49:22
Edit Download
10.14 KB lrw-r--r-- 2025-08-27 07:34:28
Edit Download
6.94 KB lrw-r--r-- 2024-05-02 14:20:10
Edit Download
1.44 KB lrw-r--r-- 2019-10-08 14:19:04
Edit Download
46.85 KB lrw-r--r-- 2025-07-06 13:42:36
Edit Download
18.61 KB lrw-r--r-- 2024-01-10 08:57:16
Edit Download
20.06 KB lrw-r--r-- 2022-09-19 20:24:12
Edit Download
5.73 KB lrw-r--r-- 2024-12-19 00:44:24
Edit Download
1.44 KB lrw-r--r-- 2021-12-07 09:20:02
Edit Download
20.81 KB lrw-r--r-- 2026-02-19 21:28:43
Edit Download
3.71 KB lrw-r--r-- 2022-10-04 00:47:16
Edit Download
64.34 KB lrw-r--r-- 2025-09-28 19:38:32
Edit Download
1.27 KB lrw-r--r-- 2022-09-19 23:51:10
Edit Download
33.53 KB lrw-r--r-- 2025-07-06 08:57:36
Edit Download
4.19 KB lrw-r--r-- 2025-08-27 07:34:28
Edit Download
38.26 KB lrw-r--r-- 2025-07-31 19:49:34
Edit Download
32.67 KB lrw-r--r-- 2025-04-21 08:49:32
Edit Download
10.82 KB lrw-r--r-- 2024-09-11 09:08:20
Edit Download
68.82 KB lrw-r--r-- 2025-12-01 15:02:34
Edit Download
10.66 KB lrw-r--r-- 2023-09-09 06:28:26
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).