LLMS_Analytics_Widget_Ajax::__construct()

Constructor


Description Description


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',

		);

		// include the abstract
		include LLMS_PLUGIN_DIR . 'includes/abstracts/abstract.llms.analytics.widget.php';

		$method = str_replace( 'llms_widget_', '', $_REQUEST['action'] );

		$file = LLMS_PLUGIN_DIR . 'includes/admin/reporting/widgets/class.llms.analytics.widget.' . $method . '.php';

		if ( file_exists( $file ) ) {

			include $file;
			$class = 'LLMS_Analytics_' . ucwords( $method ) . '_Widget';
			add_action( 'wp_ajax_llms_widget_' . $method, array( new $class, 'output' ) );

		}

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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