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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
Admin 4 weeks ago Api 4 weeks ago Blocks 4 weeks ago Caches 4 weeks ago Caching 1 year ago Checkout 4 weeks ago Database 3 months ago Enums 4 weeks ago Gateways 4 weeks ago Internal 4 weeks ago LayoutTemplates 2 years ago Proxies 4 months ago StoreApi 4 weeks ago Utilities 4 weeks ago Autoloader.php 3 months ago Container.php 4 months ago Deprecated.php 1 year ago Packages.php 3 months ago
Packages.php
367 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 * One 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 );
65
66
67 /**
68 * Init the package loader.
69 *
70 * @since 3.7.0
71 */
72 public static function init() {
73 add_action( 'plugins_loaded', array( __CLASS__, 'prepare_packages' ), -100 );
74 add_action( 'plugins_loaded', array( __CLASS__, 'on_init' ), 10 );
75
76 // Prevent plugins already merged into WooCommerce core from getting activated as standalone plugins.
77 add_action( 'activate_plugin', array( __CLASS__, 'deactivate_merged_plugins' ) );
78
79 // Display a notice in the Plugins tab next to plugins already merged into WooCommerce core.
80 add_filter( 'all_plugins', array( __CLASS__, 'mark_merged_plugins_as_pending_update' ), 10, 1 );
81 add_action( 'after_plugin_row', array( __CLASS__, 'display_notice_for_merged_plugins' ), 10, 1 );
82 }
83
84 /**
85 * Callback for WordPress init hook.
86 */
87 public static function on_init() {
88 self::deactivate_merged_packages();
89 self::initialize_packages();
90 }
91
92 /**
93 * Checks a package exists by looking for it's directory.
94 *
95 * @param string $package Package name.
96 * @return boolean
97 */
98 public static function package_exists( $package ) {
99 return file_exists( dirname( __DIR__ ) . '/packages/' . $package );
100 }
101
102 /**
103 * Checks a package exists by looking for it's directory.
104 *
105 * @param string $class_name Class name.
106 * @return boolean
107 */
108 public static function should_load_class( $class_name ) {
109
110 foreach ( self::$merged_packages as $merged_package_name => $merged_package_class ) {
111 if ( str_replace( 'woocommerce-', 'wc_', $merged_package_name ) === $class_name ) {
112 return true;
113 }
114 }
115
116 return false;
117 }
118
119 /**
120 * Gets all merged, enabled packages.
121 *
122 * @return array
123 */
124 protected static function get_enabled_packages() {
125 $enabled_packages = array();
126
127 foreach ( self::$merged_packages as $merged_package_name => $package_class ) {
128
129 $option = 'wc_feature_' . str_replace( '-', '_', $merged_package_name ) . '_enabled';
130 $option_value = get_option( $option, '' );
131
132 // Opt out from the feature.
133 if ( 'no' === $option_value ) {
134 continue;
135 }
136
137 // Force enable feature -- mainly for testing purpose.
138 if ( 'yes' === $option_value ) {
139 $enabled_packages[ $merged_package_name ] = $package_class;
140 continue;
141 }
142
143 // If an option is not set, ensure that a package is enabled for user's remote variant number. Mainly for gradual releases.
144 $experimental_package_enabled = method_exists( $package_class, 'is_enabled' ) ?
145 call_user_func( array( $package_class, 'is_enabled' ) ) :
146 false;
147
148 if ( ! $experimental_package_enabled ) {
149 continue;
150 }
151
152 $enabled_packages[ $merged_package_name ] = $package_class;
153 }
154
155 return array_merge( $enabled_packages, self::$base_packages );
156 }
157
158 /**
159 * Checks if a package is enabled.
160 *
161 * @param string $package Package name.
162 * @return boolean
163 */
164 public static function is_package_enabled( $package ) {
165 return array_key_exists( $package, self::get_enabled_packages() );
166 }
167
168 /**
169 * Prepare merged packages for initialization.
170 * Especially useful when running actions early in the 'plugins_loaded' timeline.
171 */
172 public static function prepare_packages() {
173 foreach ( self::get_enabled_packages() as $package_name => $package_class ) {
174 if ( method_exists( $package_class, 'prepare' ) ) {
175 call_user_func( array( $package_class, 'prepare' ) );
176 }
177 }
178 }
179
180 /**
181 * Deactivates merged feature plugins.
182 *
183 * Once a feature plugin is merged into WooCommerce Core it should be deactivated. This method will
184 * ensure that a plugin gets deactivated. Note that for the first request it will still be active,
185 * and as such, there may be some odd behavior. This is unlikely to cause any issues though
186 * because it will be deactivated on the request that updates or activates WooCommerce.
187 */
188 protected static function deactivate_merged_packages() {
189 // Developers may need to be able to run merged feature plugins alongside merged packages for testing purposes.
190 if ( Constants::is_true( 'WC_ALLOW_MERGED_FEATURE_PLUGINS' ) ) {
191 return;
192 }
193
194 // Scroll through all of the active plugins and disable them if they're merged packages.
195 $active_plugins = get_option( 'active_plugins', array() );
196 // Deactivate the plugin if possible so that there are no conflicts.
197 foreach ( $active_plugins as $active_plugin_path ) {
198 $plugin_file = basename( plugin_basename( $active_plugin_path ), '.php' );
199
200 if ( ! self::is_package_enabled( $plugin_file ) ) {
201 continue;
202 }
203
204 require_once ABSPATH . 'wp-admin/includes/plugin.php';
205
206 // Make sure to display a message informing the user that the plugin has been deactivated.
207 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $active_plugin_path );
208 deactivate_plugins( $active_plugin_path );
209 add_action(
210 'admin_notices',
211 function () use ( $plugin_data ) {
212 echo '<div class="error"><p>';
213 printf(
214 /* translators: %s: is referring to the plugin's name. */
215 esc_html__( 'The %1$s plugin has been deactivated as the latest improvements are now included with the %2$s plugin.', 'woocommerce' ),
216 '<code>' . esc_html( $plugin_data['Name'] ) . '</code>',
217 '<code>WooCommerce</code>'
218 );
219 echo '</p></div>';
220 }
221 );
222 }
223 }
224
225 /**
226 * Prevent plugins already merged into WooCommerce core from getting activated as standalone plugins.
227 *
228 * @param string $plugin Plugin name.
229 */
230 public static function deactivate_merged_plugins( $plugin ) {
231 $plugin_dir = basename( dirname( $plugin ) );
232
233 if ( self::is_package_enabled( $plugin_dir ) ) {
234 $plugins_url = esc_url( admin_url( 'plugins.php' ) );
235 wp_die(
236 esc_html__( 'This plugin cannot be activated because its functionality is now included in WooCommerce core.', 'woocommerce' ),
237 esc_html__( 'Plugin Activation Error', 'woocommerce' ),
238 array(
239 'link_url' => esc_url( $plugins_url ),
240 'link_text' => esc_html__( 'Return to the Plugins page', 'woocommerce' ),
241 ),
242 );
243 }
244 }
245
246 /**
247 * Mark merged plugins as pending update.
248 * This is required for correctly displaying maintenance notices.
249 *
250 * @param array $plugins Plugins list.
251 */
252 public static function mark_merged_plugins_as_pending_update( $plugins ) {
253 foreach ( $plugins as $plugin_name => $plugin_data ) {
254 $plugin_dir = basename( dirname( $plugin_name ) );
255 if ( self::is_package_enabled( $plugin_dir ) ) {
256 // Necessary to properly display notice within row.
257 $plugins[ $plugin_name ]['update'] = 1;
258 }
259 }
260 return $plugins;
261 }
262
263 /**
264 * Displays a maintenance notice next to merged plugins, to inform users
265 * that the plugin functionality is now offered by WooCommerce core.
266 *
267 * Requires 'mark_merged_plugins_as_pending_update' to properly display this notice.
268 *
269 * @param string $plugin_file Plugin file.
270 */
271 public static function display_notice_for_merged_plugins( $plugin_file ) {
272 global $wp_list_table;
273
274 $plugin_dir = basename( dirname( $plugin_file ) );
275 if ( ! self::is_package_enabled( $plugin_dir ) || is_null( $wp_list_table ) ) {
276 return;
277 }
278
279 $columns_count = $wp_list_table->get_column_count();
280 $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' );
281 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>';
282 }
283
284 /**
285 * Loads packages after plugins_loaded hook.
286 *
287 * Each package should include an init file which loads the package so it can be used by core.
288 */
289 protected static function initialize_packages() {
290 foreach ( self::get_enabled_packages() as $package_name => $package_class ) {
291 call_user_func( array( $package_class, 'init' ) );
292 }
293
294 foreach ( self::$packages as $package_name => $package_class ) {
295 if ( ! self::package_exists( $package_name ) ) {
296 self::missing_package( $package_name );
297 continue;
298 }
299 call_user_func( array( $package_class, 'init' ) );
300 }
301
302 // Proxies "activated_plugin" hook for embedded packages listen on WC plugin activation
303 // https://github.com/woocommerce/woocommerce/issues/28697.
304 if ( is_admin() ) {
305 $activated_plugin = get_transient( 'woocommerce_activated_plugin' );
306 if ( $activated_plugin ) {
307 delete_transient( 'woocommerce_activated_plugin' );
308
309 /**
310 * WooCommerce is activated hook.
311 *
312 * @since 5.0.0
313 * @param bool $activated_plugin Activated plugin path,
314 * generally woocommerce/woocommerce.php.
315 */
316 do_action( 'woocommerce_activated_plugin', $activated_plugin );
317 }
318 }
319 }
320
321 /**
322 * If a package is missing, add an admin notice.
323 *
324 * @param string $package Package name.
325 */
326 protected static function missing_package( $package ) {
327 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
328 error_log( // phpcs:ignore
329 sprintf(
330 /* Translators: %s package name. */
331 esc_html__( 'Missing the WooCommerce %s package', 'woocommerce' ),
332 '<code>' . esc_html( $package ) . '</code>'
333 ) . ' - ' . 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' )
334 );
335 }
336 add_action(
337 'admin_notices',
338 function () use ( $package ) {
339 ?>
340 <div class="notice notice-error">
341 <p>
342 <strong>
343 <?php
344 printf(
345 /* Translators: %s package name. */
346 esc_html__( 'Missing the WooCommerce %s package', 'woocommerce' ),
347 '<code>' . esc_html( $package ) . '</code>'
348 );
349 ?>
350 </strong>
351 <br>
352 <?php
353 printf(
354 /* translators: 1: is a link to a support document. 2: closing link */
355 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' ),
356 '<a href="' . esc_url( 'https://developer.woocommerce.com/docs/contribution/contributing/#setting-up-your-development-environment' ) . '" target="_blank" rel="noopener noreferrer">',
357 '</a>'
358 );
359 ?>
360 </p>
361 </div>
362 <?php
363 }
364 );
365 }
366 }
367