From 9d4123cee1867ee7199b06bdc92d40611f547ecc Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 14:54:07 -0500 Subject: Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/. --- .../lifterlms/class-astra-lifterlms.php | 858 +++++++++++++++++++++ .../class-astra-liferlms-section-configs.php | 60 ++ .../class-astra-lifter-container-configs.php | 66 ++ .../class-astra-lifter-sidebar-configs.php | 80 ++ .../layout/class-astra-lifter-general-configs.php | 104 +++ 5 files changed, 1168 insertions(+) create mode 100644 inc/compatibility/lifterlms/class-astra-lifterlms.php create mode 100644 inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php (limited to 'inc/compatibility/lifterlms') diff --git a/inc/compatibility/lifterlms/class-astra-lifterlms.php b/inc/compatibility/lifterlms/class-astra-lifterlms.php new file mode 100644 index 0000000..48d6344 --- /dev/null +++ b/inc/compatibility/lifterlms/class-astra-lifterlms.php @@ -0,0 +1,858 @@ + 3, + 'tablet' => 2, + 'mobile' => 1, + ); + $defaults['llms-membership-grid'] = array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ); + + // Container. + $defaults['lifterlms-content-layout'] = 'plain-container'; + + // Sidebar. + $defaults['lifterlms-sidebar-layout'] = 'no-sidebar'; + $defaults['lifterlms-course-lesson-sidebar-layout'] = 'default'; + + return $defaults; + } + + /** + * This function handles the HTML output of the reviews and review form. + * If the option is enabled, the review form will be output, + * if not, nothing will happen. This function also checks to + * see if a user is allowed to review more than once. + * + * @since 1.2.0 + */ + public function single_reviews() { + + /** + * Check to see if we are supposed to output the code at all + */ + if ( get_post_meta( get_the_ID(), '_llms_display_reviews', true ) ) { + ?> +
+

+ get_post_meta( get_the_ID(), '_llms_num_reviews', true ), // phpcs:ignore WPThemeReview.CoreFunctionality.PostsPerPage.posts_per_page_posts_per_page, WordPress.WP.PostsPerPage.posts_per_page_posts_per_page + 'post_type' => 'llms_review', + 'post_status' => 'publish', + 'post_parent' => get_the_ID(), + 'suppress_filters' => true, + ); + $posts_array = get_posts( $args ); + + $styles = array( + 'background-color' => '#EFEFEF', + 'title-color' => 'inherit', + 'text-color' => 'inherit', + 'custom-css' => '', + ); + + if ( has_filter( 'llms_review_custom_styles' ) ) { + $styles = apply_filters( 'llms_review_custom_styles', $styles ); + } + + foreach ( $posts_array as $post ) { + echo $styles['custom-css']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + + ?> +
+
ID ) ); ?>
+ +
ID ) ) ) ); ?>
+

ID ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

