Refactor to use constant so that we have easy way to reset admin notice version
This commit is contained in:
parent
8c6c9f2f18
commit
ec490409ea
|
@ -8,6 +8,14 @@
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name for notice for showing minimum version requirements. Change value to invalidate previous dismissals when requirement changes in future.
|
||||||
|
* Last changed in 3.8.
|
||||||
|
*
|
||||||
|
* @since 3.8.0.
|
||||||
|
*/
|
||||||
|
define( 'WC_PHP_MIN_REQUIREMENTS_NOTICE', 'wp_php_min_requirements_3_8' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WC_Admin_Notices Class.
|
* WC_Admin_Notices Class.
|
||||||
*/
|
*/
|
||||||
|
@ -26,16 +34,16 @@ class WC_Admin_Notices {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $core_notices = array(
|
private static $core_notices = array(
|
||||||
'install' => 'install_notice',
|
'install' => 'install_notice',
|
||||||
'update' => 'update_notice',
|
'update' => 'update_notice',
|
||||||
'template_files' => 'template_file_check_notice',
|
'template_files' => 'template_file_check_notice',
|
||||||
'legacy_shipping' => 'legacy_shipping_notice',
|
'legacy_shipping' => 'legacy_shipping_notice',
|
||||||
'no_shipping_methods' => 'no_shipping_methods_notice',
|
'no_shipping_methods' => 'no_shipping_methods_notice',
|
||||||
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
|
||||||
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
|
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
|
||||||
'no_secure_connection' => 'secure_connection_notice',
|
'no_secure_connection' => 'secure_connection_notice',
|
||||||
'wc_admin' => 'wc_admin_feature_plugin_notice',
|
'wc_admin' => 'wc_admin_feature_plugin_notice',
|
||||||
'wp_php_min_requirements' => 'wp_php_min_requirements_notice',
|
WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -380,7 +388,7 @@ class WC_Admin_Notices {
|
||||||
*/
|
*/
|
||||||
public static function add_min_version_notice() {
|
public static function add_min_version_notice() {
|
||||||
if ( version_compare( phpversion(), WC_NOTICE_MIN_PHP_VERSION, '<' ) || version_compare( get_bloginfo( 'version' ), WC_NOTICE_MIN_WP_VERSION, '<' ) ) {
|
if ( version_compare( phpversion(), WC_NOTICE_MIN_PHP_VERSION, '<' ) || version_compare( get_bloginfo( 'version' ), WC_NOTICE_MIN_WP_VERSION, '<' ) ) {
|
||||||
self::add_notice( 'wp_php_min_requirements' );
|
self::add_notice( WC_PHP_MIN_REQUIREMENTS_NOTICE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +399,8 @@ class WC_Admin_Notices {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function wp_php_min_requirements_notice() {
|
public static function wp_php_min_requirements_notice() {
|
||||||
if ( apply_filters( 'woocommerce_hide_php_wp_nag', get_user_meta( get_current_user_id(), 'dismissed_wp_php_min_requirements_notice', true ) ) ) {
|
if ( apply_filters( 'woocommerce_hide_php_wp_nag', get_user_meta( get_current_user_id(), 'dismissed_' . WC_PHP_MIN_REQUIREMENTS_NOTICE . '_notice', true ) ) ) {
|
||||||
self::remove_notice( 'wp_php_min_requirements' );
|
self::remove_notice( WC_PHP_MIN_REQUIREMENTS_NOTICE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
?>
|
?>
|
||||||
<div id="message" class="updated woocommerce-message">
|
<div id="message" class="updated woocommerce-message">
|
||||||
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'wp_php_min_requirements' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', WC_PHP_MIN_REQUIREMENTS_NOTICE ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php esc_html_e( 'Dismiss', 'woocommerce' ); ?></a>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue