PageRenderTime 93ms CodeModel.GetById 40ms app.highlight 10ms RepoModel.GetById 40ms app.codeStats 0ms

/htdocs/wp-admin/credits.php

https://bitbucket.org/dkrzos/phc
PHP | 161 lines | 118 code | 32 blank | 11 comment | 17 complexity | c53bb47eb39105358fa6952a29ed4c06 MD5 | raw file
  1<?php
  2/**
  3 * Credits administration panel.
  4 *
  5 * @package WordPress
  6 * @subpackage Administration
  7 */
  8
  9/** WordPress Administration Bootstrap */
 10require_once( './admin.php' );
 11
 12$title = __( 'Credits' );
 13
 14function wp_credits() {
 15	global $wp_version;
 16	$locale = get_locale();
 17
 18	$results = get_site_transient( 'wordpress_credits_' . $locale );
 19
 20	if ( ! is_array( $results )
 21		|| ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
 22	) {
 23		$response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" );
 24
 25		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
 26			return false;
 27
 28		$results = maybe_unserialize( wp_remote_retrieve_body( $response ) );
 29
 30		if ( ! is_array( $results ) )
 31			return false;
 32
 33		set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
 34	}
 35
 36	return $results;
 37}
 38
 39function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
 40	$display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
 41}
 42
 43function _wp_credits_build_object_link( &$data ) {
 44	$data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>';
 45}
 46
 47list( $display_version ) = explode( '-', $wp_version );
 48
 49include( ABSPATH . 'wp-admin/admin-header.php' );
 50?>
 51<div class="wrap about-wrap">
 52
 53<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
 54
 55<div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! WordPress %s is more polished and enjoyable than ever before. We hope you like it.' ), $display_version ); ?></div>
 56
 57<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
 58
 59<h2 class="nav-tab-wrapper">
 60	<a href="about.php" class="nav-tab">
 61		<?php _e( 'What&#8217;s New' ); ?>
 62	</a><a href="credits.php" class="nav-tab nav-tab-active">
 63		<?php _e( 'Credits' ); ?>
 64	</a><a href="freedoms.php" class="nav-tab">
 65		<?php _e( 'Freedoms' ); ?>
 66	</a>
 67</h2>
 68
 69<?php
 70
 71$credits = wp_credits();
 72
 73if ( ! $credits ) {
 74	echo '<p class="about-description">' . sprintf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
 75		'http://wordpress.org/about/',
 76		/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
 77		__( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>';
 78	include( ABSPATH . 'wp-admin/admin-footer.php' );
 79	exit;
 80}
 81
 82echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
 83
 84$gravatar = is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/';
 85
 86foreach ( $credits['groups'] as $group_slug => $group_data ) {
 87	if ( $group_data['name'] ) {
 88		if ( 'Translators' == $group_data['name'] ) {
 89			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
 90			$title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
 91		} elseif ( isset( $group_data['placeholders'] ) ) {
 92			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
 93		} else {
 94			$title = translate( $group_data['name'] );
 95		}
 96
 97		echo '<h4 class="wp-people-group">' . $title . "</h4>\n";
 98	}
 99
100	if ( ! empty( $group_data['shuffle'] ) )
101		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
102
103	switch ( $group_data['type'] ) {
104		case 'list' :
105			array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] );
106			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
107			break;
108		case 'libraries' :
109			array_walk( $group_data['data'], '_wp_credits_build_object_link' );
110			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
111			break;
112		default:
113			$compact = 'compact' == $group_data['type'];
114			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
115			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
116			foreach ( $group_data['data'] as $person_data ) {
117				echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t";
118				echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">';
119				$size = 'compact' == $group_data['type'] ? '30' : '60';
120				echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";
121				echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t";
122				if ( ! $compact )
123					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
124				echo "</li>\n";
125			}
126			echo "</ul>\n";
127		break;
128	}
129}
130
131?>
132<p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
133	/* translators: Url to the codex documentation on contributing to WordPress used on the credits page */
134	__( 'http://codex.wordpress.org/Contributing_to_WordPress' ) ); ?></p>
135
136</div>
137<?php
138
139include( ABSPATH . 'wp-admin/admin-footer.php' );
140
141return;
142
143// These are strings returned by the API that we want to be translatable
144__( 'Project Leaders' );
145__( 'Extended Core Team' );
146__( 'Core Developers' );
147__( 'Recent Rockstars' );
148__( 'Core Contributors to WordPress %s' );
149__( 'Contributing Developers' );
150__( 'Cofounder, Project Lead' );
151__( 'Lead Developer' );
152__( 'User Experience Lead' );
153__( 'Core Developer' );
154__( 'Core Committer' );
155__( 'Guest Committer' );
156__( 'Developer' );
157__( 'Designer' );
158__( 'XML-RPC' );
159__( 'Internationalization' );
160__( 'External Libraries' );
161__( 'Icon Design' );