Changeset 11728
- Timestamp:
- 04/01/2022 03:30:53 AM (3 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php
r11726 r11728 171 171 $email_report = HelpScout::api( '/v2/reports/email', $api_payload ); 172 172 173 // If any of the API's are unavailable, make it obvious that the requests have failed, but returning 0's for everything. 174 if ( ! $company_report || ! $mailbox_overall || ! $email_report ) { 175 $company_report = $mailbox_overall = $email_report = false; 176 } 177 173 178 $stats['helpscout_queue_total_conversations'] = $mailbox_overall->current->totalConversations ?? 0; 174 179 $stats['helpscout_queue_new_conversations'] = $mailbox_overall->current->newConversations ?? 0; 175 180 $stats['helpscout_queue_customers'] = $mailbox_overall->current->customers ?? 0; 176 181 $stats['helpscout_queue_conversations_per_day'] = $mailbox_overall->current->conversationsPerDay ?? 0; 177 $stats['helpscout_queue_busiest_day'] = gmdate( 'l', strtotime( 'Sunday +' . $mailbox_overall->busiestDay->day. ' days' ) ); // Hacky? but works182 $stats['helpscout_queue_busiest_day'] = gmdate( 'l', strtotime( 'Sunday +' . ( $mailbox_overall->busiestDay->day ?? 0 ) . ' days' ) ); // Hacky? but works 178 183 $stats['helpscout_queue_messages_received'] = $mailbox_overall->current->messagesReceived ?? 0; 179 184 $stats['helpscout_queue_replies_sent'] = $company_report->current->totalReplies; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/clients/class-helpscout.php
r11726 r11728 9 9 class HelpScout { 10 10 const API_BASE = 'https://api.helpscout.net'; 11 12 /** 13 * The HTTP timeout for the HelpScout API. 14 */ 15 const TIMEOUT = 15; 11 16 12 17 public static function api( $url, $args = null, $method = 'GET' ) { … … 33 38 'Authorization' => self::get_auth_string(), 34 39 ], 40 'timeout' => self::TIMEOUT, 35 41 'body' => ( 'POST' === $method && $args ) ? $args : null, 36 42 ) … … 52 58 self::API_BASE . '/v2/oauth2/token', 53 59 array( 54 'body' => array( 60 'timeout' => self::TIMEOUT, 61 'body' => array( 55 62 'grant_type' => 'client_credentials', 56 63 'client_id' => HELPSCOUT_APP_ID, … … 72 79 set_site_transient( __CLASS__ . 'get_auth_token', [ 'exp' => time() + $expiry, 'token' => $token ], $expiry ); 73 80 74 return $token;81 return 'BEARER ' . $token; 75 82 } 76 83
Note: See TracChangeset
for help on using the changeset viewer.