本文整理汇总了PHP中c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max方法的具体用法?PHP c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max怎么用?PHP c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_encryption
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_gifts
public function generate_gifts($args)
{
$default_args = array('quantity' => 0, 'discount' => '', 'directive' => '', 'singulars' => '');
$args = array_merge($default_args, $args);
$args = array_intersect_key($args, $default_args);
$quantity = (int) $args['quantity'];
$discount = str_replace('|', '', trim((string) $args['discount']));
$directive = str_replace('|', '', trim((string) $args['directive']));
$singulars = str_replace('|', '', trim((string) $args['singulars']));
if (!($quantity = (int) $quantity) || $quantity < 1) {
return array();
}
// Not possible.
for ($_i = 0, $gifts = array(); $_i < $quantity; $_i++) {
$_gift_code = c_ws_plugin__s2member_utils_encryption::uunnci_key_20_max();
$_gift_code = $this->n_code('GC' . str_pad($_gift_code, 20, '0', STR_PAD_LEFT));
$_gift_list = $_gift_code . '|' . $discount . '||' . $directive . '|' . $singulars . '||1';
// `code|discount|dates|directive|singulars|users|max uses`.
$_gift = $this->list_to_coupons($_gift_list, FALSE);
$_gift = array_merge(array_pop($_gift), array('is_gift' => TRUE));
$gifts[$_gift_code] = $_gift;
// A coupon code that's a gift.
add_option($this->gift_option_key($_gift_code), $gifts[$_gift_code], '', 'no');
}
unset($_i, $_gift_code, $_gift_list, $_gift);
// Housekeeping.
return $gifts;
}