Changeset 2200
- Timestamp:
- 12/17/2015 05:20:22 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams
- Files:
-
- 3 edited
-
css/i18n-teams.css (modified) (2 diffs)
-
views/locale-details.php (modified) (3 diffs)
-
wp-i18n-teams.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/css/i18n-teams.css
r1838 r2200 113 113 padding: 0; 114 114 } 115 116 ul.validators { 117 display: -webkit-box; 118 display: -webkit-flex; 119 display: -ms-flexbox; 120 display: flex; 121 -webkit-flex-flow: row wrap; 122 -ms-flex-flow: row wrap; 123 flex-flow: row wrap; 124 } 125 115 126 .validators li { 116 float: left; 117 width: 280px; /* todo use flexbox to prog enhance this so that they fill the space. AF is good one to test */ 127 list-style-type: none; 118 128 margin-bottom: 15px; 119 list-style-type: none;129 width: 33%; 120 130 } 121 .validators .gravatar { 122 position: relative; 123 top: -6px; 124 float: left; 125 margin: 0 10px 10px 0; 126 padding: 2px; 131 132 .validators.project-validators li { 133 width: 25%; 134 margin-bottom: 5px; 135 } 136 137 @media only screen and (max-width: 850px) { 138 .validators li { 139 width: 50%; 140 } 141 142 .validators.project-validators li { 143 width: 33%; 144 } 145 } 146 147 @media only screen and (max-width: 470px) { 148 .validators li { 149 width: 100%; 150 } 151 .validators.project-validators li { 152 width: 50%; 153 } 154 } 155 156 .validators.project-validators img.avatar { 157 margin-right: 5px !important; 127 158 } 128 159 .validators a { … … 131 162 .validators .user-name { 132 163 font-size: 16px; 164 position: relative; 165 top: .2em; 133 166 } 167 .validators.project-validators .user-name { 168 font-size: 13px; 169 } 170 134 171 .validators .user-slack { 135 172 display: block; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php
r1911 r2200 55 55 56 56 57 <h2><?php _e( ' Translation Editors', 'wporg' ); ?></h2>57 <h2><?php _e( 'General Translation Editors', 'wporg' ); ?></h2> 58 58 59 59 <?php if ( empty( $locale_data['validators'] ) ) : ?> … … 65 65 <li> 66 66 <a class="user-avatar" href="https://profiles.wordpress.org/<?php echo esc_attr( $validator['nice_name'] ); ?>"><?php 67 echo get_avatar( $validator['email'], 60 );67 echo get_avatar( $validator['email'], 50 ); 68 68 ?></a> 69 69 <a class="user-name" href="https://profiles.wordpress.org/<?php echo esc_attr( $validator['nice_name'] ); ?>"><?php … … 75 75 } 76 76 ?> 77 </li> 78 <?php endforeach; ?> 79 </ul> 80 <?php endif; ?> 81 82 83 <?php if ( ! empty( $locale_data['project_validators'] ) ) : ?> 84 <h2><?php _e( 'Project Translation Editors', 'wporg' ); ?></h2> 85 86 <ul class="validators project-validators"> 87 <?php foreach ( $locale_data['project_validators'] as $validator ) : 88 ?> 89 <li> 90 <a class="user-avatar" href="https://profiles.wordpress.org/<?php echo esc_attr( $validator['nice_name'] ); ?>"><?php 91 echo get_avatar( $validator['email'], 25 ); 92 ?></a> 93 <a class="user-name" href="https://profiles.wordpress.org/<?php echo esc_attr( $validator['nice_name'] ); ?>"><?php 94 echo esc_html( $validator['display_name'] ); 95 ?></a> 77 96 </li> 78 97 <?php endforeach; ?> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php
r1838 r2200 28 28 public function enqueue_assets() { 29 29 if ( is_singular() && false !== strpos( get_post()->post_content, '[wp-locales' ) ) { 30 wp_enqueue_style( 'wp-i18n-teams', plugins_url( 'css/i18n-teams.css', __FILE__ ), array(), 2);30 wp_enqueue_style( 'wp-i18n-teams', plugins_url( 'css/i18n-teams.css', __FILE__ ), array(), 3 ); 31 31 wp_enqueue_script( 'wp-i18n-teams', plugins_url( 'js/i18n-teams.js', __FILE__ ), array( 'jquery' ), 2 ); 32 32 } … … 212 212 $contributors = $this->get_contributors( $locale ); 213 213 $locale_data['validators'] = $contributors['validators']; 214 $locale_data['project_validators'] = $contributors['project_validators']; 214 215 $locale_data['translators'] = $contributors['translators']; 215 216 … … 230 231 231 232 $contributors = array(); 232 $contributors['validators'] = $this->get_translation_editors( $locale ); 233 $contributors['validators'] = $this->get_general_translation_editors( $locale ); 234 $contributors['project_validators'] = $this->get_project_translation_editors( $locale ); 233 235 $contributors['translators'] = $this->get_translation_contributors( $locale ); 234 236 … … 270 272 271 273 /** 272 * Get the translation editors for the given locale.274 * Get the general translation editors for the given locale. 273 275 * 274 276 * @param GP_Locale $locale 275 277 * @return array 276 278 */ 277 private function get_ translation_editors( $locale ) {279 private function get_general_translation_editors( $locale ) { 278 280 global $wpdb; 279 281 280 282 $editors = array(); 281 283 282 $subdomain = $wpdb->get_var( $wpdb->prepare( "SELECT subdomain FROM locales WHERE locale = %s", $locale->wp_locale ) ); 283 if ( ! $subdomain ) { 284 return $editors; 285 } 286 287 $blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = '/'", "$subdomain.wordpress.org" ) ); 288 if ( ! $blog_id ) { 289 return $editors; 290 } 291 292 $meta_key = $wpdb->base_prefix . intval( $blog_id ) . '_capabilities'; 293 $users = $wpdb->get_col( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$meta_key' AND meta_value LIKE '%translation_editor%'" ); 284 $users = $wpdb->get_col( $wpdb->prepare( " 285 SELECT `user_id` FROM `translate_translation_editors` 286 WHERE `project_id` = '0' AND `locale` = %s 287 ", $locale->slug ) ); 288 294 289 if ( ! $users ) { 295 290 return $editors; … … 311 306 'nice_name' => $user->user_nicename, 312 307 'slack' => self::get_slack_username( $user->ID ), 308 ); 309 } 310 } 311 312 uasort( $editors, array( $this, '_sort_display_name_callback' ) ); 313 314 return $editors; 315 } 316 317 /** 318 * Get the general translation editors for the given locale. 319 * 320 * @param GP_Locale $locale 321 * @return array 322 */ 323 private function get_project_translation_editors( $locale ) { 324 global $wpdb; 325 326 $editors = array(); 327 328 $users = $wpdb->get_col( $wpdb->prepare( " 329 SELECT `user_id` FROM `translate_translation_editors` 330 WHERE `project_id` <> '0' AND `locale` = %s 331 ", $locale->slug ) ); 332 333 if ( ! $users ) { 334 return $editors; 335 } 336 337 $user_data = $wpdb->get_results( "SELECT ID, user_nicename, display_name, user_email FROM $wpdb->users WHERE ID IN (" . implode( ',', $users ) . ")" ); 338 foreach ( $user_data as $user ) { 339 if ( $user->display_name && $user->display_name !== $user->user_nicename ) { 340 $editors[ $user->user_nicename ] = array( 341 'display_name' => $user->display_name, 342 'email' => $user->user_email, 343 'nice_name' => $user->user_nicename, 344 ); 345 } else { 346 $editors[ $user->user_nicename ] = array( 347 'display_name' => $user->user_nicename, 348 'email' => $user->user_email, 349 'nice_name' => $user->user_nicename, 313 350 ); 314 351 }
Note: See TracChangeset
for help on using the changeset viewer.