Skip to content
Merged
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
4 changes: 2 additions & 2 deletions assets/core/scss/components/_calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
}

.tutor-range-calendar-popover {
width: 700px;
max-width: 700px;
min-width: 700px;
max-width: 750px;

@include tutor-breakpoint-down(md) {
width: 300px;
Expand Down
12 changes: 9 additions & 3 deletions assets/core/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import collapse from '@alpinejs/collapse';
import focus from '@alpinejs/focus';
import { setLocaleData } from '@wordpress/i18n';
import Alpine from 'alpinejs';

import { TutorComponentRegistry } from '@Core/ts/ComponentRegistry';
Expand Down Expand Up @@ -75,11 +76,16 @@ const initializePlugin = async () => {
});

TutorComponentRegistry.registerLazy({
calendar: () =>
import(
calendar: () => {
if (tutorConfig.calendar_locales) {
setLocaleData(tutorConfig.calendar_locales, 'tutor');
}

return import(
/* webpackChunkName: "tutor-calendar" */
'@Core/ts/components/calendar'
).then(({ calendarMeta }) => calendarMeta),
).then(({ calendarMeta }) => calendarMeta);
},

form: () =>
import(
Expand Down
3 changes: 3 additions & 0 deletions classes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
function ( $file ) {
return basename( $file, '.svg' );
},
glob( tutor()->path . 'assets/icons/kids/*.svg' ) ?: array()

Check failure on line 184 in classes/Assets.php

View workflow job for this annotation

GitHub Actions / WPCS

Using short ternaries is not allowed as they are rarely used correctly
);
}

Expand Down Expand Up @@ -374,6 +374,9 @@
}
}
} else {
if ( 'en_US' !== $localize_data['local'] ) {
$localize_data['calendar_locales'] = tutils()->get_script_locale_data( 'tutor-calendar', $localize_data['local'] );
}

// Assign quiz option.
if ( ! empty( $post->post_type ) && 'tutor_quiz' === $post->post_type ) {
Expand Down
9 changes: 6 additions & 3 deletions classes/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,22 +800,25 @@ public function ajax_switch_profile() {
}

$switch_mode = '';
$switch_label = '';
$current_mode = Input::post( 'current_mode' );

if ( ! in_array( $current_mode, array( self::VIEW_AS_INSTRUCTOR, self::VIEW_AS_STUDENT ), true ) ) {
$this->response_bad_request( tutor_utils()->error_message( 'invalid_req' ) );
}

if ( self::VIEW_AS_INSTRUCTOR === $current_mode ) {
$switch_mode = self::VIEW_AS_STUDENT;
$switch_mode = self::VIEW_AS_STUDENT;
$switch_label = __( 'Student', 'tutor' );
} elseif ( self::VIEW_AS_STUDENT === $current_mode ) {
$switch_mode = self::VIEW_AS_INSTRUCTOR;
$switch_mode = self::VIEW_AS_INSTRUCTOR;
$switch_label = __( 'Instructor', 'tutor' );
}

update_user_meta( $user_id, self::VIEW_MODE_USER_META, $switch_mode );

// translators:%s for switching mode.
$this->response_success( sprintf( __( 'Profile switched to %s!', 'tutor' ), $switch_mode ) );
$this->response_success( sprintf( __( 'Profile switched to %s!', 'tutor' ), $switch_label ) );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/account/billing/order-history.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<?php
if ( empty( $orders ) ) :
EmptyState::make()
->title( 'No Orders Found!' )
->title( __( 'No Orders Found!', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/order-empty.svg' ) )
->render();
else :
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/discussions/comment-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<?php if ( empty( $lesson_comments ) ) : ?>
<?php
EmptyState::make()
->title( 'No Comments Found!' )
->title( __( 'No Comments Found!', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/comments-empty.svg' ) )
->render();
?>
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/discussions/qna-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<?php if ( empty( $questions ) ) : ?>
<?php
EmptyState::make()
->title( 'No Questions Found!' )
->title( __( 'No Questions Found!', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/qna-empty.svg' ) )
->render();
?>
Expand Down
8 changes: 4 additions & 4 deletions templates/dashboard/instructor/logged-in.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if ( 'try_again' === $instructor_status ) {
Alert::make()
->text( 'You have been rejected from being an instructor.' )
->text( __( 'You have been rejected from being an instructor.', 'tutor' ) )
->variant( Alert::WARNING )
->icon( Icon::WARNING )
->render();
Expand All @@ -34,11 +34,11 @@
<?php
$instructor_status_text = '';
if ( 'pending' === $instructor_status ) {
$instructor_status_text = 'Your application will be reviewed and the results will be sent to you by email.';
$instructor_status_text = __( 'Your application will be reviewed and the results will be sent to you by email.', 'tutor' );
} elseif ( 'approved' === $instructor_status ) {
$instructor_status_text = 'Your application has been accepted. Further necessary details have been sent to your registered email account.';
$instructor_status_text = __( 'Your application has been accepted. Further necessary details have been sent to your registered email account.', 'tutor' );
} elseif ( 'blocked' === $instructor_status ) {
$instructor_status_text = 'You have been blocked from being an instructor.';
$instructor_status_text = __( 'You have been blocked from being an instructor.', 'tutor' );
}
Alert::make()
->text( $instructor_status_text )
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard/my-courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
),
);

if ( ! current_user_can( 'administrator' ) && ! tutor_utils()->get_option( 'instructor_can_delete_course' ) ) {

Check failure on line 92 in templates/dashboard/my-courses.php

View workflow job for this annotation

GitHub Actions / WPCS

Capabilities should be used instead of roles. Found &quot;administrator&quot; in function call to current_user_can()
$show_course_delete = false;
}
?>
Expand Down Expand Up @@ -155,7 +155,7 @@
<?php if ( empty( $results ) ) : ?>
<?php
EmptyState::make()
->title( 'No Courses Found' )
->title( __( 'No Courses Found', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/learning-empty.svg' ) )
->render();
?>
Expand All @@ -164,7 +164,7 @@
<?php
global $post;
$tutor_nonce_value = wp_create_nonce( tutor()->nonce_action );
foreach ( $results as $post ) :

Check failure on line 167 in templates/dashboard/my-courses.php

View workflow job for this annotation

GitHub Actions / WPCS

Overriding WordPress globals is prohibited. Found assignment to $post
setup_postdata( $post );
$tutor_course_img = get_tutor_course_thumbnail_src();
$course_duration = tutor_utils()->get_course_duration( $post->ID, false );
Expand Down Expand Up @@ -269,7 +269,7 @@
<?php SvgIcon::make()->name( Icon::PUBLISH )->size( 20 )->render(); ?>
<span>
<?php
$can_publish_course = current_user_can( 'administrator' ) || (bool) tutor_utils()->get_option( 'instructor_can_publish_course' );

Check failure on line 272 in templates/dashboard/my-courses.php

View workflow job for this annotation

GitHub Actions / WPCS

Capabilities should be used instead of roles. Found &quot;administrator&quot; in function call to current_user_can()
if ( $can_publish_course ) {
esc_html_e( 'Publish', 'tutor' );
} else {
Expand Down
4 changes: 2 additions & 2 deletions templates/learning-area/lesson/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class="tutor-flex tutor-items-center tutor-justify-between tutor-px-6 tutor-py-5
<?php
ConfirmationModal::make()
->id( 'delete-comment-modal' )
->title( 'Delete This Item?' )
->message( 'This action cannot be undone.' )
->title( __( 'Delete This Item?', 'tutor' ) )
->message( __( 'This action cannot be undone.', 'tutor' ) )
->icon( Icon::DELETE_2, 80 )
->mutation_state( 'deleteCommentMutation' )
->confirm_handler( 'deleteCommentMutation?.mutate({ comment_id: payload?.commentId })' )
Expand Down
2 changes: 1 addition & 1 deletion templates/learning-area/subpages/qna.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<?php if ( empty( $questions ) ) : ?>
<?php
EmptyState::make()
->title( 'No Questions Found!' )
->title( __( 'No Questions Found!', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/qna-empty.svg' ) )
->render();
?>
Expand Down
Loading