Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/Instructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
},
Expand Down
7 changes: 3 additions & 4 deletions classes/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -6441,21 +6441,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 ) {
Expand Down
6 changes: 2 additions & 4 deletions includes/tutor-general-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1635,14 +1635,12 @@ 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 ) {
Expand All @@ -1655,7 +1653,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 ) );
}
Expand Down
9 changes: 3 additions & 6 deletions templates/dashboard/account/billing/order-history-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

?>
<div class="tutor-billing-card">
Expand Down Expand Up @@ -55,7 +53,7 @@

<div class="tutor-billing-card-right">
<div class="tutor-billing-card-amount">
<?php echo esc_html( tutor_get_formatted_price( $order->total_price, $html_markup ) ); ?>
<?php echo wp_kses_post( tutor_get_formatted_price( $order->total_price ) ); ?>
</div>

<?php
Expand All @@ -70,7 +68,6 @@
);

$order->titles = $titles;

OrderModel::render_billing_receipt_action( $order );
?>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/dashboard/account/withdrawals.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@
<div class="tutor-withdrawal-status">
<div class="tutor-withdrawal-status-item">
<div class="tutor-withdrawal-status-item-label"><?php esc_html_e( 'Net Income', 'tutor' ); ?></div>
<div class="tutor-withdrawal-status-item-value"><?php echo esc_html( tutor_utils()->tutor_price( $summary_data->total_income ) ); ?></div>
<div class="tutor-withdrawal-status-item-value"><?php echo wp_kses_post( tutor_utils()->tutor_price( $summary_data->total_income ) ); ?></div>
</div>
<div class="tutor-withdrawal-status-item">
<div class="tutor-withdrawal-status-item-label tutor-flex tutor-items-center tutor-gap-1">
<?php esc_html_e( 'Pending Withdrawals', 'tutor' ); ?>

</div>
<div class="tutor-withdrawal-status-item-value tutor-withdrawal-status-item-value--pending tutor-flex tutor-items-center tutor-gap-3">
<?php echo esc_html( tutor_utils()->tutor_price( $summary_data->total_pending ) ); ?>
<?php echo wp_kses_post( tutor_utils()->tutor_price( $summary_data->total_pending ) ); ?>
<?php
Tooltip::make()
->content( __( 'Total amount requested but not yet processed.', 'tutor' ) )
Expand All @@ -144,7 +144,7 @@
</div>
<div class="tutor-withdrawal-status-item">
<div class="tutor-withdrawal-status-item-label"><?php esc_html_e( 'Withdrawal Total', 'tutor' ); ?></div>
<div class="tutor-withdrawal-status-item-value"><?php echo esc_html( tutor_utils()->tutor_price( $summary_data->total_withdraw ) ); ?></div>
<div class="tutor-withdrawal-status-item-value"><?php echo wp_kses_post( tutor_utils()->tutor_price( $summary_data->total_withdraw ) ); ?></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -220,7 +220,7 @@

<div class="tutor-billing-card-right">
<div class="tutor-billing-card-amount">
<?php echo esc_html( tutor_utils()->tutor_price( $withdrawal->amount ) ); ?>
<?php echo wp_kses_post( tutor_utils()->tutor_price( $withdrawal->amount ) ); ?>

<div class="tutor-flex tutor-items-center tutor-gap-5 tutor-mt-4">
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<div class="tutor-flex tutor-items-center tutor-gap-4 tutor-justify-between tutor-mt-5">
<span class="tutor-font-semibold tutor-text-primary tutor-tiny">
<?php echo esc_html( $hover_amount ); ?>
<?php echo wp_kses_post( $hover_amount ); ?>
</span>
<span class="stat-hover-trigger <?php echo esc_attr( $hover_content['class'] ?? '' ); ?>">
<?php echo esc_html( $hover_content['percentage'] ); ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/instructor/analytics/stat-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>
<div class="tutor-stat-card-content">
<div class="tutor-stat-card-value">
<?php echo esc_html( $value ); ?>
<?php echo wp_kses_post( $value ); ?>
</div>

<?php if ( ! empty( $content_display ) ) : ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/instructor/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>

<div class="tutor-tiny tutor-font-semibold">
<?php echo esc_html( $item['revenue'] ); ?>
<?php echo wp_kses_post( $item['revenue'] ); ?>
</div>
</div>

Expand Down
Loading