Resources::load_resources( $page )


Source

File: classes/Resources.php

	public function load_resources( $page ) {
		$script_debug = dozent_script_debug();
		$suffix       = $script_debug ? '' : '.min';
		$rtl_dir      = is_rtl() ? '-rtl' : '';
		$load_select2 = false;

		if ( is_admin() ) {

			if ( $page === 'dozent-lms_page_dozent-options' ) {
				wp_enqueue_media();
			}

			wp_enqueue_style( 'dozent-noUiSlider', DOZENT_URL . "assets/plugins/noUiSlider/nouislider{$suffix}.css", [],
				DOZENT_VERSION );

			wp_enqueue_script( 'dozent-noUiSlider', DOZENT_URL . "assets/plugins/noUiSlider/nouislider{$suffix}.js", [],
				DOZENT_VERSION, true );

			$load_select2 = true;

		}

		$load_select2 = apply_filters( 'dozent_load_select2', $load_select2 );
		if ( $load_select2 ){
			$this->load_select2();
		}

		/**
		 * Tell DozentLMS if Chart.JS should load
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param bool
		 * @param string $current_page
		 */

		$load_chart_js = apply_filters( 'dozent_load_chart_js', false, $page );
		if ( $load_chart_js ) {
			wp_enqueue_script( 'dozent-chart.js', DOZENT_URL . "assets/plugins/Chart.js/Chart.bundle.min.js",
				array(), DOZENT_VERSION );
		}

		//Load Datepicker
		$load_datepicker = apply_filters( 'dozent_load_datepicker', false, $page );
		if ( $load_datepicker ) {
			wp_enqueue_script( 'jquery-ui-datepicker' );
		}

		$this->load_videojs();

		wp_enqueue_style( 'dozent', DOZENT_URL . "assets/css{$rtl_dir}/dozent{$suffix}.css", [], DOZENT_VERSION );
		wp_enqueue_script( 'dozent', DOZENT_URL . "assets/js/dozent{$suffix}.js", [ 'jquery' ], DOZENT_VERSION, true );
	}