当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Subscriptions::get_total_subscription_count方法代码示例

本文整理汇总了PHP中WC_Subscriptions::get_total_subscription_count方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Subscriptions::get_total_subscription_count方法的具体用法?PHP WC_Subscriptions::get_total_subscription_count怎么用?PHP WC_Subscriptions::get_total_subscription_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Subscriptions的用法示例。


在下文中一共展示了WC_Subscriptions::get_total_subscription_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: woo_ce_return_count


//.........这里部分代码省略.........
								} else {
									$order->email = '-';
								}
							}
							if( !in_array( $order->email, $customers ) ) {
								$customers[$order->ID] = $order->email;
								$count++;
							}
						}
						unset( $orders, $order );
					}
				}
*/
				break;

			case 'user':
				if( $users = count_users() )
					$count = $users['total_users'];
				break;

			case 'coupon':
				$post_type = 'shop_coupon';
				if( post_type_exists( $post_type ) )
					$count = wp_count_posts( $post_type );
				break;

			case 'subscription':
				$count = 0;
				// Check that WooCommerce Subscriptions exists
				if( class_exists( 'WC_Subscriptions' ) ) {
					if( method_exists( 'WC_Subscriptions', 'is_large_site' ) ) {
						// Does this store have roughly more than 3000 Subscriptions
						if( false === WC_Subscriptions::is_large_site() ) {
							if( class_exists( 'WC_Subscriptions_Manager' ) ) {
								// Check that the get_all_users_subscriptions() function exists
								if( method_exists( 'WC_Subscriptions_Manager', 'get_all_users_subscriptions' ) ) {
									if( $subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions() ) {
										foreach( $subscriptions as $key => $user_subscription ) {
											if( !empty( $user_subscription ) ) {
												foreach( $user_subscription as $subscription )
													$count++;
											}
										}
										unset( $subscriptions, $subscription, $user_subscription );
									}
								}
							}
						} else {
							if( method_exists( 'WC_Subscriptions', 'get_total_subscription_count' ) )
								$count = WC_Subscriptions::get_total_subscription_count();
							else
								$count = "~2500";
						}
					}
				}
				break;

			case 'product_vendor':
				$term_taxonomy = 'shop_vendor';
				if( taxonomy_exists( $term_taxonomy ) )
					$count = wp_count_terms( $term_taxonomy );
				break;

			case 'commission':
				$post_type = 'shop_commission';
				if( post_type_exists( $post_type ) )
					$count = wp_count_posts( $post_type );
				break;

			case 'shipping_class':
				$term_taxonomy = 'product_shipping_class';
				if( taxonomy_exists( $term_taxonomy ) )
					$count = wp_count_terms( $term_taxonomy );
				break;

			case 'attribute':
				$attributes = ( function_exists( 'wc_get_attribute_taxonomies' ) ? wc_get_attribute_taxonomies() : array() );
				$count = count( $attributes );
				break;

		}
		if( isset( $count ) || $count_sql ) {
			if( isset( $count ) ) {
				if( is_object( $count ) ) {
					$count = (array)$count;
					$count = (int)array_sum( $count );
				}
				return $count;
			} else {
				if( $count_sql )
					$count = $wpdb->get_var( $count_sql );
				else
					$count = 0;
			}
			return $count;
		} else {
			return 0;
		}

	}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:101,代码来源:functions.php

示例2: display_database_upgrade_helper

    /**
     * Let the site administrator know we are upgrading the database and provide a confirmation is complete.
     *
     * This is important to avoid the possibility of a database not upgrading correctly, but the site continuing
     * to function without any remedy.
     *
     * @since 1.2
     */
    public static function display_database_upgrade_helper()
    {
        global $woocommerce;
        wp_register_style('wcs-upgrade', plugins_url('/css/wcs-upgrade.css', WC_Subscriptions::$plugin_file));
        wp_register_script('wcs-upgrade', plugins_url('/js/wcs-upgrade.js', WC_Subscriptions::$plugin_file), 'jquery');
        $script_data = array('really_old_version' => version_compare(self::$active_version, '1.4', '<') ? 'true' : 'false', 'hooks_per_request' => self::$upgrade_limit, 'ajax_url' => admin_url('admin-ajax.php'));
        wp_localize_script('wcs-upgrade', 'wcs_update_script_data', $script_data);
        // Can't get subscription count with database structure < 1.4
        if ('false' == $script_data['really_old_version']) {
            $subscription_count = WC_Subscriptions::get_total_subscription_count();
            $estimated_duration = ceil($subscription_count / 500);
        }
        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
        ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php 
        language_attributes();
        ?>
>
<head>
	<meta http-equiv="Content-Type" content="<?php 
        bloginfo('html_type');
        ?>
; charset=<?php 
        echo get_option('blog_charset');
        ?>
" />
	<title><?php 
        _e('WooCommerce Subscriptions Update', 'woocommerce-subscriptions');
        ?>
</title>
	<?php 
        wp_admin_css('install', true);
        ?>
	<?php 
        wp_admin_css('ie', true);
        ?>
	<?php 
        wp_print_styles('wcs-upgrade');
        ?>
	<?php 
        wp_print_scripts('jquery');
        ?>
	<?php 
        wp_print_scripts('wcs-upgrade');
        ?>
</head>
<body class="wp-core-ui">
<h1 id="logo"><img alt="WooCommerce Subscriptions" width="325px" height="120px" src="<?php 
        echo plugins_url('images/woocommerce_subscriptions_logo.png', WC_Subscriptions::$plugin_file);
        ?>
" /></h1>
<div id="update-welcome">
	<h2><?php 
        _e('Database Update Required', 'woocommerce-subscriptions');
        ?>
</h2>
	<p><?php 
        _e('The WooCommerce Subscriptions plugin has been updated!', 'woocommerce-subscriptions');
        ?>
</p>
	<p><?php 
        _e('Before we send you on your way, we need to update your database to the newest version. If you do not have a recent backup of your site, now is a good time to create one.', 'woocommerce-subscriptions');
        ?>
</p>
	<p><?php 
        _e('The update process may take a little while, so please be patient.', 'woocommerce-subscriptions');
        ?>
</p>
	<form id="subscriptions-upgrade" method="get" action="<?php 
        echo admin_url('admin.php');
        ?>
">
		<input type="submit" class="button" value="<?php 
        _e('Update Database', 'woocommerce-subscriptions');
        ?>
">
	</form>
</div>
<div id="update-messages">
	<h2><?php 
        _e('Update in Progress', 'woocommerce-subscriptions');
        ?>
</h2>
	<?php 
        if ('false' == $script_data['really_old_version']) {
            ?>
	<p><?php 
            printf(__('The full update process for the %s subscriptions on your site will take approximately %s to %s minutes.', 'woocommerce-subscriptions'), $subscription_count, $estimated_duration, $estimated_duration * 2);
            ?>
</p>
	<?php 
//.........这里部分代码省略.........
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:101,代码来源:class-wc-subscriptions-upgrader.php


注:本文中的WC_Subscriptions::get_total_subscription_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。