當前位置: 首頁>>代碼示例>>PHP>>正文


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怎麽用?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();
 }
開發者ID:akshayxhtmljunkies,項目名稱:brownglock,代碼行數:36,代碼來源:class-wc-subscriptions-upgrader.php

示例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">', '&raquo;</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 
            }
        }
    }
開發者ID:jgabrielfreitas,項目名稱:MultipagosTestesAPP,代碼行數:37,代碼來源:woocommerce-subscriptions.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">', '&raquo;</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 
            }
        }
    }
開發者ID:slavic18,項目名稱:cats,代碼行數:45,代碼來源:woocommerce-subscriptions.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();
 }
開發者ID:jgabrielfreitas,項目名稱:MultipagosTestesAPP,代碼行數:54,代碼來源:class-wc-subscriptions-upgrader.php

示例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();
 }
開發者ID:slavic18,項目名稱:cats,代碼行數:38,代碼來源:class-wc-subscriptions-upgrader.php


注:本文中的WC_Subscriptions::set_duplicate_site_url_lock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。