本文整理汇总了PHP中WC_Subscriptions::set_duplicate_site_url_lock方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Subscriptions::set_duplicate_site_url_lock方法的具体用法?PHP WC_Subscriptions::set_duplicate_site_url_lock怎么用?PHP WC_Subscriptions::set_duplicate_site_url_lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Subscriptions
的用法示例。
在下文中一共展示了WC_Subscriptions::set_duplicate_site_url_lock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* Checks which upgrades need to run and calls the necessary functions for that upgrade.
*
* @since 1.2
*/
public static function upgrade()
{
global $wpdb;
update_option(WC_Subscriptions_Admin::$option_prefix . '_previous_version', self::$active_version);
// Update the hold stock notification to be one week (if it's still at the default 60 minutes) to prevent cancelling subscriptions using manual renewals and payment methods that can take more than 1 hour (i.e. PayPal eCheck)
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4', '<')) {
$hold_stock_duration = get_option('woocommerce_hold_stock_minutes');
if (60 == $hold_stock_duration) {
update_option('woocommerce_hold_stock_minutes', 60 * 24 * 7);
}
// Allow products & subscriptions to be purchased in the same transaction
update_option('woocommerce_subscriptions_multiple_purchase', 'yes');
}
// Keep track of site url to prevent duplicate payments from staging sites, first added in 1.3.8 & updated with 1.4.2 to work with WP Engine staging sites
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4.2', '<')) {
WC_Subscriptions::set_duplicate_site_url_lock();
}
// Don't autoload cron locks
if ('0' != self::$active_version && version_compare(self::$active_version, '1.4.3', '<')) {
$wpdb->query("UPDATE {$wpdb->options}\n\t\t\t\tSET autoload = 'no'\n\t\t\t\tWHERE option_name LIKE 'wcs_blocker_%'");
}
// Add support for quantities & migrate wp_cron schedules to the new action-scheduler system.
if ('0' != self::$active_version && version_compare(self::$active_version, '1.5', '<')) {
self::upgrade_to_version_1_5();
}
// Update to new system to limit subscriptions by status rather than in a binary way
if ('0' != self::$active_version && version_compare(self::$active_version, '1.5.4', '<')) {
$wpdb->query("UPDATE {$wpdb->postmeta}\n\t\t\t\tSET meta_value = 'any'\n\t\t\t\tWHERE meta_key LIKE '_subscription_limit'\n\t\t\t\tAND meta_value LIKE 'yes'");
}
self::upgrade_complete();
}
示例2: woocommerce_site_change_notice
/**
* Displays a notice when Subscriptions is being run on a different site, like a staging or testing site.
*
* @since 1.3.8
*/
public static function woocommerce_site_change_notice()
{
global $woocommerce;
if (self::is_duplicate_site() && current_user_can('manage_options')) {
if (isset($_POST['wc_subscription_duplicate_site'])) {
if ('update' === $_POST['wc_subscription_duplicate_site']) {
WC_Subscriptions::set_duplicate_site_url_lock();
} elseif ('ignore' === $_POST['wc_subscription_duplicate_site']) {
update_option('wcs_ignore_duplicate_siteurl_notice', self::get_current_sites_duplicate_lock());
}
} elseif (self::get_current_sites_duplicate_lock() !== get_option('wcs_ignore_duplicate_siteurl_notice')) {
?>
<div id="message" class="error">
<p><?php
printf(__('It looks like this site has moved or is a duplicate site. %sWooCommerce Subscriptions%s has disabled automatic payments and subscription related emails on this site to prevent duplicate payments from a staging or test environment. %sLearn more%s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://docs.woothemes.com/document/subscriptions/faq/#section-39" target="_blank">', '»</a>');
?>
</p>
<form action="" style="margin: 5px 0;" method="POST">
<button class="button-primary" name="wc_subscription_duplicate_site" value="ignore"><?php
_e('Quit nagging me (but don\'t enable automatic payments)', 'woocommerce-subscriptions');
?>
</button>
<button class="button" name="wc_subscription_duplicate_site" value="update"><?php
_e('Enable automatic payments', 'woocommerce-subscriptions');
?>
</button>
</form>
</div>
<?php
}
}
}
示例3: woocommerce_site_change_notice
/**
* Displays a notice when Subscriptions is being run on a different site, like a staging or testing site.
*
* @since 1.3.8
*/
public static function woocommerce_site_change_notice()
{
if (self::is_duplicate_site() && current_user_can('manage_options')) {
if (!empty($_REQUEST['_wcsnonce']) && wp_verify_nonce($_REQUEST['_wcsnonce'], 'wcs_duplicate_site') && isset($_GET['wc_subscription_duplicate_site'])) {
if ('update' === $_GET['wc_subscription_duplicate_site']) {
WC_Subscriptions::set_duplicate_site_url_lock();
} elseif ('ignore' === $_GET['wc_subscription_duplicate_site']) {
update_option('wcs_ignore_duplicate_siteurl_notice', self::get_current_sites_duplicate_lock());
}
wp_safe_redirect(remove_query_arg(array('wc_subscription_duplicate_site', '_wcsnonce')));
} elseif (self::get_current_sites_duplicate_lock() !== get_option('wcs_ignore_duplicate_siteurl_notice')) {
?>
<div id="message" class="error">
<p><?php
// translators: 1$-2$: opening and closing <strong> tags, 3$-4$: opening and closing link tags. Leads to duplicate site article on docs
printf(esc_html__('It looks like this site has moved or is a duplicate site. %1$sWooCommerce Subscriptions%2$s has disabled automatic payments and subscription related emails on this site to prevent duplicate payments from a staging or test environment. %3$sLearn more%4$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://docs.woothemes.com/document/subscriptions/faq/#section-39" target="_blank">', '»</a>');
?>
</p>
<div style="margin: 5px 0;">
<a class="button button-primary" href="<?php
echo esc_url(wp_nonce_url(add_query_arg('wc_subscription_duplicate_site', 'ignore'), 'wcs_duplicate_site', '_wcsnonce'));
?>
"><?php
esc_html_e('Quit nagging me (but don\'t enable automatic payments)', 'woocommerce-subscriptions');
?>
</a>
<a class="button" href="<?php
echo esc_url(wp_nonce_url(add_query_arg('wc_subscription_duplicate_site', 'update'), 'wcs_duplicate_site', '_wcsnonce'));
?>
"><?php
esc_html_e('Enable automatic payments', 'woocommerce-subscriptions');
?>
</a>
</div>
</div>
<?php
}
}
}
示例4: upgrade
/**
* Checks which upgrades need to run and calls the necessary functions for that upgrade.
*
* @since 1.2
*/
public static function upgrade()
{
global $wpdb;
@set_time_limit(600);
// Update meta keys for 1.1 to 1.1.1 multisite changes
if (version_compare(self::$active_version, '1.1.1', '<')) {
$wpdb->update($wpdb->usermeta, array('meta_key' => $wpdb->get_blog_prefix() . WC_Subscriptions_Manager::$users_meta_key), array('meta_key' => WC_Subscriptions_Manager::$users_meta_key));
}
// Fix any products that were incorrectly added as a subscription for a user in 1.1.2
if ('0' != self::$active_version && version_compare(self::$active_version, '1.1.3', '<')) {
self::upgrade_to_version_1_1_3();
}
// Upgrade order and subscription meta data to new format
if ('0' != self::$active_version && version_compare(self::$active_version, '1.2', '<')) {
self::upgrade_to_version_1_2();
}
// Fix renewal order dates & remove duplicate orders
if ('0' != self::$active_version && version_compare(self::$active_version, '1.2.1', '<')) {
self::upgrade_to_version_1_2_1();
}
// Fix paypal renewal orders
if ('0' != self::$active_version && version_compare(self::$active_version, '1.2.2', '<')) {
self::upgrade_to_version_1_2_2();
}
// Add Variable Subscription product type term
if (version_compare(self::$active_version, '1.2.5', '<=')) {
self::upgrade_to_version_1_3();
}
// Update the hold stock notification to be one week (if it's still at the default 60 minutes) to prevent cancelling subscriptions using manual renewals and payment methods that can take more than 1 hour (i.e. PayPal eCheck)
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4', '<')) {
$hold_stock_duration = get_option('woocommerce_hold_stock_minutes');
if (60 == $hold_stock_duration) {
update_option('woocommerce_hold_stock_minutes', 60 * 24 * 7);
}
}
// Moving subscription meta out of user meta and into item meta
if ('0' != self::$active_version && version_compare(self::$active_version, '1.4', '<')) {
self::upgrade_to_version_1_4();
}
// Keep track of site url to prevent duplicate payments from staging sites, first added in 1.3.8 & updated with 1.4.2 to work with WP Engine staging sites
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4.2', '<')) {
WC_Subscriptions::set_duplicate_site_url_lock();
}
// Don't autoload cron locks
if (version_compare(self::$active_version, '1.4.3', '<')) {
$wpdb->query("UPDATE {$wpdb->options}\n\t\t\t\tSET autoload = 'no'\n\t\t\t\tWHERE option_name LIKE 'wcs_blocker_%'");
}
self::upgrade_complete();
}
示例5: upgrade
/**
* Checks which upgrades need to run and calls the necessary functions for that upgrade.
*
* @since 1.2
*/
public static function upgrade()
{
global $wpdb;
self::set_upgrade_limits();
update_option(WC_Subscriptions_Admin::$option_prefix . '_previous_version', self::$active_version);
// Update the hold stock notification to be one week (if it's still at the default 60 minutes) to prevent cancelling subscriptions using manual renewals and payment methods that can take more than 1 hour (i.e. PayPal eCheck)
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4', '<')) {
$hold_stock_duration = get_option('woocommerce_hold_stock_minutes');
if (60 == $hold_stock_duration) {
update_option('woocommerce_hold_stock_minutes', 60 * 24 * 7);
}
// Allow products & subscriptions to be purchased in the same transaction
update_option('woocommerce_subscriptions_multiple_purchase', 'yes');
}
// Keep track of site url to prevent duplicate payments from staging sites, first added in 1.3.8 & updated with 1.4.2 to work with WP Engine staging sites
if ('0' == self::$active_version || version_compare(self::$active_version, '1.4.2', '<')) {
WC_Subscriptions::set_duplicate_site_url_lock();
}
// Migrate products, WP-Cron hooks and subscriptions to the latest architecture, via Ajax
if ('0' != self::$active_version && version_compare(self::$active_version, '2.0', '<')) {
// Make sure the new /my-account/view-subscription/{id} endpoints will work
flush_rewrite_rules();
// Delete old cron locks
$deleted_rows = $wpdb->query("DELETE FROM {$wpdb->options} WHERE `option_name` LIKE 'wcs\\_blocker\\_%'");
WCS_Upgrade_Logger::add(sprintf('Deleted %d rows of "wcs_blocker_"', $deleted_rows));
self::ajax_upgrade_handler();
}
// Repair incorrect dates set when upgrading with 2.0.0
if (version_compare(self::$active_version, '2.0.0', '>=') && version_compare(self::$active_version, '2.0.2', '<') && self::migrated_subscription_count() > 0) {
self::ajax_upgrade_handler();
}
self::upgrade_complete();
}