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


PHP WC_Subscriptions_Manager::get_subscription_period_strings方法代码示例

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


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

示例1: get_order_subscription_string

 /**
  * Creates a string representation of the subscription period/term for each item in the cart
  * 
  * @param $price float (optional) The price to display in the subscription. Defaults to empty, which returns just the period & duration components of the string.
  * @since 1.0
  */
 public static function get_order_subscription_string($order, $price = '', $sign_up_fee = '')
 {
     if (count($order->get_items()) == 1) {
         $subscription_period = self::get_subscription_period($order);
         $subscription_length = self::get_subscription_length($order);
         $subscription_interval = self::get_subscription_interval($order);
         $subscription_trial_length = self::get_subscription_trial_length($order);
         $subscription_string = sprintf(_n(' %s / %s', ' %s every %s', $subscription_interval, WC_Subscriptions::$text_domain), $price, WC_Subscriptions_Manager::get_subscription_period_strings($subscription_interval, strtolower($subscription_period)));
         if ($subscription_length) {
             $ranges = WC_Subscriptions_Manager::get_subscription_ranges($subscription_period);
             $subscription_string = sprintf(__('%s for %s', WC_Subscriptions::$text_domain), $subscription_string, $ranges[$subscription_length]);
         }
         if ($subscription_trial_length > 0) {
             $trial_lengths = WC_Subscriptions_Manager::get_subscription_trial_lengths($subscription_period);
             $subscription_string = sprintf(__('%s with %s free trial', WC_Subscriptions::$text_domain), $subscription_string, $trial_lengths[$subscription_trial_length]);
         }
         $sign_up_fee = !empty($sign_up_fee) ? $sign_up_fee : self::get_meta($order, '_sign_up_fee_total');
         if ($sign_up_fee > 0) {
             if (self::is_renewal($order)) {
                 $subscription_string = sprintf(__('%s with a %s initial payment', WC_Subscriptions::$text_domain), $subscription_string, woocommerce_price($sign_up_fee));
             } else {
                 $subscription_string = sprintf(__('%s with a %s sign-up fee', WC_Subscriptions::$text_domain), $subscription_string, woocommerce_price($sign_up_fee));
             }
         }
     } else {
         $subscription_string = __('Multiple Subscriptions', WC_Subscriptions::$text_domain);
     }
     return $subscription_string;
 }
开发者ID:picassentviu,项目名称:AMMPro,代码行数:35,代码来源:class-wc-subscriptions-order.php

