本文整理汇总了PHP中WC_Admin_Notices::remove_all_notices方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Notices::remove_all_notices方法的具体用法?PHP WC_Admin_Notices::remove_all_notices怎么用?PHP WC_Admin_Notices::remove_all_notices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Admin_Notices
的用法示例。
在下文中一共展示了WC_Admin_Notices::remove_all_notices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
/**
* Install WC.
*/
public static function install()
{
global $wpdb;
if (!is_blog_installed()) {
return;
}
if (!defined('WC_INSTALLING')) {
define('WC_INSTALLING', true);
}
// Ensure needed classes are loaded
include_once dirname(__FILE__) . '/admin/class-wc-admin-notices.php';
self::create_options();
self::create_tables();
self::create_roles();
// Register post types
WC_Post_types::register_post_types();
WC_Post_types::register_taxonomies();
// Also register endpoints - this needs to be done prior to rewrite rule flush
WC()->query->init_query_vars();
WC()->query->add_endpoints();
WC_API::add_endpoint();
WC_Auth::add_endpoint();
self::create_terms();
self::create_cron_jobs();
self::create_files();
// Queue upgrades/setup wizard
$current_wc_version = get_option('woocommerce_version', null);
$current_db_version = get_option('woocommerce_db_version', null);
WC_Admin_Notices::remove_all_notices();
// No versions? This is a new install :)
if (is_null($current_wc_version) && is_null($current_db_version) && apply_filters('woocommerce_enable_setup_wizard', true)) {
WC_Admin_Notices::add_notice('install');
set_transient('_wc_activation_redirect', 1, 30);
// No page? Let user run wizard again..
} elseif (!get_option('woocommerce_cart_page_id')) {
WC_Admin_Notices::add_notice('install');
}
if (!is_null($current_db_version) && version_compare($current_db_version, max(array_keys(self::$db_updates)), '<')) {
WC_Admin_Notices::add_notice('update');
} else {
self::update_db_version();
}
self::update_wc_version();
// Flush rules after install
do_action('woocommerce_flush_rewrite_rules');
delete_transient('wc_attribute_taxonomies');
/*
* Deletes all expired transients. The multi-table delete syntax is used
* to delete the transient record from table a, and the corresponding
* transient_timeout record from table b.
*
* Based on code inside core's upgrade_network() function.
*/
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\tWHERE a.option_name LIKE %s\n\t\t\tAND a.option_name NOT LIKE %s\n\t\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\n\t\t\tAND b.option_value < %d";
$wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time()));
// Trigger action
do_action('woocommerce_installed');
}