Changeset 2200 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php
- Timestamp:
- 12/17/2015 05:20:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)