API
4 weeks ago
BlockTemplates
2 years ago
Composer
2 years ago
DateTimeProvider
4 years ago
Features
4 weeks ago
Marketing
1 year ago
Notes
4 weeks ago
Overrides
2 months ago
PluginsInstallLoggers
1 year ago
PluginsProvider
4 years ago
RemoteInboxNotifications
4 weeks ago
RemoteSpecs
2 months ago
Schedulers
1 year ago
Settings
2 weeks ago
DataSourcePoller.php
2 years ago
DeprecatedClassFacade.php
1 year ago
FeaturePlugin.php
4 years ago
Loader.php
2 years ago
PageController.php
4 weeks ago
PluginsHelper.php
4 weeks ago
PluginsInstaller.php
4 years ago
ReportCSVEmail.php
1 year ago
ReportCSVExporter.php
1 year ago
ReportExporter.php
3 years ago
ReportsSync.php
4 months ago
WCAdminHelper.php
4 weeks ago
Loader.php
90 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Admin; |
| 4 | |
| 5 | use Automattic\WooCommerce\Admin\DeprecatedClassFacade; |
| 6 | use Automattic\WooCommerce\Admin\Features\Features; |
| 7 | use Automattic\WooCommerce\Internal\Admin\WCAdminAssets; |
| 8 | |
| 9 | /** |
| 10 | * Loader Class. |
| 11 | * |
| 12 | * @deprecated since 6.3.0, use WooCommerce\Internal\Admin\Loader. |
| 13 | */ |
| 14 | class Loader extends DeprecatedClassFacade { |
| 15 | |
| 16 | /** |
| 17 | * The name of the non-deprecated class that this facade covers. |
| 18 | * |
| 19 | * @var string |
| 20 | */ |
| 21 | protected static $facade_over_classname = 'Automattic\WooCommerce\Internal\Admin\Loader'; |
| 22 | |
| 23 | /** |
| 24 | * The version that this class was deprecated in. |
| 25 | * |
| 26 | * @var string |
| 27 | */ |
| 28 | protected static $deprecated_in_version = '6.3.0'; |
| 29 | |
| 30 | /** |
| 31 | * Returns if a specific wc-admin feature is enabled. |
| 32 | * |
| 33 | * @param string $feature Feature slug. |
| 34 | * @return bool Returns true if the feature is enabled. |
| 35 | * |
| 36 | * @deprecated since 5.0.0, use Features::is_enabled( $feature ) |
| 37 | */ |
| 38 | public static function is_feature_enabled( $feature ) { |
| 39 | wc_deprecated_function( 'is_feature_enabled', '5.0', '\Automattic\WooCommerce\Internal\Features\Features::is_enabled()' ); |
| 40 | return Features::is_enabled( $feature ); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Returns true if we are on a JS powered admin page or |
| 45 | * a "classic" (non JS app) powered admin page (an embedded page). |
| 46 | * |
| 47 | * @deprecated 6.3.0 |
| 48 | */ |
| 49 | public static function is_admin_or_embed_page() { |
| 50 | wc_deprecated_function( 'is_admin_or_embed_page', '6.3', '\Automattic\WooCommerce\Admin\PageController::is_admin_or_embed_page()' ); |
| 51 | return PageController::is_admin_or_embed_page(); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Returns true if we are on a JS powered admin page. |
| 56 | * |
| 57 | * @deprecated 6.3.0 |
| 58 | */ |
| 59 | public static function is_admin_page() { |
| 60 | wc_deprecated_function( 'is_admin_page', '6.3', '\Automattic\WooCommerce\Admin\PageController::is_admin_page()' ); |
| 61 | return PageController::is_admin_page(); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Returns true if we are on a "classic" (non JS app) powered admin page. |
| 66 | * |
| 67 | * @deprecated 6.3.0 |
| 68 | */ |
| 69 | public static function is_embed_page() { |
| 70 | wc_deprecated_function( 'is_embed_page', '6.3', '\Automattic\WooCommerce\Admin\PageController::is_embed_page()' ); |
| 71 | return PageController::is_embed_page(); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Determines if a minified JS file should be served. |
| 76 | * |
| 77 | * @param boolean $script_debug Only serve unminified files if script debug is on. |
| 78 | * @return boolean If js asset should use minified version. |
| 79 | * |
| 80 | * @deprecated since 6.3.0, use WCAdminAssets::should_use_minified_js_file( $script_debug ) |
| 81 | */ |
| 82 | public static function should_use_minified_js_file( $script_debug ) { |
| 83 | // Bail if WC isn't initialized (This can be called from WCAdmin's entrypoint). |
| 84 | if ( ! defined( 'WC_ABSPATH' ) ) { |
| 85 | return; |
| 86 | } |
| 87 | return WCAdminAssets::should_use_minified_js_file( $script_debug ); |
| 88 | } |
| 89 | } |
| 90 |