示例2: subscription_pricing_fields

 /**
  * Output the subscription specific pricing fields on the "Edit Product" admin page.
  * 
  * @since 1.0
  */
 public static function subscription_pricing_fields()
 {
     global $post;
     // Set month as the default billing period
     if (!($subscription_period = get_post_meta($post->ID, '_subscription_period', true))) {
         $subscription_period = 'month';
     }
     echo '<div class="options_group show_if_subscription subscription_pricing">';
     // Subscription Price
     woocommerce_wp_text_input(array('id' => '_subscription_price', 'class' => 'wc_input_subscription_price', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain)));
     // Subscription Period Interval
     woocommerce_wp_select(array('id' => '_subscription_period_interval', 'class' => 'wc_input_subscription_period_interval', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings()));
     // Billing Period
     woocommerce_wp_select(array('id' => '_subscription_period', 'class' => 'wc_input_subscription_period', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
     // Subscription Length
     woocommerce_wp_select(array('id' => '_subscription_length', 'class' => 'wc_input_subscription_length', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'description' => sprintf(__('with a %s', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol())));
     // Sign-up Fee
     woocommerce_wp_text_input(array('id' => '_subscription_sign_up_fee', 'class' => 'wc_input_subscription_intial_price', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'description' => __('sign-up fee', WC_Subscriptions::$text_domain)));
     // Trial Length
     woocommerce_wp_text_input(array('id' => '_subscription_trial_length', 'class' => 'wc_input_subscription_trial_length', 'label' => __('Free Trial', WC_Subscriptions::$text_domain)));
     // Trial Period
     woocommerce_wp_select(array('id' => '_subscription_trial_period', 'class' => 'wc_input_subscription_trial_period', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_available_time_periods(), 'description' => sprintf(__('Include an optional period of time to wait before charging the first recurring payment. Any sign up fee will still be charged at the outset of the subscription. %s', WC_Subscriptions::$text_domain), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($post->ID)));
     do_action('woocommerce_subscriptions_product_options_pricing');
     echo '</div>';
     echo '<div class="show_if_subscription clear"></div>';
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:31,代码来源:class-wc-subscriptions-admin.php

示例3: subscription_pricing_fields

 /**
  * Output the subscription specific pricing fields on the "Edit Product" admin page.
  * 
  * @since 1.0
  */
 public static function subscription_pricing_fields()
 {
     global $post;
     // Set month as the default billing period
     if (!($subscription_period = get_post_meta($post->ID, '_subscription_period', true))) {
         $subscription_period = 'month';
     }
     echo '<div class="options_group show_if_subscription subscription_pricing">';
     // Subscription Price
     woocommerce_wp_text_input(array('id' => '_subscription_price', 'class' => 'wc_input_subscription_price', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain)));
     // Subscription Period Interval
     woocommerce_wp_select(array('id' => '_subscription_period_interval', 'class' => 'wc_input_subscription_period_interval', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings()));
     // Billing Period
     woocommerce_wp_select(array('id' => '_subscription_period', 'class' => 'wc_input_subscription_period', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
     // Subscription Length
     woocommerce_wp_select(array('id' => '_subscription_length', 'class' => 'wc_input_subscription_length', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'description' => sprintf(__('with a %s', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol())));
     // Sign-up Fee
     woocommerce_wp_text_input(array('id' => '_subscription_sign_up_fee', 'class' => 'wc_input_subscription_intial_price', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'description' => __('sign-up fee and', WC_Subscriptions::$text_domain)));
     // Trial Period
     woocommerce_wp_select(array('id' => '_subscription_trial_length', 'class' => 'wc_input_subscription_trial_length', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_trial_lengths($subscription_period), 'description' => __('free trial', WC_Subscriptions::$text_domain)));
     do_action('woocommerce_subscriptions_product_options_pricing');
     echo '</div>';
 }
开发者ID:picassentviu,项目名称:AMMPro,代码行数:28,代码来源:class-wc-subscriptions-admin.php

示例4: get_subscription_price_string

 /**
  * Creates a subscription price string from an array of subscription details. For example, ""$5 / month for 12 months".
  *
  * @param array $subscription_details A set of name => value pairs for the subscription details to include in the string. Available keys:
  *		'initial_amount': The upfront payment for the subscription, including sign up fees, as a string from the @see woocommerce_price(). Default empty string (no initial payment)
  *		'initial_description': The word after the initial payment amount to describe the amount. Examples include "now" or "initial payment". Defaults to "up front".
  *		'recurring_amount': The amount charged per period. Default 0 (no recurring payment).
  *		'subscription_interval': How regularly the subscription payments are charged. Default 1, meaning each period e.g. per month.
  *		'subscription_period': The temporal period of the subscription. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings()
  *		'subscription_length': The total number of periods the subscription should continue for. Default 0, meaning continue indefinitely.
  *		'trial_length': The total number of periods the subscription trial period should continue for.  Default 0, meaning no trial period.
  *		'trial_period': The temporal period for the subscription's trial period. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings()
  * @since 1.2
  * @return float $proportion A proportion of the total (e.g. 0.5 is half of the total)
  */
 public static function get_subscription_price_string($subscription_details)
 {
     $subscription_details = wp_parse_args($subscription_details, array('initial_amount' => '', 'initial_description' => __('up front', WC_Subscriptions::$text_domain), 'recurring_amount' => '', 'subscription_interval' => 1, 'subscription_period' => '', 'subscription_length' => 0, 'trial_length' => 0, 'trial_period' => ''));
     $subscription_details['subscription_period'] = strtolower($subscription_details['subscription_period']);
     // Make sure prices have been through woocommerce_price()
     $initial_amount_string = is_numeric($subscription_details['initial_amount']) ? woocommerce_price($subscription_details['initial_amount']) : $subscription_details['initial_amount'];
     $recurring_amount_string = is_numeric($subscription_details['recurring_amount']) ? woocommerce_price($subscription_details['recurring_amount']) : $subscription_details['recurring_amount'];
     $subscription_period_string = WC_Subscriptions_Manager::get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']);
     $subscription_ranges = WC_Subscriptions_Manager::get_subscription_ranges();
     if ($subscription_details['subscription_length'] > 0 && $subscription_details['subscription_length'] == $subscription_details['subscription_interval']) {
         if (!empty($subscription_details['initial_amount'])) {
             $subscription_string = sprintf(__('%s %s then %s', WC_Subscriptions::$text_domain), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string);
         } else {
             $subscription_string = $recurring_amount_string;
         }
     } elseif (!empty($subscription_details['initial_amount'])) {
         $subscription_string = sprintf(_n('%s %s then %s / %s', '%s %s then %s every %s', $subscription_details['subscription_interval'], WC_Subscriptions::$text_domain), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $subscription_period_string);
     } elseif (!empty($subscription_details['recurring_amount'])) {
         $subscription_string = sprintf(_n('%s / %s', ' %s every %s', $subscription_details['subscription_interval'], WC_Subscriptions::$text_domain), $recurring_amount_string, $subscription_period_string);
     } else {
         $subscription_string = '';
     }
     if ($subscription_details['subscription_length'] > 0) {
         $subscription_string = sprintf(__('%s for %s', WC_Subscriptions::$text_domain), $subscription_string, $subscription_ranges[$subscription_details['subscription_period']][$subscription_details['subscription_length']]);
     }
     if ($subscription_details['trial_length'] > 1 || empty($subscription_details['initial_amount']) && $subscription_details['trial_length'] > 0) {
         $trial_length = self::get_subscription_trial_period_strings($subscription_details['trial_length'], $subscription_details['trial_period']);
         if (!empty($subscription_details['initial_amount'])) {
             $subscription_string = sprintf(__('%s with %s free trial', WC_Subscriptions::$text_domain), $subscription_string, $trial_length);
         } else {
             $subscription_string = sprintf(__('%s free trial then %s', WC_Subscriptions::$text_domain), ucfirst($trial_length), $subscription_string);
         }
     }
     return apply_filters('woocommerce_subscription_price_string', $subscription_string, $subscription_details);
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:50,代码来源:class-wc-subscriptions-manager.php

示例5: get_price_string

 /**
  * Returns a string representing the details of the subscription. 
  *
  * For example "$20 per Month for 3 Months with a $10 sign-up fee".
  *
  * @param WC_Product|int $product A WC_Product object or ID of a WC_Product.
  * @param array $inclusions An associative array of flags to indicate how to calculate the price and what to include, values:
  *			'tax_calculation'     => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively
  *			'subscription_length' => true to include subscription's length (default) or false to exclude it
  *			'sign_up_fee'         => true to include subscription's sign up fee (default) or false to exclude it
  *			'price'               => string a price to short-circuit the price calculations and use in a string for the product
  * @since 1.0
  */
 public static function get_price_string($product, $include = array())
 {
     global $wp_locale;
     if (!is_object($product)) {
         $product = WC_Subscriptions::get_product($product);
     }
     if (!self::is_subscription($product)) {
         return;
     }
     $include = wp_parse_args($include, array('tax_calculation' => get_option('woocommerce_tax_display_shop'), 'subscription_price' => true, 'subscription_period' => true, 'subscription_length' => true, 'sign_up_fee' => true, 'trial_length' => true));
     $include = apply_filters('woocommerce_subscriptions_product_price_string_inclusions', $include, $product);
     $base_price = self::get_price($product);
     if (true === $include['sign_up_fee']) {
         $sign_up_fee = self::get_sign_up_fee($product);
     } elseif (false !== $include['sign_up_fee']) {
         // Allow override of product's sign-up fee
         $sign_up_fee = $include['sign_up_fee'];
     } else {
         $sign_up_fee = 0;
     }
     if ($include['tax_calculation'] != false) {
         if (in_array($include['tax_calculation'], array('exclude_tax', 'excl'))) {
             // Subtract Tax
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = $product->get_price_excluding_tax(1, $include['price']);
             }
             if (true === $include['sign_up_fee']) {
                 $sign_up_fee = $product->get_sign_up_fee_excluding_tax();
             }
         } else {
             // Add Tax
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = $product->get_price_including_tax();
             }
             if (true === $include['sign_up_fee']) {
                 $sign_up_fee = $product->get_sign_up_fee_including_tax();
             }
         }
     } else {
         if (isset($include['price'])) {
             $price = $include['price'];
         } else {
             $price = woocommerce_price($base_price);
         }
     }
     $price .= ' <span class="subscription-details">';
     $billing_interval = self::get_interval($product);
     $billing_period = self::get_period($product);
     $subscription_length = self::get_length($product);
     $trial_length = self::get_trial_length($product);
     $trial_period = self::get_trial_period($product);
     if (is_numeric($sign_up_fee)) {
         $sign_up_fee = woocommerce_price($sign_up_fee);
     }
     if ($include['subscription_length']) {
         $ranges = WC_Subscriptions_Manager::get_subscription_ranges($billing_period);
     }
     if ($include['subscription_length'] && $subscription_length != 0) {
         $include_length = true;
     } else {
         $include_length = false;
     }
     $subscription_string = '';
     if ($include['subscription_price'] && $include['subscription_period']) {
         // Allow extensions to not show price or billing period e.g. Name Your Price
         if ($include_length && $subscription_length == $billing_interval) {
             $subscription_string = $price;
             // Only for one billing period so show "$5 for 3 months" instead of "$5 every 3 months for 3 months"
         } elseif (WC_Subscriptions_Synchroniser::is_product_synced($product) && in_array($billing_period, array('week', 'month', 'year'))) {
             $payment_day = WC_Subscriptions_Synchroniser::get_products_payment_day($product);
             switch ($billing_period) {
                 case 'week':
                     $payment_day_of_week = WC_Subscriptions_Synchroniser::get_weekday($payment_day);
                     if (1 == $billing_interval) {
                         // e.g. $5 every Wednesday
                         $subscription_string = sprintf(__('%s every %s', 'woocommerce-subscriptions'), $price, $payment_day_of_week);
                     } else {
                         // e.g. $5 every 2 weeks on Wednesday
                         $subscription_string = sprintf(__('%s every %s on %s', 'woocommerce-subscriptions'), $price, WC_Subscriptions_Manager::get_subscription_period_strings($billing_interval, $billing_period), $payment_day_of_week);
                     }
                     break;
                 case 'month':
                     if (1 == $billing_interval) {
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:101,代码来源:class-wc-subscriptions-product.php

示例6: get_price_string

 /**
  * Returns a string representing the details of the subscription. 
  *
  * For example "$20 per Month for 3 Months with a $10 sign-up fee".
  *
  * @param WC_Product|int $product A WC_Product object or ID of a WC_Product.
  * @param array $inclusions An associative array of flags to indicate how to calculate the price and what to include, values:
  *			'tax_calculation'     => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively
  *			'subscription_length' => true to include subscription's length (default) or false to exclude it
  *			'sign_up_fee'         => true to include subscription's sign up fee (default) or false to exclude it
  *			'price'               => string a price to short-circuit the price calculations and use in a string for the product
  * @since 1.0
  */
 public static function get_price_string($product, $include = array())
 {
     if (!is_object($product)) {
         $product = WC_Subscriptions::get_product($product);
     }
     if (!self::is_subscription($product)) {
         return;
     }
     $include = wp_parse_args($include, array('tax_calculation' => false, 'subscription_price' => true, 'subscription_period' => true, 'subscription_length' => true, 'sign_up_fee' => true, 'trial_length' => true));
     $include = apply_filters('woocommerce_subscriptions_product_price_string_inclusions', $include, $product);
     $base_price = self::get_price($product);
     if (true === $include['sign_up_fee']) {
         $sign_up_fee = self::get_sign_up_fee($product);
     } elseif (false !== $include['sign_up_fee']) {
         // Allow override of product's sign-up fee
         $sign_up_fee = $include['sign_up_fee'];
     } else {
         $sign_up_fee = 0;
     }
     if ($include['tax_calculation'] != false) {
         if ($include['tax_calculation'] == 'exclude_tax') {
             // Subtract Tax
             $tax_per_period = self::calculate_tax_for_subscription($base_price, $product);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($base_price - $tax_per_period);
             }
             if ($sign_up_fee > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($sign_up_fee, $product);
                 $sign_up_fee = $sign_up_fee - $sign_up_tax;
             }
         } else {
             // Add Tax
             $tax_per_period = self::calculate_tax_for_subscription($base_price, $product, true);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($base_price + $tax_per_period);
             }
             if ($sign_up_fee > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($sign_up_fee, $product, true);
                 $sign_up_fee = $sign_up_fee - $sign_up_tax;
             }
         }
     } else {
         if (isset($include['price'])) {
             $price = $include['price'];
         } else {
             $price = woocommerce_price($base_price);
         }
     }
     $billing_interval = self::get_interval($product);
     $subscription_length = self::get_length($product);
     $trial_length = self::get_trial_length($product);
     $trial_period = self::get_trial_period($product);
     if (is_numeric($sign_up_fee)) {
         $sign_up_fee = woocommerce_price($sign_up_fee);
     }
     if ($include['subscription_length']) {
         $ranges = WC_Subscriptions_Manager::get_subscription_ranges(self::get_period($product));
     }
     if ($include['subscription_length'] && $subscription_length != 0) {
         $include_length = true;
     } else {
         $include_length = false;
     }
     $subscription_string = '';
     if ($include['subscription_price'] && $include['subscription_period']) {
         // Allow extensions to not show price or billing period e.g. Name Your Price
         if ($include_length && $subscription_length == $billing_interval) {
             $subscription_string = $price;
             // Only for one billing period so show "$5 for 3 months" instead of "$5 every 3 months for 3 months"
         } else {
             $subscription_string = sprintf(_n(' %s / %s', ' %s every %s', $billing_interval, 'woocommerce-subscriptions'), $price, WC_Subscriptions_Manager::get_subscription_period_strings($billing_interval, self::get_period($product)));
         }
     } elseif ($include['subscription_price']) {
         $subscription_string = $price;
     } elseif ($include['subscription_period']) {
         $subscription_string = sprintf(_n('%s', 'every %s', $billing_interval, 'woocommerce-subscriptions'), WC_Subscriptions_Manager::get_subscription_period_strings($billing_interval, self::get_period($product)));
     }
     // Add the length to the end
     if ($include_length) {
         $subscription_string = sprintf(__('%s for %s', 'woocommerce-subscriptions'), $subscription_string, $ranges[$subscription_length]);
     }
     if ($include['trial_length'] && $trial_length != 0) {
         $trial_string = WC_Subscriptions_Manager::get_subscription_trial_period_strings($trial_length, $trial_period);
//.........这里部分代码省略.........
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:101,代码来源:class-wc-subscriptions-product.php

示例7: variable_subscription_pricing_fields

    /**
     * Output the subscription specific pricing fields on the "Edit Product" admin page.
     *
     * @since 1.3
     */
    public static function variable_subscription_pricing_fields($loop, $variation_data, $variation)
    {
        global $woocommerce, $thepostid;
        // Set month as the default billing period
        if (!($subscription_period = get_post_meta($variation->ID, '_subscription_period', true))) {
            $subscription_period = 'month';
        }
        // When called via Ajax
        if (!function_exists('woocommerce_wp_text_input')) {
            require_once $woocommerce->plugin_path() . '/admin/post-types/writepanels/writepanels-init.php';
        }
        if (!isset($thepostid)) {
            $thepostid = $variation->post_parent;
        }
        ?>
<tr class="variable_subscription_pricing show_if_variable-subscription">
	<td colspan="2">
		<label><?php 
        printf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
        ?>
</label>
		<?php 
        // Subscription Price
        woocommerce_wp_text_input(array('id' => 'variable_subscription_price[' . $loop . ']', 'class' => 'wc_input_subscription_price', 'wrapper_class' => '_subscription_price_field', 'label' => sprintf(__('Subscription Price (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_price', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
        // Subscription Period Interval
        woocommerce_wp_select(array('id' => 'variable_subscription_period_interval[' . $loop . ']', 'class' => 'wc_input_subscription_period_interval', 'wrapper_class' => '_subscription_period_interval_field', 'label' => __('Subscription Periods', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings(), 'value' => get_post_meta($variation->ID, '_subscription_period_interval', true)));
        // Billing Period
        woocommerce_wp_select(array('id' => 'variable_subscription_period[' . $loop . ']', 'class' => 'wc_input_subscription_period', 'wrapper_class' => '_subscription_period_field', 'label' => __('Billing Period', WC_Subscriptions::$text_domain), 'value' => $subscription_period, 'description' => __('for', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
        // Subscription Length
        woocommerce_wp_select(array('id' => 'variable_subscription_length[' . $loop . ']', 'class' => 'wc_input_subscription_length', 'wrapper_class' => '_subscription_length_field', 'label' => __('Subscription Length', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'value' => get_post_meta($variation->ID, '_subscription_length', true)));
        ?>
	</td>
	<td class="sign-up-fee-cell show_if_variable-subscription">
		<label><?php 
        printf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol());
        ?>
</label>
<?php 
        // Sign-up Fee
        woocommerce_wp_text_input(array('id' => 'variable_subscription_sign_up_fee[' . $loop . ']', 'class' => 'wc_input_subscription_intial_price', 'wrapper_class' => '_subscription_sign_up_fee_field', 'label' => sprintf(__('Sign-up Fee (%s)', WC_Subscriptions::$text_domain), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_sign_up_fee', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
        ?>
	</td>
</tr>
<tr class="variable_subscription_trial show_if_variable-subscription">
	<td colspan="1" class="show_if_variable-subscription">
		<label><?php 
        _e('Free Trial', WC_Subscriptions::$text_domain);
        ?>
</label>
<?php 
        // Trial Length
        woocommerce_wp_text_input(array('id' => 'variable_subscription_trial_length[' . $loop . ']', 'class' => 'wc_input_subscription_trial_length', 'wrapper_class' => '_subscription_trial_length_field', 'label' => __('Free Trial', WC_Subscriptions::$text_domain), 'placeholder' => __('e.g. 3', WC_Subscriptions::$text_domain), 'value' => get_post_meta($variation->ID, '_subscription_trial_length', true)));
        // Trial Period
        woocommerce_wp_select(array('id' => 'variable_subscription_trial_period[' . $loop . ']', 'class' => 'wc_input_subscription_trial_period', 'wrapper_class' => '_subscription_trial_period_field', 'label' => __('Subscription Trial Period', WC_Subscriptions::$text_domain), 'options' => WC_Subscriptions_Manager::get_available_time_periods(), 'description' => sprintf(__('An optional period of time to wait before charging the first recurring payment. Any sign up fee will still be charged at the outset of the subscription. %s', WC_Subscriptions::$text_domain), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($variation->ID)));
        do_action('woocommerce_variable_subscription_pricing');
        ?>
	</td>
</tr>
<?php 
    }
开发者ID:bulats,项目名称:chef,代码行数:65,代码来源:class-wc-subscriptions-admin.php

示例8: get_subscription_price_string

 /**
  * Creates a subscription price string from an array of subscription details. For example, ""$5 / month for 12 months".
  *
  * @param array $subscription_details A set of name => value pairs for the subscription details to include in the string. Available keys:
  *		'initial_amount': The upfront payment for the subscription, including sign up fees, as a string from the @see woocommerce_price(). Default empty string (no initial payment)
  *		'initial_description': The word after the initial payment amount to describe the amount. Examples include "now" or "initial payment". Defaults to "up front".
  *		'recurring_amount': The amount charged per period. Default 0 (no recurring payment).
  *		'subscription_interval': How regularly the subscription payments are charged. Default 1, meaning each period e.g. per month.
  *		'subscription_period': The temporal period of the subscription. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings()
  *		'subscription_length': The total number of periods the subscription should continue for. Default 0, meaning continue indefinitely.
  *		'trial_length': The total number of periods the subscription trial period should continue for.  Default 0, meaning no trial period.
  *		'trial_period': The temporal period for the subscription's trial period. Should be one of {day|week|month|year} as used by @see self::get_subscription_period_strings()
  * @since 1.2
  * @return float $proportion A proportion of the total (e.g. 0.5 is half of the total)
  */
 public static function get_subscription_price_string($subscription_details)
 {
     global $wp_locale;
     $subscription_details = wp_parse_args($subscription_details, array('currency' => '', 'initial_amount' => '', 'initial_description' => __('up front', 'woocommerce-subscriptions'), 'recurring_amount' => '', 'subscription_interval' => 1, 'subscription_period' => '', 'subscription_length' => 0, 'trial_length' => 0, 'trial_period' => '', 'is_synced' => false, 'synchronised_payment_day' => 0));
     $subscription_details['subscription_period'] = strtolower($subscription_details['subscription_period']);
     // Make sure prices have been through woocommerce_price()
     $initial_amount_string = is_numeric($subscription_details['initial_amount']) ? woocommerce_price($subscription_details['initial_amount'], array('currency' => $subscription_details['currency'])) : $subscription_details['initial_amount'];
     $recurring_amount_string = is_numeric($subscription_details['recurring_amount']) ? woocommerce_price($subscription_details['recurring_amount'], array('currency' => $subscription_details['currency'])) : $subscription_details['recurring_amount'];
     $subscription_period_string = self::get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']);
     $subscription_ranges = self::get_subscription_ranges();
     if ($subscription_details['subscription_length'] > 0 && $subscription_details['subscription_length'] == $subscription_details['subscription_interval']) {
         if (!empty($subscription_details['initial_amount'])) {
             if ($subscription_details['subscription_length'] == $subscription_details['subscription_interval'] && $subscription_details['trial_length'] == 0) {
                 $subscription_string = $initial_amount_string;
             } else {
                 $subscription_string = sprintf(__('%s %s then %s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string);
             }
         } else {
             $subscription_string = $recurring_amount_string;
         }
     } elseif (true === $subscription_details['is_synced'] && in_array($subscription_details['subscription_period'], array('week', 'month', 'year'))) {
         // Verbosity is important here to enable translation
         $payment_day = $subscription_details['synchronised_payment_day'];
         switch ($subscription_details['subscription_period']) {
             case 'week':
                 $payment_day_of_week = WC_Subscriptions_Synchroniser::get_weekday($payment_day);
                 if (1 == $subscription_details['subscription_interval']) {
                     // e.g. $5 every Wednesday
                     if (!empty($subscription_details['initial_amount'])) {
                         $subscription_string = sprintf(__('%s %s then %s every %s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $payment_day_of_week);
                     } else {
                         $subscription_string = sprintf(__('%s every %s', 'woocommerce-subscriptions'), $recurring_amount_string, $payment_day_of_week);
                     }
                 } else {
                     // e.g. $5 every 2 weeks on Wednesday
                     if (!empty($subscription_details['initial_amount'])) {
                         $subscription_string = sprintf(__('%s %s then %s every %s on %s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions_Manager::get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']), $payment_day_of_week);
                     } else {
                         $subscription_string = sprintf(__('%s every %s on %s', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions_Manager::get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']), $payment_day_of_week);
                     }
                 }
                 break;
             case 'month':
                 if (1 == $subscription_details['subscription_interval']) {
                     // e.g. $15 on the 15th of each month
                     if (!empty($subscription_details['initial_amount'])) {
                         if ($payment_day > 27) {
                             $subscription_string = sprintf(__('%s %s then %s on the last day of each month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string);
                         } else {
                             $subscription_string = sprintf(__('%s %s then %s on the %s of each month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day));
                         }
                     } else {
                         if ($payment_day > 27) {
                             $subscription_string = sprintf(__('%s on the last day of each month', 'woocommerce-subscriptions'), $recurring_amount_string);
                         } else {
                             $subscription_string = sprintf(__('%s on the %s of each month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day));
                         }
                     }
                 } else {
                     // e.g. $15 on the 15th of every 3rd month
                     if (!empty($subscription_details['initial_amount'])) {
                         if ($payment_day > 27) {
                             $subscription_string = sprintf(__('%s %s then %s on the last day of every %s month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                         } else {
                             $subscription_string = sprintf(__('%s %s then %s on the %s day of every %s month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                         }
                     } else {
                         if ($payment_day > 27) {
                             $subscription_string = sprintf(__('%s on the last day of every %s month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                         } else {
                             $subscription_string = sprintf(__('%s on the %s day of every %s month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                         }
                     }
                 }
                 break;
             case 'year':
                 if (1 == $subscription_details['subscription_interval']) {
                     // e.g. $15 on March 15th each year
                     if (!empty($subscription_details['initial_amount'])) {
                         $subscription_string = sprintf(__('%s %s then %s on %s %s each year', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']));
                     } else {
                         $subscription_string = sprintf(__('%s on %s %s each year', 'woocommerce-subscriptions'), $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']));
                     }
                 } else {
                     // e.g. $15 on March 15th every 3rd year
//.........这里部分代码省略.........
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:101,代码来源:class-wc-subscriptions-manager.php

示例9: get_price_string

 /**
  * Returns a string representing the details of the subscription. 
  * 
  * For example "$20 per Month for 3 Months with a $10 sign-up fee".
  * 
  * @param $product WC_Product | Int A WC_Product object or ID of a WC_Product.
  * @param $inclusions array An associative array of flags to indicate how to calculate the price and what to include, values:
  *			'tax_calculation'     => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively
  *			'subscription_length' => true to include subscription's length (default) or false to exclude it
  *			'sign_up_fee'         => true to include subscription's sign up fee (default) or false to exclude it
  *			'price'               => string a price to short-circuit the price calculations and use in a string for the product
  * @since 1.0
  */
 public static function get_price_string($product, $include = array())
 {
     if (!is_object($product)) {
         $product = new WC_Product($product);
     }
     // Shouldn't matter if product is variation as all we need is the product_type
     if (!self::is_subscription($product)) {
         return;
     }
     $include = wp_parse_args($include, array('tax_calculation' => false, 'subscription_length' => true, 'sign_up_fee' => true, 'trial_length' => true));
     if ($include['tax_calculation'] != false) {
         if ($include['tax_calculation'] == 'exclude_tax') {
             // Subtract Tax
             $tax_per_period = self::calculate_tax_for_subscription($product->product_custom_fields['_subscription_price'][0], $product);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($product->product_custom_fields['_subscription_price'][0] - $tax_per_period);
             }
             if ($product->product_custom_fields['_subscription_sign_up_fee'][0] > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($product->product_custom_fields['_subscription_sign_up_fee'][0], $product);
                 $sign_up_fee = $product->product_custom_fields['_subscription_sign_up_fee'][0] - $sign_up_tax;
             }
         } else {
             // Add Tax
             $tax_per_period = self::calculate_tax_for_subscription($product->product_custom_fields['_subscription_price'][0], $product, true);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($product->product_custom_fields['_subscription_price'][0] + $tax_per_period);
             }
             if ($product->product_custom_fields['_subscription_sign_up_fee'][0] > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($product->product_custom_fields['_subscription_sign_up_fee'][0], $product, true);
                 $sign_up_fee = $product->product_custom_fields['_subscription_sign_up_fee'][0] - $sign_up_tax;
             }
         }
     } else {
         if (isset($include['price'])) {
             $price = $include['price'];
         } else {
             $price = woocommerce_price($product->product_custom_fields['_subscription_price'][0]);
         }
         if ($product->product_custom_fields['_subscription_sign_up_fee'][0] > 0) {
             $sign_up_fee = $product->product_custom_fields['_subscription_sign_up_fee'][0];
         }
     }
     $subscription_string = sprintf(_n(' %s / %s', ' %s every %s', self::get_interval($product), WC_Subscriptions::$text_domain), $price, WC_Subscriptions_Manager::get_subscription_period_strings(self::get_interval($product), self::get_period($product)));
     if ($include['subscription_length'] && isset($product->product_custom_fields['_subscription_length'][0]) && $product->product_custom_fields['_subscription_length'][0] != 0) {
         $ranges = WC_Subscriptions_Manager::get_subscription_ranges(self::get_period($product));
         $subscription_string = sprintf(__('%s for %s', WC_Subscriptions::$text_domain), $subscription_string, $ranges[$product->product_custom_fields['_subscription_length'][0]]);
     }
     if ($include['trial_length'] && isset($product->product_custom_fields['_subscription_trial_length'][0]) && $product->product_custom_fields['_subscription_trial_length'][0] != 0) {
         $trial_lengths = WC_Subscriptions_Manager::get_subscription_trial_lengths(self::get_period($product));
         $subscription_string = sprintf(__('%s with %s free trial', WC_Subscriptions::$text_domain), $subscription_string, $trial_lengths[$product->product_custom_fields['_subscription_trial_length'][0]]);
     }
     if ($include['sign_up_fee'] && $product->product_custom_fields['_subscription_sign_up_fee'][0] > 0) {
         $subscription_string = sprintf(__('%s and a %s sign-up fee', WC_Subscriptions::$text_domain), $subscription_string, woocommerce_price($sign_up_fee));
     }
     return apply_filters('woocommerce_subscription_price_string', $subscription_string, $product);
 }
开发者ID:picassentviu,项目名称:AMMPro,代码行数:73,代码来源:class-wc-subscriptions-product.php

示例10: get_cart_subscription_string

 /**
  * Creates a string representation of the subscription period/term for each item in the cart
  * 
  * @param $price_string float (optional) The price to display in the subscription. Defaults to empty, which returns just the period & duration components of the string.
  * @param $include array (optional) Array of flags to determine what is included in the price. Options:
  * 			'length' Include the length of the subscription.
  * 			'sign_up_fee' Include the sign-up fee for the subscription.
  * 			'exclude_tax' Remove tax from the price (and other prices to include in the string, like sign-up fee)
  * @since 1.0
  */
 public static function get_cart_subscription_string($subscription_price, $sign_up_fee = 0)
 {
     global $woocommerce;
     if (strpos($subscription_price, $woocommerce->countries->inc_tax_or_vat()) !== false) {
         $subscription_price = str_replace($woocommerce->countries->inc_tax_or_vat(), '', $subscription_price);
     }
     if (strpos($subscription_price, $woocommerce->countries->ex_tax_or_vat()) !== false) {
         $subscription_price = str_replace($woocommerce->countries->ex_tax_or_vat(), '', $subscription_price);
     }
     $subscription_interval = self::get_cart_subscription_interval();
     $subscription_string = sprintf(_n(' %s / %s', ' %s every %s', $subscription_interval, WC_Subscriptions::$text_domain), $subscription_price, WC_Subscriptions_Manager::get_subscription_period_strings($subscription_interval, strtolower(self::get_cart_subscription_period())));
     if (self::get_cart_subscription_length()) {
         $ranges = WC_Subscriptions_Manager::get_subscription_ranges(self::get_cart_subscription_period());
         $subscription_string = sprintf(__('%s for %s', WC_Subscriptions::$text_domain), $subscription_string, $ranges[self::get_cart_subscription_length()]);
     }
     if (self::get_cart_subscription_trial_length()) {
         $trial_lengths = WC_Subscriptions_Manager::get_subscription_trial_lengths(self::get_cart_subscription_period());
         $subscription_string = sprintf(__('%s with %s free trial', WC_Subscriptions::$text_domain), $subscription_string, $trial_lengths[self::get_cart_subscription_trial_length()]);
     }
     if ($sign_up_fee > 0) {
         $subscription_string = sprintf(__('%s and a %s sign-up fee', WC_Subscriptions::$text_domain), $subscription_string, woocommerce_price($sign_up_fee));
     }
     return $subscription_string;
 }
开发者ID:picassentviu,项目名称:AMMPro,代码行数:34,代码来源:class-wc-subscriptions-cart.php

示例11: get_price_string

 /**
  * Returns a string representing the details of the subscription. 
  * 
  * For example "$20 per Month for 3 Months with a $10 sign-up fee".
  * 
  * @param $product WC_Product | Int A WC_Product object or ID of a WC_Product.
  * @param $inclusions array An associative array of flags to indicate how to calculate the price and what to include, values:
  *			'tax_calculation'     => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively
  *			'subscription_length' => true to include subscription's length (default) or false to exclude it
  *			'sign_up_fee'         => true to include subscription's sign up fee (default) or false to exclude it
  *			'price'               => string a price to short-circuit the price calculations and use in a string for the product
  * @since 1.0
  */
 public static function get_price_string($product, $include = array())
 {
     if (!is_object($product)) {
         $product = new WC_Product($product);
     }
     // Shouldn't matter if product is variation as all we need is the product_type
     if (!self::is_subscription($product)) {
         return;
     }
     $include = wp_parse_args($include, array('tax_calculation' => false, 'subscription_length' => true, 'sign_up_fee' => true, 'trial_length' => true));
     $base_price = self::get_price($product);
     $sign_up_fee = self::get_sign_up_fee($product);
     if ($include['tax_calculation'] != false) {
         if ($include['tax_calculation'] == 'exclude_tax') {
             // Subtract Tax
             $tax_per_period = self::calculate_tax_for_subscription($base_price, $product);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($base_price - $tax_per_period);
             }
             if ($sign_up_fee > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($sign_up_fee, $product);
                 $sign_up_fee = $sign_up_fee - $sign_up_tax;
             }
         } else {
             // Add Tax
             $tax_per_period = self::calculate_tax_for_subscription($base_price, $product, true);
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = woocommerce_price($base_price + $tax_per_period);
             }
             if ($sign_up_fee > 0) {
                 $sign_up_tax = self::calculate_tax_for_subscription($sign_up_fee, $product, true);
                 $sign_up_fee = $sign_up_fee - $sign_up_tax;
             }
         }
     } else {
         if (isset($include['price'])) {
             $price = $include['price'];
         } else {
             $price = woocommerce_price($base_price);
         }
     }
     $billing_interval = self::get_interval($product);
     $subscription_length = self::get_length($product);
     $trial_length = self::get_trial_length($product);
     $trial_period = self::get_trial_period($product);
     if ($include['subscription_length']) {
         $ranges = WC_Subscriptions_Manager::get_subscription_ranges(self::get_period($product));
     }
     if ($include['subscription_length'] && $subscription_length != 0) {
         $include_length = true;
     } else {
         $include_length = false;
     }
     if ($include_length && $subscription_length == $billing_interval) {
         $subscription_string = $price;
     } else {
         $subscription_string = sprintf(_n(' %s / %s', ' %s every %s', $billing_interval, WC_Subscriptions::$text_domain), $price, WC_Subscriptions_Manager::get_subscription_period_strings($billing_interval, self::get_period($product)));
     }
     // Add the length to the end
     if ($include_length) {
         $subscription_string = sprintf(__('%s for %s', WC_Subscriptions::$text_domain), $subscription_string, $ranges[$subscription_length]);
     }
     if ($include['trial_length'] && $trial_length != 0) {
         $trial_string = WC_Subscriptions_Manager::get_subscription_trial_period_strings($trial_length, $trial_period);
         $subscription_string = sprintf(__('%s with %s free trial', WC_Subscriptions::$text_domain), $subscription_string, $trial_string);
     }
     if ($include['sign_up_fee'] && self::get_sign_up_fee($product) > 0) {
         $subscription_string = sprintf(__('%s and a %s sign-up fee', WC_Subscriptions::$text_domain), $subscription_string, woocommerce_price($sign_up_fee));
     }
     return apply_filters('woocommerce_subscriptions_product_price_string', $subscription_string, $product, $include);
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:88,代码来源:class-wc-subscriptions-product.php

示例12: esc_html_e

?>
">

		<label for="variable_subscription_period[<?php 
echo $loop;
?>
]" class="wcs_hidden_label"><?php 
esc_html_e('Billing Period', 'woocommerce-subscriptions');
?>
</label>
		<select name="variable_subscription_period[<?php 
echo $loop;
?>
]" class="wc_input_subscription_period">
		<?php 
foreach (WC_Subscriptions_Manager::get_subscription_period_strings() as $key => $value) {
    ?>
			<option value="<?php 
    echo esc_attr($key);
    ?>
" <?php 
    selected($key, $subscription_period);
    ?>
><?php 
    echo esc_html($value);
    ?>
</option>
		<?php 
}
?>
		</select>
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:html-variation-price.php

示例13: get_subscription_period_strings

 /**
  * Return an i18n'ified associative array of all possible subscription periods.
  * ready for Subs 2.0 but with backcompat
  *
  * @since 2.2.8
  */
 public static function get_subscription_period_strings($number = 1, $period = '')
 {
     if (function_exists('wcs_get_subscription_period_strings')) {
         return wcs_get_subscription_period_strings($number, $period);
     } else {
         return WC_Subscriptions_Manager::get_subscription_period_strings($number, $period);
     }
 }
开发者ID:slavic18,项目名称:cats,代码行数:14,代码来源:class-wc-name-your-price-helpers.php

示例14: printf

    exit;
}
?>
<tr class="variable_subscription_pricing show_if_variable-subscription">
	<td colspan="2">
		<label><?php 
printf(__('Subscription Price (%s)', 'woocommerce-subscriptions'), get_woocommerce_currency_symbol());
?>
</label>
		<?php 
// Subscription Price
woocommerce_wp_text_input(array('id' => 'variable_subscription_price[' . $loop . ']', 'class' => 'wc_input_subscription_price', 'wrapper_class' => '_subscription_price_field', 'label' => sprintf(__('Subscription Price (%s)', 'woocommerce-subscriptions'), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 5.90', 'woocommerce-subscriptions'), 'value' => get_post_meta($variation->ID, '_subscription_price', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
// Subscription Period Interval
woocommerce_wp_select(array('id' => 'variable_subscription_period_interval[' . $loop . ']', 'class' => 'wc_input_subscription_period_interval', 'wrapper_class' => '_subscription_period_interval_field', 'label' => __('Subscription Periods', 'woocommerce-subscriptions'), 'options' => WC_Subscriptions_Manager::get_subscription_period_interval_strings(), 'value' => get_post_meta($variation->ID, '_subscription_period_interval', true)));
// Billing Period
woocommerce_wp_select(array('id' => 'variable_subscription_period[' . $loop . ']', 'class' => 'wc_input_subscription_period', 'wrapper_class' => '_subscription_period_field', 'label' => __('Billing Period', 'woocommerce-subscriptions'), 'value' => $subscription_period, 'description' => __('for', 'woocommerce-subscriptions'), 'options' => WC_Subscriptions_Manager::get_subscription_period_strings()));
// Subscription Length
woocommerce_wp_select(array('id' => 'variable_subscription_length[' . $loop . ']', 'class' => 'wc_input_subscription_length', 'wrapper_class' => '_subscription_length_field', 'label' => __('Subscription Length', 'woocommerce-subscriptions'), 'options' => WC_Subscriptions_Manager::get_subscription_ranges($subscription_period), 'value' => get_post_meta($variation->ID, '_subscription_length', true)));
?>
	</td>
</tr>
<tr class="variable_subscription_trial show_if_variable-subscription variable_subscription_trial_sign_up">
	<td class="sign-up-fee-cell show_if_variable-subscription">
<?php 
// Sign-up Fee
woocommerce_wp_text_input(array('id' => 'variable_subscription_sign_up_fee[' . $loop . ']', 'class' => 'wc_input_subscription_intial_price', 'wrapper_class' => '_subscription_sign_up_fee_field', 'label' => sprintf(__('Sign-up Fee (%s)', 'woocommerce-subscriptions'), get_woocommerce_currency_symbol()), 'placeholder' => __('e.g. 9.90', 'woocommerce-subscriptions'), 'value' => get_post_meta($variation->ID, '_subscription_sign_up_fee', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
?>
	</td>
	<td colspan="1" class="show_if_variable-subscription">
		<label><?php 
_e('Free Trial', 'woocommerce-subscriptions');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:html-variation-price.php


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