本文整理匯總了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;
}