diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index 6755e433d..20e63f8e1 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -611,7 +611,7 @@ function manage_columns_ticket_filter( $columns ) { function manage_columns_ticket_action( $column, $post_id ) { switch ( $column ) { case 'tix_price': - echo esc_html( append_currency( get_post_meta( $post_id, 'tix_price', true ), $this->options ) ); + echo esc_html( CampTix_Utility::append_currency( get_post_meta( $post_id, 'tix_price', true ), $this->options ) ); break; case 'tix_quantity': echo intval( get_post_meta( $post_id, 'tix_quantity', true ) ); @@ -713,11 +713,11 @@ function manage_columns_attendee_action( $column, $post_id ) { break; case 'tix_order_total': $order_total = (float) get_post_meta( $post_id, 'tix_order_total', true ); - echo esc_html( append_currency( $order_total, $this->options ) ); + echo esc_html( CampTix_Utility::append_currency( $order_total, $this->options ) ); break; case 'tix_ticket_price': $ticket_price = (float) get_post_meta( $post_id, 'tix_ticket_price', true ); - echo esc_html( append_currency( $ticket_price, $this->options ) ); + echo esc_html( CampTix_Utility::append_currency( $ticket_price, $this->options ) ); break; } } @@ -759,7 +759,7 @@ function manage_columns_coupon_action( $column, $post_id ) { $discount_price = (float) get_post_meta( $post_id, 'tix_discount_price', true ); $discount_percent = (int) get_post_meta( $post_id, 'tix_discount_percent', true ); if ( $discount_price > 0 ) { - echo esc_html( append_currency( $discount_price, $this->options ) ); + echo esc_html( CampTix_Utility::append_currency( $discount_price, $this->options ) ); } elseif ( $discount_percent > 0 ) { echo esc_html( $discount_percent . '%' ); } @@ -1915,7 +1915,7 @@ function field_currency( $args ) { $currency ) : ?> @@ -2534,7 +2534,7 @@ function menu_tools_revenue() { '

%s

', sprintf( __( 'Woah! The revenue total does not match with the transactions total. The actual total is: %s. Something somewhere has gone wrong, please report this.', 'wordcamporg' ), - esc_html( append_currency( $results['actual_total'], $this->options ) ) + esc_html( CampTix_Utility::append_currency( $results['actual_total'], $this->options ) ) ) ); } @@ -2656,18 +2656,18 @@ function generate_revenue_report_data() { __( 'Ticket type', 'wordcamporg' ) => esc_html( $ticket->post_title ), __( 'Sold', 'wordcamporg' ) => $ticket->tix_sold_count, __( 'Remaining', 'wordcamporg' ) => $ticket->tix_remaining, - __( 'Sub-Total', 'wordcamporg' ) => append_currency( $ticket->tix_sold_count * $ticket->tix_price, $this->options ), - __( 'Discounted', 'wordcamporg' ) => append_currency( $ticket->tix_discounted, $this->options ), - __( 'Revenue', 'wordcamporg' ) => append_currency( $ticket->tix_sold_count * $ticket->tix_price - $ticket->tix_discounted, $this->options ), + __( 'Sub-Total', 'wordcamporg' ) => CampTix_Utility::append_currency( $ticket->tix_sold_count * $ticket->tix_price, $this->options ), + __( 'Discounted', 'wordcamporg' ) => CampTix_Utility::append_currency( $ticket->tix_discounted, $this->options ), + __( 'Revenue', 'wordcamporg' ) => CampTix_Utility::append_currency( $ticket->tix_sold_count * $ticket->tix_price - $ticket->tix_discounted, $this->options ), ); } $rows[] = array( __( 'Ticket type', 'wordcamporg' ) => 'Total', __( 'Sold', 'wordcamporg' ) => $totals->sold, __( 'Remaining', 'wordcamporg' ) => $totals->remaining, - __( 'Sub-Total', 'wordcamporg' ) => append_currency( $totals->sub_total, $this->options ), - __( 'Discounted', 'wordcamporg' ) => append_currency( $totals->discounted, $this->options ), - __( 'Revenue', 'wordcamporg' ) => append_currency( $totals->revenue, $this->options ), + __( 'Sub-Total', 'wordcamporg' ) => CampTix_Utility::append_currency( $totals->sub_total, $this->options ), + __( 'Discounted', 'wordcamporg' ) => CampTix_Utility::append_currency( $totals->discounted, $this->options ), + __( 'Revenue', 'wordcamporg' ) => CampTix_Utility::append_currency( $totals->revenue, $this->options ), ); // Update stats @@ -4074,7 +4074,7 @@ function metabox_ticket_options() { options['currency'] ); ?> - options ) ); ?>
+ options ) ); ?>

@@ -4578,7 +4578,7 @@ function metabox_coupon_options() { - options ) ); ?> + options ) ); ?> % @@ -4701,7 +4701,7 @@ function metabox_attendee_info() { $rows[] = array( __( 'Coupon', 'wordcamporg' ), sprintf( '%s', get_edit_post_link( $coupon->ID ), $coupon->post_title ) ); } - $rows[] = array( __( 'Order Total', 'wordcamporg' ), append_currency( get_post_meta( $post->ID, 'tix_order_total', true ), $this->options ) ); + $rows[] = array( __( 'Order Total', 'wordcamporg' ), CampTix_Utility::append_currency( get_post_meta( $post->ID, 'tix_order_total', true ), $this->options ) ); // Reservation if ( $this->options['reservations_enabled'] ) { @@ -5240,7 +5240,7 @@ function template_redirect() { if ( $this->coupon->tix_discount_price > 0 ) { $ticket->tix_discounted_price = number_format( $ticket->tix_price - $this->coupon->tix_discount_price, 2, '.', '' ); - $ticket->tix_discounted_text = sprintf( __( 'Discounted %s', 'wordcamporg' ), append_currency( $this->coupon->tix_discount_price, $this->options ) ); + $ticket->tix_discounted_text = sprintf( __( 'Discounted %s', 'wordcamporg' ), CampTix_Utility::append_currency( $this->coupon->tix_discount_price, $this->options ) ); } elseif ( $this->coupon->tix_discount_percent > 0 ) { $ticket->tix_discounted_price = number_format( $ticket->tix_price - ( $ticket->tix_price * $this->coupon->tix_discount_percent / 100 ), 2, '.', '' ); $ticket->tix_discounted_text = sprintf( __( 'Discounted %s%%', 'wordcamporg' ), $this->coupon->tix_discount_percent ); @@ -5605,7 +5605,7 @@ function form_start() { 0 ) : ?> - options ) ); ?> + options ) ); ?> @@ -5638,7 +5638,7 @@ function form_start() { $discount_percent = (float) $this->coupon->tix_discount_percent; $discount_text = '0%'; if ( $discount_price > 0 ) { - $discount_text = append_currency( $discount_price, $this->options ); + $discount_text = CampTix_Utility::append_currency( $discount_price, $this->options ); } elseif ( $discount_percent > 0 ) { $discount_text = $discount_percent . '%'; } @@ -5809,13 +5809,13 @@ function form_attendee_info() { 0 ) : ?> - options ) ); ?> + options ) ); ?> - options ) ); ?> + options ) ); ?> @@ -5827,7 +5827,7 @@ function form_attendee_info() { $discount_text = ''; if ( $discount_price > 0 ) { - $discount_text = append_currency( $discount_price, $this->options ); + $discount_text = CampTix_Utility::append_currency( $discount_price, $this->options ); } elseif ( $discount_percent > 0 ) { $discount_text = $discount_percent . '%'; } @@ -5848,7 +5848,7 @@ function form_attendee_info() { - options ) ); ?> + options ) ); ?> @@ -7794,13 +7794,13 @@ function email_tickets( $payment_token = false, $from_status = 'draft', $to_stat $receipt_content = ''; foreach ( $order['items'] as $item ) { $ticket = get_post( $item['id'] ); - $receipt_content .= sprintf( "* %s (%s) x%d = %s\n", $ticket->post_title, append_currency( $item['price'], $this->options, false ), $item['quantity'], append_currency( $item['price'] * $item['quantity'], $this->options, false ) ); + $receipt_content .= sprintf( "* %s (%s) x%d = %s\n", $ticket->post_title, CampTix_Utility::append_currency( $item['price'], $this->options, false ), $item['quantity'], CampTix_Utility::append_currency( $item['price'] * $item['quantity'], $this->options, false ) ); } if ( isset( $order['coupon'] ) && $order['coupon'] ) $receipt_content .= sprintf( '* ' . __( 'Coupon used: %s', 'wordcamporg' ) . "\n", $order['coupon'] ); - $receipt_content .= sprintf( "* " . __( 'Total: %s', 'wordcamporg' ), append_currency( $order['total'], $this->options, false ) ); + $receipt_content .= sprintf( "* " . __( 'Total: %s', 'wordcamporg' ), CampTix_Utility::append_currency( $order['total'], $this->options, false ) ); $signature = apply_filters( 'camptix_ticket_email_signature', __( 'Let us know if you have any questions!', 'wordcamporg' ) ); // Set the tmp receipt for shortcodes use. diff --git a/public_html/wp-content/plugins/camptix/utility.php b/public_html/wp-content/plugins/camptix/utility.php index 716caf75e..1d5477cff 100644 --- a/public_html/wp-content/plugins/camptix/utility.php +++ b/public_html/wp-content/plugins/camptix/utility.php @@ -1,47 +1,52 @@ format( $amount ); + } elseif ( isset( $currency['format'] ) && $currency['format'] ) { + $formatted_amount = sprintf( $currency['format'], number_format( $amount, $currency['decimal_point'] ) ); + } else { + $formatted_amount = $currency_key . ' ' . number_format( $amount, $currency['decimal_point'] ); + } - if ( isset( $currency['locale'] ) ) { - $formatter = new NumberFormatter( $currency['locale'], NumberFormatter::CURRENCY ); - $formatted_amount = $formatter->format( $amount ); - } elseif ( isset( $currency['format'] ) && $currency['format'] ) { - $formatted_amount = sprintf( $currency['format'], number_format( $amount, $currency['decimal_point'] ) ); - } else { - $formatted_amount = $currency_key . ' ' . number_format( $amount, $currency['decimal_point'] ); - } + $formatted_amount = apply_filters( 'tix_append_currency', $formatted_amount, $currency, $amount ); - $formatted_amount = apply_filters( 'tix_append_currency', $formatted_amount, $currency, $amount ); + if ( $nbsp ) { + $formatted_amount = str_replace( ' ', ' ', $formatted_amount ); + } - if ( $nbsp ) { - $formatted_amount = str_replace( ' ', ' ', $formatted_amount ); + return $formatted_amount; } - - return $formatted_amount; -} +} \ No newline at end of file