Fix compatibility check to handle WP 5; call wp_get_jed_locale_data
This commit is contained in:
parent
3cc52dab29
commit
1a72cf2e4e
|
@ -78,8 +78,12 @@ function wc_admin_register_script() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up the text domain and translations.
|
// Set up the text domain and translations.
|
||||||
$locale_data = gutenberg_get_jed_locale_data( 'wc-admin' );
|
if ( function_exists( 'wp_get_jed_locale_data' ) ) {
|
||||||
$content = 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "wc-admin" );';
|
$locale_data = wp_get_jed_locale_data( 'wc-admin' );
|
||||||
|
} else {
|
||||||
|
$locale_data = gutenberg_get_jed_locale_data( 'wc-admin' );
|
||||||
|
}
|
||||||
|
$content = 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "wc-admin" );';
|
||||||
wp_add_inline_script( 'wp-i18n', $content, 'after' );
|
wp_add_inline_script( 'wp-i18n', $content, 'after' );
|
||||||
|
|
||||||
// Resets lodash to wp-admin's version of lodash.
|
// Resets lodash to wp-admin's version of lodash.
|
||||||
|
|
|
@ -43,8 +43,16 @@ function wc_admin_plugins_notice() {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function dependencies_satisfied() {
|
function dependencies_satisfied() {
|
||||||
return ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) || defined( 'GUTENBERG_VERSION' ) )
|
$woocommerce_minimum_met = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.5', '>' );
|
||||||
&& class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.5', '>' );
|
if ( ! $woocommerce_minimum_met ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$wordpress_version = get_bloginfo( 'version' );
|
||||||
|
$wordpress_includes_gutenberg = version_compare( $wordpress_version, '4.9.9', '>' );
|
||||||
|
$gutenberg_plugin_active = defined( 'GUTENBERG_DEVELOPMENT_MODE' ) || defined( 'GUTENBERG_VERSION' );
|
||||||
|
|
||||||
|
return $wordpress_includes_gutenberg || $gutenberg_plugin_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue