From 8ccfedfa4f59e2aa9a30a09ab97f0b2cf87e56de Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Thu, 16 Feb 2023 15:16:56 +0100 Subject: [PATCH] Hardcoding the string instead of refering to value ...that's only available later or not at all in some contexts. --- .../woocommerce/includes/admin/class-wc-admin-assets.php | 4 ++-- .../woocommerce/includes/admin/helper/class-wc-helper.php | 8 ++------ plugins/woocommerce/includes/admin/wc-admin-functions.php | 4 +--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-assets.php b/plugins/woocommerce/includes/admin/class-wc-admin-assets.php index f53510f8b0d..ce75609010d 100644 --- a/plugins/woocommerce/includes/admin/class-wc-admin-assets.php +++ b/plugins/woocommerce/includes/admin/class-wc-admin-assets.php @@ -106,11 +106,11 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) : * Enqueue scripts. */ public function admin_scripts() { - global $wp_query, $post, $theorder, $admin_page_hooks; + global $wp_query, $post, $theorder; $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; - $wc_screen_id = $admin_page_hooks['woocommerce']; + $wc_screen_id = 'woocommerce'; $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min'; $version = Constants::get_constant( 'WC_VERSION' ); diff --git a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php index 5236dd21323..2c22d2a10a0 100644 --- a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php +++ b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php @@ -504,11 +504,9 @@ class WC_Helper { * Enqueue admin scripts and styles. */ public static function admin_enqueue_scripts() { - global $admin_page_hooks; - $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; - $wc_screen_id = $admin_page_hooks['woocommerce']; + $wc_screen_id = 'woocommerce'; if ( $wc_screen_id . '_page_wc-addons' === $screen_id && isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) { wp_enqueue_style( 'woocommerce-helper', WC()->plugin_url() . '/assets/css/helper.css', array(), Constants::get_constant( 'WC_VERSION' ) ); @@ -663,9 +661,7 @@ class WC_Helper { * @param object $screen WP screen object. */ public static function current_screen( $screen ) { - global $admin_page_hooks; - - $wc_screen_id = $admin_page_hooks['woocommerce']; + $wc_screen_id = 'woocommerce'; if ( $wc_screen_id . '_page_wc-addons' !== $screen->id ) { return; diff --git a/plugins/woocommerce/includes/admin/wc-admin-functions.php b/plugins/woocommerce/includes/admin/wc-admin-functions.php index ccc7522b950..fd2830a0f27 100644 --- a/plugins/woocommerce/includes/admin/wc-admin-functions.php +++ b/plugins/woocommerce/includes/admin/wc-admin-functions.php @@ -18,9 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) { * @return array */ function wc_get_screen_ids() { - global $admin_page_hooks; - - $wc_screen_id = $admin_page_hooks['woocommerce']; + $wc_screen_id = 'woocommerce'; $screen_ids = array( 'toplevel_page_' . $wc_screen_id, $wc_screen_id . '_page_wc-orders',