Changeset 46709
- Timestamp:
- 11/11/2019 08:43:48 PM (5 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/credits.php
r46705 r46709 86 86 exit; 87 87 } 88 ?> 88 89 89 $previous_type = ''; 90 <hr /> 90 91 91 foreach ( $credits['groups'] as $group_slug => $group_data ) :92 ?>93 <?php94 if ( $previous_type !== $group_data['type'] ) {95 echo '<hr />';96 }97 ?>98 92 <div class="about__section"> 99 <div class="column <?php echo 'titles' === $group_data['type'] ? 'has-subtle-background-color' : ''; ?>"> 100 101 <?php 102 if ( $group_data['name'] ) { 103 if ( 'Translators' == $group_data['name'] ) { 104 // Considered a special slug in the API response. (Also, will never be returned for en_US.) 105 $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); 106 } elseif ( isset( $group_data['placeholders'] ) ) { 107 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 108 $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); 109 } else { 110 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 111 $title = translate( $group_data['name'] ); 112 } 113 114 echo '<h2 class="wp-people-group-title">' . esc_html( $title ) . "</h2>\n"; 115 } 116 117 if ( ! empty( $group_data['shuffle'] ) ) { 118 shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. 119 } 120 121 switch ( $group_data['type'] ) { 122 case 'list': 123 array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] ); 124 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 125 break; 126 case 'libraries': 127 array_walk( $group_data['data'], '_wp_credits_build_object_link' ); 128 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 129 break; 130 default: 131 $compact = 'compact' == $group_data['type']; 132 $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); 133 echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n"; 134 foreach ( $group_data['data'] as $person_data ) { 135 echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t"; 136 echo '<a href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '" class="web">'; 137 $size = 'compact' == $group_data['type'] ? 40 : 80; 138 $data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); 139 $size *= 2; 140 $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); 141 echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" />' . "\n"; 142 echo esc_html( $person_data[0] ) . "</a>\n\t"; 143 if ( ! $compact ) { 144 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 145 echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; 146 } 147 echo "</li>\n"; 148 } 149 echo "</ul>\n"; 150 break; 151 } 152 $previous_type = $group_data['type']; 153 ?> 154 93 <div class="column has-subtle-background-color"> 94 <?php wp_credits_section_title( $credits['groups']['core-developers'] ); ?> 95 <?php wp_credits_section_list( $credits, 'core-developers' ); ?> 96 <?php wp_credits_section_list( $credits, 'contributing-developers' ); ?> 155 97 </div> 156 98 </div> 157 <?php endforeach; ?> 99 100 <hr /> 101 102 <div class="about__section"> 103 <div class="column"> 104 <?php wp_credits_section_title( $credits['groups']['props'] ); ?> 105 <?php wp_credits_section_list( $credits, 'props' ); ?> 106 </div> 107 </div> 108 109 <hr /> 110 111 <?php if ( isset( $credits['groups']['translators'] ) || isset( $credits['groups']['validators'] ) ) : ?> 112 <div class="about__section"> 113 <div class="column"> 114 <?php wp_credits_section_title( $credits['groups']['validators'] ); ?> 115 <?php wp_credits_section_list( $credits, 'validators' ); ?> 116 <?php wp_credits_section_list( $credits, 'translators' ); ?> 117 </div> 118 </div> 119 120 <hr /> 121 <?php endif; ?> 122 123 <div class="about__section"> 124 <div class="column"> 125 <?php wp_credits_section_title( $credits['groups']['libraries'] ); ?> 126 <?php wp_credits_section_list( $credits, 'libraries' ); ?> 127 </div> 128 </div> 158 129 </div> 159 130 <?php -
trunk/src/wp-admin/css/about.css
r46705 r46709 551 551 ------------------------------------------------------------------------------*/ 552 552 553 .about__section .wp-people-group-title {554 margin-bottom: 2em;555 font-size: 1.4em;556 }557 558 553 .about__section .wp-people-group { 559 554 margin: 0; -
trunk/src/wp-admin/includes/credits.php
r42343 r46709 77 77 $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>'; 78 78 } 79 80 /** 81 * Display a the title for a given group of contributors. 82 * 83 * @since 5.3.0 84 * 85 * @param array $group_data The current contributor group. 86 */ 87 function wp_credits_section_title( $group_data = array() ) { 88 if ( ! count( $group_data ) ) { 89 return; 90 } 91 92 if ( $group_data['name'] ) { 93 if ( 'Translators' === $group_data['name'] ) { 94 // Considered a special slug in the API response. (Also, will never be returned for en_US.) 95 $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); 96 } elseif ( isset( $group_data['placeholders'] ) ) { 97 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 98 $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); 99 } else { 100 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 101 $title = translate( $group_data['name'] ); 102 } 103 104 echo '<h2 class="wp-people-group-title">' . esc_html( $title ) . "</h2>\n"; 105 } 106 } 107 108 /** 109 * Display a list of contributors for a given group. 110 * 111 * @since 5.3.0 112 * 113 * @param array $credits The credits groups returned from the API. 114 * @param string $slug The current group to display. 115 */ 116 function wp_credits_section_list( $credits = array(), $slug = '' ) { 117 $group_data = isset( $credits['groups'][ $slug ] ) ? $credits['groups'][ $slug ] : array(); 118 $credits_data = $credits['data']; 119 if ( ! count( $group_data ) ) { 120 return; 121 } 122 123 if ( ! empty( $group_data['shuffle'] ) ) { 124 shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. 125 } 126 127 switch ( $group_data['type'] ) { 128 case 'list': 129 array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits_data['profiles'] ); 130 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 131 break; 132 case 'libraries': 133 array_walk( $group_data['data'], '_wp_credits_build_object_link' ); 134 echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; 135 break; 136 default: 137 $compact = 'compact' === $group_data['type']; 138 $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); 139 echo '<ul class="' . $classes . '" id="wp-people-group-' . $slug . '">' . "\n"; 140 foreach ( $group_data['data'] as $person_data ) { 141 echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t"; 142 echo '<a href="' . esc_url( sprintf( $credits_data['profiles'], $person_data[2] ) ) . '" class="web">'; 143 $size = $compact ? 40 : 80; 144 $data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); 145 $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size * 2 ) ); 146 echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" />' . "\n"; 147 echo esc_html( $person_data[0] ) . "</a>\n\t"; 148 if ( ! $compact ) { 149 // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText 150 echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; 151 } 152 echo "</li>\n"; 153 } 154 echo "</ul>\n"; 155 break; 156 } 157 }
Note: See TracChangeset
for help on using the changeset viewer.