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 4.6.1.1 6.5.1.4 4.6.10 6.5.1.5 4.6.10.2 6.5.1.6 4.6.11 6.5.2 4.6.11.2 6.6.0 4.6.12.1 6.6.0.1 4.6.13.1 6.6.0.2 4.6.14 6.6.1 4.6.14.2 6.6.2 4.6.15.1 6.6.3 4.6.16.1 6.6.4 4.6.17.1 6.6.4.1 4.6.18.1 6.6.4.2 4.6.19.1 6.7.0 4.6.2.1 6.7.1 4.6.20 6.8.0 4.6.20.2 6.8.1 4.6.21.1 6.8.2 4.6.22 6.8.2.1 4.6.22.2 6.8.3 4.6.23.1 6.9.0 4.6.24 6.9.1 4.6.24.2 4.6.25.1 4.6.26 4.6.26.2 4.6.3.1 4.6.4.1 4.6.5.1 4.6.6.1 4.6.7.1 4.6.8.1 4.6.9.1 4.7 4.7.0.2 4.7.1.1 4.7.2.1 4.7.3.1 4.7.4.1 4.8 4.8.0.2 4.8.1.1 4.8.2.1 4.9.0.1 4.9.0.2 4.9.0.4 4.9.1 4.9.1.2 4.9.10.1 4.9.11.1 4.9.12.1 4.9.13.1 4.9.14.1 4.9.2.1 4.9.3 4.9.3.1 4.9.3.3 4.9.4.1 4.9.5.1 4.9.6.1 4.9.7.1 4.9.8.1 4.9.9.1 5.0.0 5.0.0.1 5.0.0.3 5.0.1.1 5.0.1.2 5.0.2 5.0.2.2 5.0.2.3 5.0.3 5.0.3.2 5.0.3.3 5.1.0.1 5.1.0.2
the-events-calendar / common / src / Tribe / Dependency.php
the-events-calendar / common / src / Tribe Last commit date
Admin 8 years ago Ajax 8 years ago Asset 8 years ago Customizer 8 years ago Documentation 8 years ago Duplicate 8 years ago Image 8 years ago JSON_LD 8 years ago Languages 8 years ago Log 8 years ago Meta 8 years ago PUE 8 years ago Process 8 years ago REST 8 years ago Service_Providers 8 years ago Support 8 years ago Tabbed_View 8 years ago Utils 8 years ago Validator 8 years ago Abstract_Deactivation.php 8 years ago App_Shop.php 8 years ago Assets.php 8 years ago Assets_Pipeline.php 8 years ago Autoloader.php 8 years ago Cache.php 8 years ago Cache_Listener.php 8 years ago Changelog_Reader.php 8 years ago Container.php 8 years ago Context.php 8 years ago Cost_Utils.php 8 years ago Credits.php 8 years ago Customizer.php 8 years ago Data.php 8 years ago Date_Utils.php 8 years ago Debug.php 8 years ago Dependency.php 8 years ago Deprecation.php 8 years ago Error.php 8 years ago Exception.php 8 years ago Extension.php 8 years ago Extension_Loader.php 8 years ago Field.php 8 years ago Field_Conditional.php 8 years ago Log.php 8 years ago Main.php 8 years ago Notices.php 8 years ago Plugin_Meta_Links.php 8 years ago Plugins.php 8 years ago Plugins_API.php 8 years ago Post_History.php 8 years ago Post_Transient.php 8 years ago Rewrite.php 8 years ago Settings.php 8 years ago Settings_Manager.php 8 years ago Settings_Tab.php 8 years ago Simple_Table.php 8 years ago Support.php 8 years ago Tabbed_View.php 8 years ago Template.php 8 years ago Template_Factory.php 8 years ago Template_Part_Cache.php 8 years ago Templates.php 8 years ago Terms.php 8 years ago Timezones.php 8 years ago Tracker.php 8 years ago Validate.php 8 years ago View_Helpers.php 8 years ago
Dependency.php
204 lines
1 <?php
2 // Don't load directly
3 defined( 'WPINC' ) or die;
4
5 if ( ! class_exists( 'Tribe__Dependency' ) ) {
6 /**
7 * Tracks which tribe plugins are currently activated
8 */
9 class Tribe__Dependency {
10
11 /**
12 * An multidimensional array of active tribe plugins in the following format
13 *
14 * array(
15 * 'class' => 'main class name',
16 * 'version' => 'version num', (optional)
17 * 'path' => 'Path to the main plugin/bootstrap file' (optional)
18 * )
19 */
20 protected $active_plugins = array();
21
22 /**
23 * Static Singleton Holder
24 *
25 * @var self
26 */
27 private static $instance;
28
29
30 /**
31 * Static Singleton Factory Method
32 *
33 * @return self
34 */
35 public static function instance() {
36 if ( ! self::$instance ) {
37 self::$instance = new self;
38 }
39 return self::$instance;
40 }
41
42
43 /**
44 * Adds a plugin to the active list
45 *
46 * @param string $main_class Main/base class for this plugin
47 * @param string $version Version number of plugin
48 * @param string $path Path to the main plugin/bootstrap file
49 */
50 public function add_active_plugin( $main_class, $version = null, $path = null ) {
51
52 $plugin = array(
53 'class' => $main_class,
54 'version' => $version,
55 'path' => $path,
56 );
57
58 $this->active_plugins[ $main_class ] = $plugin;
59 }
60
61
62 /**
63 * Retrieves active plugin array
64 *
65 * @return array
66 */
67 public function get_active_plugins() {
68 $this->add_legacy_plugins();
69
70 return $this->active_plugins;
71 }
72
73
74 /**
75 * Searches the plugin list for key/value pair and return the full details for that plugin
76 *
77 * @param string $search_key The array key this value will appear in
78 * @param string $search_val The value itself
79 *
80 * @return array|null
81 */
82 public function get_plugin_by_key( $search_key, $search_val ) {
83 foreach ( $this->get_active_plugins() as $plugin ) {
84 if ( isset( $plugin[ $search_key ] ) && $plugin[ $search_key ] === $search_val ) {
85 return $plugin;
86 }
87 }
88
89 return null;
90 }
91
92
93 /**
94 * Retrieves the plugins details by class name
95 *
96 * @param string $main_class Main/base class for this plugin
97 *
98 * @return array|null
99 */
100 public function get_plugin_by_class( $main_class ) {
101 return $this->get_plugin_by_key( 'class', $main_class );
102 }
103
104
105 /**
106 * Retrieves the version of the plugin
107 *
108 * @param string $main_class Main/base class for this plugin
109 *
110 * @return string|null Version
111 */
112 public function get_plugin_version( $main_class ) {
113 $plugin = $this->get_plugin_by_class( $main_class );
114
115 return ( isset( $plugin['version'] ) ? $plugin['version'] : null );
116 }
117
118
119 /**
120 * Checks if the plugin is active
121 *
122 * @param string $main_class Main/base class for this plugin
123 *
124 * @return bool
125 */
126 public function is_plugin_active( $main_class ) {
127 return ( $this->get_plugin_by_class( $main_class ) !== null );
128 }
129
130
131 /**
132 * Checks if a plugin is active and has the specified version
133 *
134 * @param string $main_class Main/base class for this plugin
135 * @param string $version Version to do a compare against
136 * @param string $compare Version compare string, defaults to >=
137 *
138 * @return bool
139 */
140 public function is_plugin_version( $main_class, $version, $compare = '>=' ) {
141
142 if ( ! $this->is_plugin_active( $main_class ) ) {
143 return false;
144 } elseif ( version_compare( $this->get_plugin_version( $main_class ), $version, $compare ) ) {
145 return true;
146 } elseif ( $this->get_plugin_version( $main_class ) === null ) {
147 // If the plugin version is not set default to assuming it's a compatible version
148 return true;
149 }
150
151 return false;
152 }
153
154
155 /**
156 * Checks if each plugin is active and exceeds the specified version number
157 *
158 * @param array $plugins_required Each item is a 'class_name' => 'min version' pair. Min ver can be null.
159 *
160 * @return bool
161 */
162 public function has_requisite_plugins( $plugins_required = array() ) {
163
164 foreach ( $plugins_required as $class => $version ) {
165 // Return false if the plugin is not set or is a lesser version
166 if ( ! $this->is_plugin_active( $class ) ) {
167 return false;
168 }
169
170 if ( null !== $version && ! $this->is_plugin_version( $class, $version ) ) {
171 return false;
172 }
173 }
174
175 return true;
176 }
177
178
179 /**
180 * Registers older plugins that did not implement this class
181 *
182 * @TODO Consider removing this in 5.0
183 */
184 public function add_legacy_plugins() {
185
186 $tribe_plugins = new Tribe__Plugins();
187
188 foreach ( $tribe_plugins->get_list() as $plugin ) {
189 // Only add plugin if it's present and not already added
190 if ( ! class_exists( $plugin['class'] ) || array_key_exists( $plugin['class'], $this->active_plugins ) ) {
191 continue;
192 }
193
194 $ver_const = $plugin['class'] . '::VERSION';
195 $version = defined( $ver_const ) ? constant( $ver_const ) : null;
196
197 $this->add_active_plugin( $plugin['class'], $version );
198 }
199 }
200
201 }
202
203 }
204