You appear to be a bot. Output may be restricted
Description
Tie into the heartbeat and append our stats
Usage
$array = EDD_Heartbeat::heartbeat_received( $response, $data );
Parameters
- $response
- ( mixed ) required –
- $data
- ( mixed ) required –
Returns
array
Source
File name: easy-digital-downloads/includes/admin/class-edd-heartbeat.php
Lines:
1 to 27 of 27
public static function heartbeat_received( $response, $data ) { if( ! current_user_can( 'view_shop_reports' ) ) { return $response; // Only modify heartbeat if current user can view show reports } // Make sure we only run our query if the edd_heartbeat key is present if( ( isset( $data['edd_heartbeat'] ) ) && ( $data['edd_heartbeat'] == 'dashboard_summary' ) ) { // Instantiate the stats class $stats = new EDD_Payment_Stats; $earnings = edd_get_total_earnings(); // Send back the number of complete payments $response['edd-total-payments'] = edd_format_amount( edd_get_total_sales(), false ); $response['edd-total-earnings'] = html_entity_decode( edd_currency_filter( edd_format_amount( $earnings ) ), ENT_COMPAT, 'UTF-8' ); $response['edd-payments-month'] = edd_format_amount( $stats->get_sales( 0, 'this_month', false, array( 'publish', 'revoked' ) ), false ); $response['edd-earnings-month'] = html_entity_decode( edd_currency_filter( edd_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ), ENT_COMPAT, 'UTF-8' ); $response['edd-payments-today'] = edd_format_amount( $stats->get_sales( 0, 'today', false, array( 'publish', 'revoked' ) ), false ); $response['edd-earnings-today'] = html_entity_decode( edd_currency_filter( edd_format_amount( $stats->get_earnings( 0, 'today' ) ) ), ENT_COMPAT, 'UTF-8' ); } return $response; }