本文整理汇总了PHP中WC_Subscriptions_Manager::get_available_time_periods方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Subscriptions_Manager::get_available_time_periods方法的具体用法?PHP WC_Subscriptions_Manager::get_available_time_periods怎么用?PHP WC_Subscriptions_Manager::get_available_time_periods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Subscriptions_Manager
的用法示例。
在下文中一共展示了WC_Subscriptions_Manager::get_available_time_periods方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _e
?>
">
<label for="variable_subscription_period[<?php
echo $loop;
?>
]" class="wcs_hidden_label"><?php
_e('Subscription Trial Period', 'woocommerce-subscriptions');
?>
</label>
<select name="variable_subscription_trial_period[<?php
echo $loop;
?>
]" class="wc_input_subscription_trial_period">
<?php
foreach (WC_Subscriptions_Manager::get_available_time_periods() as $key => $value) {
?>
<option value="<?php
echo esc_attr($key);
?>
" <?php
selected($key, $chosen_trial_period);
?>
><?php
echo esc_html($value);
?>
</option>
<?php
}
?>
</select>
示例2: get_trial_period_validation_message
/**
* Returns either a string or array of strings describing the allowable trial period range
* for a subscription.
*
* @since 1.0
*/
public static function get_trial_period_validation_message($form = 'combined')
{
$subscription_ranges = WC_Subscriptions_Manager::get_subscription_ranges();
if ('combined' == $form) {
$error_message = sprintf(__('The trial period can not exceed: %1s, %2s, %3s or %4s.', WC_Subscriptions::$text_domain), array_pop($subscription_ranges['day']), array_pop($subscription_ranges['week']), array_pop($subscription_ranges['month']), array_pop($subscription_ranges['year']));
} else {
foreach (WC_Subscriptions_Manager::get_available_time_periods() as $period => $string) {
$error_message[$period] = sprintf(__('The trial period can not exceed %1s.', WC_Subscriptions::$text_domain), array_pop($subscription_ranges[$period]));
}
}
return apply_filters('woocommerce_subscriptions_trial_period_validation_message', $error_message);
}
示例3: woocommerce_wp_text_input
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');
?>
</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', 'woocommerce-subscriptions'), 'placeholder' => __('e.g. 3', 'woocommerce-subscriptions'), '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', 'woocommerce-subscriptions'), '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', 'woocommerce-subscriptions'), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($variation->ID)));
?>
</td>
</tr>