本文整理汇总了PHP中WC_Subscriptions::is_large_site方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Subscriptions::is_large_site方法的具体用法?PHP WC_Subscriptions::is_large_site怎么用?PHP WC_Subscriptions::is_large_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Subscriptions
的用法示例。
在下文中一共展示了WC_Subscriptions::is_large_site方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_large_site
/**
* A flag to indicate whether the current site has roughly more than 3000 subscriptions. Used to disable
* features on the Manage Subscriptions list table that do not scale well (yet).
*
* @since 1.4.4
*/
public static function is_large_site()
{
if (false === self::$is_large_site) {
self::$is_large_site = filter_var(get_option('wcs_is_large_site'), FILTER_VALIDATE_BOOLEAN);
if (false === self::$is_large_site && self::get_total_subscription_count() > 2500) {
add_option('wcs_is_large_site', 'true', '', false);
self::$is_large_site = true;
}
}
return apply_filters('woocommerce_subscriptions_is_large_site', self::$is_large_site);
}
示例2: get_sortable_columns
/**
* Make the table sortable by all columns and set the default sort field to be start_date.
*
* @return array An associative array containing all the columns that should be sortable: 'slugs' => array( 'data_values', bool )
* @since 1.0
*/
public function get_sortable_columns()
{
$sortable_columns = array('status' => array('status', false), 'order_id' => array('order_id', false), 'title' => array('_order_item_name', false), 'user' => array('user_display_name', false), 'start_date' => array('start_date', true), 'expiry_date' => array('expiry_date', false), 'trial_expiry_date' => array('trial_expiry_date', false), 'end_date' => array('end_date', false), 'last_payment_date' => array('last_payment_date', false), 'renewal_order_count' => array('renewal_order_count', false));
if (false === WC_Subscriptions::is_large_site()) {
$sortable_columns['next_payment_date'] = array('next_payment_date', false);
}
return $sortable_columns;
}
示例3: woo_ce_return_count
//.........这里部分代码省略.........
if( $user )
$order->email = $user->user_email;
unset( $user );
} 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;
示例4: subscriptions_management_page
/**
* Outputs the Subscription Management admin page with a sortable @see WC_Subscriptions_List_Table used to
* display all the subscriptions that have been purchased.
*
* @uses WC_Subscriptions_List_Table
* @since 1.0
*/
public static function subscriptions_management_page()
{
$subscriptions_table = self::get_subscriptions_list_table();
$subscriptions_table->prepare_items();
?>
<div class="wrap">
<div id="icon-woocommerce" class="icon32-woocommerce-users icon32"><br/></div>
<h2><?php
_e('Manage Subscriptions', 'woocommerce-subscriptions');
?>
</h2>
<?php
$subscriptions_table->messages();
?>
<?php
$subscriptions_table->views();
?>
<?php
if (false === WC_Subscriptions::is_large_site()) {
?>
<form id="subscriptions-search" action="" method="get"><?php
// Don't send all the subscription meta across
?>
<?php
$subscriptions_table->search_box(__('Search Subscriptions', 'woocommerce-subscriptions'), 'subscription');
?>
<input type="hidden" name="page" value="subscriptions" />
<?php
if (isset($_REQUEST['status'])) {
?>
<input type="hidden" name="status" value="<?php
echo esc_attr($_REQUEST['status']);
?>
" />
<?php
}
?>
</form>
<?php
}
?>
<form id="subscriptions-filter" action="" method="get">
<?php
$subscriptions_table->display();
?>
</form>
</div>
<?php
}