本文整理汇总了PHP中WC_Admin_Notices::has_notice方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Notices::has_notice方法的具体用法?PHP WC_Admin_Notices::has_notice怎么用?PHP WC_Admin_Notices::has_notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Admin_Notices
的用法示例。
在下文中一共展示了WC_Admin_Notices::has_notice方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install_actions
/**
* Install actions such as installing pages when a button is clicked.
*/
public static function install_actions()
{
// Install - Add pages button
if (!empty($_GET['install_woocommerce_pages'])) {
self::create_pages();
// We no longer need to install pages
WC_Admin_Notices::remove_notice('install');
// What's new redirect
if (!WC_Admin_Notices::has_notice('update')) {
delete_transient('_wc_activation_redirect');
wp_redirect(admin_url('index.php?page=wc-about&wc-updated=true'));
exit;
}
// Update button
} elseif (!empty($_GET['do_update_woocommerce'])) {
self::update();
// Update complete
WC_Admin_Notices::remove_notice('update');
// What's new redirect
if (!WC_Admin_Notices::has_notice('install')) {
delete_transient('_wc_activation_redirect');
wp_redirect(admin_url('index.php?page=wc-about&wc-updated=true'));
exit;
}
}
}
示例2: admin_redirects
/**
* Handle redirects to setup/welcome page after install and updates.
*
* For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects()
{
// Nonced plugin install redirects (whitelisted)
if (!empty($_GET['wc-install-plugin-redirect'])) {
$plugin_slug = wc_clean($_GET['wc-install-plugin-redirect']);
if (current_user_can('install_plugins') && in_array($plugin_slug, array('woocommerce-gateway-stripe'))) {
$nonce = wp_create_nonce('install-plugin_' . $plugin_slug);
$url = self_admin_url('update.php?action=install-plugin&plugin=' . $plugin_slug . '&_wpnonce=' . $nonce);
} else {
$url = admin_url('plugin-install.php?tab=search&type=term&s=' . $plugin_slug);
}
wp_safe_redirect($url);
exit;
}
// Setup wizard redirect
if (get_transient('_wc_activation_redirect')) {
delete_transient('_wc_activation_redirect');
if (!empty($_GET['page']) && in_array($_GET['page'], array('wc-setup')) || is_network_admin() || isset($_GET['activate-multi']) || !current_user_can('manage_woocommerce') || apply_filters('woocommerce_prevent_automatic_wizard_redirect', false)) {
return;
}
// If the user needs to install, send them to the setup wizard
if (WC_Admin_Notices::has_notice('install')) {
wp_safe_redirect(admin_url('index.php?page=wc-setup'));
exit;
}
}
}
示例3: admin_redirects
/**
* Handle redirects to setup/welcome page after install and updates.
*
* Transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects()
{
if (!get_transient('_wc_activation_redirect')) {
return;
}
delete_transient('_wc_activation_redirect');
if (!empty($_GET['page']) && in_array($_GET['page'], array('wc-setup')) || is_network_admin() || isset($_GET['activate-multi']) || !current_user_can('manage_woocommerce') || apply_filters('woocommerce_prevent_automatic_wizard_redirect', false)) {
return;
}
// If the user needs to install, send them to the setup wizard
if (WC_Admin_Notices::has_notice('install')) {
wp_safe_redirect(admin_url('index.php?page=wc-setup'));
exit;
}
}
示例4: admin_redirects
/**
* Handle redirects to setup/welcome page after install and updates.
*
* Transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
*/
public function admin_redirects()
{
if (!get_transient('_wc_activation_redirect') || is_network_admin() || isset($_GET['activate-multi']) || !current_user_can('manage_woocommerce')) {
return;
}
delete_transient('_wc_activation_redirect');
if (!empty($_GET['page']) && in_array($_GET['page'], array('wc-setup', 'wc-about'))) {
return;
}
// If the user needs to install, send them to the setup wizard
if (WC_Admin_Notices::has_notice('install')) {
wp_safe_redirect(admin_url('index.php?page=wc-setup'));
exit;
// Otherwise, the welcome page
} else {
wp_safe_redirect(admin_url('index.php?page=wc-about'));
exit;
}
}
示例5: welcome
/**
* Sends user to the welcome page on first activation.
*/
public function welcome()
{
// Bail if no activation redirect transient is set
if (!get_transient('_wc_activation_redirect')) {
return;
}
// Delete the redirect transient
delete_transient('_wc_activation_redirect');
// Bail if we are waiting to install or update via the interface update/install links
if (WC_Admin_Notices::has_notice('install') || WC_Admin_Notices::has_notice('update')) {
return;
}
// Bail if activating from network, or bulk, or within an iFrame
if (is_network_admin() || isset($_GET['activate-multi']) || defined('IFRAME_REQUEST')) {
return;
}
if (isset($_GET['action']) && 'upgrade-plugin' == $_GET['action'] || !empty($_GET['page']) && $_GET['page'] === 'wc-about') {
return;
}
wp_redirect(admin_url('index.php?page=wc-about'));
exit;
}