Changeset 8781
- Timestamp:
- 05/13/2019 05:49:46 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php
r5344 r8781 130 130 131 131 <?php if ( ! empty( $locale_data['translators'] ) ) : ?> 132 <h2><?php printf( __( ' AllTranslation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2>132 <h2><?php printf( __( 'Current Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2> 133 133 134 134 <p> … … 136 136 $translators = array(); 137 137 foreach ( $locale_data['translators'] as $translator ) { 138 $translators[] = sprintf( 139 '<a href="https://profiles.wordpress.org/%s">%s</a>', 140 esc_attr( $translator['nice_name'] ), 141 esc_html( $translator['display_name'] ) 142 ); 143 } 144 echo wp_sprintf( '%l.', $translators ); 145 ?> 146 </p> 147 <?php endif; ?> 148 149 <?php if ( ! empty( $locale_data['translators_past'] ) ) : ?> 150 <h2><?php printf( __( 'Past Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators_past'] ) ) ); ?></h2> 151 152 <p> 153 <?php 154 $translators = array(); 155 foreach ( $locale_data['translators_past'] as $translator ) { 138 156 $translators[] = sprintf( 139 157 '<a href="https://profiles.wordpress.org/%s">%s</a>', -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php
r7829 r8781 282 282 $locale_data['project_validators'] = $contributors['project_validators']; 283 283 $locale_data['translators'] = $contributors['translators']; 284 $locale_data['translators_past'] = $contributors['translators_past']; 284 285 285 286 return $locale_data; … … 302 303 $contributors['validators'] = $this->get_general_translation_editors( $locale ); 303 304 $contributors['project_validators'] = $this->get_project_translation_editors( $locale ); 304 $contributors['translators'] = $this->get_translation_contributors( $locale ); 305 $contributors['translators'] = $this->get_translation_contributors( $locale, 365 ); // Contributors from the past year 306 $contributors['translators_past'] = array_diff_key( $this->get_translation_contributors( $locale ), $contributors['translators'] ); 305 307 306 308 wp_cache_set( 'contributors-data:' . $locale->wp_locale, $contributors, 'wp-i18n-teams', 2 * HOUR_IN_SECONDS ); … … 478 480 * @return array 479 481 */ 480 private function get_translation_contributors( $locale ) {482 private function get_translation_contributors( $locale, $max_age_days = null ) { 481 483 global $wpdb; 482 484 483 485 $contributors = array(); 486 487 $date_constraint = ''; 488 if ( !is_null( $max_age_days ) ) 489 $date_constraint = $wpdb->prepare( " AND date_modified >= CURRENT_DATE - INTERVAL %d DAY", $max_age_days ); 484 490 485 491 $users = $wpdb->get_col( $wpdb->prepare( 486 492 "SELECT DISTINCT user_id FROM translate_user_translations_count WHERE accepted > 0 AND locale = %s", 487 493 $locale->slug 488 ) );494 ) . $date_constraint ); 489 495 490 496 if ( ! $users ) {
Note: See TracChangeset
for help on using the changeset viewer.