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/lp-core-functions.php +141 -1049 4.2.04.4.8 View file →
@@ -7,8 +7,10 @@
7 7 * @package LearnPress/Functions
8 8 * @version 1.0
9 9 */
10 10
11 +use LearnPress\Helpers\Config;
12 +
11 13 defined( 'ABSPATH' ) || exit;
12 14
13 15 /**
14 16 * Vue write php has script, so when sanitize will error, so use code is mask pass check sanitize, esc
@@ -39,38 +41,13 @@
39 41 return $can_edit;
40 42 }
41 43 add_filter( 'use_block_editor_for_post_type', 'learnpress_gutenberg_disable_cpt', 10, 2 );
42 44
43 -/**
44 - * Get instance of a CURD class by type
45 - *
46 - * @param string $type
47 - *
48 - * @return bool|LP_Course_CURD|LP_User_CURD|LP_Quiz_CURD|LP_Question_CURD
49 - * @deprecated 4.1.7.2
50 - */
51 -/*function learn_press_get_curd( $type ) {
52 - $curds = array(
53 - 'user' => 'LP_User_CURD',
54 - 'course' => 'LP_Course_CURD',
55 - 'quiz' => 'LP_Quiz_CURD',
56 - 'question' => 'LP_Question_CURD',
57 - );
58 -
59 - $curd = false;
60 -
61 - if ( ! empty( $curds[ $type ] ) && class_exists( $curds[ $type ] ) ) {
62 - $curd = new $curds[ $type ]();
63 - }
64 -
65 - return apply_filters( 'learn-press/curd', $curd, $type, $curds );
66 -}*/
67 -
68 45 if ( ! function_exists( 'lp_add_body_class' ) ) {
69 46 function lp_add_body_class( $classes ) {
70 47 $classes = (array) $classes;
71 48
72 - if ( learn_press_is_profile() ) {
49 + if ( LP_Page_Controller::is_page_profile() ) {
73 50 $classes[] = 'learnpress-profile';
74 51 } elseif ( learn_press_is_checkout() ) {
75 52 $classes[] = 'learnpress-checkout';
76 53 }
@@ -127,9 +104,9 @@
127 104 }
128 105 $atts = ' ' . implode( ' ', $options );
129 106 }
130 107
131 - $tip = sprintf( '<span class="learn-press-tip" ' . $atts . '>%s</span>', $tip );
108 + $tip = sprintf( '<div class="learn-press-tip" ' . $atts . '><span>%s</span></div>', $tip );
132 109
133 110 if ( $echo ) {
134 111 echo wp_kses_post( $tip );
135 112 }
@@ -295,39 +272,39 @@
295 272 /**
296 273 * Get current URL user is viewing.
297 274 *
298 275 * @return string
276 + * @deprecated 4.2.2
299 277 */
300 278 function learn_press_get_current_url() {
301 - static $current_url;
279 + //_deprecated_function( __FUNCTION__, '4.2.2', 'LP_Helper::getUrlCurrent' );
280 + return LP_Helper::getUrlCurrent();
302 281
303 - if ( ! $current_url ) {
304 - $url = untrailingslashit( esc_url_raw( $_SERVER['REQUEST_URI'] ) );
282 + $url = untrailingslashit( esc_url_raw( $_SERVER['REQUEST_URI'] ) );
305 283
306 - if ( ! preg_match( '!^https?!', $url ) ) {
307 - $siteurl = trailingslashit( get_home_url() );
308 - $home_query = '';
284 + if ( ! preg_match( '!^https?!', $url ) ) {
285 + $siteurl = trailingslashit( get_home_url() );
286 + $home_query = '';
309 287
310 - if ( strpos( $siteurl, '?' ) !== false ) {
311 - $parts = explode( '?', $siteurl );
312 - $home_query = $parts[1];
313 - $siteurl = $parts[0];
314 - }
288 + if ( strpos( $siteurl, '?' ) !== false ) {
289 + $parts = explode( '?', $siteurl );
290 + $home_query = $parts[1];
291 + $siteurl = $parts[0];
292 + }
315 293
316 - if ( $home_query ) {
317 - parse_str( untrailingslashit( $home_query ), $home_query );
318 - $url = esc_url_raw( add_query_arg( $home_query, $url ) );
319 - }
294 + if ( $home_query ) {
295 + parse_str( untrailingslashit( $home_query ), $home_query );
296 + $url = esc_url_raw( add_query_arg( $home_query, $url ) );
297 + }
320 298
321 - $segs1 = explode( '/', $siteurl );
322 - $segs2 = explode( '/', $url );
299 + $segs1 = explode( '/', $siteurl );
300 + $segs2 = explode( '/', $url );
323 301
324 - if ( $removed = array_intersect( $segs1, $segs2 ) ) {
325 - if ( $segs2 = array_diff( $segs2, $removed ) ) {
326 - $current_url = $siteurl . join( '/', $segs2 );
327 - if ( strpos( $current_url, '?' ) === false ) {
328 - $current_url = trailingslashit( $current_url );
329 - }
302 + if ( $removed = array_intersect( $segs1, $segs2 ) ) {
303 + if ( $segs2 = array_diff( $segs2, $removed ) ) {
304 + $current_url = $siteurl . join( '/', $segs2 );
305 + if ( strpos( $current_url, '?' ) === false ) {
306 + $current_url = trailingslashit( $current_url );
330 307 }
331 308 }
332 309 }
333 310 }
@@ -335,21 +312,8 @@
335 312 return $current_url;
336 313 }
337 314
338 315 /**
339 - * Compares an url with current URL user is viewing
340 - *
341 - * @param string $url
342 - *
343 - * @return bool
344 - */
345 -function learn_press_is_current_url( $url ) {
346 - $current_url = learn_press_get_current_url();
347 -
348 - return ( $current_url && $url ) && strcmp( $current_url, learn_press_sanitize_url( $url ) ) == 0;
349 -}
350 -
351 -/**
352 316 * Remove unneeded characters in an URL
353 317 *
354 318 * @param string $url
355 319 * @param bool $trailingslashit
@@ -363,9 +327,9 @@
363 327 $url_without_http = preg_replace( '![/]+!', '/', $url_without_http );
364 328 $url = $matches[1] . $url_without_http;
365 329
366 330 return ( $trailingslashit &&
367 - strpos( $url, '?' ) === false ) ? trailingslashit( $url ) : untrailingslashit( $url );
331 + strpos( $url, '?' ) === false ) ? trailingslashit( $url ) : untrailingslashit( $url );
368 332 }
369 333
370 334 return $url;
371 335 }
@@ -449,11 +413,11 @@
449 413 // This isn't needed for get_terms
450 414 unset( $args['orderby'] );
451 415
452 416 // Set args for get_terms
453 - $args['menu_order'] = isset( $args['order'] ) ? $args['order'] : 'ASC';
454 - $args['hide_empty'] = isset( $args['hide_empty'] ) ? $args['hide_empty'] : 0;
455 - $args['fields'] = isset( $args['fields'] ) ? $args['fields'] : 'names';
417 + $args['menu_order'] = $args['order'] ?? 'ASC';
418 + $args['hide_empty'] = $args['hide_empty'] ?? 0;
419 + $args['fields'] = $args['fields'] ?? 'names';
456 420
457 421 // Ensure slugs is valid for get_terms - slugs isn't supported
458 422 $args['fields'] = $args['fields'] === 'slugs' ? 'id=>slug' : $args['fields'];
459 423 $terms = get_terms( $taxonomy, $args );
@@ -659,9 +623,9 @@
659 623
660 624 if ( $links ) {
661 625 ?>
662 626 <div class="<?php echo esc_attr( $args['wrapper_class'] ); ?>">
663 - <?php echo wp_kses_post( $links ); ?>
627 + <?php echo wp_kses_post( $links ); ?>
664 628 </div>
665 629 <?php
666 630 }
667 631
@@ -692,9 +656,9 @@
692 656
693 657 $pages = absint( $total / $limit );
694 658
695 659 if ( $total % $limit != 0 ) {
696 - $pages ++;
660 + ++$pages;
697 661 }
698 662
699 663 return $pages;
700 664 }
@@ -787,66 +751,8 @@
787 751 return $a1;
788 752 }
789 753
790 754 /**
791 - * Send email notification.
792 - *
793 - * @param string $to .
794 - * @param string $action .
795 - * @param array $vars .
796 - *
797 - * @return bool
798 - * @deprecated 4.1.7.2
799 - */
800 -/*function learn_press_send_mail( $to = '', $action = '', $vars = array() ) {
801 - $email_settings = LP_Settings::instance();
802 -
803 - if ( ! $email_settings->get( $action . '.enable' ) ) {
804 - return "The action {$action} doesnt support";
805 - }
806 -
807 - $user = get_user_by( 'email', $to );
808 -
809 - $vars['log_in'] = apply_filters( 'learn_press_site_url', get_home_url() );
810 -
811 - // Send email.
812 - $email = new LP_Email();
813 - $email->set_action( $action );
814 - $email->parse_email( $vars );
815 - $email->add_recipient( $to );
816 -
817 - return $email->send();
818 -}*/
819 -
820 -/*
821 - * Send email notification when a course be published
822 - * @deprecated 4.1.7.2
823 - */
824 -/*function learn_press_publish_course( $new_status, $old_status, $post ) {
825 - if ( $old_status == 'pending' && $new_status == 'publish' && $post->post_type == 'lp_course' ) {
826 - $instructor = get_userdata( $post->post_author );
827 - $mail_to = $instructor->user_email;
828 -
829 - learn_press_send_mail(
830 - $mail_to,
831 - 'published_course',
832 - apply_filters(
833 - 'learn_press_vars_enrolled_course',
834 - array(
835 - 'user_name' => $instructor->display_name,
836 - 'course_name' => $post->post_title,
837 - 'course_link' => get_permalink( $post->ID ),
838 - ),
839 - $post,
840 - $instructor
841 - )
842 - );
843 - }
844 -}*/
845 -
846 -//add_action( 'transition_post_status', 'learn_press_publish_course', 10, 3 );
847 -
848 -/**
849 755 * @param $user_id
850 756 *
851 757 * @return WP_Query
852 758 */
@@ -927,365 +833,35 @@
927 833 /**
928 834 * Get the list of currencies with code and name.
929 835 *
930 836 * @return array
931 - * @version 3.0.0
837 + * @version 3.0.1
932 838 *
933 839 * @author ThimPress
934 840 */
935 841 function learn_press_currencies() {
936 - $currencies = array(
937 - 'AFN' => __( 'Afghan afghani', 'learnpress' ),
938 - 'ALL' => __( 'Albanian lek', 'learnpress' ),
939 - 'DZD' => __( 'Algerian dinar', 'learnpress' ),
940 - 'EUR' => __( 'Euro', 'learnpress' ),
941 - 'AOA' => __( 'Angolan kwanza', 'learnpress' ),
942 - 'XCD' => __( 'East Caribbean dollar', 'learnpress' ),
943 - 'ARS' => __( 'Argentine peso', 'learnpress' ),
944 - 'AMD' => __( 'Armenian dram', 'learnpress' ),
945 - 'AWG' => __( 'Aruban florin', 'learnpress' ),
946 - 'AUD' => __( 'Australian dollar', 'learnpress' ),
947 - 'AZN' => __( 'Azerbaijani manat', 'learnpress' ),
948 - 'BSD' => __( 'Bahamian dollar', 'learnpress' ),
949 - 'BHD' => __( 'Bahraini dinar', 'learnpress' ),
950 - 'BDT' => __( 'Bangladeshi taka', 'learnpress' ),
951 - 'BBD' => __( 'Barbadian dollar', 'learnpress' ),
952 - 'BYR' => __( 'Belarusian ruble', 'learnpress' ),
953 - 'BZD' => __( 'Belizean dollar', 'learnpress' ),
954 - 'XOF' => __( 'West African CFA franc', 'learnpress' ),
955 - 'BMD' => __( 'Bermudian dollar', 'learnpress' ),
956 - 'BTN' => __( 'Bhutanese ngultrum', 'learnpress' ),
957 - 'BOB' => __( 'Bolivian boliviano', 'learnpress' ),
958 - 'USD' => __( 'US dollar', 'learnpress' ),
959 - 'BAM' => __( 'Bosnia and Herzegovina convertible mark', 'learnpress' ),
960 - 'BWP' => __( 'Botswana pula', 'learnpress' ),
961 - 'BRL' => __( 'Brazilian real', 'learnpress' ),
962 - 'BND' => __( 'Brunei dollar', 'learnpress' ),
963 - 'BGN' => __( 'Bulgarian lev', 'learnpress' ),
964 - 'MMK' => __( 'Burmese kyat', 'learnpress' ),
965 - 'BIF' => __( 'Burundian franc', 'learnpress' ),
966 - 'KHR' => __( 'Cambodian riel', 'learnpress' ),
967 - 'XAF' => __( 'Central African CFA franc', 'learnpress' ),
968 - 'CAD' => __( 'Canadian dollar', 'learnpress' ),
969 - 'CVE' => __( 'Cape Verdean escudo', 'learnpress' ),
970 - 'KYD' => __( 'Cayman Islands dollar', 'learnpress' ),
971 - 'CLP' => __( 'Chilean peso', 'learnpress' ),
972 - 'CNY' => __( 'Chinese renminbi', 'learnpress' ),
973 - 'COP' => __( 'Colombian peso', 'learnpress' ),
974 - 'KMF' => __( 'Comorian franc', 'learnpress' ),
975 - 'CDF' => __( 'Congolese franc', 'learnpress' ),
976 - 'NZD' => __( 'New Zealand dollar', 'learnpress' ),
977 - 'CRC' => __( 'Costa Rican colón', 'learnpress' ),
978 - 'HRK' => __( 'Croatian kuna', 'learnpress' ),
979 - 'CUC' => __( 'Cuban peso', 'learnpress' ),
980 - 'ANG' => __( 'Netherlands Antilles guilder', 'learnpress' ),
981 - 'CZK' => __( 'Czech koruna', 'learnpress' ),
982 - 'DKK' => __( 'Danish krone', 'learnpress' ),
983 - 'DJF' => __( 'Djiboutian franc', 'learnpress' ),
984 - 'DOP' => __( 'Dominican peso', 'learnpress' ),
985 - 'EGP' => __( 'Egyptian pound', 'learnpress' ),
986 - 'SVC' => __( 'Salvadoran colón', 'learnpress' ),
987 - 'ERN' => __( 'Eritrean nakfa', 'learnpress' ),
988 - 'ETB' => __( 'Ethiopian birr', 'learnpress' ),
989 - 'FKP' => __( 'Falkland Islands pound', 'learnpress' ),
990 - 'FJD' => __( 'Fijian dollar', 'learnpress' ),
991 - 'XPF' => __( 'CFP franc', 'learnpress' ),
992 - 'GMD' => __( 'Gambian dalasi', 'learnpress' ),
993 - 'GEL' => __( 'Georgian lari', 'learnpress' ),
994 - 'GHS' => __( 'Ghanian cedi', 'learnpress' ),
995 - 'GIP' => __( 'Gibraltar pound', 'learnpress' ),
996 - 'GTQ' => __( 'Guatemalan quetzal', 'learnpress' ),
997 - 'GBP' => __( 'British pound', 'learnpress' ),
998 - 'GNF' => __( 'Guinean franc', 'learnpress' ),
999 - 'GYD' => __( 'Guyanese dollar', 'learnpress' ),
1000 - 'HTG' => __( 'Haitian gourde', 'learnpress' ),
1001 - 'HNL' => __( 'Honduran lempira', 'learnpress' ),
1002 - 'HKD' => __( 'Hong Kong dollar', 'learnpress' ),
1003 - 'HUF' => __( 'Hungarian forint', 'learnpress' ),
1004 - 'ISK' => __( 'Icelandic króna', 'learnpress' ),
1005 - 'INR' => __( 'Indian rupee', 'learnpress' ),
1006 - 'IDR' => __( 'Indonesian rupiah', 'learnpress' ),
1007 - 'IRR' => __( 'Iranian rial', 'learnpress' ),
1008 - 'IQD' => __( 'Iraqi dinar', 'learnpress' ),
1009 - 'ILS' => __( 'Israeli new sheqel', 'learnpress' ),
1010 - 'JMD' => __( 'Jamaican dollar', 'learnpress' ),
1011 - 'JPY' => __( 'Japanese yen ', 'learnpress' ),
1012 - 'JOD' => __( 'Jordanian dinar', 'learnpress' ),
1013 - 'KZT' => __( 'Kazakhstani tenge', 'learnpress' ),
1014 - 'KES' => __( 'Kenyan shilling', 'learnpress' ),
1015 - 'KPW' => __( 'North Korean won', 'learnpress' ),
1016 - 'KWD' => __( 'Kuwaiti dinar', 'learnpress' ),
1017 - 'KGS' => __( 'Kyrgyzstani som', 'learnpress' ),
1018 - 'KRW' => __( 'South Korean won', 'learnpress' ),
1019 - 'LAK' => __( 'Lao kip', 'learnpress' ),
1020 - 'LVL' => __( 'Latvian lats', 'learnpress' ),
1021 - 'LBP' => __( 'Lebanese pound', 'learnpress' ),
1022 - 'LSL' => __( 'Lesotho loti', 'learnpress' ),
1023 - 'LRD' => __( 'Liberian dollar', 'learnpress' ),
1024 - 'LD' => __( 'Libyan dinar', 'learnpress' ),
1025 - 'CHF' => __( 'Swiss franc', 'learnpress' ),
1026 - 'LTL' => __( 'Lithuanian litas', 'learnpress' ),
1027 - 'MOP' => __( 'Macanese pataca', 'learnpress' ),
1028 - 'MKD' => __( 'Macedonian denar', 'learnpress' ),
1029 - 'MGA' => __( 'Malagasy ariary', 'learnpress' ),
1030 - 'MWK' => __( 'Malawian kwacha', 'learnpress' ),
1031 - 'MYR' => __( 'Malaysian ringgit', 'learnpress' ),
1032 - 'MVR' => __( 'Maldivian rufiyaa', 'learnpress' ),
1033 - 'MRO' => __( 'Mauritanian ouguiya', 'learnpress' ),
1034 - 'MUR' => __( 'Mauritian rupee', 'learnpress' ),
1035 - 'MXN' => __( 'Mexican peso', 'learnpress' ),
1036 - 'MDL' => __( 'Moldovan leu', 'learnpress' ),
1037 - 'MNT' => __( 'Mongolian tugrik', 'learnpress' ),
1038 - 'MAD' => __( 'Moroccan dirham', 'learnpress' ),
1039 - 'MZN' => __( 'Mozambican metical', 'learnpress' ),
1040 - 'NAD' => __( 'Namibian dollar', 'learnpress' ),
1041 - 'NPR' => __( 'Nepalese rupee', 'learnpress' ),
1042 - 'NIO' => __( 'Nicaraguan córdoba', 'learnpress' ),
1043 - 'NGN' => __( 'Nigerian naira', 'learnpress' ),
1044 - 'NOK' => __( 'Norwegian krone', 'learnpress' ),
1045 - 'OMR' => __( 'Omani rial', 'learnpress' ),
1046 - 'PKR' => __( 'Pakistani rupee', 'learnpress' ),
1047 - 'PAB' => __( 'Panamanian balboa', 'learnpress' ),
1048 - 'PGK' => __( 'Papua New Guinea kina', 'learnpress' ),
1049 - 'PYG' => __( 'Paraguayan guarani', 'learnpress' ),
1050 - 'PEN' => __( 'Peruvian nuevo sol', 'learnpress' ),
1051 - 'PHP' => __( 'Philippine peso', 'learnpress' ),
1052 - 'PLN' => __( 'Polish zloty', 'learnpress' ),
1053 - 'QAR' => __( 'Qatari riyal', 'learnpress' ),
1054 - 'RON' => __( 'Romanian leu', 'learnpress' ),
1055 - 'RUB' => __( 'Russian ruble', 'learnpress' ),
1056 - 'RWF' => __( 'Rwandan franc', 'learnpress' ),
1057 - 'WST' => __( 'Samoan tālā', 'learnpress' ),
1058 - 'STD' => __( 'São Tomé and Príncipe dobra', 'learnpress' ),
1059 - 'SAR' => __( 'Saudi riyal', 'learnpress' ),
1060 - 'RSD' => __( 'Serbian dinar', 'learnpress' ),
1061 - 'SCR' => __( 'Seychellois rupee', 'learnpress' ),
1062 - 'SLL' => __( 'Sierra Leonean leone', 'learnpress' ),
1063 - 'SGD' => __( 'Singapore dollar', 'learnpress' ),
1064 - 'SBD' => __( 'Solomon Islands dollar', 'learnpress' ),
1065 - 'SOS' => __( 'Somali shilling', 'learnpress' ),
1066 - 'ZAR' => __( 'South African rand', 'learnpress' ),
1067 - 'LKR' => __( 'Sri Lankan rupee', 'learnpress' ),
1068 - 'SHP' => __( 'St. Helena pound', 'learnpress' ),
1069 - 'SDG' => __( 'Sudanese pound', 'learnpress' ),
1070 - 'SRD' => __( 'Surinamese dollar', 'learnpress' ),
1071 - 'SZL' => __( 'Swazi lilangeni', 'learnpress' ),
1072 - 'SEK' => __( 'Swedish krona', 'learnpress' ),
1073 - 'SYP' => __( 'Syrian pound', 'learnpress' ),
1074 - 'TWD' => __( 'New Taiwan dollar', 'learnpress' ),
1075 - 'TJS' => __( 'Tajikistani somoni', 'learnpress' ),
1076 - 'TZS' => __( 'Tanzanian shilling', 'learnpress' ),
1077 - 'THB' => __( 'Thai baht ', 'learnpress' ),
1078 - 'TOP' => __( 'Tongan pa’anga', 'learnpress' ),
1079 - 'TTD' => __( 'Trinidad and Tobago dollar', 'learnpress' ),
1080 - 'TND' => __( 'Tunisian dinar', 'learnpress' ),
1081 - 'TRY' => __( 'Turkish lira', 'learnpress' ),
1082 - 'TMT' => __( 'Turkmenistani manat', 'learnpress' ),
1083 - 'UGX' => __( 'Ugandan shilling', 'learnpress' ),
1084 - 'UAH' => __( 'Ukrainian hryvnia', 'learnpress' ),
1085 - 'AED' => __( 'United Arab Emirates dirham', 'learnpress' ),
1086 - 'UYU' => __( 'Uruguayan peso', 'learnpress' ),
1087 - 'UZS' => __( 'Uzbekistani som', 'learnpress' ),
1088 - 'VUV' => __( 'Vanuatu vatu', 'learnpress' ),
1089 - 'VEF' => __( 'Venezuelan bolivar', 'learnpress' ),
1090 - 'VND' => __( 'Vietnamese dong', 'learnpress' ),
1091 - 'YER' => __( 'Yemeni rial', 'learnpress' ),
1092 - 'ZMK' => __( 'Zambian kwacha', 'learnpress' ),
1093 - 'ZWL' => __( 'Zimbabwean dollar', 'learnpress' ),
1094 - 'JEP' => __( 'Jersey pound', 'learnpress' ),
1095 - 'LYD' => __( 'Libyan dinar', 'learnpress' ),
1096 - );
1097 -
1098 - asort( $currencies );
1099 -
1100 - return apply_filters( 'learn-press/currencies', $currencies );
842 + return Config::instance()->get( 'currencies', 'settings' );
1101 843 }
1102 844
1103 845 /**
1104 - * Get current setting of currency.
846 + * Return list of common symbols of the currencies on the world.
1105 847 *
1106 - * @return string
848 + * @return array
849 + * @version 3.0.1
1107 850 */
1108 -function learn_press_get_currency() {
1109 - $currency = apply_filters( 'learn_press_currency', LP_Settings::instance()->get( 'currency', 'USD' ) );
1110 -
1111 - return apply_filters( 'learn-press/currency', $currency );
851 +function learn_press_currency_symbols() {
852 + return Config::instance()->get( 'currency-symbols', 'settings' );
1112 853 }
1113 854
1114 855 /**
1115 - * Return list of common symbols of the currencies on the world.
856 + * Get current setting of currency.
1116 857 *
1117 - * @return array
858 + * @return string
1118 859 */
1119 -function learn_press_currency_symbols() {
1120 - $symbols = array(
1121 - 'AED' => '&#x62f;.&#x625;',
1122 - 'AFN' => '&#x60b;',
1123 - 'ALL' => 'L',
1124 - 'AMD' => 'AMD',
1125 - 'ANG' => '&fnof;',
1126 - 'AOA' => 'Kz',
1127 - 'ARS' => '&#36;',
1128 - 'AUD' => '&#36;',
1129 - 'AWG' => 'Afl.',
1130 - 'AZN' => 'AZN',
1131 - 'BAM' => 'KM',
1132 - 'BBD' => '&#36;',
1133 - 'BDT' => '&#2547;&nbsp;',
1134 - 'BGN' => '&#1083;&#1074;.',
1135 - 'BHD' => '.&#x62f;.&#x628;',
1136 - 'BIF' => 'Fr',
1137 - 'BMD' => '&#36;',
1138 - 'BND' => '&#36;',
1139 - 'BOB' => 'Bs.',
1140 - 'BRL' => '&#82;&#36;',
1141 - 'BSD' => '&#36;',
1142 - 'BTC' => '&#3647;',
1143 - 'BTN' => 'Nu.',
1144 - 'BWP' => 'P',
1145 - 'BYR' => 'Br',
1146 - 'BYN' => 'Br',
1147 - 'BZD' => '&#36;',
1148 - 'CAD' => '&#36;',
1149 - 'CDF' => 'Fr',
1150 - 'CHF' => '&#67;&#72;&#70;',
1151 - 'CLP' => '&#36;',
1152 - 'CNY' => '&yen;',
1153 - 'COP' => '&#36;',
1154 - 'CRC' => '&#x20a1;',
1155 - 'CUC' => '&#36;',
1156 - 'CUP' => '&#36;',
1157 - 'CVE' => '&#36;',
1158 - 'CZK' => '&#75;&#269;',
1159 - 'DJF' => 'Fr',
1160 - 'DKK' => 'DKK',
1161 - 'DOP' => 'RD&#36;',
1162 - 'DZD' => '&#x62f;.&#x62c;',
1163 - 'EGP' => 'EGP',
1164 - 'ERN' => 'Nfk',
1165 - 'ETB' => 'Br',
1166 - 'EUR' => '&euro;',
1167 - 'FJD' => '&#36;',
1168 - 'FKP' => '&pound;',
1169 - 'GBP' => '&pound;',
1170 - 'GEL' => '&#x20be;',
1171 - 'GGP' => '&pound;',
1172 - 'GHS' => '&#x20b5;',
1173 - 'GIP' => '&pound;',
1174 - 'GMD' => 'D',
1175 - 'GNF' => 'Fr',
1176 - 'GTQ' => 'Q',
1177 - 'GYD' => '&#36;',
1178 - 'HKD' => '&#36;',
1179 - 'HNL' => 'L',
1180 - 'HRK' => 'kn',
1181 - 'HTG' => 'G',
1182 - 'HUF' => '&#70;&#116;',
1183 - 'IDR' => 'Rp',
1184 - 'ILS' => '&#8362;',
1185 - 'IMP' => '&pound;',
1186 - 'INR' => '&#8377;',
1187 - 'IQD' => '&#x639;.&#x62f;',
1188 - 'IRR' => '&#xfdfc;',
1189 - 'IRT' => '&#x062A;&#x0648;&#x0645;&#x0627;&#x0646;',
1190 - 'ISK' => 'kr.',
1191 - 'JEP' => '&pound;',
1192 - 'JMD' => '&#36;',
1193 - 'JOD' => '&#x62f;.&#x627;',
1194 - 'JPY' => '&yen;',
1195 - 'KES' => 'KSh',
1196 - 'KGS' => '&#x441;&#x43e;&#x43c;',
1197 - 'KHR' => '&#x17db;',
1198 - 'KMF' => 'Fr',
1199 - 'KPW' => '&#x20a9;',
1200 - 'KRW' => '&#8361;',
1201 - 'KWD' => '&#x62f;.&#x643;',
1202 - 'KYD' => '&#36;',
1203 - 'KZT' => '&#8376;',
1204 - 'LAK' => '&#8365;',
1205 - 'LBP' => '&#x644;.&#x644;',
1206 - 'LKR' => '&#xdbb;&#xdd4;',
1207 - 'LRD' => '&#36;',
1208 - 'LSL' => 'L',
1209 - 'LYD' => '&#x644;.&#x62f;',
1210 - 'MAD' => '&#x62f;.&#x645;.',
1211 - 'MDL' => 'MDL',
1212 - 'MGA' => 'Ar',
1213 - 'MKD' => '&#x434;&#x435;&#x43d;',
1214 - 'MMK' => 'Ks',
1215 - 'MNT' => '&#x20ae;',
1216 - 'MOP' => 'P',
1217 - 'MRU' => 'UM',
1218 - 'MUR' => '&#x20a8;',
1219 - 'MVR' => '.&#x783;',
1220 - 'MWK' => 'MK',
1221 - 'MXN' => '&#36;',
1222 - 'MYR' => '&#82;&#77;',
1223 - 'MZN' => 'MT',
1224 - 'NAD' => 'N&#36;',
1225 - 'NGN' => '&#8358;',
1226 - 'NIO' => 'C&#36;',
1227 - 'NOK' => '&#107;&#114;',
1228 - 'NPR' => '&#8360;',
1229 - 'NZD' => '&#36;',
1230 - 'OMR' => '&#x631;.&#x639;.',
1231 - 'PAB' => 'B/.',
1232 - 'PEN' => 'S/',
1233 - 'PGK' => 'K',
1234 - 'PHP' => '&#8369;',
1235 - 'PKR' => '&#8360;',
1236 - 'PLN' => '&#122;&#322;',
1237 - 'PRB' => '&#x440;.',
1238 - 'PYG' => '&#8370;',
1239 - 'QAR' => '&#x631;.&#x642;',
1240 - 'RMB' => '&yen;',
1241 - 'RON' => 'lei',
1242 - 'RSD' => '&#1088;&#1089;&#1076;',
1243 - 'RUB' => '&#8381;',
1244 - 'RWF' => 'Fr',
1245 - 'SAR' => '&#x631;.&#x633;',
1246 - 'SBD' => '&#36;',
1247 - 'SCR' => '&#x20a8;',
1248 - 'SDG' => '&#x62c;.&#x633;.',
1249 - 'SEK' => '&#107;&#114;',
1250 - 'SGD' => '&#36;',
1251 - 'SHP' => '&pound;',
1252 - 'SLL' => 'Le',
1253 - 'SOS' => 'Sh',
1254 - 'SRD' => '&#36;',
1255 - 'SSP' => '&pound;',
1256 - 'STN' => 'Db',
1257 - 'SYP' => '&#x644;.&#x633;',
1258 - 'SZL' => 'L',
1259 - 'THB' => '&#3647;',
1260 - 'TJS' => '&#x405;&#x41c;',
1261 - 'TMT' => 'm',
1262 - 'TND' => '&#x62f;.&#x62a;',
1263 - 'TOP' => 'T&#36;',
1264 - 'TRY' => '&#8378;',
1265 - 'TTD' => '&#36;',
1266 - 'TWD' => '&#78;&#84;&#36;',
1267 - 'TZS' => 'Sh',
1268 - 'UAH' => '&#8372;',
1269 - 'UGX' => 'UGX',
1270 - 'USD' => '&#36;',
1271 - 'UYU' => '&#36;',
1272 - 'UZS' => 'UZS',
1273 - 'VEF' => 'Bs F',
1274 - 'VES' => 'Bs.S',
1275 - 'VND' => '&#8363;',
1276 - 'VUV' => 'Vt',
1277 - 'WST' => 'T',
1278 - 'XAF' => 'CFA',
1279 - 'XCD' => '&#36;',
1280 - 'XOF' => 'CFA',
1281 - 'XPF' => 'Fr',
1282 - 'YER' => '&#xfdfc;',
1283 - 'ZAR' => '&#82;',
1284 - 'ZMW' => 'ZK',
1285 - );
860 +function learn_press_get_currency(): string {
861 + $currency = LP_Settings::instance()->get( 'currency', 'USD' );
1286 862
1287 - return apply_filters( 'learn-press/currency-symbols', $symbols );
863 + return esc_html( apply_filters( 'learn-press/currency', $currency ) );
1288 864 }
1289 865
1290 866 /**
1291 867 * Return currency symbol from the code.
@@ -1298,9 +874,9 @@
1298 874 if ( ! $currency ) {
1299 875 $currency = learn_press_get_currency();
1300 876 }
1301 877 $symbols = learn_press_currency_symbols();
1302 - $currency_symbol = isset( $symbols[ $currency ] ) ? $symbols[ $currency ] : '';
878 + $currency_symbol = $symbols[ $currency ] ?? '';
1303 879
1304 880 $currency_symbol = apply_filters( 'learn_press_currency_symbol', $currency_symbol, $currency );
1305 881
1306 882 return apply_filters( 'learn-press/currency-symbol', $currency_symbol, $currency );
@@ -1315,14 +891,19 @@
1315 891 * @editor tungnx
1316 892 * @modify 4.1.4
1317 893 */
1318 894 function learn_press_get_page_link( string $key ): string {
1319 - $page_id = learn_press_get_page_id( $key );
1320 - $link = '';
895 + $page_id = learn_press_get_page_id( $key );
896 + $key_cache = "lp/page-link/{$key}";
897 + $link = LP_Cache::cache_load_first( 'get', $key_cache );
898 + if ( false !== $link ) {
899 + return $link;
900 + }
1321 901
1322 902 if ( $page_id && get_post_status( $page_id ) == 'publish' ) {
1323 903 $permalink = get_permalink( $page_id );
1324 904 $link = apply_filters( 'learn-press/get-page-link', trailingslashit( $permalink ), $page_id, $key );
905 + LP_Cache::cache_load_first( 'set', $key_cache, $link );
1325 906 }
1326 907
1327 908 return $link;
1328 909 }
@@ -1423,41 +1004,8 @@
1423 1004
1424 1005 return $result;
1425 1006 }
1426 1007
1427 -add_filter( 'learn_press_course_lesson_permalink', 'learn_press_course_lesson_permalink_friendly', 10, 3 );
1428 -function learn_press_course_lesson_permalink_friendly( $permalink, $lesson_id, $course_id ) {
1429 - if ( '' != get_option( 'permalink_structure' ) ) {
1430 - if ( preg_match( '!\?lesson=([^\?\&]*)!', $permalink, $matches ) ) {
1431 - $permalink = preg_replace(
1432 - '!/?\?lesson=([^\?\&]*)!',
1433 - '/' . basename( get_permalink( $matches[1] ) ),
1434 - untrailingslashit( $permalink )
1435 - );
1436 - }
1437 - }
1438 -
1439 - return $permalink;
1440 -}
1441 -
1442 -/**
1443 - * @deprecated 4.1.7.3
1444 - */
1445 -function learn_press_course_question_permalink_friendly( $permalink, $lesson_id, $course_id ) {
1446 - _deprecated_function( __FUNCTION__, '4.1.7.3' );
1447 - if ( '' != get_option( 'permalink_structure' ) ) {
1448 - if ( preg_match( '!\?lesson=([^\?\&]*)!', $permalink, $matches ) ) {
1449 - $permalink = preg_replace(
1450 - '!/?\?lesson=([^\?\&]*)!',
1451 - '/' . basename( get_permalink( $matches[1] ) ),
1452 - untrailingslashit( $permalink )
1453 - );
1454 - }
1455 - }
1456 -
1457 - return $permalink;
1458 -}
1459 -
1460 1008 function learn_press_user_maybe_is_a_teacher( $user = null ) {
1461 1009 if ( ! $user ) {
1462 1010 $user = learn_press_get_current_user();
1463 1011 } elseif ( is_numeric( $user ) ) {
@@ -1495,61 +1043,8 @@
1495 1043 }
1496 1044
1497 1045 add_filter( 'gettext_with_context', '_learn_press_translate_user_roles', 10, 4 );
1498 1046
1499 -/**
1500 - * Modifies the statement $where to make the search works correct
1501 - *
1502 - * @param string
1503 - *
1504 - * @return string
1505 - * @deprecated 4.1.7.2
1506 - */
1507 -//function learn_press_posts_where_statement_search( $where ) {
1508 -// // gets the global query var object
1509 -// global $wp_query, $wpdb;
1510 -//
1511 -// /**
1512 -// * Need to wrap this block into () in order to make it works correctly when filter by specific post type => maybe a bug :)
1513 -// * from => ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%'
1514 -// * to => ( ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%' )
1515 -// */
1516 -// $a = preg_match( '!(' . $wpdb->posts . '.post_status)!', $where );
1517 -// $b = preg_match( '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!', $where );
1518 -//
1519 -// if ( $a && $b ) {
1520 -// // append ( to the start of the block
1521 -// $where = preg_replace( '!(' . $wpdb->posts . '.post_status)!', '( $1', $where, 1 );
1522 -//
1523 -// // append ) to the end of the block
1524 -// $where = preg_replace(
1525 -// '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!',
1526 -// '$1 )',
1527 -// $where
1528 -// );
1529 -// }
1530 -// remove_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1531 -//
1532 -// return $where;
1533 -//}
1534 -
1535 -/**
1536 - * Filter post type for search function
1537 - * Only search lpr_course if see the param ref=course in request
1538 - *
1539 - * @param WP_Query $q
1540 - * @deprecated 4.1.7.2
1541 - */
1542 -/*function learn_press_filter_search( $q ) {
1543 - if ( $q->is_main_query() && $q->is_search() && ( ! empty( $_REQUEST['ref'] ) && sanitize_text_field( $_REQUEST['ref'] ) == 'course' ) ) {
1544 - $q->set( 'post_type', 'lp_course' );
1545 -
1546 - add_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1547 - remove_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
1548 - }
1549 -}*/
1550 -//add_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
1551 -
1552 1047 if ( ! function_exists( 'learn_press_send_json' ) ) {
1553 1048 function learn_press_send_json( $data ) {
1554 1049 echo '<-- LP_AJAX_START -->';
1555 1050 echo wp_json_encode( $data );
@@ -1718,19 +1213,15 @@
1718 1213 }
1719 1214 }
1720 1215
1721 1216 if ( ! function_exists( 'learn_press_is_course' ) ) {
1722 - function learn_press_is_course() {
1723 - /**
1724 - * @var WP_Query $wp_query
1725 - */
1726 - global $wp_query;
1727 -
1728 - if ( $wp_query->get_queried_object() ) {
1217 + function learn_press_is_course(): bool {
1218 + try {
1729 1219 return is_singular( array( LP_COURSE_CPT ) );
1730 - } else {
1731 - return false;
1220 + } catch ( Throwable $e ) {
1732 1221 }
1222 +
1223 + return false;
1733 1224 }
1734 1225 }
1735 1226
1736 1227 if ( ! function_exists( 'learn_press_is_lesson' ) ) {
@@ -1780,8 +1271,19 @@
1780 1271
1781 1272 return apply_filters( 'learn-press/is-checkout', false );
1782 1273 }
1783 1274
1275 +function learn_press_is_instructors() {
1276 + $page_id = learn_press_get_page_id( 'instructors' );
1277 +
1278 + if ( $page_id && is_page( $page_id ) ) {
1279 + return true;
1280 + }
1281 +
1282 + return apply_filters( 'learn-press/is-instructor', false );
1283 +}
1284 +
1285 +
1784 1286 /**
1785 1287 * Return register permalink
1786 1288 *
1787 1289 * @return mixed
@@ -1796,10 +1298,12 @@
1796 1298 * @param string
1797 1299 * @param string
1798 1300 *
1799 1301 * @return mixed
1302 + * @deprecated 4.2.5
1800 1303 */
1801 1304 function learn_press_add_notice( $message, $type = 'updated' ) {
1305 + _deprecated_function( __FUNCTION__, '4.2.5' );
1802 1306 LP_Admin_Notice::instance()->add( $message, $type );
1803 1307 }
1804 1308
1805 1309 /**
@@ -1813,11 +1317,9 @@
1813 1317 * @editor tungnx
1814 1318 * @version 1.0.3
1815 1319 */
1816 1320 function learn_press_setcookie( string $name = '', string $value = '', int $expire = 0, bool $httponly = true ) {
1817 - $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
1818 -
1819 - @setcookie( $name, $value, $expire, COOKIEPATH ?: '/', COOKIE_DOMAIN, $secure, $httponly );
1321 + @setcookie( $name, $value, $expire, COOKIEPATH ?: '/', COOKIE_DOMAIN, is_ssl(), $httponly );
1820 1322 }
1821 1323
1822 1324 /**
1823 1325 * Clear cookie
@@ -1825,9 +1327,9 @@
1825 1327 * @param string $name
1826 1328 */
1827 1329 function learn_press_remove_cookie( string $name = '' ) {
1828 1330 if ( ! empty( $name ) ) {
1829 - setcookie( $name, '', time() - YEAR_IN_SECONDS, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN );
1331 + setcookie( $name, '', time() - YEAR_IN_SECONDS, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, is_ssl(), true );
1830 1332 }
1831 1333
1832 1334 if ( array_key_exists( $name, $_COOKIE ) ) {
1833 1335 unset( $_COOKIE[ $name ] );
@@ -1886,45 +1388,12 @@
1886 1388 return apply_filters( 'learn_press_get_endpoint_url', esc_url_raw( $url ), $name, $value, $url );
1887 1389 }
1888 1390
1889 1391 /**
1890 - * Add all endpoints from settings to the pages.
1392 + * @deprecated 4.2.3
1891 1393 */
1892 -function learn_press_add_endpoints() {
1893 - $settings = LP_Settings::instance();
1894 -
1895 - $endpoints = $settings->get_checkout_endpoints();
1896 - if ( $endpoints ) {
1897 - foreach ( $endpoints as $endpoint => $value ) {
1898 - LearnPress::instance()->query_vars[ $endpoint ] = $value;
1899 - add_rewrite_endpoint( $value, EP_PAGES );
1900 - }
1901 - }
1902 -
1903 - $endpoints = $settings->get_profile_endpoints();
1904 - if ( $endpoints ) {
1905 - foreach ( $endpoints as $endpoint => $value ) {
1906 - LearnPress::instance()->query_vars[ $endpoint ] = $value;
1907 - add_rewrite_endpoint( $value, EP_PAGES );
1908 - }
1909 - }
1910 -
1911 - $endpoints = $settings->get( 'quiz_endpoints' );
1912 - if ( $endpoints ) {
1913 - foreach ( $endpoints as $endpoint => $value ) {
1914 - $endpoint = preg_replace( '!_!', '-', $endpoint );
1915 - LearnPress::instance()->query_vars[ $endpoint ] = $value;
1916 - add_rewrite_endpoint(
1917 - $value, /*EP_ROOT | */
1918 - EP_PAGES
1919 - );
1920 - }
1921 - }
1922 -}
1923 -
1924 -add_action( 'init', 'learn_press_add_endpoints' );
1925 -
1926 1394 function learn_press_is_yes( $value ) {
1395 + _deprecated_function( __FUNCTION__, '4.2.3' );
1927 1396 return ( $value === 1 ) || ( $value === '1' ) || ( $value == 'yes' ) || ( $value == true ) || ( $value == 'on' );
1928 1397 }
1929 1398
1930 1399 /**
@@ -1930,10 +1399,12 @@
1930 1399 /**
1931 1400 * @param mixed $value
1932 1401 *
1933 1402 * @return bool
1403 + * @deprecated 4.2.3
1934 1404 */
1935 1405 function _is_false_value( $value ) {
1406 + _deprecated_function( __FUNCTION__, '4.2.3' );
1936 1407 if ( is_numeric( $value ) ) {
1937 1408 return $value == 0;
1938 1409 } elseif ( is_string( $value ) ) {
1939 1410 return ( empty( $value ) || is_null( $value ) || in_array( $value, array( 'no', 'off', 'false' ) ) );
@@ -1973,23 +1444,8 @@
1973 1444 }
1974 1445 }
1975 1446
1976 1447 /**
1977 - * @param string $handle
1978 - * @param bool $hash
1979 - *
1980 - * @return string
1981 - * @deprecated 4.1.7.2
1982 - */
1983 -/*function learn_press_get_log_file_path( $handle, $hash = false ) {
1984 - if ( $hash ) {
1985 - $hash = '-' . sanitize_file_name( wp_hash( $handle ) );
1986 - }
1987 -
1988 - return trailingslashit( LP_LOG_PATH ) . $handle . $hash . '.log';
1989 -}*/
1990 -
1991 -/**
1992 1448 * Get the cart object in checkout page
1993 1449 *
1994 1450 * @return LP_Cart
1995 1451 * @deprecated 4.2.0
@@ -1998,31 +1454,8 @@
1998 1454 _deprecated_function( __FUNCTION__, '4.2.0', 'LearnPress::instance()->cart' );
1999 1455 return apply_filters( 'learn_press_checkout_cart', LearnPress::instance()->cart );
2000 1456 }
2001 1457
2002 -/*function learn_press_front_scripts() {
2003 - if ( is_admin() ) {
2004 - return;
2005 - }
2006 - $js = array(
2007 - 'ajax' => admin_url( 'admin-ajax.php' ),
2008 - 'plugin_url' => LearnPress::instance()->plugin_url(),
2009 - 'siteurl' => home_url(),
2010 - 'current_url' => learn_press_get_current_url(),
2011 - 'localize' => array(
2012 - 'button_ok' => __( 'OK', 'learnpress' ),
2013 - 'button_cancel' => __( 'Cancel', 'learnpress' ),
2014 - 'button_yes' => __( 'Yes', 'learnpress' ),
2015 - 'button_no' => __( 'No', 'learnpress' ),
2016 - ),
2017 - );
2018 - foreach ( $js as $k => $v ) {
2019 - LP_Assets::add_param( $k, $v, array( 'learn-press-single-course', 'learn-press-global' ), 'LP_Settings' );
2020 - }
2021 -}
2022 -
2023 -add_action( 'wp_print_scripts', 'learn_press_front_scripts' );*/
2024 -
2025 1458 function learn_press_user_time( $time, $format = 'timestamp' ) {
2026 1459 if ( is_string( $time ) ) {
2027 1460 $time = @strtotime( $time );
2028 1461 }
@@ -2048,8 +1481,10 @@
2048 1481 *
2049 1482 * @param bool $default
2050 1483 *
2051 1484 * @return mixed|string
1485 + * @deprecated 4.2.2
1486 + * addon commission 4.0.2 still use this function
2052 1487 */
2053 1488 function learn_press_get_current_profile_tab( $default = true ) {
2054 1489 global $wp_query, $wp;
2055 1490 $current = '';
@@ -2054,12 +1489,9 @@
2054 1489 global $wp_query, $wp;
2055 1490 $current = '';
2056 1491
2057 1492 // Only load on profile page.
2058 - $page_profile_option = untrailingslashit( get_the_permalink( learn_press_get_page_id( 'profile' ) ) );
2059 - $page_profile_option = str_replace( '/', '\/', $page_profile_option );
2060 - $pattern = '/' . $page_profile_option . '/';
2061 - if ( ! preg_match( $pattern, LP_Helper::getUrlCurrent() ) ) {
1493 + if ( ! LP_Page_Controller::is_page_profile() ) {
2062 1494 return false;
2063 1495 }
2064 1496
2065 1497 if ( ! empty( $_REQUEST['tab'] ) ) {
@@ -2083,9 +1515,9 @@
2083 1515
2084 1516 return $current;
2085 1517 }
2086 1518
2087 -add_action( 'init', 'learn_press_get_current_profile_tab' );
1519 +//add_action( 'init', 'learn_press_get_current_profile_tab' );
2088 1520
2089 1521 function learn_press_profile_tab_exists( $tab ) {
2090 1522 $tabs = learn_press_get_user_profile_tabs();
2091 1523
@@ -2095,40 +1527,8 @@
2095 1527
2096 1528 return false;
2097 1529 }
2098 1530
2099 -/**
2100 - * Replace the spacing with the + (plus) char.
2101 - *
2102 - * @param string $string
2103 - *
2104 - * @return string
2105 - * @deprecated 4.1.7.2
2106 - */
2107 -/*function _learn_press_urlencode( $string ) {
2108 - return preg_replace( '/\s/', '+', $string );
2109 -}*/
2110 -
2111 -/**
2112 - * Point the archive post type link to course page if current
2113 - * post type is course and the page for displaying course is
2114 - * setup.
2115 - *
2116 - * @param string $link
2117 - * @param string $post_type
2118 - *
2119 - * @return string
2120 - * @deprecated 4.1.7.2
2121 - */
2122 -/*function learn_press_post_type_archive_link( $link, $post_type ) {
2123 - if ( $post_type == LP_COURSE_CPT && learn_press_get_page_id( 'courses' ) ) {
2124 - $link = learn_press_get_page_link( 'courses' );
2125 - }
2126 -
2127 - return $link;
2128 -}*/
2129 -//add_filter( 'post_type_archive_link', 'learn_press_post_type_archive_link', 10, 2 );
2130 -
2131 1531 function learn_press_single_term_title( $prefix = '', $display = true ) {
2132 1532 $term = get_queried_object();
2133 1533
2134 1534 if ( ! $term ) {
@@ -2375,33 +1775,8 @@
2375 1775 die( __FUNCTION__ );
2376 1776 }
2377 1777 }
2378 1778
2379 -/**
2380 - * Get current time to user for calculate remaining time of quiz.
2381 - *
2382 - * @return int
2383 - * @deprecated 4.1.7.2
2384 - */
2385 -/*function learn_press_get_current_time() {
2386 - $current_time = apply_filters( 'learn_press_get_current_time', 0 );
2387 -
2388 - if ( $current_time > 0 ) {
2389 - return $current_time;
2390 - }
2391 -
2392 - $a = current_time( 'timestamp' );
2393 - $b = time();
2394 - $c = current_time( 'mysql' );
2395 - $d = strtotime( $c );
2396 -
2397 - if ( $d == $a ) {
2398 - return $a;
2399 - } else {
2400 - return $b;
2401 - }
2402 -}*/
2403 -
2404 1779 function learn_press_get_requested_post_type() {
2405 1780 global $pagenow;
2406 1781 if ( $pagenow == 'post-new.php' && ! empty( $_REQUEST['post_type'] ) ) {
2407 1782 $post_type = LP_Helper::sanitize_params_submitted( $_REQUEST['post_type'] );
@@ -2541,30 +1916,14 @@
2541 1916 echo '<span class="learn-press-tooltip" data-tooltip="' . esc_attr( $tooltip ) . '"></span>';
2542 1917 }
2543 1918
2544 1919 /**
2545 - * Get timezone offset from wp settings.
2546 - *
2547 - * @return float|int
2548 - * @since 3.0.0
2549 - * @deprecated 4.1.7.2
2550 - */
2551 -/*function learn_press_timezone_offset() {
2552 - if ( $tz = get_option( 'timezone_string' ) ) {
2553 - $timezone = new DateTimeZone( $tz );
2554 -
2555 - return $timezone->getOffset( new DateTime( 'now' ) );
2556 - } else {
2557 - return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS;
2558 - }
2559 -}*/
2560 -
2561 -/**
2562 1920 * Get default static pages of LP.
2563 1921 *
2564 1922 * @return array
2565 1923 *
2566 1924 * @since 3.0.0
1925 + * @deprecated 4.2.3
2567 1926 */
2568 1927 function learn_press_static_page_ids() {
2569 1928 $pages = LP_Object_Cache::get( 'static-page-ids', 'learn-press' );
2570 1929
@@ -2588,35 +1947,8 @@
2588 1947 return apply_filters( 'learn-press/static-page-ids', $pages );
2589 1948 }
2590 1949
2591 1950 /**
2592 - * Get default static pages of LP.
2593 - *
2594 - * @param bool $name - Optional. TRUE will return name only.
2595 - *
2596 - * @return array
2597 - *
2598 - * @since 3.0.0
2599 - */
2600 -function learn_press_static_pages( $name = false ) {
2601 - $pages = apply_filters(
2602 - 'learn-press/static-pages',
2603 - array(
2604 - 'checkout' => _x( 'Checkout', 'static-page-name', 'learnpress' ),
2605 - 'courses' => _x( 'Courses', 'static-page-name', 'learnpress' ),
2606 - 'profile' => _x( 'Profile', 'static-page-name', 'learnpress' ),
2607 - 'become_a_teacher' => _x( 'Become a Teacher', 'static-page-name', 'learnpress' ),
2608 - )
2609 - );
2610 -
2611 - if ( $name ) {
2612 - return array_keys( $pages );
2613 - }
2614 -
2615 - return $pages;
2616 -}
2617 -
2618 -/**
2619 1951 * Callback function for sorting to array|object by key|prop priority.
2620 1952 *
2621 1953 * @param array|object $a
2622 1954 * @param array|object $b
@@ -2622,10 +1954,11 @@
2622 1954 * @param array|object $b
2623 1955 *
2624 1956 * @return int
2625 1957 * @since 3.0.0
1958 + * @deprecated 4.4.5
2626 1959 */
2627 -function learn_press_sort_list_by_priority_callback( $a, $b ) {
1960 +/*function learn_press_sort_list_by_priority_callback( $a, $b ) {
2628 1961 $a_priority = null;
2629 1962 $b_priority = null;
2630 1963
2631 1964 if ( is_array( $a ) && array_key_exists( 'priority', $a ) ) {
@@ -2652,9 +1985,9 @@
2652 1985 return 0;
2653 1986 }
2654 1987
2655 1988 return ( $a_priority < $b_priority ) ? - 1 : 1;
2656 -}
1989 +}*/
2657 1990
2658 1991 /**
2659 1992 * Localize date with custom format.
2660 1993 *
@@ -2663,8 +1996,9 @@
2663 1996 * @param bool $gmt
2664 1997 *
2665 1998 * @return string
2666 1999 * @since 3.0.0
2000 + * @deprcated 4.2.6 use LP_Datetime format instead
2667 2001 */
2668 2002 function learn_press_date_i18n( $timestamp = 0, string $format = '', bool $gmt = false ): string {
2669 2003 if ( ! $format ) {
2670 2004 $format = get_option( 'date_format' );
@@ -2722,42 +2056,8 @@
2722 2056 return $post_type;
2723 2057 }
2724 2058
2725 2059 /**
2726 - * Add post type of a post into cache
2727 - *
2728 - * @param int|array $id
2729 - * @param string $type
2730 - *
2731 - * @since 3.1.0
2732 - * @deprecated 4.1.7.2
2733 - */
2734 -/*function learn_press_cache_add_post_type( $id, $type = '' ) {
2735 - if ( false === ( $post_types = LP_Object_Cache::get( 'post-types', 'learn-press' ) ) ) {
2736 - $post_types = array();
2737 - }
2738 -
2739 - if ( func_num_args() == 1 && is_array( $id ) ) {
2740 - $post_types = $post_types + $id;
2741 - } else {
2742 - $post_types[ $id ] = $type;
2743 - }
2744 -
2745 - LP_Object_Cache::set( 'post-types', $post_types, 'learn-press' );
2746 -}*/
2747 -
2748 -/**
2749 - * @deprecated 4.1.7.2
2750 - */
2751 -/*function learn_press_has_option( $name ) {
2752 - global $wpdb;
2753 -
2754 - $query = $wpdb->prepare( "SELECT option_id FROM {$wpdb->options} WHERE option_name = %s", $name );
2755 -
2756 - return $wpdb->get_var( $query ) > 0;
2757 -}*/
2758 -
2759 -/**
2760 2060 * Update option to enable shuffle themes for ad.
2761 2061 *
2762 2062 * @since 3.2.1
2763 2063 */
@@ -2767,17 +2067,8 @@
2767 2067
2768 2068 add_action( 'learn-press/schedule-enable-shuffle-themes', '_learn_press_schedule_enable_shuffle_themes' );
2769 2069
2770 2070 /**
2771 - * @deprecated 4.1.7.2
2772 - */
2773 -/*function learn_press_show_log() {
2774 - if ( trim( LP_Request::get( 'show_log' ) ) === md5( AUTH_KEY ) ) {
2775 - call_user_func_array( 'learn_press_debug', func_get_args() );
2776 - }
2777 -}*/
2778 -
2779 -/**
2780 2071 * Return localize script data for admin.
2781 2072 *
2782 2073 * @return array
2783 2074 * @since 3.2.6
@@ -2784,22 +2075,22 @@
2784 2075 * @version 1.0.1
2785 2076 */
2786 2077 function learn_press_global_script_params(): array {
2787 2078 $localize = [
2788 - 'ajax' => admin_url( 'admin-ajax.php' ),
2789 - 'plugin_url' => LearnPress::instance()->plugin_url(),
2790 - 'siteurl' => home_url(),
2791 - 'current_url' => learn_press_get_current_url(),
2792 - 'theme' => get_stylesheet(),
2793 - 'localize' => array(
2079 + 'ajax' => admin_url( 'admin-ajax.php' ),
2080 + 'plugin_url' => LearnPress::instance()->plugin_url(),
2081 + 'siteurl' => home_url(),
2082 + //'current_url' => learn_press_get_current_url(),
2083 + 'theme' => get_stylesheet(),
2084 + 'localize' => array(
2794 2085 'button_ok' => __( 'OK', 'learnpress' ),
2795 2086 'button_cancel' => __( 'Cancel', 'learnpress' ),
2796 2087 'button_yes' => __( 'Yes', 'learnpress' ),
2797 2088 'button_no' => __( 'No', 'learnpress' ),
2798 2089 ),
2799 - 'rest' => esc_url_raw( rest_url() ),
2800 - 'nonce' => wp_create_nonce( 'wp_rest' ),
2801 - 'is_admin' => current_user_can( ADMIN_ROLE ),
2090 + 'rest' => esc_url_raw( rest_url() ),
2091 + 'nonce' => wp_create_nonce( 'wp_rest' ),
2092 + 'is_admin' => current_user_can( ADMIN_ROLE ),
2802 2093 ];
2803 2094
2804 2095 return apply_filters( 'lp/admin/localize/scripts', $localize );
2805 2096 }
@@ -2804,69 +2095,8 @@
2804 2095 return apply_filters( 'lp/admin/localize/scripts', $localize );
2805 2096 }
2806 2097
2807 2098 /**
2808 - * Get url for setup cron job on server.
2809 - *
2810 - * @return string
2811 - * @since 3.3.0
2812 - * @deprecated 4.1.7.2
2813 - */
2814 -/*function learn_press_get_cron_url() {
2815 - $nonce = get_option( 'learnpress_cron_url_nonce' );
2816 -
2817 - if ( ! $nonce ) {
2818 - $nonce = md5( microtime( true ) );
2819 - update_option( 'learnpress_cron_url_nonce', $nonce );
2820 - }
2821 - $url = add_query_arg(
2822 - array(
2823 - 'lp-ajax' => 'cron',
2824 - 'sid' => $nonce,
2825 - ),
2826 - get_home_url()
2827 - );
2828 -
2829 - return $url;
2830 -}*/
2831 -
2832 -/**
2833 - * Get courses expired.
2834 - *
2835 - * @return array
2836 - * @since 3.3.0
2837 - * @deprecated 4.1.7.2
2838 - */
2839 -/*function learn_press_get_expired_courses() {
2840 - global $wpdb;
2841 -
2842 - $query = $wpdb->prepare(
2843 - "
2844 - SELECT X.*
2845 - FROM(
2846 - SELECT ui.*
2847 - FROM {$wpdb->learnpress_user_items} ui
2848 - LEFT JOIN {$wpdb->learnpress_user_items} uix
2849 - ON ui.item_id = uix.item_id
2850 - AND ui.user_id = uix.user_id
2851 - AND ui.user_item_id < uix.user_item_id
2852 - WHERE uix.user_item_id IS NULL
2853 - ) X
2854 - INNER JOIN {$wpdb->users} u ON u.ID = X.user_id
2855 - INNER JOIN {$wpdb->posts} p ON p.ID = X.item_id
2856 - WHERE X.item_type = %s
2857 - AND X.status = %s
2858 - #AND expiration_time_gmt <= UTC_TIMESTAMP()
2859 - AND expiration_time <= UTC_TIMESTAMP()
2860 - LIMIT 0, 10
2861 - ",
2862 - LP_COURSE_CPT,
2863 - 'enrolled'
2864 - );
2865 -
2866 -}*/
2867 -
2868 -/**
2869 2099 * Return list types of questions that support answer options.
2870 2100 *
2871 2101 * @return array
2872 2102 * @since 3.3.0
@@ -2900,85 +2130,15 @@
2900 2130 return $questions;
2901 2131 }
2902 2132
2903 2133 /**
2904 - * Helper function to output html for rendering a 'circle progress bar'
2134 + * LP Cookie
2905 2135 *
2906 - * @param int $percent
2907 - * @param int $width
2908 - * @param int $border
2909 - * @param string $color
2136 + * @param $name
2137 + * @param $namespace
2910 2138 *
2911 - * @since 3.3.0
2912 - * @deprecated 4.1.7.2
2139 + * @return mixed|null
2913 2140 */
2914 -/*function learn_press_circle_progress_html( $percent = 0, $width = 32, $border = 4, $color = '' ) {
2915 - $radius = $width / 2;
2916 - $r = ( $width - $border ) / 2;
2917 - $circumference = $r * 2 * pi();
2918 - $offset = $circumference - $percent / 100 * $circumference;
2919 -
2920 - printf(
2921 - '<svg class="circle-progress-bar" width="%d" height="%d">
2922 - <circle class="circle-progress-bar__circle"
2923 - stroke="%s"
2924 - stroke-width="%d"
2925 - style="stroke-dasharray:%s %s; stroke-dashoffset:%s;"
2926 - fill="transparent"
2927 - r="%d" cx="%d" cy="%d"></circle>
2928 - </svg>',
2929 - $width,
2930 - $width,
2931 - $color,
2932 - $border,
2933 - $circumference,
2934 - $circumference,
2935 - $offset,
2936 - $r,
2937 - $radius,
2938 - $radius
2939 - );
2940 -}*/
2941 -
2942 -/**
2943 - * @deprecated 4.1.7.2
2944 - */
2945 -/*function learn_press_is_page( $page_name ) {
2946 - $page_id = learn_press_get_page_id( $page_name );
2947 -
2948 - return $page_id && is_page( $page_id );
2949 -}*/
2950 -
2951 -/**
2952 - * Get end-date from start date with a duration.
2953 - *
2954 - * @param string|int $duration
2955 - * @param string|int $start
2956 - *
2957 - * @return false|string
2958 - * @since 3.x.x
2959 - * @deprecated 4.1.7.2
2960 - */
2961 -/*function learn_press_date_end_from( $duration, $start = '' ) {
2962 - $format = 'Y-m-d H:i:s';
2963 -
2964 - if ( ! $start ) {
2965 - $start = time();
2966 - } elseif ( ! is_numeric( $start ) ) {
2967 - $start = strtotime( $start );
2968 - }
2969 -
2970 - // is LP duration format, e.g: 10 weeks
2971 - if ( preg_match( '/^[0-9]+ [a-z]+$/', $duration ) ) {
2972 - $duration = ( new LP_Duration( $duration ) )->get();
2973 - } elseif ( ! is_numeric( $duration ) ) {
2974 - // 10 days 5 hours ...
2975 - $duration = strtotime( $duration, 0 );
2976 - }
2977 -
2978 - return date( $format, $start + $duration );
2979 -}*/
2980 -
2981 2141 function learn_press_cookie_get( $name, $namespace = 'LP' ) {
2982 2142 if ( $namespace ) {
2983 2143 $cookie = ! empty( $_COOKIE[ $namespace ] ) ? (array) json_decode( LP_Helper::sanitize_params_submitted( stripslashes( $_COOKIE[ $namespace ] ), 'html' ) ) : array();
2984 2144 } else {
@@ -2996,15 +2156,16 @@
2996 2156 * @return array
2997 2157 * @since 3.x.x
2998 2158 */
2999 2159 function learn_press_course_evaluation_methods( $postid, $return = '', $final_quizz_passing = '' ) {
3000 - $course_tip = '<span class="learn-press-tip">%s</span>';
3001 - $final_quiz_btn = '<a href="#" class="lp-metabox-get-final-quiz" data-postid="' . $postid . '" data-loading="' . esc_attr__(
3002 - 'Loading...',
3003 - 'learnpress'
3004 - ) . '">' . esc_html__( 'Get A Passing Grade', 'learnpress' ) . '</a>';
2160 + $final_quiz_btn = sprintf(
2161 + '<a href="#" class="lp-metabox-get-final-quiz" data-postid="%d" data-loading="%s">%s</a>',
2162 + $postid,
2163 + esc_attr__( 'Loading...', 'learnpress' ),
2164 + esc_html__( 'Get A Passing Grade', 'learnpress' )
2165 + );
3005 2166
3006 - $course_desc = array(
2167 + $evaluations_desc = array(
3007 2168 'evaluate_lesson' => sprintf(
3008 2169 '<p>%s<br/>%s</p>',
3009 2170 __( 'Evaluate by the number of completed lessons per the total number of lessons.', 'learnpress' ),
3010 2171 __( 'E.g: If a course has 10 lessons and a user completes 5 lessons, then the result is 5/10 (50%).', 'learnpress' )
@@ -3034,29 +2195,37 @@
3034 2195
3035 2196 $methods = apply_filters(
3036 2197 'learnpress/course-evaluation/methods',
3037 2198 array(
3038 - 'evaluate_lesson' => __(
3039 - 'Evaluate via lessons',
3040 - 'learnpress'
3041 - ) . learn_press_quick_tip( $course_desc['evaluate_lesson'], false ),
3042 - 'evaluate_final_quiz' => __( 'Evaluate via results of the final quiz', 'learnpress' ) . sprintf(
3043 - $course_tip,
3044 - $course_desc['evaluate_final_quiz']
3045 - ) . $final_quiz_btn . $final_quizz_passing,
3046 - 'evaluate_quiz' => __( 'Evaluate via passed quizzes', 'learnpress' ) . sprintf(
3047 - $course_tip,
3048 - $course_desc['evaluate_quiz']
2199 + 'evaluate_lesson' => sprintf(
2200 + '%s %s',
2201 + __( 'Evaluate via lessons', 'learnpress' ),
2202 + learn_press_quick_tip( $evaluations_desc['evaluate_lesson'], false )
3049 2203 ),
3050 - 'evaluate_questions' => __( 'Evaluate via questions', 'learnpress' ) . sprintf(
3051 - $course_tip,
3052 - $course_desc['evaluate_questions']
2204 + 'evaluate_final_quiz' => sprintf(
2205 + '%s %s %s %s',
2206 + __( 'Evaluate via results of the final quiz', 'learnpress' ),
2207 + learn_press_quick_tip( $evaluations_desc['evaluate_final_quiz'], false ),
2208 + $final_quiz_btn,
2209 + $final_quizz_passing
3053 2210 ),
3054 - 'evaluate_mark' => __( 'Evaluate via mark', 'learnpress' ) . sprintf(
3055 - $course_tip,
3056 - $course_desc['evaluate_mark']
2211 + 'evaluate_quiz' => sprintf(
2212 + '%s %s',
2213 + __( 'Evaluate via passed quizzes', 'learnpress' ),
2214 + learn_press_quick_tip( $evaluations_desc['evaluate_quiz'], false )
3057 2215 ),
3058 - )
2216 + 'evaluate_questions' => sprintf(
2217 + '%s %s',
2218 + __( 'Evaluate via questions', 'learnpress' ),
2219 + learn_press_quick_tip( $evaluations_desc['evaluate_questions'], false )
2220 + ),
2221 + 'evaluate_mark' => sprintf(
2222 + '%s %s',
2223 + __( 'Evaluate via mark', 'learnpress' ),
2224 + learn_press_quick_tip( $evaluations_desc['evaluate_mark'], false )
2225 + ),
2226 + ),
2227 + $postid
3059 2228 );
3060 2229
3061 2230 return apply_filters(
3062 2231 'learn-press/course-evaluation-methods',
@@ -3065,34 +2234,8 @@
3065 2234 );
3066 2235 }
3067 2236
3068 2237 /**
3069 - * Convert time from GMT to local.
3070 - *
3071 - * @param string|int|LP_Datetime $gmt_time
3072 - * @param string $format
3073 - *
3074 - * @return false|int|string
3075 - * @since 4.0.0
3076 - * @deprecated 4.1.7.2
3077 - */
3078 -/*function learn_press_time_from_gmt( $gmt_time, $format = 'Y-m-d H:i:s' ) {
3079 - if ( is_string( $gmt_time ) ) {
3080 - $gmt_time = strtotime( $gmt_time );
3081 - } elseif ( $gmt_time instanceof LP_Datetime ) {
3082 - $gmt_time = strtotime( $gmt_time . '' );
3083 - }
3084 -
3085 - $current_time = $gmt_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
3086 -
3087 - if ( $format ) {
3088 - return date( $format, $current_time );
3089 - }
3090 -
3091 - return $current_time;
3092 -}*/
3093 -
3094 -/**
3095 2238 * Get max retrying quiz allowed.
3096 2239 *
3097 2240 * @param int $quiz_id
3098 2241 * @param int $course_id
@@ -3104,21 +2247,8 @@
3104 2247 return apply_filters( 'learn-press/max-retry-quiz-allowed', 1, $quiz_id, $course_id );
3105 2248 }
3106 2249
3107 2250 /**
3108 - * Get max retrying course allowed.
3109 - *
3110 - * @param int $course_id
3111 - *
3112 - * @return int
3113 - * @since 4.0.0
3114 - * @deprecated 4.1.7.2
3115 - */
3116 -/*function learn_press_get_course_max_retrying( $course_id ) {
3117 - return apply_filters( 'learn-press/max-retry-course-allowed', 1, $course_id );
3118 -}*/
3119 -
3120 -/**
3121 2251 * Get slug for status of course/lesson/quiz if user
3122 2252 * completed/finished and graduation is passed.
3123 2253 *
3124 2254 * @param string $type
@@ -3166,62 +2296,24 @@
3166 2296 }
3167 2297
3168 2298 //require_once dirname( __FILE__ ) . '/lp-custom-hooks.php';
3169 2299
3170 -
3171 -/**
3172 - * Disable auto update
3173 - *
3174 - * @param $update
3175 - * @param $item
3176 - *
3177 - * @return false
3178 - * @author hungkv
3179 - */
3180 -/*function learnpress_disable_auto_update( $update, $item ) {
3181 - $plugins = array( // Plugins to auto-update
3182 - 'learnpress',
3183 - );
3184 - // Auto-update specified plugins
3185 - if ( in_array( $item->slug, $plugins ) ) {
3186 - return false;
3187 - }
3188 -}
3189 -add_filter( 'auto_update_plugin', 'learnpress_disable_auto_update', 10, 2 );*/
3190 -
3191 -add_action(
2300 +// Notify update message for LearnPress plugin
2301 +/*add_action(
3192 2302 'in_plugin_update_message-learnpress/learnpress.php',
3193 2303 function ( $plugin_data ) {
3194 2304 if ( version_compare( $plugin_data['new_version'], LEARNPRESS_VERSION, '<=' ) ) {
3195 2305 return;
3196 2306 }
3197 - ?>
3198 - <hr/>
3199 - <h3>
3200 - <?php echo esc_html__( 'Heads up! Please backup before upgrading!', 'learnpress' ); ?>
3201 - </h3>
3202 - <div>
3203 - <?php echo esc_html__( 'The latest update includes some substantial changes across different areas of the plugin. We highly recommend you backup your site before upgrading, and make sure you first update in a staging environment', 'learnpress' ); ?>
3204 - </div>
3205 - <?php
3206 - }
3207 -);
3208 2307
3209 -// If profile content don't have shortcode profile.
3210 -function lp_add_shortcode_profile() {
3211 - global $post;
3212 -
3213 - if ( learn_press_is_profile() && is_object( $post ) ) {
3214 - if ( ! has_shortcode( $post->post_content, 'learn_press_profile' ) ) {
3215 - $post->post_content .= '<!-- wp:shortcode -->[' . apply_filters( 'learn-press/shortcode/profile/tag', 'learn_press_profile' ) . ']<!-- /wp:shortcode -->';
3216 - }
3217 -
3218 - wp_update_post( $post );
2308 + echo sprintf(
2309 + '<hr/><h3>%s</h3><div>%s</div>',
2310 + esc_html__( 'Heads up! Please backup before upgrading!', 'learnpress' ),
2311 + esc_html__( 'The latest update includes some substantial changes across different areas of the plugin. We highly recommend you backup your site before upgrading, and make sure you first update in a staging environment', 'learnpress' )
2312 + );
3219 2313 }
3220 -}
2314 +);*/
3221 2315
3222 -add_action( 'template_redirect', 'lp_add_shortcode_profile' );
3223 -
3224 2316 /**
3225 2317 * If Elementor Pro set Theme builder type "Archive", will not show content on page "Archive course"
3226 2318 *
3227 2319 * @editor tungnx
@@ -3231,9 +2323,9 @@
3231 2323 * @version 1.0.1
3232 2324 */
3233 2325 add_filter(
3234 2326 'elementor/theme/get_location_templates/template_id',
3235 - function( $theme_template_id ) {
2327 + function ( $theme_template_id ) {
3236 2328 $elementor_template_type = get_post_meta( $theme_template_id, '_elementor_template_type', true );
3237 2329
3238 2330 if ( in_array( $elementor_template_type, array( 'archive' ) ) ) {
3239 2331 if ( LP_PAGE_COURSES === LP_Page_Controller::page_current() && class_exists( 'ElementorPro\Modules\ThemeBuilder\Conditions\Archive' ) ) {