LLMS_Analytics_Widget_Ajax::__construct()

Constructor


Return Return

(void)


Top ↑

Source Source

File: includes/admin/reporting/widgets/class.llms.analytics.widget.ajax.php

	 */
	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' ) );
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Removed loading of class files that don't instantiate their class in favor of autoloading.
3.35.0 Sanitize $_REQUEST data.
3.16.8 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.