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.0.1 5.2.0-beta.1 10.0.2 5.2.0-rc.1 10.0.3 5.2.0-rc.2 10.0.4 5.2.1 10.0.5 5.2.2 10.0.6 5.2.3 10.1.0 5.2.4 10.1.0-rc.1 5.2.5 10.1.0-rc.2 5.3.0 10.1.0-rc.3 5.3.0-beta.1 10.1.0-rc.4 5.3.0-rc.1 10.1.1 5.3.0-rc.2 10.1.2 5.3.1 10.1.3 5.3.2 10.1.4 5.3.3 10.2.0 5.4.0 10.2.0-beta.1 5.4.0-beta.1 10.2.0-beta.2 5.4.0-rc.1 10.2.0-rc.1 5.4.1 10.2.1 5.4.2 10.2.2 5.4.3 10.2.3 5.4.4 10.2.4 5.4.5 10.3.0 5.5.0 10.3.0-beta.1 5.5.0-beta.1 10.3.0-beta.2 5.5.0-rc.1 10.3.0-rc.1 5.5.0-rc.2 10.3.0-rc.2 5.5.1 10.3.1 5.5.2 10.3.2 5.5.3 10.3.3 5.5.4 10.3.4 5.5.5 10.3.5 5.6.0 10.3.6 5.6.0-beta.1 10.3.7 5.6.0-rc.1 10.3.8 5.6.0-rc.2 10.4.0 5.6.1 10.4.0-beta.1 5.6.2 10.4.0-beta.2 5.6.3 10.4.0-rc.1 5.7.0 10.4.1 5.7.0-beta.1 10.4.2 5.7.0-rc.1 10.4.3 5.7.1 10.4.4 5.7.2 10.5.0 5.7.3 10.5.0-beta.1 5.8.0 10.5.0-beta.2 5.8.0-beta.1 10.5.0-rc.1 5.8.0-beta.2 10.5.0-rc.2 5.8.0-rc.1 10.5.0-rc.3 5.8.1 10.5.1 5.8.2 10.5.2 5.9.0 10.5.3 5.9.0-beta.1 10.6.0 5.9.0-rc.1 10.6.0-beta.1 5.9.0-rc.2 10.6.0-beta.2 5.9.1 10.6.0-rc.1 5.9.2 10.6.1 6.0.0 10.6.2 6.0.0-beta.1 10.7.0 6.0.0-rc.1 10.7.0-beta.1 6.0.1 10.7.0-beta.2 6.0.2 10.7.0-rc.1 6.1.0 3.0.0 6.1.0-beta.1 3.0.1 6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c.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / src / Internal / Admin / FeaturePlugin.php
woocommerce / src / Internal / Admin Last commit date
Agentic 6 months ago EmailImprovements 1 year ago EmailPreview 1 month ago Emails 2 weeks ago ImportExport 1 year ago Logging 2 weeks ago Marketing 2 years ago Notes 2 weeks ago Onboarding 2 weeks ago Orders 1 month ago ProductForm 2 years ago ProductReviews 2 months ago RemoteFreeExtensions 2 months ago Reports 2 weeks ago Schedulers 2 weeks ago Settings 2 weeks ago Suggestions 2 weeks ago WCPayPromotion 1 year ago ActivityPanels.php 4 years ago Analytics.php 2 weeks ago CategoryLookup.php 4 years ago Coupons.php 2 weeks ago CouponsMovedTrait.php 7 months ago CustomerEffortScoreTracks.php 9 months ago Events.php 2 weeks ago FeaturePlugin.php 2 weeks ago Homescreen.php 2 weeks ago Loader.php 1 month ago Marketing.php 1 year ago Marketplace.php 7 months ago MobileAppBanner.php 4 years ago OrderMilestoneEasterEgg.php 2 months ago RemoteInboxNotifications.php 2 weeks ago Settings.php 2 weeks ago ShippingLabelBanner.php 1 year ago ShippingLabelBannerDisplayRules.php 1 year ago SiteHealth.php 2 weeks ago Survey.php 4 years ago SystemStatusReport.php 2 weeks ago TaxSettingsRecommendations.php 1 month ago Translations.php 1 year ago WCAdminAssets.php 1 week ago WCAdminSharedSettings.php 1 year ago WCAdminUser.php 10 months ago WcPayWelcomePage.php 1 year ago
FeaturePlugin.php
261 lines
1 <?php
2 /**
3 * WooCommerce Admin: Feature plugin main class.
4 */
5
6 namespace Automattic\WooCommerce\Internal\Admin;
7
8 defined( 'ABSPATH' ) || exit;
9
10 use Automattic\WooCommerce\Admin\API;
11 use Automattic\WooCommerce\Admin\Notes\Notes;
12 use Automattic\WooCommerce\Internal\Admin\Notes\OrderMilestones;
13 use Automattic\WooCommerce\Internal\Admin\Notes\WooSubscriptionsNotes;
14 use Automattic\WooCommerce\Internal\Admin\Notes\TrackingOptIn;
15 use Automattic\WooCommerce\Internal\Admin\Notes\WooCommercePayments;
16 use Automattic\WooCommerce\Internal\Admin\Notes\InstallJPAndWCSPlugins;
17 use Automattic\WooCommerce\Internal\Admin\Notes\SellingOnlineCourses;
18 use Automattic\WooCommerce\Internal\Admin\Notes\MagentoMigration;
19 use Automattic\WooCommerce\Internal\Admin\Notes\ScheduledUpdatesPromotion;
20 use Automattic\WooCommerce\Admin\Features\Features;
21 use Automattic\WooCommerce\Admin\PluginsHelper;
22 use Automattic\WooCommerce\Admin\PluginsInstaller;
23 use Automattic\WooCommerce\Admin\ReportExporter;
24 use Automattic\WooCommerce\Admin\ReportsSync;
25 use Automattic\WooCommerce\Internal\Admin\CategoryLookup;
26 use Automattic\WooCommerce\Internal\Admin\Events;
27 use Automattic\WooCommerce\Internal\Admin\Onboarding\Onboarding;
28
29 /**
30 * Feature plugin main class.
31 *
32 * @internal This file will not be bundled with woo core, only the feature plugin.
33 * @internal Note this is not called WC_Admin due to a class already existing in core with that name.
34 */
35 class FeaturePlugin {
36 /**
37 * The single instance of the class.
38 *
39 * @var object
40 */
41 protected static $instance = null;
42
43 /**
44 * Indicates if init has been invoked already.
45 *
46 * @var bool
47 */
48 private bool $initialized = false;
49
50 /**
51 * Constructor
52 *
53 * @return void
54 */
55 protected function __construct() {}
56
57 /**
58 * Get class instance.
59 *
60 * @return object Instance.
61 */
62 final public static function instance() {
63 if ( null === static::$instance ) {
64 static::$instance = new static();
65 }
66 return static::$instance;
67 }
68
69 /**
70 * Init the feature plugin, only if we can detect both Gutenberg and WooCommerce.
71 */
72 public function init() {
73 // Bail if WC isn't initialized (This can be called from WCAdmin's entrypoint).
74 if ( ! defined( 'WC_ABSPATH' ) ) {
75 return;
76 }
77
78 if ( $this->initialized ) {
79 return;
80 }
81 $this->initialized = true;
82
83 // Load the page controller functions file first to prevent fatal errors when disabling WooCommerce Admin.
84 $this->define_constants();
85 require_once WC_ADMIN_ABSPATH . '/includes/react-admin/page-controller-functions.php';
86 require_once WC_ADMIN_ABSPATH . '/src/Admin/Notes/DeprecatedNotes.php';
87 require_once WC_ADMIN_ABSPATH . '/includes/react-admin/core-functions.php';
88 require_once WC_ADMIN_ABSPATH . '/includes/react-admin/feature-config.php';
89 require_once WC_ADMIN_ABSPATH . '/includes/react-admin/wc-admin-update-functions.php';
90 require_once WC_ADMIN_ABSPATH . '/includes/react-admin/class-experimental-abtest.php';
91
92 if ( did_action( 'plugins_loaded' ) ) {
93 self::on_plugins_loaded();
94 } else {
95 // Make sure we hook into `plugins_loaded` before core's Automattic\WooCommerce\Package::init().
96 // If core is network activated but we aren't, the packaged version of WooCommerce Admin will
97 // attempt to use a data store that hasn't been loaded yet - because we've defined our constants here.
98 // See: https://github.com/woocommerce/woocommerce-admin/issues/3869.
99 add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ), 9 );
100 }
101 }
102
103 /**
104 * Setup plugin once all other plugins are loaded.
105 *
106 * @return void
107 */
108 public function on_plugins_loaded() {
109 $this->hooks();
110 $this->includes();
111 }
112
113 /**
114 * Define Constants.
115 *
116 * IMPORTANT: When adding new constants here, also add them to
117 * php-stubs/wc-constants.php for PHPStan static analysis.
118 */
119 protected function define_constants() {
120 $this->define( 'WC_ADMIN_APP', 'wc-admin-app' );
121 $this->define( 'WC_ADMIN_ABSPATH', WC_ABSPATH );
122 $this->define( 'WC_ADMIN_DIST_JS_FOLDER', 'assets/client/admin/' );
123 $this->define( 'WC_ADMIN_DIST_CSS_FOLDER', 'assets/client/admin/' );
124 $this->define( 'WC_ADMIN_PLUGIN_FILE', WC_PLUGIN_FILE );
125
126 /**
127 * Define the WC Admin Images Folder URL.
128 *
129 * @deprecated 6.7.0
130 * @var string
131 */
132 if ( ! defined( 'WC_ADMIN_IMAGES_FOLDER_URL' ) ) {
133 /**
134 * Define the WC Admin Images Folder URL.
135 *
136 * @deprecated 6.7.0
137 * @var string
138 */
139 define( 'WC_ADMIN_IMAGES_FOLDER_URL', plugins_url( 'assets/images', WC_PLUGIN_FILE ) );
140 }
141
142 /**
143 * Define the current WC Admin version.
144 *
145 * @deprecated 6.4.0
146 * @var string
147 */
148 if ( ! defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
149 /**
150 * Define the current WC Admin version.
151 *
152 * @deprecated 6.4.0
153 * @var string
154 */
155 define( 'WC_ADMIN_VERSION_NUMBER', '3.3.0' );
156 }
157 }
158
159 /**
160 * Include WC Admin classes.
161 */
162 public function includes() {
163 // Initialize Database updates, option migrations, and Notes.
164 Events::instance()->init();
165 Notes::init();
166
167 // Initialize Plugins Installer.
168 PluginsInstaller::init();
169 PluginsHelper::init();
170
171 // Initialize API.
172 API\Init::instance();
173
174 Onboarding::init();
175
176 if ( $this->is_analytics_enabled_during_bootstrap() ) {
177 // Initialize Reports syncing.
178 ReportsSync::init();
179 CategoryLookup::instance()->init();
180 // Initialize Reports exporter.
181 ReportExporter::init();
182 }
183
184 // Admin note providers.
185 // @todo These should be bundled in the features/ folder, but loading them from there currently has a load order issue.
186 new WooSubscriptionsNotes();
187 new OrderMilestones();
188 new TrackingOptIn();
189 new WooCommercePayments();
190 new InstallJPAndWCSPlugins();
191 new SellingOnlineCourses();
192 new MagentoMigration();
193 new ScheduledUpdatesPromotion();
194 }
195
196 /**
197 * Check whether Analytics should be initialized during plugin bootstrap.
198 *
199 * Feature definitions contain translated presentation strings and are not safe to build before init.
200 *
201 * @return bool
202 */
203 private function is_analytics_enabled_during_bootstrap(): bool {
204 // Keep this fallback aligned with `enabled_by_default` for Analytics in FeaturesController.
205 return ! Features::is_analytics_disabled_by_legacy_filters()
206 && 'yes' === get_option( Analytics::TOGGLE_OPTION_NAME, 'yes' );
207 }
208
209 /**
210 * Set up our admin hooks and plugin loader.
211 */
212 protected function hooks() {
213 add_filter( 'woocommerce_admin_features', array( $this, 'replace_supported_features' ), 0 );
214
215 Loader::get_instance();
216 WCAdminAssets::get_instance();
217 }
218
219 /**
220 * Adds the allowed features from a local `feature-config.php` file.
221 *
222 * @param array $features Array of feature slugs.
223 * @return array
224 */
225 public function replace_supported_features( $features ) {
226 /**
227 * Get additional feature config
228 *
229 * @since 6.5.0
230 */
231 $feature_config = apply_filters( 'woocommerce_admin_get_feature_config', wc_admin_get_feature_config() );
232 $features = array_merge( $features, array_keys( array_filter( $feature_config ) ) );
233
234 return array_values( array_unique( $features ) );
235 }
236
237 /**
238 * Define constant if not already set.
239 *
240 * @param string $name Constant name.
241 * @param string|bool $value Constant value.
242 */
243 protected function define( $name, $value ) {
244 if ( ! defined( $name ) ) {
245 define( $name, $value );
246 }
247 }
248
249 /**
250 * Prevent cloning.
251 */
252 private function __clone() {}
253
254 /**
255 * Prevent unserializing.
256 */
257 public function __wakeup() {
258 die();
259 }
260 }
261