+
+ +
+
+ 1, + 'post_type' => 'llms_review', + 'post_status' => 'publish', + 'post_parent' => get_the_ID(), + 'author' => get_current_user_id(), + 'suppress_filters' => true, + ); + $posts_array = get_posts( $args ); + + /** + * Check to see if we are allowed to write more than one review. + * If we are not, check to see if we have written a review already. + */ + if ( get_post_meta( get_the_ID(), '_llms_multiple_reviews_disabled', true ) && $posts_array ) { + ?> +
+

+
+ +
+

+ + + + + + + + +
+ + = 0 ) { + unset( $classes[ $index ] ); + } + } + $classes[] = 'cols-' . $llms_grid['desktop']; + } + } + + if ( ! empty( $llms_grid['tablet'] ) ) { + $classes[] = 'llms-tablet-cols-' . $llms_grid['tablet']; + } + if ( ! empty( $llms_grid['mobile'] ) ) { + $classes[] = 'llms-mobile-cols-' . $llms_grid['mobile']; + } + + return $classes; + } + + /** + * Enqueue styles + * + * @since 1.2.0 + * @return void + */ + public function add_dynamic_styles() { + + /** + * - Variable Declaration + */ + $theme_color = astra_get_option( 'theme-color' ); + $link_color = astra_get_option( 'link-color', $theme_color ); + $link_h_color = astra_get_option( 'link-h-color' ); + + $theme_forground_color = astra_get_foreground_color( $link_color ); + $btn_color = astra_get_option( 'button-color' ); + if ( empty( $btn_color ) ) { + $btn_color = $theme_forground_color; + } + + $btn_h_color = astra_get_option( 'button-h-color' ); + if ( empty( $btn_h_color ) ) { + $btn_h_color = astra_get_foreground_color( $link_h_color ); + } + $btn_bg_color = astra_get_option( 'button-bg-color', '', $link_color ); + $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color ); + + $btn_border_radius = astra_get_option( 'button-radius' ); + $theme_btn_padding = astra_get_option( 'theme-button-padding' ); + + $css_output = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, button.llms-field-button, a.llms-field-button' => array( + 'color' => $btn_color, + 'border-color' => $btn_bg_color, + 'background-color' => $btn_bg_color, + ), + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => array( + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ), + 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ), + 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ), + 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ), + ), + 'a.llms-button-primary:hover, a.llms-button-primary:focus, .llms-button-secondary:hover, .llms-button-secondary:focus, .llms-button-action:hover, .llms-button-action:focus, button.llms-field-button:hover, button.llms-field-button:focus, a.llms-field-button:hover, a.llms-field-button:focus' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + ), + 'nav.llms-pagination ul li a:focus, nav.llms-pagination ul li a:hover, nav.llms-pagination ul li span.current' => array( + 'background' => $link_color, + 'color' => $btn_color, + ), + 'nav.llms-pagination ul, nav.llms-pagination ul li, .llms-instructor-info .llms-instructors .llms-author, .llms-instructor-info .llms-instructors .llms-author .avatar' => array( + 'border-color' => $link_color, + ), + '.llms-progress .progress-bar-complete, .llms-instructor-info .llms-instructors .llms-author .avatar, h4.llms-access-plan-title, .llms-lesson-preview .llms-icon-free, .llms-access-plan .stamp, .llms-student-dashboard .llms-status.llms-active, .llms-student-dashboard .llms-status.llms-completed, .llms-student-dashboard .llms-status.llms-txn-succeeded, .color-full, body .llms-syllabus-wrapper .llms-section-title' => array( + 'background' => $link_color, + ), + '.llms-lesson-preview.is-complete .llms-lesson-complete, .llms-lesson-preview.is-free .llms-lesson-complete, .llms-widget-syllabus .lesson-complete-placeholder.done, .llms-widget-syllabus .llms-lesson-complete.done, .single-llms_quiz .llms-quiz-results .llms-donut.passing, .llms-quiz-timer' => array( + 'color' => $link_color, + ), + '.llms-quiz-timer' => array( + 'border-color' => $link_color, + ), + '.single-llms_quiz .llms-quiz-results .llms-donut.passing svg path' => array( + 'stroke' => $link_color, + ), + 'h4.llms-access-plan-title, .llms-instructor-info .llms-instructors .llms-author .avatar, h4.llms-access-plan-title, .llms-lesson-preview .llms-icon-free, .llms-access-plan .stamp, .llms-student-dashboard .llms-status.llms-active, .llms-student-dashboard .llms-status.llms-completed, .llms-student-dashboard .llms-status.llms-txn-succeeded, body .llms-syllabus-wrapper .llms-section-title' => array( + 'color' => $theme_forground_color, + ), + 'body .progress-bar-complete:after' => array( + 'color' => $theme_forground_color, + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + if ( is_lesson() ) { + $css_output .= $this->llms_single_lesson_css(); + } + /** + * Global button CSS - Tablet. + */ + $css_global_button_tablet = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => array( + 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ), + 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ), + 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ), + 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ), + ), + ); + + $css_output .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() ); + + /** + * Global button CSS - Mobile. + */ + $css_global_button_mobile = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => array( + 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ), + 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ), + 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ), + 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ), + ), + ); + + $css_output .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() ); + + wp_add_inline_style( 'lifterlms-styles', apply_filters( 'astra_theme_lifterlms_dynamic_css', $css_output ) ); + + } + + /** + * Add start of wrapper + * + * @since 1.2.0 + * @return void + */ + public function before_main_content_start() { + $site_sidebar = astra_page_layout(); + if ( 'left-sidebar' == $site_sidebar ) { + get_sidebar(); + } + ?> +
+ + + +
+
+ +
+
+ + + +
+ 'ast-main-header-display', + 'id' => 'ast-main-header-display', + 'label' => esc_html__( 'Disable Primary Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Above Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-above-header-display', + 'id' => 'ast-hfb-above-header-display', + 'label' => esc_html__( 'Disable Above Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Below Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-below-header-display', + 'id' => 'ast-hfb-below-header-display', + 'label' => esc_html__( 'Disable Below Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Mobile Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-mobile-header-display', + 'id' => 'ast-hfb-mobile-header-display', + 'label' => esc_html__( 'Disable Mobile Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + if ( $show_meta_field ) { + $disable_fields[] = array( + 'attribute' => 'site-post-title', + 'id' => 'site-post-title', + 'label' => esc_html__( 'Disable Title', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + if ( $show_meta_field && 'disabled' != astra_get_option( 'footer-adv' ) ) { + $disable_fields[] = array( + 'attribute' => 'footer-adv-display', + 'id' => 'footer-adv-display', + 'label' => esc_html__( 'Disable Footer Widgets', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + if ( 'disabled' != astra_get_option( 'footer-sml-layout' ) ) { + $disable_fields[] = array( + 'attribute' => 'footer-sml-layout', + 'id' => 'footer-sml-layout', + 'label' => esc_html__( 'Disable Footer', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + $fields['astra_theme_settings'] = array( + 'title' => __( 'Astra Settings', 'astra' ), + 'toggleable' => true, + 'fields' => apply_filters( + 'astra_theme_lifterlms_settings', + array( + array( + array( + 'attribute' => 'site-sidebar-layout', + 'id' => 'site-sidebar-layout', + 'label' => esc_html__( 'Sidebar', 'astra' ), + 'type' => 'ast-select', + 'options' => array( + 'default' => esc_html__( 'Customizer Setting', 'astra' ), + 'left-sidebar' => esc_html__( 'Left Sidebar', 'astra' ), + 'right-sidebar' => esc_html__( 'Right Sidebar', 'astra' ), + 'no-sidebar' => esc_html__( 'No Sidebar', 'astra' ), + ), + ), + array( + 'attribute' => 'site-content-layout', + 'id' => 'site-content-layout', + 'label' => esc_html__( 'Content Layout', 'astra' ), + 'type' => 'ast-select', + 'options' => array( + 'default' => esc_html__( 'Customizer Setting', 'astra' ), + 'boxed-container' => esc_html__( 'Boxed', 'astra' ), + 'content-boxed-container' => esc_html__( 'Content Boxed', 'astra' ), + 'plain-container' => esc_html__( 'Full Width / Contained', 'astra' ), + 'page-builder' => esc_html__( 'Full Width / Stretched', 'astra' ), + ), + ), + ), + $disable_fields, + ) + ), + ); + $default_fields['assignment'] = $fields; + $default_fields['lesson'] = $fields; + $default_fields['quiz'] = $fields; + return $default_fields; + } + + /** + * Llms single lesson static CSS move to dynamic to load conditionally. + * + * @since 3.3.0 + * @return string + */ + public function llms_single_lesson_css() { + $single_lesson_static_css = ' + .single-lesson.ast-separate-container .llms-lesson-preview .llms-lesson-link { + background: #fff; + } + + .single-lesson.ast-separate-container .llms-lesson-preview .llms-lesson-link:hover { + background: #fafafa; + } + + .single-lesson .ast-article-single .llms-lesson-button-wrapper { + font-weight: 600; + } + + .single-lesson .ast-article-single .llms-lesson-button-wrapper .llms-complete-lesson-form .llms-field-button:before { + content: "\2714"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation { + padding: 2em 0 0; + border-top: 1px solid #eeeeee; + } + + .single-lesson .llms-course-navigation .llms-lesson-preview { + vertical-align: top; + margin-top: 0; + } + + .single-lesson .llms-course-navigation .llms-lesson-preview .llms-lesson-link { + padding-left: 20px; + padding-right: 20px; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson h6.llms-pre-text:before { + content: "\2190"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation .llms-back-to-course:first-child h6.llms-pre-text:before { + content: "\2190"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course h6.llms-pre-text:after, + .single-lesson .llms-course-navigation .llms-next-lesson h6.llms-pre-text:after { + content: "\2192"; + margin-left: 5px; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course .llms-lesson-title, + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course .llms-lesson-excerpt, + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course h6.llms-pre-text, + .single-lesson .llms-course-navigation .llms-next-lesson .llms-lesson-title, + .single-lesson .llms-course-navigation .llms-next-lesson .llms-lesson-excerpt, + .single-lesson .llms-course-navigation .llms-next-lesson h6.llms-pre-text { + text-align: right; + } + + @media (max-width: 544px) { + .single-lesson .llms-course-navigation { + padding-top: 1.5em; + } + .single-lesson .llms-course-navigation .llms-course-nav { + width: 100%; + margin: 0; + } + .single-lesson .llms-course-navigation .llms-course-nav:first-child { + margin-bottom: 1.5em; + } + }'; + return Astra_Enqueue_Scripts::trim_css( $single_lesson_static_css ); + } + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +if ( apply_filters( 'astra_enable_lifterlms_integration', true ) ) { + Astra_LifterLMS::get_instance(); +} diff --git a/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php b/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php new file mode 100644 index 0000000..e6e6956 --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php @@ -0,0 +1,60 @@ + 'section-lifterlms', + 'type' => 'section', + 'priority' => 65, + 'title' => __( 'LifterLMS', 'astra' ), + ), + + /** + * General Section + */ + array( + 'name' => 'section-lifterlms-general', + 'type' => 'section', + 'title' => __( 'General', 'astra' ), + 'section' => 'section-lifterlms', + 'priority' => 0, + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Liferlms_Section_Configs(); diff --git a/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php new file mode 100644 index 0000000..c74af6f --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php @@ -0,0 +1,66 @@ + ASTRA_THEME_SETTINGS . '[lifterlms-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-container-layout', + 'default' => astra_get_option( 'lifterlms-content-layout' ), + 'priority' => 66, + 'title' => __( 'LifterLMS Layout', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_Container_Configs(); + + diff --git a/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php new file mode 100644 index 0000000..787d385 --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php @@ -0,0 +1,80 @@ + ASTRA_THEME_SETTINGS . '[lifterlms-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'priority' => 5, + 'default' => astra_get_option( 'lifterlms-sidebar-layout' ), + 'title' => __( 'LifterLMS', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: LifterLMS Course/Lesson + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[lifterlms-course-lesson-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'lifterlms-course-lesson-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'LifterLMS Course/Lesson', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_Sidebar_Configs(); diff --git a/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php b/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php new file mode 100644 index 0000000..392e28b --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php @@ -0,0 +1,104 @@ + 'ast-bottom-divider' ); + $section = 'section-lifterlms-general'; + } else { + $divider_array = array(); + $section = 'section-lifterlms'; + } + + $_configs = array( + + /** + * Option: Course Columns + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[llms-course-grid]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $section, + 'default' => astra_get_option( + 'llms-course-grid', + array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ) + ), + 'title' => __( 'Course Columns', 'astra' ), + 'priority' => 0, + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Membership Columns + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[llms-membership-grid]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $section, + 'default' => astra_get_option( + 'llms-membership-grid', + array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ) + ), + 'title' => __( 'Membership Columns', 'astra' ), + 'priority' => 0, + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + 'divider' => $divider_array, + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_General_Configs(); -- cgit v1.2.3-70-g09d2