Tribe__Service_Providers__Processes::register()

Hooks the filters and binds the implementations needed to handle processes.


Source

File: src/Tribe/Service_Providers/Processes.php

	public function register() {
		$this->context = tribe( 'context' );

		// If the context of this request is neither AJAX or Cron bail.
		if ( ! ( $this->context->doing_ajax() || $this->context->doing_cron() ) ) {
			return;
		}

		/** @var Tribe__Feature_Detection $feature_detection */
		$feature_detection         = tribe( 'feature-detection' );
		$action                    = tribe_get_request_var( 'action', false );
		$testing_for_async_support = $action === $this->get_handler_action( 'Tribe__Process__Tester' );

		 // Dispatch in async mode if testing for it (w/o re-checking) or if async processes are supported.
		if ( $testing_for_async_support || $feature_detection->supports_async_process() ) {
			$this->dispatch_async();

			return;
		}

		$this->dispatch_cron();
	}