|
22 | 22 | <div class="tutor-flex tutor-items-center tutor-justify-between tutor-px-6 tutor-py-5 tutor-border-t" :class="{ 'tutor-loading-spinner': loadingReplies }"> |
23 | 23 | <div class="tutor-small tutor-text-secondary"> |
24 | 24 | <?php esc_html_e( 'Replies', 'tutor' ); ?> |
25 | | - <span class="tutor-text-primary tutor-font-medium">(<?php echo (int) count( $replies ); ?>)</span> |
| 25 | + <span class="tutor-text-primary tutor-font-medium">(<?php echo esc_html( count( $replies ) ); ?>)</span> |
26 | 26 | </div> |
27 | 27 | <?php |
28 | 28 | Sorting::make() |
|
36 | 36 | <div class="tutor-discussion-single-reply-list tutor-border-t"> |
37 | 37 | <?php foreach ( $replies as $reply ) : ?> |
38 | 38 | <div class="tutor-discussion-reply-list-item"> |
39 | | - <div class="tutor-flex tutor-gap-5 tutor-w-full" x-show="editingId !== <?php echo (int) $reply->comment_ID; ?>"> |
| 39 | + <div class="tutor-flex tutor-gap-5 tutor-w-full" x-show="editingId !== <?php echo esc_attr( $reply->comment_ID ); ?>"> |
40 | 40 | <?php Avatar::make()->user( $reply->user_id )->size( Size::SIZE_40 )->render(); ?> |
41 | 41 | <div class="tutor-flex-1"> |
42 | 42 | <div class="tutor-flex tutor-items-center tutor-gap-5 tutor-mb-2 tutor-small"> |
|
45 | 45 | </span> |
46 | 46 | <span class="tutor-text-secondary"> |
47 | 47 | <?php |
48 | | - // Translators: %s is the time of comment. |
49 | | - echo esc_html( sprintf( __( '%s ago', 'tutor' ), human_time_diff( strtotime( $reply->comment_date_gmt ) ) ) ); |
| 48 | + // translators: %s is the time of comment. |
| 49 | + echo esc_html( sprintf( __( '%s ago', 'tutor' ), human_time_diff( strtotime( $reply->comment_date_gmt ) ) ) ); |
50 | 50 | ?> |
51 | 51 | </span> |
52 | 52 | </div> |
53 | | - <div class="tutor-p2 tutor-text-secondary" id="tutor-qna-text-<?php echo (int) $reply->comment_ID; ?>"> |
| 53 | + <div class="tutor-p2 tutor-text-secondary" id="tutor-qna-text-<?php echo esc_attr( $reply->comment_ID ); ?>"> |
54 | 54 | <?php echo wp_kses_post( $reply->comment_content ); ?> |
55 | 55 | </div> |
56 | 56 | </div> |
|
60 | 60 | $has_menu = $can_edit || $can_delete; |
61 | 61 | ?> |
62 | 62 | <?php if ( $has_menu ) : ?> |
63 | | - <div x-data="tutorPopover({ placement: 'bottom-end' })" class="tutor-ml-auto"> |
64 | | - <button x-ref="trigger" @click="toggle()" class="tutor-btn tutor-btn-ghost tutor-btn-x-small tutor-btn-icon"> |
65 | | - <?php tutor_utils()->render_svg_icon( Icon::ELLIPSES, 16, 16, array( 'class' => 'tutor-icon-secondary' ) ); ?> |
66 | | - </button> |
67 | | - <div x-ref="content" x-show="open" x-cloak @click.outside="handleClickOutside()" class="tutor-popover"> |
68 | | - <div class="tutor-popover-menu" style="min-width: 110px;"> |
69 | | - <?php if ( $user_id === (int) $reply->user_id ) : ?> |
70 | | - <button class="tutor-popover-menu-item tutor-gap-5" @click="setEditing(<?php echo (int) $reply->comment_ID; ?>, 'qna'); hide()"> |
71 | | - <?php tutor_utils()->render_svg_icon( Icon::EDIT_2, 20, 20 ); ?> |
72 | | - <?php esc_html_e( 'Edit', 'tutor' ); ?> |
73 | | - </button> |
74 | | - <?php endif; ?> |
75 | | - <?php if ( User::is_instructor_view() || $user_id === (int) $reply->user_id ) : ?> |
76 | | - <button |
77 | | - class="tutor-popover-menu-item tutor-gap-5" |
78 | | - @click="TutorCore.modal.showModal('tutor-qna-delete-modal', { question_id: <?php echo esc_html( $reply->comment_ID ); ?>, context: 'reply' }); hide()"> |
79 | | - <?php tutor_utils()->render_svg_icon( Icon::DELETE_2, 20, 20 ); ?> |
80 | | - <?php esc_html_e( 'Delete', 'tutor' ); ?> |
81 | | - </button> |
82 | | - <?php endif; ?> |
| 63 | + <div x-data="tutorPopover({ placement: 'bottom-end' })" class="tutor-ml-auto"> |
| 64 | + <button x-ref="trigger" @click="toggle()" class="tutor-btn tutor-btn-ghost tutor-btn-x-small tutor-btn-icon"> |
| 65 | + <?php tutor_utils()->render_svg_icon( Icon::ELLIPSES, 16, 16, array( 'class' => 'tutor-icon-secondary' ) ); ?> |
| 66 | + </button> |
| 67 | + <div x-ref="content" x-show="open" x-cloak @click.outside="handleClickOutside()" class="tutor-popover"> |
| 68 | + <div class="tutor-popover-menu" style="min-width: 110px;"> |
| 69 | + <?php if ( $can_edit ) : ?> |
| 70 | + <button class="tutor-popover-menu-item tutor-gap-5" @click="setEditing(<?php echo esc_attr( $reply->comment_ID ); ?>, 'qna'); hide()"> |
| 71 | + <?php tutor_utils()->render_svg_icon( Icon::EDIT_2, 20, 20 ); ?> |
| 72 | + <?php esc_html_e( 'Edit', 'tutor' ); ?> |
| 73 | + </button> |
| 74 | + <?php endif; ?> |
| 75 | + <?php if ( $can_delete ) : ?> |
| 76 | + <button |
| 77 | + class="tutor-popover-menu-item tutor-gap-5" |
| 78 | + @click="TutorCore.modal.showModal('tutor-qna-delete-modal', { question_id: <?php echo esc_attr( $reply->comment_ID ); ?>, context: 'reply' }); hide()" |
| 79 | + > |
| 80 | + <?php tutor_utils()->render_svg_icon( Icon::DELETE_2, 20, 20 ); ?> |
| 81 | + <?php esc_html_e( 'Delete', 'tutor' ); ?> |
| 82 | + </button> |
| 83 | + <?php endif; ?> |
| 84 | + </div> |
83 | 85 | </div> |
84 | 86 | </div> |
85 | | - </div> |
86 | 87 | <?php endif; ?> |
87 | 88 | </div> |
88 | 89 |
|
89 | | - <?php if ( $user_id === (int) $reply->user_id ) : ?> |
90 | | - <div x-show="editingId === <?php echo (int) $reply->comment_ID; ?>" x-cloak class="tutor-mt-5 tutor-w-full"> |
| 90 | + <?php if ( $can_edit ) : ?> |
| 91 | + <div x-show="editingId === <?php echo esc_attr( $reply->comment_ID ); ?>" x-cloak class="tutor-mt-5 tutor-w-full"> |
91 | 92 | <?php |
92 | 93 | tutor_load_template( |
93 | 94 | 'dashboard.discussions.qna-form', |
|
0 commit comments