Changeset 12063 for sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php
- Timestamp:
- 09/15/2022 03:13:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php
r12003 r12063 326 326 } 327 327 } 328 if ( isset( $comment_meta['reject_reason'][0] ) && ! empty( maybe_unserialize( $comment_meta['reject_reason'][0] ) ) ) { 329 $reasons = array(); 330 $comment_reasons = Helper_Translation_Discussion::get_comment_reasons(); 331 $reasons = array_map( 332 function( $reason ) use ( $comment_reasons ) { 333 if ( array_key_exists( $reason, $comment_reasons ) ) { 334 return $comment_reasons[ $reason ]['name']; 335 } 336 }, 337 maybe_unserialize( $comment_meta['reject_reason'][0] ) 338 ); 339 $output .= '- <strong>' . esc_html__( 'Reason(s): ' ) . '</strong>' . esc_html( implode( ', ', $reasons ) ) . '<br>'; 340 } 328 341 $output .= '- <strong>' . esc_html__( 'Comment: ' ) . '</strong>' . esc_html( $comment->comment_content ) . '</pre>'; 329 342 $output .= '<br><br>'; … … 430 443 */ 431 444 private static function get_opted_in_email_addresses( array $email_addresses ): array { 432 foreach ( $email_addresses as $email_address ) { 433 if ( self::is_global_optout_email_address( $email_address ) ) { 434 $index = array_search( $email_address, $email_addresses, true ); 435 if ( false !== $index ) { 436 unset( $email_addresses[ $index ] ); 437 } 445 foreach ( $email_addresses as $index => $email_address ) { 446 if ( ! is_string( $email_address ) || empty( $email_address ) || self::is_global_optout_email_address( $email_address ) ) { 447 unset( $email_addresses[ $index ] ); 438 448 } 439 449 } … … 451 461 */ 452 462 private static function is_global_optout_email_address( string $email_address ): bool { 463 if ( empty( $email_address ) || ! is_email( $email_address ) ) { 464 return false; 465 } 453 466 $user = get_user_by( 'email', $email_address ); 454 467 $gp_default_sort = get_user_option( 'gp_default_sort', $user->ID ); … … 602 615 $user = wp_get_current_user(); 603 616 617 if ( ! $user->user_email ) { 618 return __( "You will not receive notifications because you don't have an e-mail address set." ); 619 } 604 620 if ( self::is_global_optout_email_address( $user->user_email ) ) { 605 $output = __( 'You will not receive notifications because you have not yet opted-in. ' );621 $output = __( 'You will not receive notifications because you have not yet opted-in.' ); 606 622 $output .= ' <a href="https://translate.wordpress.org/settings/">' . __( 'Start receiving notifications.' ) . '</a>'; 607 623 return $output;
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)