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.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / src / Packages.php
woocommerce / src Last commit date
Abilities 4 weeks ago Admin 5 days ago Api 4 weeks ago Blocks 2 weeks ago Caches 2 months ago Caching 1 month ago Checkout 4 weeks ago Database 4 months ago Enums 4 weeks ago Gateways 2 months ago Internal 5 days ago LayoutTemplates 2 years ago Proxies 5 months ago StoreApi 4 weeks ago Utilities 4 weeks ago Autoloader.php 4 months ago Container.php 5 months ago Deprecated.php 1 year ago Packages.php 4 weeks ago
Packages.php
368 lines
1 <?php
2 /**
3 * Loads WooCommerce packages from the /packages directory. These are packages developed outside of core.
4 */
5
6 declare( strict_types=1 );
7
8 namespace Automattic\WooCommerce;
9
10 use Automattic\Jetpack\Constants;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Packages class.
16 *
17 * @since 3.7.0
18 */
19 class Packages {
20
21 /**
22 * Static-only class.
23 */
24 private function __construct() {}
25
26 /**
27 * Array of package names and their main package classes. Once a package has been merged into WooCommerce
28 * directly it should be removed from here and added to the merged packages array.
29 *
30 * @var array Key is the package name/directory, value is the main package class which handles init.
31 */
32 protected static $packages = array(
33 'email-editor' => '\\Automattic\\WooCommerce\\Internal\\EmailEditor\\Package',
34 );
35
36 /**
37 * Array of package names and their main package classes.
38 *
39 * Once a package has been merged into WooCommerce Core it should be moved from the package list and placed in
40 * this list. This will ensure that the feature plugin is disabled as well as provide the class to handle
41 * initialization for the now-merged feature plugin.
42 *
43 * Once a package has been merged into WooCommerce Core it should have its slug added here. This will ensure
44 * that we deactivate the feature plugin automatically to prevent any problems caused by conflicts between
45 * the two versions caused by them both being active.
46 *
47 * The packages included in this array cannot be deactivated and will always load with WooCommerce core.
48 *
49 * @var array Key is the package name/directory, value is the main package class which handles init.
50 */
51 protected static $base_packages = array(
52 'woocommerce-admin' => '\\Automattic\\WooCommerce\\Admin\\Composer\\Package',
53 'woocommerce-gutenberg-products-block' => '\\Automattic\\WooCommerce\\Blocks\\Package',
54 );
55
56 /**
57 * Similar to $base_packages, but
58 * the packages included in this array can be deactivated via the 'woocommerce_merged_packages' filter.
59 *
60 * @var array Key is the package name/directory, value is the main package class which handles init.
61 */
62 protected static $merged_packages = array(
63 'woocommerce-brands' => '\\Automattic\\WooCommerce\\Internal\\Brands',
64 'woocommerce-additional-variation-images' => '\\Automattic\\WooCommerce\\Internal\\VariationGallery\\Package',
65 );
66
67
68 /**
69 * Init the package loader.
70 *
71 * @since 3.7.0
72 */
73 public static function init() {
74 add_action( 'plugins_loaded', array( __CLASS__, 'prepare_packages' ), -100 );
75 add_action( 'plugins_loaded', array( __CLASS__, 'on_init' ), 10 );
76
77 // Prevent plugins already merged into WooCommerce core from getting activated as standalone plugins.
78 add_action( 'activate_plugin', array( __CLASS__, 'deactivate_merged_plugins' ) );
79
80 // Display a notice in the Plugins tab next to plugins already merged into WooCommerce core.
81 add_filter( 'all_plugins', array( __CLASS__, 'mark_merged_plugins_as_pending_update' ), 10, 1 );
82 add_action( 'after_plugin_row', array( __CLASS__, 'display_notice_for_merged_plugins' ), 10, 1 );
83 }
84
85 /**
86 * Callback for WordPress init hook.
87 */
88 public static function on_init() {
89 self::deactivate_merged_packages();
90 self::initialize_packages();
91 }
92
93 /**
94 * Checks a package exists by looking for its directory.
95 *
96 * @param string $package Package name.
97 * @return boolean
98 */
99 public static function package_exists( $package ) {
100 return file_exists( dirname( __DIR__ ) . '/packages/' . $package );
101 }
102
103 /**
104 * Checks if a class name corresponds to a merged package and should be loaded.
105 *
106 * @param string $class_name Class name.
107 * @return boolean
108 */
109 public static function should_load_class( $class_name ) {
110
111 foreach ( self::$merged_packages as $merged_package_name => $merged_package_class ) {
112 if ( str_replace( 'woocommerce-', 'wc_', $merged_package_name ) === $class_name ) {
113 return true;
114 }
115 }
116
117 return false;
118 }
119
120 /**
121 * Gets all merged, enabled packages.
122 *
123 * @return array
124 */
125 protected static function get_enabled_packages() {
126 $enabled_packages = array();
127
128 foreach ( self::$merged_packages as $merged_package_name => $package_class ) {
129
130 $option = 'wc_feature_' . str_replace( '-', '_', $merged_package_name ) . '_enabled';
131 $option_value = get_option( $option, '' );
132
133 // Opt out from the feature.
134 if ( 'no' === $option_value ) {
135 continue;
136 }
137
138 // Force enable feature -- mainly for testing purpose.
139 if ( 'yes' === $option_value ) {
140 $enabled_packages[ $merged_package_name ] = $package_class;
141 continue;
142 }
143
144 // If an option is not set, ensure that a package is enabled for user's remote variant number. Mainly for gradual releases.
145 $experimental_package_enabled = method_exists( $package_class, 'is_enabled' ) ?
146 call_user_func( array( $package_class, 'is_enabled' ) ) :
147 false;
148
149 if ( ! $experimental_package_enabled ) {
150 continue;
151 }
152
153 $enabled_packages[ $merged_package_name ] = $package_class;
154 }
155
156 return array_merge( $enabled_packages, self::$base_packages );
157 }
158
159 /**
160 * Checks if a package is enabled.
161 *
162 * @param string $package Package name.
163 * @return boolean
164 */
165 public static function is_package_enabled( $package ) {
166 return array_key_exists( $package, self::get_enabled_packages() );
167 }
168
169 /**
170 * Prepare merged packages for initialization.
171 * Especially useful when running actions early in the 'plugins_loaded' timeline.
172 */
173 public static function prepare_packages() {
174 foreach ( self::get_enabled_packages() as $package_name => $package_class ) {
175 if ( method_exists( $package_class, 'prepare' ) ) {
176 call_user_func( array( $package_class, 'prepare' ) );
177 }
178 }
179 }
180
181 /**
182 * Deactivates merged feature plugins.
183 *
184 * Once a feature plugin is merged into WooCommerce Core it should be deactivated. This method will
185 * ensure that a plugin gets deactivated. Note that for the first request it will still be active,
186 * and as such, there may be some odd behavior. This is unlikely to cause any issues though
187 * because it will be deactivated on the request that updates or activates WooCommerce.
188 */
189 protected static function deactivate_merged_packages() {
190 // Developers may need to be able to run merged feature plugins alongside merged packages for testing purposes.
191 if ( Constants::is_true( 'WC_ALLOW_MERGED_FEATURE_PLUGINS' ) ) {
192 return;
193 }
194
195 // Scroll through all of the active plugins and disable them if they're merged packages.
196 $active_plugins = get_option( 'active_plugins', array() );
197 // Deactivate the plugin if possible so that there are no conflicts.
198 foreach ( $active_plugins as $active_plugin_path ) {
199 $plugin_file = basename( plugin_basename( $active_plugin_path ), '.php' );
200
201 if ( ! self::is_package_enabled( $plugin_file ) ) {
202 continue;
203 }
204
205 require_once ABSPATH . 'wp-admin/includes/plugin.php';
206
207 // Make sure to display a message informing the user that the plugin has been deactivated.
208 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $active_plugin_path );
209 deactivate_plugins( $active_plugin_path );
210 add_action(
211 'admin_notices',
212 function () use ( $plugin_data ) {
213 echo '<div class="error"><p>';
214 printf(
215 /* translators: %s: is referring to the plugin's name. */
216 esc_html__( 'The %1$s plugin has been deactivated as the latest improvements are now included with the %2$s plugin.', 'woocommerce' ),
217 '<code>' . esc_html( $plugin_data['Name'] ) . '</code>',
218 '<code>WooCommerce</code>'
219 );
220 echo '</p></div>';
221 }
222 );
223 }
224 }
225
226 /**
227 * Prevent plugins already merged into WooCommerce core from getting activated as standalone plugins.
228 *
229 * @param string $plugin Plugin name.
230 */
231 public static function deactivate_merged_plugins( $plugin ) {
232 $plugin_dir = basename( dirname( $plugin ) );
233
234 if ( self::is_package_enabled( $plugin_dir ) ) {
235 $plugins_url = esc_url( admin_url( 'plugins.php' ) );
236 wp_die(
237 esc_html__( 'This plugin cannot be activated because its functionality is now included in WooCommerce core.', 'woocommerce' ),
238 esc_html__( 'Plugin Activation Error', 'woocommerce' ),
239 array(
240 'link_url' => esc_url( $plugins_url ),
241 'link_text' => esc_html__( 'Return to the Plugins page', 'woocommerce' ),
242 ),
243 );
244 }
245 }
246
247 /**
248 * Mark merged plugins as pending update.
249 * This is required for correctly displaying maintenance notices.
250 *
251 * @param array $plugins Plugins list.
252 */
253 public static function mark_merged_plugins_as_pending_update( $plugins ) {
254 foreach ( $plugins as $plugin_name => $plugin_data ) {
255 $plugin_dir = basename( dirname( $plugin_name ) );
256 if ( self::is_package_enabled( $plugin_dir ) ) {
257 // Necessary to properly display notice within row.
258 $plugins[ $plugin_name ]['update'] = 1;
259 }
260 }
261 return $plugins;
262 }
263
264 /**
265 * Displays a maintenance notice next to merged plugins, to inform users
266 * that the plugin functionality is now offered by WooCommerce core.
267 *
268 * Requires 'mark_merged_plugins_as_pending_update' to properly display this notice.
269 *
270 * @param string $plugin_file Plugin file.
271 */
272 public static function display_notice_for_merged_plugins( $plugin_file ) {
273 global $wp_list_table;
274
275 $plugin_dir = basename( dirname( $plugin_file ) );
276 if ( ! self::is_package_enabled( $plugin_dir ) || is_null( $wp_list_table ) ) {
277 return;
278 }
279
280 $columns_count = $wp_list_table->get_column_count();
281 $notice = __( 'This plugin can no longer be activated because its functionality is now included in <strong>WooCommerce</strong>. It is recommended to <strong>delete</strong> it.', 'woocommerce' );
282 echo '<tr class="plugin-update-tr"><td colspan="' . esc_attr( $columns_count ) . '" class="plugin-update"><div class="update-message notice inline notice-error notice-alt"><p>' . wp_kses_post( $notice ) . '</p></div></td></tr>';
283 }
284
285 /**
286 * Loads packages after plugins_loaded hook.
287 *
288 * Each package should include an init file which loads the package so it can be used by core.
289 */
290 protected static function initialize_packages() {
291 foreach ( self::get_enabled_packages() as $package_name => $package_class ) {
292 call_user_func( array( $package_class, 'init' ) );
293 }
294
295 foreach ( self::$packages as $package_name => $package_class ) {
296 if ( ! self::package_exists( $package_name ) ) {
297 self::missing_package( $package_name );
298 continue;
299 }
300 call_user_func( array( $package_class, 'init' ) );
301 }
302
303 // Proxies "activated_plugin" hook for embedded packages listen on WC plugin activation
304 // https://github.com/woocommerce/woocommerce/issues/28697.
305 if ( is_admin() ) {
306 $activated_plugin = get_transient( 'woocommerce_activated_plugin' );
307 if ( $activated_plugin ) {
308 delete_transient( 'woocommerce_activated_plugin' );
309
310 /**
311 * WooCommerce is activated hook.
312 *
313 * @since 5.0.0
314 * @param bool $activated_plugin Activated plugin path,
315 * generally woocommerce/woocommerce.php.
316 */
317 do_action( 'woocommerce_activated_plugin', $activated_plugin );
318 }
319 }
320 }
321
322 /**
323 * If a package is missing, add an admin notice.
324 *
325 * @param string $package Package name.
326 */
327 protected static function missing_package( $package ) {
328 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
329 error_log( // phpcs:ignore
330 sprintf(
331 /* Translators: %s package name. */
332 esc_html__( 'Missing the WooCommerce %s package', 'woocommerce' ),
333 '<code>' . esc_html( $package ) . '</code>'
334 ) . ' - ' . esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, please refer to this document to set up your development environment: https://developer.woocommerce.com/docs/contribution/contributing/#setting-up-your-development-environment', 'woocommerce' )
335 );
336 }
337 add_action(
338 'admin_notices',
339 function () use ( $package ) {
340 ?>
341 <div class="notice notice-error">
342 <p>
343 <strong>
344 <?php
345 printf(
346 /* Translators: %s package name. */
347 esc_html__( 'Missing the WooCommerce %s package', 'woocommerce' ),
348 '<code>' . esc_html( $package ) . '</code>'
349 );
350 ?>
351 </strong>
352 <br>
353 <?php
354 printf(
355 /* translators: 1: is a link to a support document. 2: closing link */
356 esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, %1$splease refer to this document%2$s to set up your development environment.', 'woocommerce' ),
357 '<a href="' . esc_url( 'https://developer.woocommerce.com/docs/contribution/contributing/#setting-up-your-development-environment' ) . '" target="_blank" rel="noopener noreferrer">',
358 '</a>'
359 );
360 ?>
361 </p>
362 </div>
363 <?php
364 }
365 );
366 }
367 }
368