From 74d5da301dbc9bdae0d03a750579ad6272117577 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Tue, 26 Dec 2023 15:09:02 -0600 Subject: [PATCH] Update mt-reports.php --- src/mt-reports.php | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/mt-reports.php b/src/mt-reports.php index 7bfdcbdf..ed85ff49 100644 --- a/src/mt-reports.php +++ b/src/mt-reports.php @@ -48,16 +48,16 @@ function mt_reports_page() { } else { mt_generate_report_by_event(); } - $event_id = (int) $_GET['event_id']; - $report_type = ( isset( $_GET['mt-event-report'] ) && 'tickets' === $_GET['mt-event-report'] ) ? 'tickets' : 'purchases'; + $event_id = (int) $_GET['event_id']; + $report_type = ( isset( $_GET['mt-event-report'] ) && 'tickets' === $_GET['mt-event-report'] ) ? 'tickets' : 'purchases'; if ( isset( $_GET['mt_print'] ) ) { $print_report_url = 'javascript:window.print()'; } else { $print_report_url = esc_url( admin_url( 'admin.php?page=mt-reports&event_id=' . $event_id . '&mt-event-report=' . $report_type . '&format=view&mt_print=true' ) ); } - $back_url = admin_url( apply_filters( 'mt_printable_report_back', 'admin.php?page=mt-reports&mt-event-report=' . $report_type . '&event_id=' . $event_id ) ); - $return = ( isset( $_GET['mt_print'] ) ) ? '' . __( 'Return to My Tickets Reports', 'my-tickets' ) . '' : ''; - $show = ''; + $back_url = admin_url( apply_filters( 'mt_printable_report_back', 'admin.php?page=mt-reports&mt-event-report=' . $report_type . '&event_id=' . $event_id ) ); + $return = ( isset( $_GET['mt_print'] ) ) ? '' . __( 'Return to My Tickets Reports', 'my-tickets' ) . '' : ''; + $show = ''; echo '

' . __( 'Print this report', 'my-tickets' ) . ' ' . $return . ' ' . $show . '

'; } ?> @@ -103,7 +103,7 @@ function mt_column_headers_events( $context = 'purchases', $type = 'table' ) { 'mt-first' => array( 'label' => __( 'First Name', 'my-tickets' ), ), - 'mt-last' => array( + 'mt-last' => array( 'label' => __( 'Last Name', 'my-tickets' ), ), 'mt-post' => array( @@ -142,7 +142,7 @@ function mt_column_headers_events( $context = 'purchases', $type = 'table' ) { * @param array $headers Array of column headers. * @param string $type Display type table or csv. * - * @return string + * @return string */ function mt_set_column_headers( $headers, $type ) { $cols = array(); @@ -679,13 +679,13 @@ function mt_get_tickets( $event_id ) { if ( ! is_array( $ticket ) ) { continue; } - $ticket_url = add_query_arg( 'ticket_id', $ticket_id, get_permalink( $options['mt_tickets_page'] ) ); - $purchase_id = $ticket['purchase_id']; - $alternate = ( 'alternate' === $alternate ) ? 'even' : 'alternate'; - $columns = mt_column_headers_events(); - $i = 0; - $rows = array(); - $csvs = array(); + $ticket_url = add_query_arg( 'ticket_id', $ticket_id, get_permalink( $options['mt_tickets_page'] ) ); + $purchase_id = $ticket['purchase_id']; + $alternate = ( 'alternate' === $alternate ) ? 'even' : 'alternate'; + $columns = mt_column_headers_events(); + $i = 0; + $rows = array(); + $csvs = array(); foreach ( $columns as $key => $value ) { if ( 0 === $i ) { $rows[] = "$ticket_id"; @@ -698,12 +698,12 @@ function mt_get_tickets( $event_id ) { } $contents = call_user_func( $callback, $key, $purchase_id, $ticket_id, $ticket ); $rows[] = "$contents"; - $csvs[] = "\"" . wp_strip_all_tags( $contents) . "\""; + $csvs[] = '\"' . wp_strip_all_tags( $contents ) . '\"'; } $i ++; } - $row = "" . implode( PHP_EOL, $rows ) . ''; - $csv = implode( ',', $csvs ) . PHP_EOL; + $row = "" . implode( PHP_EOL, $rows ) . ''; + $csv = implode( ',', $csvs ) . PHP_EOL; $report['html'][] = $row; $report['csv'][] = $csv; } @@ -719,21 +719,21 @@ function mt_get_tickets( $event_id ) { * @param string $ticket_id ID of the ticket being displayed. * @param array $ticket Array of ticket information. * - * @return string + * @return string */ function mt_get_report_data( $type, $purchase_id, $ticket_id, $ticket ) { $value = ''; switch ( $type ) { - case 'mt-seqid' : + case 'mt-seqid': $value = mt_get_sequential_id( $ticket_id ); break; - case 'mt-type' : + case 'mt-type': $value = mt_get_label( $ticket['type'] ); break; - case 'mt-purchaser' : + case 'mt-purchaser': $value = get_the_title( $purchase_id ); break; - case 'mt-first' : + case 'mt-first': $first = get_post_meta( $purchase_id, '_first_name', true ); if ( ! $first ) { $name = explode( ' ', get_the_title( $purchase_id ) ); @@ -741,7 +741,7 @@ function mt_get_report_data( $type, $purchase_id, $ticket_id, $ticket ) { } $value = $first; break; - case 'mt-last' : + case 'mt-last': $last = get_post_meta( $purchase_id, '_last_name', true ); if ( ! $last ) { $name = explode( ' ', get_the_title( $purchase_id ) ); @@ -749,18 +749,18 @@ function mt_get_report_data( $type, $purchase_id, $ticket_id, $ticket ) { } $value = $last; break; - case 'mt-post' : + case 'mt-post': $value = "$purchase_id"; break; - case 'mt-price' : + case 'mt-price': $value = apply_filters( 'mt_money_format', $ticket['price'] ); break; - case 'mt-status' : + case 'mt-status': $value = get_post_meta( $purchase_id, '_is_paid', true ); break; - case 'mt-used' : + case 'mt-used': $used_tickets = get_post_meta( $purchase_id, '_tickets_used' ); - $value = ( in_array( $ticket_id, $used_tickets, true ) ) ? ' ' . __( 'Used', 'my-tickets' ) : '--'; + $value = ( in_array( $ticket_id, $used_tickets, true ) ) ? ' ' . __( 'Used', 'my-tickets' ) : '--'; break; }