LLMS_Analytics_Widget_Ajax
Contents
Source Source
File: includes/admin/reporting/widgets/class.llms.analytics.widget.ajax.php
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | class LLMS_Analytics_Widget_Ajax { /** * Constructor. * * @since 3.0.0 * @since 3.16.8 Unknown. * @since 3.35.0 Sanitize `$_REQUEST` data. * @since 6.0.0 Removed loading of class files that don't instantiate their class in favor of autoloading. * @since 7.3.0 Ajax calls are now handled by `LLMS_Analytics_Widget_Ajax::handle()` method. * * @return void */ public function __construct() { // Only proceed if we're doing ajax. if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_REQUEST [ 'action' ] ) ) { return ; } $methods = array ( // Sales. 'coupons' , 'discounts' , 'refunded' , 'refunds' , 'revenue' , 'sales' , 'sold' , // Enrollments. 'enrollments' , 'registrations' , 'lessoncompletions' , 'coursecompletions' , ); $method = str_replace ( 'llms_widget_' , '' , sanitize_text_field( wp_unslash( $_REQUEST [ 'action' ] ) ) ); $file = LLMS_PLUGIN_DIR . 'includes/admin/reporting/widgets/class.llms.analytics.widget.' . $method . '.php' ; if ( file_exists ( $file ) ) { add_action( 'wp_ajax_llms_widget_' . $method , array ( __CLASS__ , 'handle' ) ); } } /** * Handles the AJAX request. |
Expand full source code Collapse full source code View on GitHub
Methods Methods
- __construct — Constructor
Changelog Changelog
Version | Description |
---|---|
3.35.0 | Sanitize $_REQUEST data. |
3.0.0 | Introduced. |