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 @@ -|
-
- render_svg_icon( Icon::INSTRUCTOR, 20, 20 ); ?>
-
-
- |
-
-
-
-
- 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 ); ?>
-
-
-
- |
-
- |
-
- render_svg_icon( Icon::CERTIFICATE_2, 20, 20 ); ?>
-
-
- You will receive certificate on completion |
- |
+
+ + + | +