Tribe__Image__Plus__Main::maybe_set_common_lib_info()

To avoid duplication of our own methods and to provide a underlying system Modern Tribe maintains a Library called Common to store a base for our plugins

Currently we will read the File common/package.json to determine which version of the Common Lib we will pass to the Auto-Loader of PHP.

In the past we used to parse common/src/Tribe/Main.php for the Common Lib version.

See also


Top ↑

Return

(void)


Top ↑

Source

File: src/Tribe/Main.php

	public function maybe_set_common_lib_info() {
		// if always set common version to something super low because ANY common should override the
		// one in image-widget-plus
		$common_version = '1.0';

		/**
		 * If we don't have a version of Common or an Older version of the Lib
		 * overwrite what should be loaded by the auto-loader
		 */
		if (
			empty( $GLOBALS['tribe-common-info'] ) ||
			version_compare( $GLOBALS['tribe-common-info']['version'], $common_version, '<' )
		) {
			$GLOBALS['tribe-common-info'] = array(
				'dir' => "{$this->plugin_path}common/src/Tribe",
				'version' => $common_version,
			);
		}
	}