Tribe__Tickets__Main::plugins_loaded()

Finalize the initialization of this plugin


Source

File: src/Tribe/Main.php

	public function plugins_loaded() {

		// early check for an older version of The Events Calendar to prevent fatal error
		if (
			class_exists( 'Tribe__Events__Main' ) &&
			! version_compare( Tribe__Events__Main::VERSION, $this->min_tec_version, '>=' )
		) {
			add_action( 'admin_notices', [ $this, 'tec_compatibility_notice' ] );
			add_action( 'network_admin_notices', [ $this, 'tec_compatibility_notice' ] );
			add_action( 'tribe_plugins_loaded', [ $this, 'remove_exts' ], 0 );
			/*
			* After common was loaded by another source (e.g. The Event Calendar) let's append this plugin source files
			* to the ones the Autoloader will search. Since we're appending them the ones registered by the plugin
			* "owning" common will be searched first.
			*/
			add_action( 'tribe_common_loaded', [ $this, 'register_plugin_autoload_paths' ] );

			return;
		}

		// WordPress and PHP Version Check
		if ( ! self::supported_version( 'wordpress' ) || ! self::supported_version( 'php' ) ) {
			add_action( 'admin_notices', array( $this, 'not_supported_error' ) );
			add_action( 'network_admin_notices', array( $this, 'not_supported_error' ) );

			return;
		}

		$this->maybe_set_common_lib_info();

		/**
		 * Before any methods from this plugin are called, we initialize our Autoloading
		 * After this method we can use any `Tribe__` classes
		 */
		$this->init_autoloading();

		if (
			class_exists( 'Tribe__Events__Main' ) &&
			! version_compare( Tribe__Events__Main::VERSION, $this->min_tec_version, '>=' )
		) {
			add_action( 'admin_notices', array( $this, 'tec_compatibility_notice' ) );
			add_action( 'network_admin_notices', array( $this, 'tec_compatibility_notice' ) );
			/**
			 * Fires if Event Tickets cannot load due to compatibility or other problems.
			 */
			do_action( 'tribe_tickets_plugin_failed_to_load' );
			return;
		}

		// Start Up Common
		Tribe__Main::instance();
		add_action( 'tribe_common_loaded', array( $this, 'bootstrap' ), 0 );
	}