Tribe__Events__Main::maybe_set_common_lib_info()
To avoid duplication of our own methods and to provide a underlying system The Events Calendar 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
Return
(void)
Source
File: src/Tribe/Main.php
public function maybe_set_common_lib_info() { // if there isn't a tribe-common version, bail with a notice $common_version = file_get_contents( $this->plugin_path . 'common/src/Tribe/Main.php' ); if ( ! preg_match( "/const\s+VERSION\s*=\s*'([^']+)'/m", $common_version, $matches ) ) { return add_action( 'admin_head', array( $this, 'missing_common_libs' ) ); } $common_version = $matches[1]; /** * If we don't have a version of Common or a 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, ); } }