From 4201c9c853fc6ad95e14943187818875ab78afb4 Mon Sep 17 00:00:00 2001 From: sanjana4khan Date: Fri, 3 Apr 2026 17:04:18 +0600 Subject: [PATCH 1/3] Removed html markup from tutor_price() and changes other file related to this --- classes/Instructor.php | 2 +- classes/Utils.php | 7 +++---- templates/dashboard/account/withdrawals.php | 8 ++++---- .../dashboard/instructor/analytics/stat-card-hover.php | 2 +- templates/dashboard/instructor/analytics/stat-card.php | 2 +- templates/dashboard/instructor/home.php | 2 +- .../instructor/home/top-performing-course-item.php | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/classes/Instructor.php b/classes/Instructor.php index b6806f64f9..9163617865 100644 --- a/classes/Instructor.php +++ b/classes/Instructor.php @@ -677,7 +677,7 @@ function ( $course ) { return array( 'name' => $course->course_title, 'url' => get_permalink( $course->course_id ), - 'revenue' => wp_kses_post( tutor_utils()->tutor_price( $course->total_revenue ?? 0, false ) ), + 'revenue' => tutor_utils()->tutor_price( $course->total_revenue ?? 0 ), 'students' => $course->total_student ?? 0, ); }, diff --git a/classes/Utils.php b/classes/Utils.php index c25fb7453c..5ff71a82ea 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -6432,21 +6432,20 @@ public function get_earning_statements( $user_id = 0, $filter_data = array() ) { * Get the price format * * @since 1.1.2 - * @since 4.0.0 Condition added for different monetizations and also added $html_markup for woocommece + * @since 4.0.0 Condition added for different monetizations. * * @param int $price price. - * @param bool $html_markup Whether to include HTML markup ( Only for woocommerce as it returns html markup ). * * @return int|string */ - public function tutor_price( $price = 0, $html_markup = true ) { + public function tutor_price( $price = 0 ) { $monetize_by = $this->get_option( 'monetize_by' ); if ( Ecommerce::MONETIZE_BY === $monetize_by ) { return tutor_get_formatted_price( $price ); } elseif ( function_exists( 'wc_price' ) && 'wc' === $monetize_by ) { - return wc_price( $price, array( 'in_span' => $html_markup ) ); + return wc_price( $price ); } elseif ( function_exists( 'edd_currency_filter' ) && 'edd' === $monetize_by ) { return edd_currency_filter( edd_format_amount( $price ) ); } elseif ( function_exists( 'pmpro_formatPrice' ) && 'pmpro' === $monetize_by ) { diff --git a/templates/dashboard/account/withdrawals.php b/templates/dashboard/account/withdrawals.php index 7a6d7a3d86..e034f9e22f 100644 --- a/templates/dashboard/account/withdrawals.php +++ b/templates/dashboard/account/withdrawals.php @@ -123,7 +123,7 @@
-
tutor_price( $summary_data->total_income ) ); ?>
+
tutor_price( $summary_data->total_income ) ); ?>
@@ -131,7 +131,7 @@
- tutor_price( $summary_data->total_pending ) ); ?> + tutor_price( $summary_data->total_pending ) ); ?> content( __( 'Total amount requested but not yet processed.', 'tutor' ) ) @@ -144,7 +144,7 @@
-
tutor_price( $summary_data->total_withdraw ) ); ?>
+
tutor_price( $summary_data->total_withdraw ) ); ?>
@@ -220,7 +220,7 @@
- tutor_price( $withdrawal->amount ) ); ?> + tutor_price( $withdrawal->amount ) ); ?>
- + diff --git a/templates/dashboard/instructor/analytics/stat-card.php b/templates/dashboard/instructor/analytics/stat-card.php index c0b185300c..ce8b9bf1f7 100644 --- a/templates/dashboard/instructor/analytics/stat-card.php +++ b/templates/dashboard/instructor/analytics/stat-card.php @@ -61,7 +61,7 @@
- +
diff --git a/templates/dashboard/instructor/home.php b/templates/dashboard/instructor/home.php index 8d64d13fbc..cc4e9c6312 100644 --- a/templates/dashboard/instructor/home.php +++ b/templates/dashboard/instructor/home.php @@ -126,7 +126,7 @@ 'variation' => 'success', 'title' => esc_html__( 'Total Earnings', 'tutor' ), 'icon' => Icon::EARNING, - 'value' => wp_kses_post( tutor_utils()->tutor_price( $total_earnings ?? 0, false ) ), + 'value' => tutor_utils()->tutor_price( $total_earnings ?? 0 ), 'hover_content' => $total_earnings_state_card_details, ), array( diff --git a/templates/dashboard/instructor/home/top-performing-course-item.php b/templates/dashboard/instructor/home/top-performing-course-item.php index 619f8372d3..ed5de13869 100644 --- a/templates/dashboard/instructor/home/top-performing-course-item.php +++ b/templates/dashboard/instructor/home/top-performing-course-item.php @@ -36,7 +36,7 @@
- +
From cb3b6920e2841ac065310b580907e8d1dc1a8a9b Mon Sep 17 00:00:00 2001 From: sanjana4khan Date: Fri, 3 Apr 2026 17:11:30 +0600 Subject: [PATCH 2/3] Changes in other file for removing html markup from tutor_price --- includes/tutor-general-functions.php | 5 ++--- .../dashboard/account/billing/order-history-card.php | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/includes/tutor-general-functions.php b/includes/tutor-general-functions.php index f69da2e56c..772d2c418f 100644 --- a/includes/tutor-general-functions.php +++ b/includes/tutor-general-functions.php @@ -1635,14 +1635,13 @@ function tutor_get_course_formatted_price_html( $course_id, $echo = true ) { * Formatting as per ecommerce price settings * * @since 3.0.0 - * @since 4.0.0 Added $html_markup for wooCommerce * * @param mixed $price Raw price. * @param bool $html_markup Whether to include HTML markup ( Only for wooCommerce as it returns html markup ). * * @return string|void */ - function tutor_get_formatted_price( $price, $html_markup = true ) { + function tutor_get_formatted_price( $price ) { $price = floatval( Input::sanitize( $price ) ); $monetize_by = tutor_utils()->get_option( 'monetize_by' ); if ( Ecommerce::MONETIZE_BY === $monetize_by ) { @@ -1655,7 +1654,7 @@ function tutor_get_formatted_price( $price, $html_markup = true ) { $price = number_format( $price, $no_of_decimal, $decimal_separator, $thousand_separator ); $price = 'left' === $currency_position ? $currency_symbol . $price : $price . $currency_symbol; } elseif ( 'wc' === $monetize_by ) { - $price = wc_price( $price, array( 'in_span' => $html_markup ) ); + $price = wc_price( $price ); } elseif ( 'edd' === $monetize_by ) { $price = edd_currency_filter( edd_format_amount( $price ) ); } diff --git a/templates/dashboard/account/billing/order-history-card.php b/templates/dashboard/account/billing/order-history-card.php index 4ddc20d603..3c8ce95d4a 100644 --- a/templates/dashboard/account/billing/order-history-card.php +++ b/templates/dashboard/account/billing/order-history-card.php @@ -15,10 +15,8 @@ use Tutor\Helpers\DateTimeHelper; use Tutor\Models\OrderModel; -$monetize_by = tutor_utils()->get_option( 'monetize_by' ); -$html_markup = 'wc' !== $monetize_by; -$titles = OrderModel::get_order_history_titles( $order ); -$pay_link = OrderModel::get_order_history_pay_link( $order ); +$titles = OrderModel::get_order_history_titles( $order ); +$pay_link = OrderModel::get_order_history_pay_link( $order ); ?>
@@ -55,7 +53,7 @@
- total_price, $html_markup ) ); ?> + total_price ) ); ?>
titles = $titles; - OrderModel::render_billing_receipt_action( $order ); ?>
From 0a7460a40e53cd08c1fbc14cdde919cd5c4ca3ed Mon Sep 17 00:00:00 2001 From: sanjana4khan Date: Fri, 3 Apr 2026 17:21:20 +0600 Subject: [PATCH 3/3] Changes for removing html markup from tutor_get_formatted_price() --- includes/tutor-general-functions.php | 1 - templates/dashboard/account/billing/order-history-card.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/tutor-general-functions.php b/includes/tutor-general-functions.php index 772d2c418f..044feeb335 100644 --- a/includes/tutor-general-functions.php +++ b/includes/tutor-general-functions.php @@ -1637,7 +1637,6 @@ function tutor_get_course_formatted_price_html( $course_id, $echo = true ) { * @since 3.0.0 * * @param mixed $price Raw price. - * @param bool $html_markup Whether to include HTML markup ( Only for wooCommerce as it returns html markup ). * * @return string|void */ diff --git a/templates/dashboard/account/billing/order-history-card.php b/templates/dashboard/account/billing/order-history-card.php index 3c8ce95d4a..4077d2c020 100644 --- a/templates/dashboard/account/billing/order-history-card.php +++ b/templates/dashboard/account/billing/order-history-card.php @@ -53,7 +53,7 @@
- total_price ) ); ?> + total_price ) ); ?>