LLMS_Analytics_Widget_Ajax::handle()

Handles the AJAX request.


Return Return

(void)


Top ↑

Source Source

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

	public static function handle() {

		// Make sure we are getting a valid AJAX request.
		check_ajax_referer( LLMS_Ajax::NONCE );

		$method = str_replace(
			'llms_widget_',
			'',
			sanitize_text_field( wp_unslash( $_REQUEST['action'] ?? '' ) )
		);
		$class  = 'LLMS_Analytics_' . ucwords( $method ) . '_Widget';

		if ( ! class_exists( $class ) ) {
			return;
		}

		$widget           = new $class();
		$can_be_processed = $widget->can_be_processed();

		if ( is_wp_error( $can_be_processed ) ) {
			wp_send_json_error( $can_be_processed );
			wp_die();
		}

		$widget->output();

	}

Top ↑

Changelog Changelog

Changelog
Version Description
7.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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