var/www/html/wiensworld.de/wp-admin/includes | uid:33
credits.php [X]
<?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   = $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;
	}
}
admin-filters.php7.8KV E R D
admin.php3.5KV E R D
ajax-actions.php149.2KV E R D
bookmark.php11.4KV E R D
class-bulk-plugin-upgrader-skin.php2.5KV E R D
class-bulk-upgrader-skin.php6.5KV E R D
class-core-upgrader.php14.8KV E R D
class-custom-background.php21.2KV E R D
class-custom-image-header.php48KV E R D
class-ftp-sockets.php8.3KV E R D
class-ftp.php26.7KV E R D
class-language-pack-upgrader-skin.php2.8KV E R D
class-language-pack-upgrader.php15.2KV E R D
class-pclzip.php192.1KV E R D
class-plugin-installer-skin.php11.7KV E R D
class-plugin-upgrader.php22.7KV E R D
class-theme-upgrader-skin.php4.1KV E R D
class-theme-upgrader.php26.2KV E R D
class-walker-category-checklist.php5KV E R D
class-walker-nav-menu-checklist.php5.6KV E R D
class-walker-nav-menu-edit.php14KV E R D
class-wp-ajax-upgrader-skin.php4.1KV E R D
class-wp-application-passwords-list-table.php6.8KV E R D
class-wp-automatic-updater.php60.5KV E R D
class-wp-comments-list-table.php33.8KV E R D
class-wp-debug-data.php70.3KV E R D
class-wp-filesystem-base.php23.8KV E R D
class-wp-filesystem-direct.php18.2KV E R D
class-wp-filesystem-ftpext.php22.7KV E R D
class-wp-filesystem-ftpsockets.php18.1KV E R D
class-wp-filesystem-ssh2.php22.8KV E R D
class-wp-importer.php7.6KV E R D
class-wp-internal-pointers.php4.5KV E R D
class-wp-links-list-table.php9.3KV E R D
class-wp-list-table-compat.php1.5KV E R D
class-wp-list-table.php51.9KV E R D
class-wp-media-list-table.php26.4KV E R D
class-wp-ms-sites-list-table.php22.2KV E R D
class-wp-ms-themes-list-table.php29.5KV E R D
class-wp-ms-users-list-table.php15.3KV E R D
class-wp-plugin-install-list-table.php24.4KV E R D
class-wp-plugins-list-table.php56.7KV E R D
class-wp-post-comments-list-table.php1.4KV E R D
class-wp-posts-list-table.php63.5KV E R D
class-wp-privacy-data-export-requests-list-table.php5.4KV E R D
class-wp-privacy-data-removal-requests-list-table.php5.6KV E R D
class-wp-privacy-requests-table.php14.4KV E R D
class-wp-screen.php36.6KV E R D
class-wp-site-health-auto-updates.php14KV E R D
class-wp-site-health.php128.2KV E R D
class-wp-terms-list-table.php20.6KV E R D
class-wp-theme-install-list-table.php15.3KV E R D
class-wp-themes-list-table.php10.1KV E R D
class-wp-upgrader-skin.php6.9KV E R D
class-wp-upgrader.php47.2KV E R D
class-wp-users-list-table.php18.6KV E R D
comment.php6.1KV E R D
credits.php5.7KV E R D
dashboard.php68.7KV E R D
deprecated.php40.8KV E R D
edit-tag-messages.php1.4KV E R D
export.php25.4KV E R D
file.php95.6KV E R D
image-edit.php43KV E R D
image.php44.1KV E R D
import.php6.5KV E R D
list-table.php3.7KV E R D
menu.php9.4KV E R D
meta-boxes.php65.3KV E R D
misc.php45.4KV E R D
ms-admin-filters.php1.3KV E R D
ms-deprecated.php3.7KV E R D
ms.php33.4KV E R D
nav-menu.php48KV E R D
network.php26.4KV E R D
noop.php1.1KV E R D
options.php4.1KV E R D
plugin-install.php38.2KV E R D
plugin.php91.1KV E R D
post.php80.3KV E R D
privacy-tools.php32.7KV E R D
revision.php16.2KV E R D
schema.php44.5KV E R D
screen.php6.2KV E R D
taxonomy.php8.3KV E R D
template.php97.3KV E R D
theme-install.php6.8KV E R D
theme.php46.4KV E R D
translation-install.php10.8KV E R D
update-core.php71.2KV E R D
update.php34KV E R D
upgrade.php114KV E R D