Changeset 14665 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
- Timestamp:
- 02/20/2026 04:56:02 AM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
r13909 r14665 681 681 return 200 === wp_remote_retrieve_response_code( $request ); 682 682 } 683 684 /**685 * Fetch the list of known Helpscout emails for a given post.686 *687 * @param \WP_Post $post The post to fetch emails for.688 * @return array689 */690 public static function get_helpscout_emails( $post, $filters = [] ) {691 global $wpdb;692 693 $limit = 999;694 if ( isset( $filters['limit'] ) ) {695 $limit = absint( $filters['limit'] );696 unset( $filters['limit'] );697 }698 699 // Trim off the rejected prefix/suffix.700 $slug = preg_replace( '/(^rejected-|-rejected(-\d)?$)/i', '', $post->post_name );701 $wheres = '';702 703 foreach ( $filters as $key => $value ) {704 $wheres .= $wpdb->prepare( 'AND emails.%i LIKE %s ', $key, '%' . $value . '%' );705 }706 707 $emails = $wpdb->get_results( $wpdb->prepare(708 "SELECT emails.*709 FROM %i emails710 JOIN %i meta ON emails.id = meta.helpscout_id711 WHERE meta.meta_key = 'plugins' AND meta.meta_value IN( %s, %s )712 $wheres713 ORDER BY `created` DESC714 LIMIT %d",715 "{$wpdb->base_prefix}helpscout",716 "{$wpdb->base_prefix}helpscout_meta",717 $slug,718 $post->post_name,719 $limit720 ) );721 722 foreach ( $emails as &$email ) {723 $email->url = 'https://secure.helpscout.net/conversation/' . $email->id . '/' . $email->number;724 }725 726 if ( 1 === $limit ) {727 return reset( $emails );728 }729 730 return $emails;731 }732 683 }
Note: See TracChangeset
for help on using the changeset viewer.