Hardcoding the string instead of refering to value

...that's only available later or not at all in some contexts.
This commit is contained in:
Peter Fabian 2023-02-16 15:16:56 +01:00
parent 0c254c03c3
commit 8ccfedfa4f
3 changed files with 5 additions and 11 deletions

View File

@ -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' );

View File

@ -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;

View File

@ -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',