/** * Return an i18n'ified associative array of all possible subscription periods. * * @since 1.5 */ public static function get_billing_period_ranges($billing_period = '') { global $wp_locale; if (empty(self::$billing_period_ranges)) { foreach (array('week', 'month', 'year') as $key) { self::$billing_period_ranges[$key][0] = __('Do not synchronise', 'woocommerce-subscriptions'); } // Week $weekdays = array_merge($wp_locale->weekday, array($wp_locale->weekday[0])); unset($weekdays[0]); foreach ($weekdays as $i => $weekly_billing_period) { self::$billing_period_ranges['week'][$i] = sprintf(__('%s each week', 'woocommerce-subscriptions'), $weekly_billing_period); } // Month foreach (range(1, 27) as $i) { self::$billing_period_ranges['month'][$i] = sprintf(__('%s day of the month', 'woocommerce-subscriptions'), WC_Subscriptions::append_numeral_suffix($i)); } self::$billing_period_ranges['month'][28] = __('Last day of the month', 'woocommerce-subscriptions'); self::$billing_period_ranges = apply_filters('woocommerce_subscription_billing_period_ranges', self::$billing_period_ranges); } if (empty($billing_period)) { return self::$billing_period_ranges; } elseif (isset(self::$billing_period_ranges[$billing_period])) { return self::$billing_period_ranges[$billing_period]; } else { return array(); } }