<?php /** * Scripts & Styles * * @since 2.1.0 * * @package LearnDash\Scripts */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Enqueues styles for front-end. * * Fires on `wp_enqueue_scripts` hook. * * @global array $learndash_assets_loaded An array of loaded styles and scripts. * * @since 2.1.0 */ function learndash_load_resources() { global $learndash_assets_loaded; wp_enqueue_style( 'learndash_style', LEARNDASH_LMS_PLUGIN_URL . 'assets/css/style' . learndash_min_asset() . '.css', array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'learndash_style', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['learndash_style'] = __FUNCTION__; /** * General LearnDash frontend styles under the new plugin structure. * * It contains styles for the frontend facing LearnDash pages and components. * * @since 4.13.0 */ wp_enqueue_style( 'learndash', LEARNDASH_LMS_PLUGIN_URL . 'src/assets/dist/css/styles.css', [ 'dashicons' ], LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'learndash', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['learndash'] = __FUNCTION__; wp_enqueue_style( 'sfwd_front_css', LEARNDASH_LMS_PLUGIN_URL . 'assets/css/front' . learndash_min_asset() . '.css', array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'sfwd_front_css', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['sfwd_front_css'] = __FUNCTION__; if ( ! is_admin() ) { wp_enqueue_style( 'jquery-dropdown-css', LEARNDASH_LMS_PLUGIN_URL . 'assets/css/jquery.dropdown.min.css', array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'jquery-dropdown-css', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['jquery-dropdown-css'] = __FUNCTION__; } $filepath = SFWD_LMS::get_template( 'learndash_pager.css', null, null, true ); if ( ! empty( $filepath ) ) { wp_enqueue_style( 'learndash_pager_css', learndash_template_url_from_path( $filepath ), array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'learndash_pager_css', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['learndash_pager_css'] = __FUNCTION__; } $filepath = SFWD_LMS::get_template( 'learndash_pager.js', null, null, true ); if ( ! empty( $filepath ) ) { wp_enqueue_script( 'learndash_pager_js', learndash_template_url_from_path( $filepath ), array( 'jquery' ), LEARNDASH_SCRIPT_VERSION_TOKEN, true ); $learndash_assets_loaded['scripts']['learndash_pager_js'] = __FUNCTION__; } $filepath = SFWD_LMS::get_template( 'learndash_template_style.css', null, null, true ); if ( ! empty( $filepath ) ) { wp_enqueue_style( 'learndash_template_style_css', learndash_template_url_from_path( $filepath ), array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); wp_style_add_data( 'learndash_template_style_css', 'rtl', 'replace' ); $learndash_assets_loaded['styles']['learndash_template_style_css'] = __FUNCTION__; } $filepath = LEARNDASH_LMS_PLUGIN_URL . 'assets/js/learndash-payments' . learndash_min_asset() . '.js'; if ( ! empty( $filepath ) ) { wp_register_script( 'learndash-payments', $filepath, array( 'jquery' ), LEARNDASH_SCRIPT_VERSION_TOKEN, true ); $learndash_assets_loaded['scripts']['learndash-payments'] = __FUNCTION__; wp_localize_script( 'learndash-payments', 'learndash_payments', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'messages' => array( 'successful_transaction' => is_user_logged_in() ? sprintf( // Translators: %s: order label. esc_html__( 'Your %s was successful.', 'learndash' ), learndash_get_custom_label_lower( 'order' ) ) : sprintf( // Translators: %s: order label. esc_html__( 'Your %s was successful. Please log in to access your content.', 'learndash' ), learndash_get_custom_label_lower( 'order' ) ), ), ) ); } $filepath = LEARNDASH_LMS_PLUGIN_URL . 'assets/js/learndash-password-strength-meter.js'; if ( ! empty( $filepath ) ) { wp_register_script( 'learndash-password-strength-meter', $filepath, array( 'jquery', 'password-strength-meter' ), LEARNDASH_SCRIPT_VERSION_TOKEN, true ); $learndash_assets_loaded['scripts']['learndash-password-strength-meter'] = __FUNCTION__; } /** This filter is documented in includes/ld-misc-functions.php */ if ( true === apply_filters( 'learndash_responsive_video', true, get_post_type(), get_the_ID() ) ) { $filepath = SFWD_LMS::get_template( 'learndash_lesson_video.css', null, null, true ); if ( ! empty( $filepath ) ) { wp_enqueue_style( 'learndash_lesson_video', learndash_template_url_from_path( $filepath ), array(), LEARNDASH_SCRIPT_VERSION_TOKEN ); $learndash_assets_loaded['styles']['learndash_lesson_video'] = __FUNCTION__; } } if ( ! isset( $learndash_assets_loaded['scripts']['learndash_template_script_js'] ) ) { // First check if the theme has the file learndash/learndash_template_script.js or learndash_template_script.js file. $filepath = SFWD_LMS::get_template( 'learndash_template_script.js', null, null, true ); if ( ! empty( $filepath ) ) { wp_enqueue_script( 'learndash_template_script_js', learndash_template_url_from_path( $filepath ), array( 'jquery' ), LEARNDASH_SCRIPT_VERSION_TOKEN, true ); $learndash_assets_loaded['scripts']['learndash_template_script_js'] = __FUNCTION__; $data = array(); $data['ajaxurl'] = admin_url( 'admin-ajax.php' ); $data = array( 'json' => wp_json_encode( $data ) ); wp_localize_script( 'learndash_template_script_js', 'sfwd_data', $data ); } } // This will be dequeued via the get_footer hook if the button was not used. if ( ! is_admin() ) { wp_enqueue_script( 'jquery-dropdown-js', LEARNDASH_LMS_PLUGIN_URL . 'assets/js/jquery.dropdown.min.js', array( 'jquery' ), LEARNDASH_SCRIPT_VERSION_TOKEN, true ); $learndash_assets_loaded['scripts']['jquery-dropdown-js'] = __FUNCTION__; } } /** * Filters LearnDash resources load priority. * * @param string $priority Resources load priority. */ add_action( 'wp_enqueue_scripts', 'learndash_load_resources', apply_filters( 'learndash_load_resources_priority', '10' ) ); /** * Dequeues scripts. * * @global array $learndash_assets_loaded * @global array $learndash_shortcode_used * @global array $learndash_post_types */ function learndash_unload_resources() { global $learndash_shortcode_used; global $learndash_assets_loaded; // If we are showing a known LD post type then leave it all. global $learndash_post_types; if ( ( is_singular( $learndash_post_types ) ) || ( false !== $learndash_shortcode_used ) ) { return; } if ( ( isset( $learndash_assets_loaded['scripts'] ) ) && ( ! empty( $learndash_assets_loaded['scripts'] ) ) ) { foreach ( $learndash_assets_loaded['scripts'] as $script_tag => $function_loaded ) { // We *should* check these scripts to ensure we dequeue only ones set to load in the footer. Oh well. wp_dequeue_script( $script_tag ); } } } add_action( 'wp_print_footer_scripts', 'learndash_unload_resources', 1 );
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
admin | Folder | 0755 |
|
|
classes | Folder | 0755 |
|
|
coupon | Folder | 0755 |
|
|
course | Folder | 0755 |
|
|
deprecated | Folder | 0755 |
|
|
dto | Folder | 0755 |
|
|
exam | Folder | 0755 |
|
|
group | Folder | 0755 |
|
|
gutenberg | Folder | 0755 |
|
|
helpers | Folder | 0755 |
|
|
import | Folder | 0755 |
|
|
interfaces | Folder | 0755 |
|
|
lib | Folder | 0755 |
|
|
licensing | Folder | 0755 |
|
|
loggers | Folder | 0755 |
|
|
models | Folder | 0755 |
|
|
payments | Folder | 0755 |
|
|
quiz | Folder | 0755 |
|
|
reports | Folder | 0755 |
|
|
rest-api | Folder | 0755 |
|
|
settings | Folder | 0755 |
|
|
shortcodes | Folder | 0755 |
|
|
site-health | Folder | 0755 |
|
|
views | Folder | 0755 |
|
|
widgets | Folder | 0755 |
|
|
class-ld-addons-updater.php | File | 35.03 KB | 0644 |
|
class-ld-bitbucket-api.php | File | 59.32 KB | 0644 |
|
class-ld-course-wizard.php | File | 29.51 KB | 0644 |
|
class-ld-cpt-instance.php | File | 34.14 KB | 0644 |
|
class-ld-cpt-widget.php | File | 198 B | 0644 |
|
class-ld-cpt.php | File | 18.17 KB | 0644 |
|
class-ld-custom-label.php | File | 24.3 KB | 0644 |
|
class-ld-design-wizard.php | File | 37.05 KB | 0644 |
|
class-ld-gdpr.php | File | 48.61 KB | 0644 |
|
class-ld-lms.php | File | 224.76 KB | 0644 |
|
class-ld-permalinks.php | File | 29.92 KB | 0644 |
|
class-ld-search.php | File | 6.66 KB | 0644 |
|
class-ld-semper-fi-module.php | File | 61.88 KB | 0644 |
|
class-ld-setup-wizard.php | File | 23.09 KB | 0644 |
|
class-ld-translations.php | File | 28.85 KB | 0644 |
|
class-ldlms-db.php | File | 19.01 KB | 0644 |
|
class-ldlms-post-types.php | File | 8.64 KB | 0644 |
|
class-ldlms-transients.php | File | 5.04 KB | 0644 |
|
ld-assignment-uploads.php | File | 38.35 KB | 0644 |
|
ld-autoupdate.php | File | 241 B | 0644 |
|
ld-certificates.php | File | 26.74 KB | 0644 |
|
ld-convert-post-pdf.php | File | 31.07 KB | 0644 |
|
ld-core-functions.php | File | 857 B | 0644 |
|
ld-groups.php | File | 92.44 KB | 0644 |
|
ld-license.php | File | 12.93 KB | 0644 |
|
ld-misc-functions.php | File | 72.5 KB | 0644 |
|
ld-reports.php | File | 59.38 KB | 0644 |
|
ld-scripts.php | File | 6.89 KB | 0644 |
|
ld-users.php | File | 47.6 KB | 0644 |
|
ld-wp-editor.php | File | 3.46 KB | 0644 |
|