diff --git a/classes/Input.php b/classes/Input.php index 12253927d..e0aa7fb53 100644 --- a/classes/Input.php +++ b/classes/Input.php @@ -356,4 +356,64 @@ public static function allow_iframe( $tags, $context ) { ); return $tags; } + + /** + * This method is used with wp_kses_allowed_html filter + * to allow svg tags. + * + * @since 4.0.0 + * + * @param array $allowed_tags allowed HTML tags. + * + * @return array + */ + public static function allow_svg( $allowed_tags ) { + $svg_tags = array( + 'svg' => array( + 'class' => true, + 'aria-hidden' => true, + 'aria-label' => true, + 'role' => true, + 'xmlns' => true, + 'width' => true, + 'height' => true, + 'viewbox' => true, + 'fill' => true, + ), + 'g' => array( + 'fill' => true, + ), + 'path' => array( + 'd' => true, + 'fill' => true, + 'stroke' => true, + 'stroke-width' => true, + ), + 'circle' => array( + 'cx' => true, + 'cy' => true, + 'r' => true, + ), + 'rect' => array( + 'x' => true, + 'y' => true, + 'width' => true, + 'height' => true, + ), + 'line' => array( + 'x1' => true, + 'x2' => true, + 'y1' => true, + 'y2' => true, + ), + 'polyline' => array( + 'points' => true, + ), + 'polygon' => array( + 'points' => true, + ), + ); + + return array_merge( $allowed_tags, $svg_tags ); + } } diff --git a/classes/Template.php b/classes/Template.php index a5412d64a..0ef91125c 100644 --- a/classes/Template.php +++ b/classes/Template.php @@ -166,11 +166,7 @@ public function load_single_course_template( $template ) { global $wp_query; if ( $wp_query->is_single && ! empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] === $this->course_post_type ) { // Check if the slug contains subpage of learning area. - $learning_area_subpages = self::make_learning_area_sub_page_nav_items(); - $subpage = Input::get( 'subpage' ); - $subpage_slugs = array_keys( $learning_area_subpages ); - - if ( in_array( $subpage, $subpage_slugs, true ) ) { + if ( Input::has( 'subpage' ) ) { $template = tutor_get_template( 'learning-area.index' ); } else { do_action( 'single_course_template_before_load', get_the_ID() ); @@ -537,15 +533,15 @@ public static function make_learning_area_sub_page_nav_items( $base_url = '' ): $menu_items = array( 'qna' => array( - 'title' => __( 'Q&A', 'tutor' ), - 'icon' => Icon::QA, - 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'qna' ) ), + 'title' => __( 'Q&A', 'tutor' ), + 'icon' => Icon::QA, + 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'qna' ) ), 'template' => tutor_get_template( 'learning-area.subpages.qna' ), ), 'course-info' => array( - 'title' => __( 'Course Info', 'tutor' ), - 'icon' => Icon::INFO_OCTAGON, - 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'course-info' ) ), + 'title' => __( 'Course Info', 'tutor' ), + 'icon' => Icon::INFO_OCTAGON, + 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'course-info' ) ), 'template' => tutor_get_template( 'learning-area.subpages.course-info' ), ), ); diff --git a/classes/Utils.php b/classes/Utils.php index bbc41e75b..08ac972d9 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -5619,11 +5619,8 @@ public function is_learning_area(): bool { if ( is_single() && ! empty( $current_post_type ) ) { if ( in_array( $current_post_type, $post_types, true ) ) { return true; - } elseif ( tutor()->course_post_type === $current_post_type ) { - // Check if the subpage is belongs to learning area. - $learning_subpage = Input::get( 'subpage' ); - $allowed_subpages = array_keys( Template::make_learning_area_sub_page_nav_items() ); - return in_array( $learning_subpage, $allowed_subpages, true ); + } elseif ( tutor()->course_post_type === $current_post_type && Input::has( 'subpage' ) ) { + return true; } } @@ -8542,7 +8539,7 @@ public function is_tutor_dashboard( $subpage = null ) { * * @since 1.9.4 * @since 4.0.0 Subpage check support added. - * Example: assignments/submitted + * Example: assignments/submitted * * @param string $subpage subpage. * @@ -9521,7 +9518,7 @@ public function not_found_text(): string { */ public function instructor_menus(): array { $menus = array( - 'index' => array( + 'index' => array( 'title' => __( 'Home', 'tutor' ), 'icon' => Icon::HOME, ), @@ -9558,9 +9555,8 @@ public function instructor_menus(): array { ), ); - if ( $this->should_show_dicussion_menu() ) { - $other_menus['discussions'] = array ( + $other_menus['discussions'] = array( 'title' => __( 'Discussions', 'tutor' ), 'auth_cap' => tutor()->instructor_role, 'icon' => Icon::QA, @@ -9606,10 +9602,10 @@ public function default_menus(): array { 'title' => __( 'Courses', 'tutor' ), 'icon' => Icon::COURSES, ), - 'account' => array( - 'label' => __( 'Account', 'tutor' ), - 'show_ui' => false - ) + 'account' => array( + 'label' => __( 'Account', 'tutor' ), + 'show_ui' => false, + ), ); if ( $this->should_show_dicussion_menu() ) { diff --git a/templates/learning-area/index.php b/templates/learning-area/index.php index b8ca8dbc9..cfd3a4212 100644 --- a/templates/learning-area/index.php +++ b/templates/learning-area/index.php @@ -16,10 +16,8 @@ wp_head(); -$current_user_id = get_current_user_id(); -$subpages = Template::make_learning_area_sub_page_nav_items(); - // Tutor global variable for using inside learning area. +$current_user_id = get_current_user_id(); $tutor_current_post_type = get_post_type(); $tutor_current_post = get_post(); $tutor_current_content_id = get_the_ID(); @@ -30,6 +28,7 @@ $tutor_is_public_course = Course_List::is_public( $tutor_course_id ); $tutor_is_course_instructor = tutor_utils()->has_user_course_content_access( $current_user_id, $tutor_course_id ); +$subpages = Template::make_learning_area_sub_page_nav_items(); ?> @@ -42,9 +41,8 @@ -
-
-
- - - - - - - - - - - - - - - - - - - - - -
-
-

-
- - September 3, 2025 +// Globals inherited from learning-area/index.php template. +global $tutor_course_id, +$tutor_course, +$current_user_id; + +$is_course_completed = tutor_utils()->is_completed_course( $tutor_course_id, $current_user_id ); +$course_thumbnail = get_tutor_course_thumbnail_src( 'full', $tutor_course_id ); +$course_author = get_user( $tutor_course->post_author ); +$course_benefits = tutor_course_benefits( $tutor_course_id ); +$instructors = tutor_utils()->get_instructors_by_course( $tutor_course_id ); +$course_rating = tutor_utils()->get_course_rating( $tutor_course_id ); +$course_materials = tutor_course_material_includes( $tutor_course_id ); +$course_attachments = tutor_utils()->get_attachments( $tutor_course_id ); + +ob_start(); +foreach ( $instructors as $key => $instructor ) { + ?> +
+ user( $instructor->ID )->size( 'md' )->render(); ?> + +
+
+ display_name ); ?>
-
- - 85.35% + tutor_profile_job_title ) ) : ?> +
+ tutor_profile_job_title ); ?>
-
-
- - +
+ Icon::INSTRUCTOR, + 'title' => __( 'Instructors', 'tutor' ), + 'content' => $instructors_content, + ), +); + +if ( tutor_utils()->get_option( 'enable_course_total_enrolled' ) ) { + $default_meta[] = array( + 'icon' => Icon::PASSED, + 'title' => __( 'Total Enrolled', 'tutor' ), + 'content' => sprintf( + // translators: %s is the total enrolled users count. + _n( '%s Student', '%s Students', tutor_utils()->count_enrolled_users_by_course(), 'tutor' ), + tutor_utils()->count_enrolled_users_by_course() + ), + ); +} + +if ( tutor_utils()->get_option( 'enable_course_level', true, true ) ) { + $default_meta[] = array( + 'icon' => Icon::LEVEL, + 'title' => __( 'Level', 'tutor' ), + 'content' => get_tutor_course_level( $tutor_course_id ), + ); +} + +if ( tutor_utils()->get_option( 'enable_course_duration', true, true ) ) { + $default_meta[] = array( + 'icon' => Icon::TIME, + 'title' => __( 'Duration', 'tutor' ), + 'content' => get_tutor_course_duration_context( $tutor_course_id ), + ); +} + +$default_meta[] = array( + 'icon' => Icon::RATINGS, + 'title' => __( 'Student Ratings', 'tutor' ), + 'content' => StarRating::make()->count( $course_rating->rating_count )->rating( $course_rating->rating_avg )->show_average( true )->get(), +); + +$default_meta[] = array( + 'icon' => Icon::RESOURCES, + 'title' => __( 'Resources', 'tutor' ), + 'content' => sprintf( + // translators: %s is the total attachments count. + _n( '%s File', '%s Files', count( $course_attachments ), 'tutor' ), + count( $course_attachments ) + ), +); + +ob_start(); +?> +
    + +
  • + +
+ Icon::MATERIAL, + 'title' => __( 'Materials', 'tutor' ), + 'content' => $course_materials_content, +); + +$metadata = apply_filters( 'tutor_learning_area_course_info_metadata', $default_meta, $tutor_course_id ); +?> +
+
- course thumb + <?php echo esc_attr( $tutor_course->post_title ); ?>
render_svg_icon( Icon::RELOAD_2 ); ?> - August 28, 2025 Last Updated + post_modified ); ?> Last Updated
-

Intimate Photography Portraits

-
by School of Rock
+

post_title ); ?>

