From 3e43a19c30bbfe587ee562d2991a94c64c88e66c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 24 Apr 2013 14:29:38 +0100 Subject: [PATCH] Fix Screen ids when plugin name localised. Closes #3013. Closes #3016. --- admin/woocommerce-admin-init.php | 7 ++++--- readme.txt | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/woocommerce-admin-init.php b/admin/woocommerce-admin-init.php index ed21a4e6e46..806ad7ead2b 100644 --- a/admin/woocommerce-admin-init.php +++ b/admin/woocommerce-admin-init.php @@ -398,10 +398,11 @@ function woocommerce_admin_scripts() { wp_register_script( 'chosen', $woocommerce->plugin_url() . '/assets/js/chosen/chosen.jquery'.$suffix.'.js', array('jquery'), $woocommerce->version ); // Get admin screen id - $screen = get_current_screen(); + $screen = get_current_screen(); + $wc_screen_id = strtolower( __( 'WooCommerce', 'woocommerce' ) ); // WooCommerce admin pages - if ( in_array( $screen->id, apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'edit-shop_order', 'edit-shop_coupon', 'shop_coupon', 'shop_order', 'edit-product', 'product' ) ) ) ) { + if ( in_array( $screen->id, apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_' . $wc_screen_id, $wc_screen_id . '_page_woocommerce_settings', $wc_screen_id . '_page_woocommerce_reports', 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'edit-shop_order', 'edit-shop_coupon', 'shop_coupon', 'shop_order', 'edit-product', 'product' ) ) ) ) { wp_enqueue_script( 'woocommerce_admin' ); wp_enqueue_script( 'farbtastic' ); @@ -496,7 +497,7 @@ function woocommerce_admin_scripts() { } // Reports pages - if ( $screen->id == apply_filters( 'woocommerce_reports_screen_id', 'woocommerce_page_woocommerce_reports' ) ) { + if ( in_array( $screen->id, apply_filters( 'woocommerce_reports_screen_ids', array( $wc_screen_id . '_page_woocommerce_reports', apply_filters( 'woocommerce_reports_screen_id', 'woocommerce_page_woocommerce_reports' ) ) ) ) ) { wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_script( 'flot', $woocommerce->plugin_url() . '/assets/js/admin/jquery.flot'.$suffix.'.js', 'jquery', '1.0' ); diff --git a/readme.txt b/readme.txt index 67816fcda6d..c2bf6bef601 100644 --- a/readme.txt +++ b/readme.txt @@ -169,6 +169,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Tweak - Notices during checkout for admin users if the checkout is mis-configured. * Fix - Disable autocomplete for checkout fields which refresh totals - no events get fired on autocomplete. * Fix - Clear rating transients when editing comments. +* Fix - Screen ids when plugin name localised. * Localization - Netherlands, Hungarian, Taiwan, Italian, Spanish updates. * Other minor fixes and localisation updates.