PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/course/abstract-course.php +201 -103 4.1.7.24.4.8 View file →
@@ -6,8 +6,12 @@
6 6 * @package LearnPress/Classes
7 7 * @version 4.0.0
8 8 */
9 9
10 +use LearnPress\Models\CourseModel;
11 +use LearnPress\TemplateHooks\Course\SingleCourseTemplate;
12 +use LearnPress\TemplateHooks\Instructor\SingleInstructorTemplate;
13 +
10 14 defined( 'ABSPATH' ) || exit();
11 15
12 16 if ( ! function_exists( 'LP_Abstract_Course' ) ) {
13 17
@@ -161,8 +165,14 @@
161 165 if ( metadata_exists( 'post', $this->get_id(), '_lp_regular_price' ) ) {
162 166 $regular_price = get_post_meta( $id, '_lp_regular_price', true );
163 167 }
164 168
169 + $block_course_finished = get_post_meta(
170 + $id,
171 + '_lp_block_finished',
172 + true
173 + );
174 +
165 175 $this->_set_data(
166 176 array(
167 177 'status' => $post_object->post_status,
168 178 'no_required_enroll' => get_post_meta( $id, '_lp_no_required_enroll', true ),
@@ -185,15 +195,12 @@
185 195 $id,
186 196 '_lp_block_expire_duration',
187 197 true
188 198 ),
189 - 'block_course_finished' => get_post_meta(
190 - $id,
191 - '_lp_block_finished',
192 - true
193 - ),
199 + 'block_course_finished' => $block_course_finished ? $block_course_finished : 'yes',
194 200 'allow_repurchase' => get_post_meta( $id, '_lp_allow_course_repurchase', true ),
195 201 'allow_repurchase_course_option' => get_post_meta( $id, '_lp_course_repurchase_option', true ),
202 + 'excerpt' => $post_object->post_excerpt,
196 203 )
197 204 );
198 205 }
199 206
@@ -199,9 +206,9 @@
199 206
200 207 /**
201 208 * Load course curriculum.
202 209 *
203 - * @depecated 4.1.6.9
210 + * @deprecated 4.1.6.9
204 211 */
205 212 public function load_curriculum() {
206 213 _deprecated_function( __FUNCTION__, '4.1.6.9' );
207 214 /*$item_ids = array();
@@ -297,13 +304,9 @@
297 304 $url = get_the_post_thumbnail_url( $parent_id, $size );
298 305 }
299 306
300 307 if ( ! $url ) {
301 - if ( 'course_thumbnail' == $size ) {
302 - $url = LearnPress::instance()->image( 'no-image.png' );
303 - } else {
304 - $url = LearnPress::instance()->image( 'placeholder-500x300' );
305 - }
308 + $url = LearnPress::instance()->image( 'no-image.png' );
306 309 }
307 310
308 311 return apply_filters( 'learn-press/course-thumbnail-url', $url, $this->get_id(), $size );
309 312 }
@@ -331,46 +334,39 @@
331 334 return 'publish' === get_post_status( $this->get_id() );
332 335 }
333 336
334 337 /**
335 - * Check if this course is required enroll or not.
338 + * Check this course is required enroll.
336 339 *
337 - * @param mixed
338 - *
339 340 * @return bool
340 - * @depecated 4.0.0
341 341 */
342 - public function is_required_enroll() {
343 - //_deprecated_function( __FUNCTION__, '4.1.7.2', 'is_no_required_enroll' );
342 + public function is_required_enroll(): bool {
344 343 return ! $this->is_no_required_enroll();
345 344 }
345 +
346 346 /**
347 + * @deprecated 4.2.0
348 + */
349 + public function is_require_enrollment() {
350 + _deprecated_function( __METHOD__, '4.2.0' );
351 + return ! $this->is_no_required_enroll();
352 + }
353 +
354 + /**
347 355 * Check if this course is required enroll or not.
348 356 *
349 357 * @author hungkv
350 358 * @since 4.0.5
351 359 * @return bool
352 - * @version 1.0.0
360 + * @version 1.0.1
353 361 */
354 362 public function is_no_required_enroll(): bool {
355 - $return = false;
356 - if ( $this->get_data( 'no_required_enroll', 'no' ) == 'yes' && ! is_user_logged_in() ) {
357 - $return = true;
358 - }
359 - return apply_filters( 'learn-press/course/require-enrollment', $return, $this->get_id() );
363 + return $this->get_data( 'no_required_enroll', 'no' ) === 'yes' && ! is_user_logged_in();
360 364 }
361 365
362 366 /**
363 - * @return mixed
364 - * @deprecated
367 + * @deprecated 4.1.6.9
365 368 */
366 - public function is_require_enrollment() {
367 - return ! $this->is_no_required_enroll();
368 - }
369 -
370 - /**
371 - * @depecated 4.1.6.9
372 - */
373 369 /*public function get_item_types( $group = false ) {
374 370 $cache_key = $group ? 'course-item-group-types' : 'course-item-types';
375 371 $items = LP_Object_Cache::get( 'course-' . $this->get_id(), "learn-press/{$cache_key}" );
376 372 $items = false;
@@ -442,9 +438,9 @@
442 438 /**
443 439 * Get item is viewing in single course.
444 440 *
445 441 * @return LP_Course_Item
446 - * @depecated 4.1.6.9
442 + * @deprecated 4.1.6.9
447 443 */
448 444 public function get_viewing_item() {
449 445 _deprecated_function( __FUNCTION__, '4.1.6.9' );
450 446 //return apply_filters( 'learn-press/single-course-viewing-item', $this->_viewing_item, $this->get_id() );
@@ -454,9 +450,9 @@
454 450 * Get total students fake.
455 451 *
456 452 * @return int
457 453 */
458 - public function get_fake_students() : int {
454 + public function get_fake_students(): int {
459 455 return absint( $this->get_data( 'fake_students', 0 ) );
460 456 }
461 457
462 458 /**
@@ -509,33 +505,43 @@
509 505 return apply_filters( 'learn-press/course/instructor-name', $name, $this->get_id() );
510 506 }
511 507
512 508 /**
509 + * Get instructor html of course.
510 + *
513 511 * @param int|bool $with_avatar
514 512 * @param string $link_class
515 513 *
516 514 * @return string
517 515 */
518 - public function get_instructor_html( $with_avatar = false, $link_class = '' ) {
519 - $instructor = $this->get_instructor_name();
516 + public function get_instructor_html( $with_avatar = false, $link_class = '' ): string {
517 + $html = '';
520 518
521 - $html = sprintf(
522 - '<a href="%s"%s>%s<span>%s</span></a>',
523 - learn_press_user_profile_link( get_post_field( 'post_author', $this->get_id() ) ),
524 - $link_class ? sprintf( 'class="%s"', $link_class ) : '',
525 - $with_avatar ? get_avatar(
526 - $this->get_instructor( 'id' ),
527 - $with_avatar === true ? 48 : $with_avatar
528 - ) : '',
529 - $instructor
530 - );
519 + try {
520 + $instructor = $this->get_author();
521 + if ( ! $instructor ) {
522 + return '';
523 + }
531 524
532 - return apply_filters(
533 - 'learn_press_course_instructor_html',
534 - $html,
535 - get_post_field( 'post_author', $this->get_id() ),
536 - $this->get_id()
537 - );
525 + $singleInstructorTemplate = SingleInstructorTemplate::instance();
526 +
527 + $html = apply_filters(
528 + 'learn-press/course/instructor-html',
529 + sprintf(
530 + '<a href="%s"%s>%s %s</a>',
531 + $instructor->get_url_instructor(),
532 + $link_class ? sprintf( 'class="%s"', $link_class ) : '',
533 + $with_avatar ? $instructor->get_profile_picture() : '',
534 + $singleInstructorTemplate->html_display_name( $instructor )
535 + ),
536 + $instructor,
537 + $singleInstructorTemplate
538 + );
539 + } catch ( Throwable $e ) {
540 + error_log( $e->getMessage() );
541 + }
542 +
543 + return $html;
538 544 }
539 545
540 546 /**
541 547 * Check if a course is Free
@@ -555,9 +561,9 @@
555 561 public function get_sale_price() {
556 562 $sale_price_value = $this->get_data( 'sale_price', '' );
557 563
558 564 if ( '' !== $sale_price_value ) {
559 - return floatval( $sale_price_value );
565 + return apply_filters( 'learn-press/course/sale-price', floatval( $sale_price_value ), $this->get_id() );
560 566 }
561 567
562 568 return $sale_price_value;
563 569 }
@@ -579,11 +585,14 @@
579 585 }
580 586
581 587 // Check in days sale
582 588 if ( $has_sale_price && '' !== $start_date && '' !== $end_date ) {
583 - $now = strtotime( get_date_from_gmt( gmdate( 'Y-m-d H:i:s', time() ), 'Y-m-d H:i:s' ) );
584 - $end = strtotime( $end_date );
585 - $start = strtotime( $start_date );
589 + $nowObj = new LP_Datetime();
590 + // Compare via timezone WP
591 + $nowStr = $nowObj->toSql( true );
592 + $now = strtotime( $nowStr );
593 + $end = strtotime( $end_date );
594 + $start = strtotime( $start_date );
586 595
587 596 $has_sale_price = $now >= $start && $now <= $end;
588 597 }
589 598
@@ -611,9 +620,9 @@
611 620 */
612 621 public function get_regular_price_html() {
613 622 $price = learn_press_format_price( $this->get_regular_price(), true );
614 623
615 - return apply_filters( 'learn-press/course/regular-price', $price, $this->get_id() );
624 + return apply_filters( 'learn-press/course/regular-price-html', $price, $this->get_id() );
616 625 }
617 626
618 627 /**
619 628 * Get the price of course.
@@ -626,18 +635,20 @@
626 635
627 636 if ( false === $price ) {
628 637 if ( $this->has_sale_price() ) {
629 638 $price = $this->get_sale_price();
630 - // Add key _lp_course_is_sale for query
631 - update_post_meta( $this->get_id(), '_lp_course_is_sale', 1 );
639 + // Add key _lp_course_is_sale for query - Todo: Check performance, need write function get all courses, and set on Admin, on background
640 + //update_post_meta( $this->get_id(), '_lp_course_is_sale', 1 );
632 641 } else {
633 642 // Delete key _lp_course_is_sale
634 - delete_post_meta( $this->get_id(), '_lp_course_is_sale' );
643 + //delete_post_meta( $this->get_id(), '_lp_course_is_sale' );
635 644 $price = $this->get_regular_price();
636 645 }
637 646
638 - // For case set sale by days range
639 - update_post_meta( $this->get_id(), '_lp_price', $price );
647 + // Save price only on page Single Course
648 + /*if ( LP_PAGE_SINGLE_COURSE === LP_Page_Controller::page_current() ) {
649 + update_post_meta( $this->get_id(), '_lp_price', $price );
650 + }*/
640 651
641 652 LP_Course_Cache::cache_load_first( 'set', $key_cache, $price );
642 653 }
643 654
@@ -648,12 +659,12 @@
648 659 * Get html course price
649 660 *
650 661 * @author tungnx
651 662 * @since 4.1.5
652 - * @version 1.0.0
653 - * @return mixed|void
663 + * @version 1.0.2
664 + * @return string
654 665 */
655 - public function get_course_price_html() {
666 + public function get_course_price_html(): string {
656 667 $price_html = '';
657 668
658 669 if ( $this->is_free() ) {
659 670 if ( is_float( $this->get_sale_price() ) ) {
@@ -661,18 +672,28 @@
661 672 }
662 673
663 674 $price_html .= sprintf( '<span class="free">%s</span>', esc_html__( 'Free', 'learnpress' ) );
664 675 $price_html = apply_filters( 'learn_press_course_price_html_free', $price_html, $this );
676 + } elseif ( $this->get_data( 'no_required_enroll', 'no' ) === 'yes' ) {
677 + $price_html .= '';
665 678 } else {
666 679 if ( $this->has_sale_price() ) {
667 680 $price_html .= sprintf( '<span class="origin-price">%s</span>', $this->get_regular_price_html() );
668 681 }
669 682
670 - $price_html .= sprintf( '<span class="price">%s</span>', learn_press_format_price( $this->get_price(), true ) );
671 - $price_html = apply_filters( 'learn_press_course_price_html', $price_html, $this->has_sale_price(), $this->get_id() );
683 + $price_html .= sprintf( '<span class="price">%s</span>', learn_press_format_price( $this->get_price(), true ) );
684 + $course = CourseModel::find( $this->get_id(), true );
685 + $singleCourseTemplate = SingleCourseTemplate::instance();
686 + $price_html = sprintf(
687 + '%1$s %2$s %3$s',
688 + $singleCourseTemplate->html_price_prefix( $course ),
689 + $price_html,
690 + $singleCourseTemplate->html_price_suffix( $course )
691 + );
692 + $price_html = apply_filters( 'learn_press_course_price_html', $price_html, $this->has_sale_price(), $this->get_id() );
672 693 }
673 694
674 - return $price_html;
695 + return sprintf( '<span class="course-item-price">%s</span>', $price_html );
675 696 }
676 697
677 698 /**
678 699 * Get the price of course with html
@@ -806,11 +827,14 @@
806 827 return apply_filters( 'learn-press/is-purchasable', $is_purchasable, $this->get_id() );
807 828 }
808 829
809 830 /**
810 - * Check if students have enrolled or purchased course is reached.
831 + * Check if students have purchased course is reached.
832 + * For case check course can purchase.
811 833 *
812 834 * @return mixed
835 + * @since 3.0.0
836 + * @version 1.0.1
813 837 */
814 838 public function is_in_stock() {
815 839 $in_stock = true;
816 840 $max_allowed = $this->get_max_students();
@@ -822,8 +846,27 @@
822 846 return apply_filters( 'learn-press/is-in-stock', $in_stock, $this->get_id() );
823 847 }
824 848
825 849 /**
850 + * Check max student can enroll.
851 + * For case check course can enroll.
852 + *
853 + * @return mixed
854 + * @since 4.2.5.7
855 + * @version 1.0.0
856 + */
857 + public function is_in_stock_enroll() {
858 + $in_stock = true;
859 + $max_allowed = $this->get_max_students();
860 +
861 + if ( $max_allowed ) {
862 + $in_stock = $max_allowed > $this->get_total_user_enrolled_or_purchased();
863 + }
864 +
865 + return apply_filters( 'learn-press/is-in-stock', $in_stock, $this->get_id() );
866 + }
867 +
868 + /**
826 869 * Get max students can enroll to course.
827 870 *
828 871 * @return int
829 872 *
@@ -843,24 +886,16 @@
843 886 * and add the fake value if both are set.
844 887 *
845 888 * @return int
846 889 * @editor tungnx
890 + * @version 1.0.1
891 + * @since 3.0.0
847 892 * @Todo: view and rewrite this function
848 893 */
849 894 public function count_students(): int {
850 - $key_cache = "{$this->get_id()}/total-students";
851 - $total = LP_Course_Cache::instance()->get_cache( $key_cache );
895 + $total = $this->get_total_user_enrolled_or_purchased();
896 + $total += $this->get_fake_students();
852 897
853 - if ( $total ) {
854 - return $total;
855 - }
856 -
857 - $lp_course_db = LP_Course_DB::getInstance();
858 - $total = $lp_course_db->get_total_user_enrolled( $this->get_id() );
859 - $total += $this->get_fake_students();
860 -
861 - LP_Course_Cache::instance()->set_cache( $key_cache, $total, 6 * HOUR_IN_SECONDS );
862 -
863 898 return $total;
864 899 }
865 900
866 901 /**
@@ -865,32 +900,83 @@
865 900
866 901 /**
867 902 * Get total user enrolled
868 903 *
904 + * @since 4.1.4
905 + * @version 1.0.1
869 906 * @return int
870 907 */
871 908 public function get_total_user_enrolled(): int {
872 - $lp_course_db = LP_Course_DB::getInstance();
873 - return $lp_course_db->get_total_user_enrolled( $this->get_id() );
909 + $total = 0;
910 + $lp_course_cache = new LP_Course_Cache( true );
911 +
912 + try {
913 + $total = $lp_course_cache->get_total_students_enrolled( $this->get_id() );
914 + if ( false !== $total ) {
915 + return $total;
916 + }
917 +
918 + $lp_course_db = LP_Course_DB::getInstance();
919 + $total = $lp_course_db->get_total_user_enrolled( $this->get_id() );
920 + $lp_course_cache->set_total_students_enrolled( $this->get_id(), $total );
921 + } catch ( Throwable $e ) {
922 + error_log( $e->getMessage() );
923 + }
924 +
925 + return $total;
874 926 }
875 927
876 928 /**
877 - * Get total user enrolled or finished
929 + * Get total user enrolled include fake
930 + * @since 4.2.2
931 + * @return int
932 + */
933 + /*public function get_total_user_enrolled_include_fake() {
934 + $total_user_enrolled = 0;
935 + $key_cache = "{$this->get_id()}/total-students-include-fake";
936 +
937 + try {
938 + $total_user_enrolled = LP_Course_Cache::cache_load_first( 'get', $key_cache );
939 +
940 + if ( false === $total_user_enrolled ) {
941 + $lp_course_db = LP_Course_DB::getInstance();
942 + $total_user_enrolled = $lp_course_db->get_total_user_enrolled( $this->get_id() );
943 + $total_user_enrolled += $this->get_fake_students();
944 +
945 + LP_Course_Cache::cache_load_first( 'set', $key_cache, $total_user_enrolled );
946 + }
947 + } catch ( Throwable $e ) {
948 + error_log( $e->getMessage() );
949 + }
950 +
951 + return $total_user_enrolled;
952 + }*/
953 +
954 + /**
955 + * Get total user enrolled, purchased or finished
878 956 *
957 + * @since 4.1.4
958 + * @version 1.0.1
879 959 * @return int
880 960 */
881 961 public function get_total_user_enrolled_or_purchased(): int {
882 - $key_cache = "{$this->get_id()}/total-students-attended";
883 - $total_user_enrolled = LP_Course_Cache::cache_load_first( 'get', $key_cache );
962 + $total = 0;
963 + $lp_course_cache = new LP_Course_Cache( true );
884 964
885 - if ( false === $total_user_enrolled ) {
886 - $lp_course_db = LP_Course_DB::getInstance();
887 - $total_user_enrolled = $lp_course_db->get_total_user_enrolled_or_purchased( $this->get_id() );
965 + try {
966 + $total = $lp_course_cache->get_total_students_enrolled_or_purchased( $this->get_id() );
967 + if ( false !== $total ) {
968 + return $total;
969 + }
888 970
889 - LP_Course_Cache::cache_load_first( 'set', $key_cache, $total_user_enrolled );
971 + $lp_course_db = LP_Course_DB::getInstance();
972 + $total = $lp_course_db->get_total_user_enrolled_or_purchased( $this->get_id() );
973 + $lp_course_cache->set_total_students_enrolled_or_purchased( $this->get_id(), $total );
974 + } catch ( Throwable $e ) {
975 + error_log( $e->getMessage() );
890 976 }
891 977
892 - return $total_user_enrolled;
978 + return $total;
893 979 }
894 980
895 981 /**
896 982 * @param string|array $statuses
@@ -970,9 +1056,9 @@
970 1056 * @param string $context
971 1057 *
972 1058 * @return array|mixed|string
973 1059 */
974 - public function get_passing_condition( $format = false, $context = '' ) {
1060 + public function get_passing_condition( $format = false ) {
975 1061 $value = absint( $this->get_data( 'passing_condition' ) );
976 1062
977 1063 if ( $format ) {
978 1064 $value = "{$value}%";
@@ -977,9 +1063,9 @@
977 1063 if ( $format ) {
978 1064 $value = "{$value}%";
979 1065 }
980 1066
981 - return 'edit' === $context ? $value : apply_filters(
1067 + return apply_filters(
982 1068 'learn-press/course-passing-condition',
983 1069 $value,
984 1070 $format,
985 1071 $this->get_id()
@@ -1005,18 +1091,17 @@
1005 1091
1006 1092 $slug_prefixes = apply_filters(
1007 1093 'learn-press/course/custom-item-prefixes',
1008 1094 array(
1009 - LP_QUIZ_CPT => sanitize_title_with_dashes( LP_Settings::instance()->get( 'quiz_slug', 'quizzes' ) ),
1010 - LP_LESSON_CPT => sanitize_title_with_dashes( LP_Settings::instance()->get( 'lesson_slug', 'lessons' ) ),
1095 + LP_QUIZ_CPT => sanitize_title_with_dashes( LP_Settings::get_option( 'quiz_slug', 'quizzes' ) ),
1096 + LP_LESSON_CPT => sanitize_title_with_dashes( LP_Settings::get_option( 'lesson_slug', 'lessons' ) ),
1011 1097 ),
1012 1098 $this->get_id()
1013 1099 );
1014 1100
1015 1101 $slug_prefix = trailingslashit( $slug_prefixes[ $item_type ] ?? '' );
1102 + $item_link = trailingslashit( $course_permalink . $slug_prefix . $item_slug );
1016 1103
1017 - $item_link = $course_permalink . $slug_prefix . $item_slug;
1018 -
1019 1104 return apply_filters( 'learn-press/course/item-link', $item_link, $item_id, $this );
1020 1105 }
1021 1106
1022 1107 /**
@@ -1043,9 +1128,9 @@
1043 1128 *
1044 1129 * @param LP_Course_Item|LP_User_Item|int $item
1045 1130 *
1046 1131 * @return mixed
1047 - * @depecated 4.1.6.9
1132 + * @deprecated 4.1.6.9
1048 1133 */
1049 1134 /*public function get_item_position( $item ) {
1050 1135 $items = $this->get_items();
1051 1136
@@ -1077,9 +1162,9 @@
1077 1162 */
1078 1163 public function get_next_item( $args = null ) {
1079 1164 $item_nav = $this->get_item_nav();
1080 1165
1081 - return apply_filters( 'learn-press/course/next-item', $item_nav[2], $this->get_id(), $args );
1166 + return apply_filters( 'learn-press/course/next-item', $item_nav ? $item_nav[2] : 0, $this->get_id(), $args );
1082 1167 }
1083 1168
1084 1169 /**
1085 1170 * Get item standing before the item is viewing.
@@ -1089,8 +1174,11 @@
1089 1174 * @return int
1090 1175 */
1091 1176 public function get_prev_item( $args = null ) {
1092 1177 $item_nav = $this->get_item_nav();
1178 + if ( ! is_array( $item_nav ) || empty( $item_nav ) ) {
1179 + return 0;
1180 + }
1093 1181
1094 1182 return apply_filters( 'learn-press/course/prev-item', $item_nav[0], $this->get_id(), $args );
1095 1183 }
1096 1184
@@ -1124,9 +1212,9 @@
1124 1212 $user = learn_press_get_current_user();
1125 1213 $pos_tmp = $pos;
1126 1214
1127 1215 while ( $pos_tmp < $max ) {
1128 - $pos_tmp ++;
1216 + ++$pos_tmp;
1129 1217
1130 1218 if ( ! $viewable ) {
1131 1219 $next_id = $item_ids[ $pos_tmp ];
1132 1220
@@ -1136,9 +1224,9 @@
1136 1224
1137 1225 $pos_tmp = $pos;
1138 1226
1139 1227 while ( $pos_tmp > 0 ) {
1140 - $pos_tmp --;
1228 + --$pos_tmp;
1141 1229
1142 1230 if ( ! $viewable ) {
1143 1231 $prev_id = $item_ids[ $pos_tmp ];
1144 1232
@@ -1187,9 +1275,8 @@
1187 1275 return false;
1188 1276 }
1189 1277
1190 1278 public function get_prev_item_html( $args = null ) {
1191 -
1192 1279 }
1193 1280
1194 1281 public function get_preview_items() {
1195 1282 return LP_Object_Cache::get( 'course-' . $this->get_id(), 'learn-press/course-preview-items' );
@@ -1253,9 +1340,9 @@
1253 1340
1254 1341 if ( $start_time + $duration > $now ) {
1255 1342 $remain = $start_time + $duration - $now;
1256 1343 $remain = learn_press_seconds_to_weeks( $remain );
1257 - $html = sprintf( __( 'This course will end within next %s', 'learnpress' ), $remain );
1344 + $html = sprintf( __( 'This course will end within the next %s', 'learnpress' ), $remain );
1258 1345 }
1259 1346 }
1260 1347
1261 1348 return $html;
@@ -1371,6 +1458,17 @@
1371 1458 $this->get_id(),
1372 1459 $this
1373 1460 );
1374 1461 }
1462 +
1463 + /**
1464 + * [get_downloadable_material get all material files of this course and lesson of this course]
1465 + * @return [array] [array of material files or empty array]
1466 + * @deprecated 4.2.6.4
1467 + */
1468 + /*public function get_downloadable_material(): array {
1469 + $material = LP_Material_Files_DB::getInstance();
1470 + $materials = $material->get_material_by_item_id( $this->get_id(), 1 );
1471 + return apply_filters( 'learn-press/course-materials', $materials, $this->get_id() );
1472 + }*/
1375 1473 }
1376 1474 }