+
+ display_name + ) + ); + ?> +
- course thumb + course thumb
-
Intimate Photography Portraits
-
by School of Rock
+
post_title ); ?>
+
+ display_name + ) + ); + ?> +
@@ -85,14 +169,14 @@
- About this Course +
render_svg_icon( Icon::CHEVRON_DOWN_2, 24, 24 ); ?>
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam nobis asperiores, dicta delectus rem omnis voluptas eaque magni. Totam sed delectus corporis praesentium modi voluptatem error saepe quaerat illum deleniti? + post_content ); ?>
@@ -106,30 +190,14 @@
-
- render_svg_icon( Icon::CHECK_2 ); ?> -
- Master the basics of Figma, from interface navigation to essential tools. -
-
-
- render_svg_icon( Icon::CHECK_2 ); ?> -
- Create stunning, functional designs with advanced Figma features. + +
+ render_svg_icon( Icon::CHECK_2 ); ?> +
+ +
-
-
- render_svg_icon( Icon::CHECK_2 ); ?> -
- Develop practical design projects that enhance your portfolio. -
-
-
- render_svg_icon( Icon::CHECK_2 ); ?> -
- Continuously update skills with weekly new projects, staying ahead in design trends. -
-
+
@@ -137,104 +205,24 @@
- - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +
-
- render_svg_icon( Icon::INSTRUCTOR, 20, 20 ); ?> - -
-
-
- User Avatar -
-
-
Bilbo Baggins
-
- Dr. Rosa I. Arriaga, Senior Research Scientist
School of Interactive Computing + +
+
+ render_svg_icon( $meta['icon'], 20, 20 ); ?> +
- -
-
- render_svg_icon( Icon::PASSED, 20, 20 ); ?> - -
-
1200 Students
-
- render_svg_icon( Icon::LEVEL, 20, 20 ); ?> - -
-
Beginner
-
- render_svg_icon( Icon::TIME, 20, 20 ); ?> - -
-
8+ Hours
-
- render_svg_icon( Icon::RATINGS, 20, 20 ); ?> - -
-
-
- - - - - -
- Average Rating 4.6 -
-
- render_svg_icon( Icon::RESOURCES, 20, 20 ); ?> - -
-
3 Files
-
- render_svg_icon( Icon::MATERIAL, 20, 20 ); ?> - -
-
-
    -
  • Introduction to Programming
  • -
  • Advanced Data Structures
  • -
  • Web Development Basics
  • -
  • Machine Learning Fundamentals
  • -
-
-
- render_svg_icon( Icon::CERTIFICATE_2, 20, 20 ); ?> - -
-
You will receive certificate on completion
+ +