Tribe__Main::__construct( $context = null )

Constructor for Common Class

We are using a public constructor here for backwards compatibility.

The way our code used to work we would have new Tribe__Main() called directly which causes fatals if you have an older version of Core/Tickets active along side a new one


Source

File: src/Tribe/Main.php

	public function __construct( $context = null ) {
		if ( self::$instance ) {
			return;
		}

		// the 5.2 compatible autoload file
		if ( version_compare( PHP_VERSION, '5.2.17', '<=' ) ) {
			require_once realpath( dirname( dirname( dirname( __FILE__ ) ) ) . '/vendor/autoload_52.php' );
		} else {
			require_once realpath( dirname( dirname( dirname( __FILE__ ) ) ) . '/vendor/autoload.php' );
		}

		// the DI container class
		require_once dirname( __FILE__ ) . '/Container.php';

		if ( is_object( $context ) ) {
			$this->plugin_context = $context;
			$this->plugin_context_class = get_class( $context );
		}

		$this->plugin_path = trailingslashit( dirname( dirname( dirname( __FILE__ ) ) ) );
		$this->plugin_dir  = trailingslashit( basename( $this->plugin_path ) );
		$parent_plugin_dir = trailingslashit( plugin_basename( $this->plugin_path ) );
		$this->plugin_url  = plugins_url( $parent_plugin_dir === $this->plugin_dir ? $this->plugin_dir : $parent_plugin_dir );

		add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 1 );
		add_action( 'tribe_common_loaded', array( $this, 'tribe_common_app_store' ), 10 );
	}