Skip to content

Commit 33fdaca

Browse files
committed
Review Changes
1 parent 32c7d9e commit 33fdaca

5 files changed

Lines changed: 46 additions & 13 deletions

File tree

classes/Icon.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,31 @@ final class Icon {
412412
const ZIP = 'zip';
413413
const ZOOM = 'zoom';
414414
const ZOOM_COLORIZE = 'zoom-colorize';
415+
416+
417+
/**
418+
* Get the icon constant based on the given post type.
419+
*
420+
* @since 4.0.0
421+
*
422+
* @param string $post_type The post type slug.
423+
*
424+
* @return string Icon constant associated with the post type.
425+
*/
426+
public static function get_icon_by_post_type( $post_type ): string {
427+
switch ( $post_type ) {
428+
case 'tutor_assignments':
429+
return self::ASSIGNMENT;
430+
case 'tutor-google-meet':
431+
return self::GOOGLE_MEET_COLORIZE;
432+
case 'tutor_quiz':
433+
return self::QUIZ;
434+
case 'tutor_zoom_meeting':
435+
return self::ZOOM_COLORIZE;
436+
case 'lesson':
437+
return self::LESSON;
438+
default:
439+
return '';
440+
}
441+
}
415442
}

models/OrderModel.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,12 @@ private static function should_active_pay_button( $order, $show_pay_button ) {
19301930
public function get_statements( $post_type_in_clause, $course_query, $date_query, $user_id, $offset, $limit, $order_by, $order ): array {
19311931
global $wpdb;
19321932

1933+
$order_clause = '';
1934+
1935+
if ( sanitize_sql_orderby( $order ) ) {
1936+
$order_clause = "ORDER BY {$order_by} {$order}";
1937+
}
1938+
19331939
//phpcs:disable
19341940
$statements = $wpdb->get_results(
19351941
$wpdb->prepare(
@@ -1951,7 +1957,7 @@ public function get_statements( $post_type_in_clause, $course_query, $date_query
19511957
WHERE statements.user_id = %d
19521958
{$course_query}
19531959
{$date_query}
1954-
ORDER BY {$order_by} {$order}
1960+
{$order_clause}
19551961
LIMIT %d, %d",
19561962
$user_id,
19571963
$offset,

templates/dashboard/instructor/analytics/stat-card-hover.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
defined( 'ABSPATH' ) || exit;
1010

11-
$start_date = $data['start_date'];
12-
$end_date = $data['end_date'];
11+
$start_date = $data['start_date'] ?? '';
12+
$end_date = $data['end_date'] ?? '';
1313
$hover_content = $data['hover_content'];
1414
$hover_amount = $data['hover_amount'];
1515
$time_zone = wp_timezone();
16-
$previous_start_date = $hover_content['previous_start_date'];
17-
$previous_end_date = $hover_content['previous_end_date'];
16+
$previous_start_date = $hover_content['previous_start_date'] ?? '';
17+
$previous_end_date = $hover_content['previous_end_date'] ?? '';
1818

1919
?>
2020

2121
<div class="tutor-stat-card-hover tutor-m-1">
2222
<div class="tutor-stat-card-hover-wrap">
23-
<span class="stat-hover-trigger <?php echo $hover_content['class'] ?? ''; //phpcs:ignore ?>">
24-
<?php echo $hover_content['percentage']; //phpcs:ignore ?>
23+
<span class="stat-hover-trigger <?php echo esc_attr( $hover_content['class'] ?? '' ); ?>">
24+
<?php echo esc_html( $hover_content['percentage'] ); ?>
2525
<?php tutor_utils()->render_svg_icon( $hover_content['icon'], 16, 16, array( 'class' => $hover_content['icon_class'] ?? '' ) ); ?>
2626
</span>
2727

@@ -31,7 +31,7 @@
3131
<?php echo esc_html( tutor_i18n_get_formated_date( $previous_start_date, 'M j' ) ); ?> -
3232
<?php echo esc_html( tutor_i18n_get_formated_date( $previous_end_date, 'M j Y' ) ); ?>
3333
</span>
34-
<span class="tutor-text-subdued"><?php echo __( 'vs', 'tutor-pro' ); ?></span>
34+
<span class="tutor-text-subdued"><?php echo esc_html_e( 'vs', 'tutor' ); ?></span>
3535
<span>
3636
<?php echo esc_html( tutor_i18n_get_formated_date( $start_date, 'M j' ) ); ?> -
3737
<?php echo esc_html( tutor_i18n_get_formated_date( $end_date, 'M j Y' ) ); ?>
@@ -41,8 +41,8 @@
4141
<span class="tutor-font-semibold tutor-text-primary tutor-tiny">
4242
<?php echo esc_html( $hover_amount ); ?>
4343
</span>
44-
<span class="stat-hover-trigger <?php echo $hover_content['class'] ?? ''; //phpcs:ignore ?>">
45-
<?php echo $hover_content['percentage']; ?>
44+
<span class="stat-hover-trigger <?php echo esc_attr( $hover_content['class'] ?? '' ); ?>">
45+
<?php echo esc_html( $hover_content['percentage'] ); ?>
4646
<?php tutor_utils()->render_svg_icon( $hover_content['icon'], 16, 16, array( 'class' => $hover_content['icon_class'] ?? '' ) ); ?>
4747
</span>
4848
</div>

templates/dashboard/instructor/home/upcoming-task-item.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@
5454
</div>
5555
<div class="tutor-dashboard-home-task-live-tag" data-meta>
5656
<div class="tutor-dashboard-home-task-live-tag-badge">
57-
<?php Badge::make()
58-
->icon( $get_icon_by_post_type( $item['post_type'] ) )
57+
<?php
58+
Badge::make()
59+
->icon( Icon::get_icon_by_post_type( $item['post_type'] ) )
5960
->label( $label )
6061
->rounded()
6162
->render();

templates/dashboard/instructor/profile-statistics.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @since 4.0.0
99
*/
1010

11-
use TUTOR\Icon;
1211
?>
1312

1413
<h5 class="tutor-statistic-title">

0 commit comments

Comments
 (0)