LLMS_Admin_Assets::maybe_enqueue_reporting( WP_Sreen $screen )
Register and enqueue scripts used on and related-to reporting and analytics
Parameters Parameters
- $screen
-
(WP_Sreen) (Required) Screen object from WP
get_current_screen().
Return Return
(void)
Source Source
File: includes/admin/class.llms.admin.assets.php
protected function maybe_enqueue_reporting( $screen ) {
if ( in_array( $screen->base, array( 'lifterlms_page_llms-reporting', 'lifterlms_page_llms-dashboard', 'dashboard' ), true ) ) {
$current_tab = llms_filter_input( INPUT_GET, 'tab' );
wp_register_script( 'llms-google-charts', LLMS_PLUGIN_URL . 'assets/js/vendor/gcharts-loader.min.js', array(), '2019-09-04', false );
wp_register_script( 'llms-analytics', LLMS_PLUGIN_URL . 'assets/js/llms-analytics' . LLMS_ASSETS_SUFFIX . '.js', array( 'jquery', 'llms', 'llms-admin-scripts', 'llms-google-charts' ), LLMS_ASSETS_VERSION, true );
// Dashboard page where we have analytics widgets.
if ( in_array( $screen->base, array( 'lifterlms_page_llms-dashboard', 'dashboard' ), true ) ) {
wp_enqueue_script( 'llms-analytics' );
} elseif ( 'lifterlms_page_llms-reporting' === $screen->base ) {
if ( in_array( $current_tab, array( 'enrollments', 'sales' ), true ) ) {
wp_enqueue_script( 'llms-analytics' );
} elseif ( 'quizzes' === $current_tab && 'attempts' === llms_filter_input( INPUT_GET, 'stab' ) ) {
wp_enqueue_script( 'llms-quiz-attempt-review', LLMS_PLUGIN_URL . 'assets/js/llms-quiz-attempt-review' . LLMS_ASSETS_SUFFIX . '.js', array( 'jquery', 'llms' ), LLMS_ASSETS_VERSION, true );
}
}
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.2.0 | Load on dashboard screen.<br> Use LLMS_ASSETS_VERSION for asset versions. |
| 5.9.0 | Stop using deprecated FILTER_SANITIZE_STRING. |
| 4.3.3 | Introduced. |