本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::esc_dq方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::esc_dq方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::esc_dq怎么用?PHP c_ws_plugin__s2member_utils_strings::esc_dq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::esc_dq方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cp
//.........这里部分代码省略.........
update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
update_user_option($user_id, 's2member_custom', $paypal['custom']);
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
}
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
delete_user_option($user_id, 's2member_file_download_access_log');
delete_user_option($user_id, 's2member_auto_eot_time');
$pr_times = get_user_option('s2member_paid_registration_times', $user_id);
$pr_times['level'] = !$pr_times['level'] ? time() : $pr_times['level'];
// Preserves existing.
$pr_times['level' . $paypal['level']] = !$pr_times['level' . $paypal['level']] ? time() : $pr_times['level' . $paypal['level']];
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
// Update now.
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\\:/');
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\\. ID @ time of demotion\\:/');
$paypal['s2member_log'][] = 's2Member Level/Capabilities updated on Subscription modification.';
$sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_subject'];
// The same for standard and w/ Pro-Forms.
$msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_message'];
// The same for standard and w/ Pro-Forms.
$rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_email_recipients'];
// The same for standard and w/ Pro-Forms.
if (($rec = c_ws_plugin__s2member_utils_strings::fill_cvs($rec, $paypal['custom'])) && ($rec = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $rec))) {
if (($rec = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $rec)) && ($rec = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $rec))) {
if (($rec = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $rec)) && ($rec = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $rec))) {
if (($rec = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $rec)) && ($rec = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $rec))) {
if (($rec = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $rec)) && ($rec = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $rec))) {
if (($rec = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $rec)) && ($rec = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $rec))) {
if (($rec = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $rec)) && ($rec = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $rec))) {
if (($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec))) {
if (($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec))) {
if ($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $rec)) {
// **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
if ($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)) {
if (($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec))) {
if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $rec)) {
if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)) {
if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
if (($sbj = c_ws_plugin__s2member_utils_strings::fill_cvs($sbj, $paypal['custom'])) && ($sbj = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $sbj))) {
if (($sbj = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $sbj)) && ($sbj = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $sbj))) {
if (($sbj = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $sbj)) && ($sbj = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $sbj))) {
if (($sbj = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $sbj)) && ($sbj = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $sbj))) {
if (($sbj = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $sbj)) && ($sbj = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $sbj))) {
if (($sbj = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $sbj)) && ($sbj = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $sbj))) {
if (($sbj = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $sbj)) && ($sbj = preg_replace('/%%recurring\\/regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring'] ? $paypal['recurring'] . ' / ' . c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], TRUE) : '0 / non-recurring'), $sbj))) {
if (($sbj = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $sbj)) && ($sbj = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $sbj))) {
if (($sbj = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $sbj)) && ($sbj = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $sbj))) {
if ($sbj = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $sbj)) {
if ($sbj = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $sbj)) {
if (($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) && ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj))) {
if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $sbj)) {
if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $sbj)) {
if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $msg))) {
if (($msg = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $msg)) && ($msg = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $msg))) {
if (($msg = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $msg)) && ($msg = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $msg))) {
if (($msg = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $msg)) && ($msg = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $msg))) {
if (($msg = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $msg)) && ($msg = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $msg))) {
if (($msg = preg_replace('/%%initial_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['initial_term'])), $msg)) && ($msg = preg_replace('/%%regular_cycle%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(c_ws_plugin__s2member_utils_time::period_term($paypal['regular_term'], $paypal['recurring'])), $msg))) {
示例2: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110815
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
*
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
*/
public static function cp($vars = array())
{
extract($vars, EXTR_OVERWRITE | EXTR_REFS);
// Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
if (!empty($paypal['txn_type']) && preg_match('/^web_accept$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_wo_level_regex'], $paypal['item_number'])) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status'])) && !empty($paypal['txn_id']) && !empty($paypal['payer_email']) && (!empty($paypal['txn_baid']) || ($paypal['txn_baid'] = $paypal['txn_id'])) && (!empty($paypal['txn_cid']) || ($paypal['txn_cid'] = $paypal['txn_id']))) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify_before_new_ccaps', get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.';
list($paypal['level'], $paypal['ccaps'], $paypal['eotper']) = preg_split('/\\:/', $paypal['item_number'], 3);
$paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
$paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
$paypal['currency'] = strtoupper($paypal['mc_currency']);
// Normalize input currency.
$paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
if (!empty($coupon['coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
$coupon_class = new c_ws_plugin__s2member_pro_coupons();
$coupon_class->update_uses($coupon['coupon_code']);
}
if (preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1']) {
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['txn_id'], $paypal['option_selection1'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
if (!$user->has_cap('administrator')) {
$processing = $during = TRUE;
// Yes, we ARE processing this.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps', get_defined_vars());
unset($__refs, $__v);
$fields = get_user_option('s2member_custom_fields', $user_id);
// These will be needed in the routines below.
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
// Original IP during Registration.
$user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
// Now merge conditionally.
if (is_multisite() && !is_user_member_of_blog($user_id)) {
add_existing_user_to_blog(array('user_id' => $user_id, 'role' => get_option('default_role')));
$user = new WP_User($user_id);
}
if ($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps']))) {
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match('/^access_s2member_ccap_/', $cap)) {
$user->remove_cap($ccap = $cap);
}
}
}
if ($paypal['ccaps'] && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) {
foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap) {
if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
$user->add_cap('access_s2member_ccap_' . $ccap);
}
}
}
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
}
if (!empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
$user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
$user_coupons = array_unique(array_merge($user_coupons, (array) $coupon['full_coupon_code']));
update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
}
$paypal['s2member_log'][] = 's2Member Custom Capabilities updated w/ advanced update routines.';
$sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_subject'];
// The same for standard and w/ Pro-Forms.
$msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_message'];
// The same for standard and w/ Pro-Forms.
$rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_email_recipients'];
// The same for standard and w/ Pro-Forms.
if (($rec = c_ws_plugin__s2member_utils_strings::fill_cvs($rec, $paypal['custom'])) && ($rec = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $rec))) {
if (($rec = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $rec)) && ($rec = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $rec))) {
if (($rec = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $rec)) && ($rec = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $rec))) {
if (($rec = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $rec)) && ($rec = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $rec))) {
if (($rec = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $rec)) && ($rec = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $rec))) {
if (($rec = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name'])), $rec)) && ($rec = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name'])), $rec))) {
if ($rec = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $rec)) {
// **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. 'N\'ame' <email>).
if ($rec = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $rec)) {
if (($rec = preg_replace('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $rec)) && ($rec = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $rec))) {
if (($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $rec)) && ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $rec))) {
if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $rec)) {
if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $rec)) {
if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
if (($sbj = c_ws_plugin__s2member_utils_strings::fill_cvs($sbj, $paypal['custom'])) && ($sbj = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $sbj))) {
if (($sbj = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $sbj)) && ($sbj = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $sbj))) {
if (($sbj = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $sbj)) && ($sbj = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $sbj))) {
//.........这里部分代码省略.........
示例3: new_user_notification
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
/**/
if (in_array("admin", $notify)) {
/* Send Admin(s) a notification? */
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
$fields = get_user_option("s2member_custom_fields", $user_id);
$cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
$user_full_name = trim($user->first_name . " " . $user->last_name);
$user_ip = $_SERVER["REMOTE_ADDR"];
/**/
if ($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
if ($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) {
if ($rec = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(wp_login_url()), $rec)) {
if ($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name)), $rec)) {
if ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name)), $rec)) {
if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($user_full_name)), $rec)) {
if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $rec)) {
if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $rec)) {
if ($rec = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_pass), $rec)) {
if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ip), $rec)) {
if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $rec)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
/* Custom Registration/Profile Fields. */
if (!($rec = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $rec))) {
break;
}
}
}
/**/
if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]) {
if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) {
if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(wp_login_url()), $sbj)) {
if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $sbj)) {
if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $sbj)) {
if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_full_name), $sbj)) {
if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $sbj)) {
if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $sbj)) {
if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_pass), $sbj)) {
if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ip), $sbj)) {
if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $sbj)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
/* Custom Registration/Profile Fields. */
if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(maybe_serialize($val)), $sbj))) {
break;
示例4: new_user_notification
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (in_array("admin", $notify)) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
$fields = get_user_option("s2member_custom_fields", $user_id);
$cv = preg_split("/\\|/", get_user_option("s2member_custom", $user_id));
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
$label = c_ws_plugin__s2member_user_access::user_access_label($user);
$level = c_ws_plugin__s2member_user_access::user_access_level($user);
$ccaps = implode(",", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user->user_email = $user_email ? $user_email : $user->user_email;
$user_full_name = trim($user->first_name . " " . $user->last_name);
$user_ip = $_SERVER["REMOTE_ADDR"];
if ($rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"]) {
if ($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $rec)) {
if ($rec = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $rec)) {
if ($rec = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $rec)) {
if ($rec = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $rec)) {
if ($rec = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $rec)) {
if ($rec = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $rec)) {
if ($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name)), $rec)) {
if ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name)), $rec)) {
if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name)), $rec)) {
if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
if ($rec = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $rec)) {
if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $rec)) {
if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($rec = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec))) {
break;
}
}
}
if ($sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_subject"]) {
if ($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim(@$cv[$1])', $sbj)) {
if ($sbj = preg_replace("/%%wp_login_url%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
if ($sbj = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
if ($sbj = preg_replace("/%%label%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
if ($sbj = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
if ($sbj = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
if ($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
if ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
if ($sbj = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
示例5: export_users
/**
* Handles the exportation of Users/Members.
*
* @package s2Member\Exports
* @since 110815
*
* @return null Or exits script execution after issuing file download prompt with CSV file.
*/
public static function export_users()
{
if (!empty($_POST['ws_plugin__s2member_pro_export_simple_users']) && ($nonce = $_POST['ws_plugin__s2member_pro_export_simple_users']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-pro-export-users') && current_user_can('create_users')) {
global $wpdb;
// Global database object reference.
/** @var \wpdb $wpdb This line for IDEs that need a reference. */
global $current_site, $current_blog;
// Multisite Networking.
@set_time_limit(0);
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
@ini_set('zlib.output_compression', 0);
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', '1');
}
while (@ob_end_clean()) {
}
$format = !empty($_POST['ws_plugin__s2member_pro_export_users_format']) ? $_POST['ws_plugin__s2member_pro_export_users_format'] : '';
$utf8_bom = isset($_POST['ws_plugin__s2member_pro_export_users_utf8_bom']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_utf8_bom'] : 0;
$start = !empty($_POST['ws_plugin__s2member_pro_export_users_start']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_start'] : 1;
$limit = !empty($_POST['ws_plugin__s2member_pro_export_users_limit']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_limit'] : apply_filters('ws_plugin__s2member_pro_export_users_limit', 1000);
// Back compatibility; and for blog farms.
$start = $start >= 1 ? $start : 1;
// Must be 1 or higher.
$sql_s = $start === 1 ? 0 : $start;
// 1 should be 0.
$export = '';
// Initialize the export file variable.
$s2map = array('custom' => $wpdb->prefix . 's2member_custom', 'subscr_id' => $wpdb->prefix . 's2member_subscr_id', 'subscr_gateway' => $wpdb->prefix . 's2member_subscr_gateway', 'auto_eot_time' => $wpdb->prefix . 's2member_auto_eot_time', 'last_payment_time' => $wpdb->prefix . 's2member_last_payment_time', 'paid_registration_times' => $wpdb->prefix . 's2member_paid_registration_times', 'custom_fields' => $wpdb->prefix . 's2member_custom_fields');
if (is_array($_users = $wpdb->get_results("SELECT `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql($wpdb->prefix . 'capabilities') . "' ORDER BY `" . $wpdb->users . "`.`ID` ASC LIMIT " . $sql_s . ", " . $limit))) {
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
$export .= '"ID","Username","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"';
} else {
// Otherwise, we use the standardized format for exportation.
$export .= '"ID","Username","Password","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"';
}
$custom_field_vars = array();
// Initialize this array.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
$custom_field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
$custom_field_vars[] = $custom_field_var;
}
}
sort($custom_field_vars, SORT_STRING);
// Always sort this array.
foreach ($custom_field_vars as $custom_field_var) {
$export .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_field_var, 1, '"') . '"';
}
$export .= "\n";
// This completes the headers.
foreach ($_users as $_user) {
if (is_object($user = new WP_User($_user->ID)) && $user->ID) {
$custom_capabilities = '';
// Reset each time.
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match('/^access_s2member_ccap_/', $cap)) {
if ($cap = preg_replace('/^access_s2member_ccap_/', '', $cap)) {
$custom_capabilities .= ',' . $cap;
}
}
}
$custom_capabilities = trim($custom_capabilities, ',');
$custom = isset($user->{$s2map}['custom']) ? $user->{$s2map}['custom'] : '';
$subscr_id = isset($user->{$s2map}['subscr_id']) ? $user->{$s2map}['subscr_id'] : '';
$subscr_gateway = isset($user->{$s2map}['subscr_gateway']) ? $user->{$s2map}['subscr_gateway'] : '';
$auto_eot_time = isset($user->{$s2map}['auto_eot_time']) ? $user->{$s2map}['auto_eot_time'] : '';
$last_payment_time = isset($user->{$s2map}['last_payment_time']) ? $user->{$s2map}['last_payment_time'] : '';
$paid_registration_times = isset($user->{$s2map}['paid_registration_times']) ? $user->{$s2map}['paid_registration_times'] : array();
$custom_fields = isset($user->{$s2map}['custom_fields']) && is_array($user->{$s2map}['custom_fields']) ? $user->{$s2map}['custom_fields'] : array();
$paid_registration_date = !empty($paid_registration_times['level']) ? date('m/d/Y', $paid_registration_times['level']) : '';
$paid_registration_times = !empty($paid_registration_times) && is_array($paid_registration_times) ? serialize($paid_registration_times) : '';
$registration_date = $user->user_registered ? date('m/d/Y', strtotime($user->user_registered)) : '';
$last_payment_date = $last_payment_time ? date('m/d/Y', $last_payment_time) : '';
$auto_eot_date = $auto_eot_time ? date('m/d/Y', $auto_eot_time) : '';
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
if ($format === 'readable') {
$line = '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->ID, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_login, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->first_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->last_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->display_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_email, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_url, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq(reset($user->roles), 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_capabilities, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($registration_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($paid_registration_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($last_payment_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($auto_eot_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_id, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_gateway, 1, '"') . '",';
//.........这里部分代码省略.........
示例6: cp
//.........这里部分代码省略.........
} else {
$paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
}
} else {
$paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
} else {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.";
/**/
if (($registration_url = c_ws_plugin__s2member_register_access::register_link_gen($paypal["subscr_gateway"], $paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
$processing = $during = true;
/* Yes, we ARE processing this. */
/**/
$sbj = preg_replace("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_GET["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_GET["s2member_paypal_proxy_use"]) ? "pro_" : "") . "signup_email_subject"]);
$msg = preg_replace("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_GET["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_GET["s2member_paypal_proxy_use"]) ? "pro_" : "") . "signup_email_message"]);
$rec = preg_replace("/%%registration_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($registration_url), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"][($_GET["s2member_paypal_proxy"] && preg_match("/pro-emails/", $_GET["s2member_paypal_proxy_use"]) ? "pro_" : "") . "signup_email_recipients"]);
/**/
if (($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $rec))) {
if (($rec = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $rec)) && ($rec = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $rec))) {
if (($rec = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $rec)) && ($rec = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $rec))) {
if (($rec = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $rec)) && ($rec = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $rec))) {
if (($rec = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $rec)) && ($rec = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $rec))) {
if (($rec = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $rec)) && ($rec = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $rec))) {
if (($rec = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"])), $rec)) && ($rec = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"])), $rec))) {
if ($rec = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $rec)) {
/* **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. ( ex. "N\"ame" <email> ). */
if ($rec = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $rec)) {
if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $rec)) {
/**/
if (($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $sbj))) {
if (($sbj = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $sbj)) && ($sbj = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $sbj))) {
if (($sbj = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $sbj)) && ($sbj = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $sbj))) {
if (($sbj = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $sbj)) && ($sbj = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $sbj))) {
if (($sbj = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $sbj)) && ($sbj = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $sbj))) {
if (($sbj = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $sbj)) && ($sbj = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $sbj))) {
if (($sbj = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $sbj)) && ($sbj = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $sbj))) {
if ($sbj = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)) {
if ($sbj = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $sbj)) {
if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $sbj)) {
/**/
if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $msg))) {
if (($msg = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $msg)) && ($msg = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $msg))) {
if (($msg = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $msg)) && ($msg = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $msg))) {
if (($msg = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $msg)) && ($msg = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $msg))) {
if (($msg = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $msg)) && ($msg = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $msg))) {
if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
if ($msg = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $msg)) {
if ($msg = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["ip"]), $msg)) {
/**/
if (($rec = trim(preg_replace("/%%(.+?)%%/i", "", $rec))) && ($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
foreach (c_ws_plugin__s2member_utils_strings::parse_emails($rec) as $recipient) {
/* Go through a possible list of recipients. */
c_ws_plugin__s2member_email_configs::email_config() . wp_mail($recipient, apply_filters("ws_plugin__s2member_signup_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_signup_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") . c_ws_plugin__s2member_email_configs::email_config_release();
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:67,代码来源:paypal-notify-in-subscr-or-wa-w-level.inc.php
示例7: export_users
/**
* Handles the exportation of Users/Members.
*
* @package s2Member\Exports
* @since 110815
*
* @return null Or exits script execution after issuing file download prompt with CSV file.
*/
public static function export_users()
{
if (!empty($_POST["ws_plugin__s2member_pro_export_users"]) && ($nonce = $_POST["ws_plugin__s2member_pro_export_users"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-pro-export-users") && current_user_can("create_users")) {
global $wpdb;
global $current_site, $current_blog;
@set_time_limit(0);
@ini_set("memory_limit", apply_filters("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
@ini_set("zlib.output_compression", 0);
if (function_exists("apache_setenv")) {
@apache_setenv("no-gzip", "1");
}
while (@ob_end_clean()) {
}
$format = !empty($_POST["ws_plugin__s2member_pro_export_users_format"]) ? $_POST["ws_plugin__s2member_pro_export_users_format"] : "";
$utf8_bom = isset($_POST["ws_plugin__s2member_pro_export_users_utf8_bom"]) ? (int) $_POST["ws_plugin__s2member_pro_export_users_utf8_bom"] : 0;
$start = !empty($_POST["ws_plugin__s2member_pro_export_users_start"]) ? (int) $_POST["ws_plugin__s2member_pro_export_users_start"] : 1;
$start = $start >= 1 ? $start : 1;
$sql_s = $start === 1 ? 0 : $start;
$export = "";
$s2map = array("custom" => $wpdb->prefix . "s2member_custom", "subscr_id" => $wpdb->prefix . "s2member_subscr_id", "subscr_gateway" => $wpdb->prefix . "s2member_subscr_gateway", "auto_eot_time" => $wpdb->prefix . "s2member_auto_eot_time", "last_payment_time" => $wpdb->prefix . "s2member_last_payment_time", "paid_registration_times" => $wpdb->prefix . "s2member_paid_registration_times", "custom_fields" => $wpdb->prefix . "s2member_custom_fields");
if (is_array($_users = $wpdb->get_results("SELECT `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql($wpdb->prefix . "capabilities") . "' ORDER BY `" . $wpdb->users . "`.`ID` ASC LIMIT " . $sql_s . ", " . apply_filters("ws_plugin__s2member_pro_export_users_limit", 1000)))) {
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
$export .= '"ID","Username","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"';
} else {
// Otherwise, we use the standardized format for exportation.
$export .= '"ID","Username","Password","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"';
}
$custom_field_vars = array();
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], TRUE) as $field) {
$custom_field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
$custom_field_vars[] = $custom_field_var;
}
}
sort($custom_field_vars, SORT_STRING);
foreach ($custom_field_vars as $custom_field_var) {
$export .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_field_var, 1, '"') . '"';
}
$export .= "\n";
foreach ($_users as $_user) {
if (is_object($user = new WP_User($_user->ID)) && $user->ID) {
$custom_capabilities = "";
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match("/^access_s2member_ccap_/", $cap)) {
if ($cap = preg_replace("/^access_s2member_ccap_/", "", $cap)) {
$custom_capabilities .= "," . $cap;
}
}
}
$custom_capabilities = trim($custom_capabilities, ",");
$custom = isset($user->{$s2map}["custom"]) ? $user->{$s2map}["custom"] : "";
$subscr_id = isset($user->{$s2map}["subscr_id"]) ? $user->{$s2map}["subscr_id"] : "";
$subscr_gateway = isset($user->{$s2map}["subscr_gateway"]) ? $user->{$s2map}["subscr_gateway"] : "";
$auto_eot_time = isset($user->{$s2map}["auto_eot_time"]) ? $user->{$s2map}["auto_eot_time"] : "";
$last_payment_time = isset($user->{$s2map}["last_payment_time"]) ? $user->{$s2map}["last_payment_time"] : "";
$paid_registration_times = isset($user->{$s2map}["paid_registration_times"]) ? $user->{$s2map}["paid_registration_times"] : array();
$custom_fields = isset($user->{$s2map}["custom_fields"]) && is_array($user->{$s2map}["custom_fields"]) ? $user->{$s2map}["custom_fields"] : array();
$paid_registration_date = $paid_registration_times["level"] ? date("m/d/Y", $paid_registration_times["level"]) : "";
$paid_registration_times = is_array($paid_registration_times) && !empty($paid_registration_times) ? serialize($paid_registration_times) : "";
$registration_date = $user->user_registered ? date("m/d/Y", strtotime($user->user_registered)) : "";
$last_payment_date = $last_payment_time ? date("m/d/Y", $last_payment_time) : "";
$auto_eot_date = $auto_eot_time ? date("m/d/Y", $auto_eot_time) : "";
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
if ($format === "readable") {
$line = '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->ID, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_login, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->first_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->last_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->display_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_email, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_url, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq(reset($user->roles), 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_capabilities, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($registration_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($paid_registration_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($last_payment_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($auto_eot_date, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_id, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_gateway, 1, '"') . '",';
foreach ($custom_field_vars as $custom_field_var) {
if (isset($custom_fields[$custom_field_var])) {
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq(implode("|", (array) $custom_fields[$custom_field_var]), 1, '"') . '",';
} else {
$line .= '"",';
}
}
} else {
$line = '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->ID, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_login, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->first_name, 1, '"') . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->last_name, 1, '"') . '",';
//.........这里部分代码省略.........
示例8: new_user_notification
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (in_array('admin', $notify, true) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_admin_email_recipients']) {
$fields = get_user_option('s2member_custom_fields', $user_id);
$cv = preg_split('/\\|/', get_user_option('s2member_custom', $user_id));
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
$label = c_ws_plugin__s2member_user_access::user_access_label($user);
$level = c_ws_plugin__s2member_user_access::user_access_level($user);
$ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user->user_email = $user_email ? $user_email : $user->user_email;
$user_full_name = trim($user->first_name . ' ' . $user->last_name);
$user_ip = $_SERVER['REMOTE_ADDR'];
if ($rec = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_admin_email_recipients']) {
if ($rec = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $rec)) {
if ($rec = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $rec)) {
if ($rec = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $rec)) {
if ($rec = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $rec)) {
if ($rec = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $rec)) {
if ($rec = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $rec)) {
if ($rec = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name)), $rec)) {
if ($rec = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name)), $rec)) {
if ($rec = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name)), $rec)) {
if ($rec = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $rec)) {
if ($rec = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $rec)) {
if ($rec = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $rec)) {
if ($rec = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $rec)) {
if ($rec = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $rec)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
// Custom Registration/Profile Fields.
if (!($rec = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $rec))) {
break;
}
}
}
// Empty; we can stop here.
if ($sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_admin_email_subject']) {
if ($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) {
if ($sbj = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
if ($sbj = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
if ($sbj = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
if ($sbj = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
if ($sbj = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
if ($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
if ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
if ($sbj = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
if (is_array($fields) && !empty($fields)) {
示例9: cp
//.........这里部分代码省略.........
}
}
}
update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
update_user_option($user_id, "s2member_custom", $paypal["custom"]);
if (!get_user_option("s2member_registration_ip", $user_id)) {
update_user_option($user_id, "s2member_registration_ip", $paypal["ip"]);
}
update_user_option($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
delete_user_option($user_id, "s2member_file_download_access_log");
delete_user_option($user_id, "s2member_auto_eot_time");
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
$pr_times["level"] = !$pr_times["level"] ? time() : $pr_times["level"];
// Preserves existing.
$pr_times["level" . $paypal["level"]] = !$pr_times["level" . $paypal["level"]] ? time() : $pr_times["level" . $paypal["level"]];
update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
// Update now.
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, "/^Demoted by s2Member\\:/");
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, "/^Paid Subscr\\. ID @ time of demotion\\:/");
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
$sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_subject"];
// The same for standard and w/ Pro Forms.
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_message"];
// The same for standard and w/ Pro Forms.
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_email_recipients"];
// The same for standard and w/ Pro Forms.
if (($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $rec))) {
if (($rec = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $rec)) && ($rec = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $rec))) {
if (($rec = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $rec)) && ($rec = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $rec))) {
if (($rec = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $rec)) && ($rec = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $rec))) {
if (($rec = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $rec)) && ($rec = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $rec))) {
if (($rec = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $rec)) && ($rec = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $rec))) {
if (($rec = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"])), $rec)) && ($rec = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"])), $rec))) {
if ($rec = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $rec)) {
// **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
if ($rec = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $rec)) {
if (($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $rec)) && ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $rec))) {
if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $rec)) {
if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $rec)) {
if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $rec)) {
if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $rec)) {
if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $rec)) {
if (($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $sbj))) {
if (($sbj = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $sbj)) && ($sbj = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $sbj))) {
if (($sbj = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $sbj)) && ($sbj = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $sbj))) {
if (($sbj = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $sbj)) && ($sbj = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $sbj))) {
if (($sbj = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $sbj)) && ($sbj = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $sbj))) {
if (($sbj = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $sbj)) && ($sbj = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $sbj))) {
if (($sbj = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $sbj)) && ($sbj = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $sbj))) {
if ($sbj = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)) {
if ($sbj = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $sbj)) {
if (($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $sbj)) && ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $sbj))) {
if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $sbj)) {
if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $sbj)) {
if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $sbj)) {
if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $sbj)) {
if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $sbj)) {
if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $msg))) {
if (($msg = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $msg)) && ($msg = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $msg))) {
if (($msg = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $msg)) && ($msg = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $msg))) {
if (($msg = preg_replace("/%%initial_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["initial_term"])), $msg)) && ($msg = preg_replace("/%%regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], $paypal["recurring"])), $msg))) {
if (($msg = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $msg)) && ($msg = preg_replace("/%%recurring\\/regular_cycle%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"] ? $paypal["recurring"] . " / " . c_ws_plugin__s2member_utils_time::period_term($paypal["regular_term"], true) : "0 / non-recurring"), $msg))) {
if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
if (($msg = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $msg)) && ($msg = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $msg))) {
if ($msg = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $msg)) {
示例10: amazon_cf_url
/**
* Creates an Amazon CloudFront RSA-SHA1 signature URL.
*
* @package s2Member\Files
* @since 110926
*
* @param string $file Input file path, to be signed by this routine.
* @param bool $stream Is this resource file to be served as streaming media?
* @param bool $inline Is this resource file to be served inline, or no?
* @param bool $ssl Is this resource file to be served via SSL, or no?
* @param string $basename The absolute basename of the resource file.
* @param string $mimetype The MIME content-type of the resource file.
*
* @return string An RSA-SHA1 signature URL for Amazon CloudFront.
*/
public static function amazon_cf_url($file = '', $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = '', $mimetype = '')
{
$file = trim((string) $file, '/');
// Trim & force string.
$url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
$url_e_file = str_ireplace('%2F', '/', $url_e_file);
foreach ($GLOBALS['WS_PLUGIN__']['s2member']['o'] as $option => $option_value) {
if (preg_match('/^amazon_cf_files_/', $option) && ($option = preg_replace('/^amazon_cf_files_/', '', $option))) {
$cfc[$option] = $option_value;
}
}
$cfc['expires'] = strtotime('+' . apply_filters('ws_plugin__s2member_amazon_cf_file_expires_time', '24 hours', get_defined_vars()));
$cf_extn = strtolower(substr($file, strrpos($file, '.') + 1));
// Parses the file extension out so we can scan it in some special scenarios.
$cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? FALSE : TRUE;
// Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon CloudFront sees.
$cf_stream_extn_resource_exclusions = array_unique((array) apply_filters('ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions', array('mp3'), get_defined_vars()));
// MP3 files should NOT include an extension in their resource reference.
$cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, '.')) : $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
$cf_url = $stream ? 'rtmp' . ($ssl ? 'e' : '') . '://' . ($cfc['distro_streaming_cname'] ? $cfc['distro_streaming_cname'] : $cfc['distro_streaming_dname']) . '/cfx/st/' . $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
$cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER['REMOTE_ADDR']) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc['expires'] . '}}}]}';
$cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
$cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array('+', '=', '/'), array('-', '_', '~'), FALSE);
$cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array('+', '=', '/'), array('-', '_', '~'), FALSE);
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array('Policy' => $cf_base64_url_safe_policy, 'Signature' => $cf_base64_url_safe_signature, 'Key-Pair-Id' => $cfc['private_key_id']))), $cf_url);
}
示例11: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110815
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
*
* @todo Optimize with ``empty()`` and ``isset()``.
*/
public static function cp($vars = array())
{
extract($vars);
// Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
if (!empty($paypal["txn_type"]) && preg_match("/^web_accept\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"])) && (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])) && (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && !empty($paypal["payer_email"])) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
list($paypal["level"], $paypal["ccaps"], $paypal["eotper"]) = preg_split("/\\:/", $paypal["item_number"], 3);
$paypal["ip"] = preg_match("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"] ? $paypal["option_selection2"] : "";
$paypal["ip"] = !$paypal["ip"] && preg_match("/^[a-z0-9]+~[0-9\\.]+\$/i", $paypal["invoice"]) ? preg_replace("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
if (preg_match("/(referenc|associat|updat|upgrad)/i", $paypal["option_name1"]) && $paypal["option_selection1"]) {
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal["txn_id"], $paypal["option_selection1"])) && is_object($user = new WP_User($user_id)) && $user->ID) {
if (!$user->has_cap("administrator")) {
$processing = $during = true;
// Yes, we ARE processing this.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps", get_defined_vars());
unset($__refs, $__v);
$fields = get_user_option("s2member_custom_fields", $user_id);
// These will be needed in the routines below.
$user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
// Original IP during Registration.
$user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
// Now merge conditionally.
if (is_multisite() && !is_user_member_of_blog($user_id)) {
add_existing_user_to_blog(array("user_id" => $user_id, "role" => get_option("default_role")));
$user = new WP_User($user_id);
}
if ($paypal["ccaps"] && preg_match("/^-all/", str_replace("+", "", $paypal["ccaps"]))) {
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match("/^access_s2member_ccap_/", $cap)) {
$user->remove_cap($ccap = $cap);
}
}
}
if ($paypal["ccaps"] && preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) {
foreach (preg_split("/[\r\n\t\\s;,]+/", preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) as $ccap) {
if (strlen($ccap = trim(strtolower(preg_replace("/[^a-z_0-9]/i", "", $ccap))))) {
$user->add_cap("access_s2member_ccap_" . $ccap);
}
}
}
if (!get_user_option("s2member_registration_ip", $user_id)) {
update_user_option($user_id, "s2member_registration_ip", $paypal["ip"]);
}
$paypal["s2member_log"][] = "s2Member Custom Capabilities updated w/ advanced update routines.";
$sbj = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_subject"];
// The same for standard and w/ Pro Forms.
$msg = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_message"];
// The same for standard and w/ Pro Forms.
$rec = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_email_recipients"];
// The same for standard and w/ Pro Forms.
if (($rec = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $rec)) && ($rec = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $rec))) {
if (($rec = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $rec)) && ($rec = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $rec))) {
if (($rec = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $rec)) && ($rec = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $rec))) {
if (($rec = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"])), $rec)) && ($rec = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"])), $rec))) {
if ($rec = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_dq(c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $rec)) {
// **NOTE** c_ws_plugin__s2member_utils_strings::esc_dq() is applied here. (ex. "N\"ame" <email>).
if ($rec = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $rec)) {
if (($rec = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $rec)) && ($rec = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $rec))) {
if (($rec = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $rec)) && ($rec = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $rec))) {
if ($rec = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $rec)) {
if ($rec = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $rec)) {
if ($rec = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $rec)) {
if ($rec = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $rec)) {
if ($rec = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $rec)) {
if (($sbj = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $sbj))) {
if (($sbj = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $sbj)) && ($sbj = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $sbj))) {
if (($sbj = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $sbj)) && ($sbj = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $sbj))) {
if (($sbj = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $sbj)) && ($sbj = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $sbj))) {
if ($sbj = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $sbj)) {
if ($sbj = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $sbj)) {
if (($sbj = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["full_coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["coupon_code"]), $sbj)) && ($sbj = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($coupon["affiliate_id"]), $sbj))) {
if (($sbj = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $sbj)) && ($sbj = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $sbj))) {
if ($sbj = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $sbj)) {
if ($sbj = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $sbj)) {
if ($sbj = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $sbj)) {
if ($sbj = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $sbj)) {
if ($sbj = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $sbj)) {
if (($msg = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $msg))) {
if (($msg = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $msg)) && ($msg = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $msg))) {
if (($msg = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $msg)) && ($msg = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $msg))) {
//.........这里部分代码省略.........
示例12: export_users
/**
* Handles the exportation of Users/Members.
*
* @package s2Member\Exports
* @since 110815
*
* @return null Or exits script execution after issuing file download prompt with CSV file.
*/
public static function export_users()
{
if (!empty($_POST["ws_plugin__s2member_pro_export_users"]) && ($nonce = $_POST["ws_plugin__s2member_pro_export_users"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-pro-export-users") && current_user_can("create_users")) {
global $wpdb;
/* Global database object reference. */
global $current_site, $current_blog;
/* Multisite Networking. */
/**/
@set_time_limit(0) . @ini_set("memory_limit", apply_filters("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
@ini_set("zlib.output_compression", 0) . eval('while (@ob_end_clean ());');
/**/
$format = !empty($_POST["ws_plugin__s2member_pro_export_users_format"]) ? $_POST["ws_plugin__s2member_pro_export_users_format"] : "";
$start = !empty($_POST["ws_plugin__s2member_pro_export_users_start"]) ? (int) $_POST["ws_plugin__s2member_pro_export_users_start"] : 1;
/**/
$start = $start >= 1 ? $start : 1;
/* Must be 1 or higher. */
$sql_s = $start === 1 ? 0 : $start;
/* 1 should be 0. */
/**/
$export = "";
/* Initialize the export file variable. */
/**/
$s2map = array("custom" => $wpdb->prefix . "s2member_custom", "subscr_id" => $wpdb->prefix . "s2member_subscr_id", "subscr_gateway" => $wpdb->prefix . "s2member_subscr_gateway", "auto_eot_time" => $wpdb->prefix . "s2member_auto_eot_time", "last_payment_time" => $wpdb->prefix . "s2member_last_payment_time", "paid_registration_times" => $wpdb->prefix . "s2member_paid_registration_times", "custom_fields" => $wpdb->prefix . "s2member_custom_fields");
/**/
if (is_array($_users = $wpdb->get_results("SELECT `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql($wpdb->prefix . "capabilities") . "' LIMIT " . $sql_s . ", 250"))) {
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
$export .= '"ID","Username","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"' . "\n";
} else {
/* Otherwise, we use the standardized format for exportation.*/
$export .= '"ID","Username","Password","First Name","Last Name","Display Name","Email","Website","Role","Custom Capabilities","Registration Date","First Payment Date","Last Payment Date","Auto-EOT Date","Custom Value","Paid Subscr. ID","Paid Subscr. Gateway"' . "\n";
}
/**/
foreach ($_users as $_user) {
if (is_object($user = new WP_User($_user->ID)) && $user->ID) {
$custom_capabilities = "";
/* Reset each time. */
/**/
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match("/^access_s2member_ccap_/", $cap)) {
if ($cap = preg_replace("/^access_s2member_ccap_/", "", $cap)) {
$custom_capabilities .= "," . $cap;
}
}
}
/**/
$custom_capabilities = trim($custom_capabilities, ",");
/**/
$custom = isset($user->{$s2map}["custom"]) ? $user->{$s2map}["custom"] : "";
$subscr_id = isset($user->{$s2map}["subscr_id"]) ? $user->{$s2map}["subscr_id"] : "";
$subscr_gateway = isset($user->{$s2map}["subscr_gateway"]) ? $user->{$s2map}["subscr_gateway"] : "";
/**/
$auto_eot_time = isset($user->{$s2map}["auto_eot_time"]) ? $user->{$s2map}["auto_eot_time"] : "";
$last_payment_time = isset($user->{$s2map}["last_payment_time"]) ? $user->{$s2map}["last_payment_time"] : "";
$paid_registration_times = isset($user->{$s2map}["paid_registration_times"]) ? $user->{$s2map}["paid_registration_times"] : "";
$custom_fields = isset($user->{$s2map}["custom_fields"]) && is_array($user->{$s2map}["custom_fields"]) ? $user->{$s2map}["custom_fields"] : array();
/**/
$paid_registration_date = $paid_registration_times["level"] ? date("m/d/Y", $paid_registration_times["level"]) : "";
$paid_registration_times = is_array($paid_registration_times) && !empty($paid_registration_times) ? serialize($paid_registration_times) : "";
$registration_date = $user->user_registered ? date("m/d/Y", strtotime($user->user_registered)) : "";
$last_payment_date = $last_payment_time ? date("m/d/Y", $last_payment_time) : "";
$auto_eot_date = $auto_eot_time ? date("m/d/Y", $auto_eot_time) : "";
/**/
ksort($custom_fields);
/* Make sure Custom Fields are always in the same order.
This provides clarity/uniformity in the export file. */
/**/
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
if ($format === "readable") {
$line = '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->ID) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_login) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->first_name) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->last_name) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->display_name) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_email) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_url) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq(reset($user->roles)) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_capabilities) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($registration_date) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($paid_registration_date) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($last_payment_date) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($auto_eot_date) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_id) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($subscr_gateway) . '",';
/**/
foreach ($custom_fields as $custom_field_var => $custom_field_value) {
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($custom_field_var) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq(implode("|", (array) $custom_field_value)) . '",';
}
} else {
$line = '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->ID) . '",';
$line .= '"' . c_ws_plugin__s2member_utils_strings::esc_dq($user->user_login) . '",';
//.........这里部分代码省略.........
示例13: export_users
/**
* Handles the exportation of Users/Members.
*
* @package s2Member\Exports
* @since 140724
*
* @return null Or exits script execution after issuing file download prompt with CSV file.
*/
public static function export_users()
{
if (!empty($_POST['ws_plugin__s2member_pro_export_users']) && ($nonce = $_POST['ws_plugin__s2member_pro_export_users']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-pro-export-users') && current_user_can('create_users')) {
global $wpdb;
// Global database object reference.
/** @var \wpdb $wpdb This line for IDEs that need a reference. */
global $current_site, $current_blog;
// Multisite Networking.
@set_time_limit(0);
@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
@ini_set('zlib.output_compression', 0);
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', '1');
}
while (@ob_end_clean()) {
}
$format = !empty($_POST['ws_plugin__s2member_pro_export_users_format']) ? $_POST['ws_plugin__s2member_pro_export_users_format'] : '';
$utf8_bom = isset($_POST['ws_plugin__s2member_pro_export_users_utf8_bom']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_utf8_bom'] : 0;
$start = !empty($_POST['ws_plugin__s2member_pro_export_users_start']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_start'] : 1;
$limit = !empty($_POST['ws_plugin__s2member_pro_export_users_limit']) ? (int) $_POST['ws_plugin__s2member_pro_export_users_limit'] : apply_filters('ws_plugin__s2member_pro_export_users_limit', 1000);
// Back compatibility; and for blog farms.
$start = $start >= 1 ? $start : 1;
// Must be 1 or higher.
$sql_s = $start === 1 ? 0 : $start;
// 1 should be 0.
$export = '';
// Initialize the export file variable.
$user_keys = array();
// Initialize array of user keys.
if (is_object($_user_row = $wpdb->get_row("SELECT * FROM `" . $wpdb->users . "` LIMIT 1"))) {
foreach (array_keys((array) $_user_row) as $_user_key) {
if (!in_array($_user_key, array('user_pass'), TRUE)) {
$user_keys[] = $_user_key;
}
}
}
unset($_user_row, $_user_key);
// Housekeeping.
$user_keys = array_unique($user_keys);
// Only unique keys please.
$user_permission_keys = array('role', 'ccaps');
$user_meta_keys = $wpdb->get_col("SELECT DISTINCT `meta_key` FROM `" . $wpdb->usermeta . "` WHERE (`" . $wpdb->usermeta . "`.`meta_key` NOT LIKE '" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape($wpdb->base_prefix)) . "%' OR `" . $wpdb->usermeta . "`.`meta_key` LIKE '" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape($wpdb->prefix)) . "%')");
$user_meta_keys = is_array($user_meta_keys) ? $user_meta_keys : array();
foreach ($user_meta_keys as $_index => $_meta_key) {
if ($_meta_key === $wpdb->prefix . 's2member_custom_fields') {
unset($user_meta_keys[$_index]);
}
}
if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
foreach ($user_meta_keys as $_index => $_meta_key) {
if (strpos($_meta_key, $wpdb->prefix) !== 0) {
if (!in_array($_meta_key, array('first_name', 'last_name', 'nickname', 'description'), TRUE)) {
unset($user_meta_keys[$_index]);
}
}
}
}
unset($_index, $_meta_key);
// Housekeeping.
$user_meta_keys = array_unique($user_meta_keys);
// Only unique keys please.
$user_custom_field_keys = array();
// Initialize this array.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $_field) {
$custom_field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($_field['id']));
$user_custom_field_keys[] = $custom_field_var;
}
}
unset($_field);
// Housekeeping.
$user_custom_field_keys = array_unique($user_custom_field_keys);
// Only unique keys please.
sort($user_custom_field_keys, SORT_STRING);
// Sort these also; just to give them some order.
$export_headers = '';
// Initialize export headers.
foreach ($user_keys as $_user_key) {
// Include all of the user fields first.
$export_headers .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($_user_key, 1, '"') . '"';
}
unset($_user_key);
// Housekeeping.
foreach ($user_permission_keys as $_user_permission_key) {
// Include permission keys now.
$export_headers .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($_user_permission_key, 1, '"') . '"';
}
unset($_user_permission_key);
// Housekeeping.
foreach ($user_meta_keys as $_user_meta_key) {
// Next comes all of the user meta fields.
$export_headers .= ',"meta_key__' . c_ws_plugin__s2member_utils_strings::esc_dq($_user_meta_key, 1, '"') . '"';
//.........这里部分代码省略.........
示例14: amazon_cf_url
/**
* Creates an Amazon CloudFront RSA-SHA1 signature URL.
*
* @package s2Member\Files
* @since 110926
*
* @param str $file Input file path, to be signed by this routine.
* @param bool $stream Is this resource file to be served as streaming media?
* @param bool $inline Is this resource file to be served inline, or no?
* @param bool $ssl Is this resource file to be served via SSL, or no?
* @param str $basename The absolute basename of the resource file.
* @param str $mimetype The MIME content-type of the resource file.
* @return str An RSA-SHA1 signature URL for Amazon CloudFront.
*/
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
{
$file = trim((string) $file, "/");
$url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
$url_e_file = str_ireplace("%2F", "/", $url_e_file);
foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value) {
if (preg_match("/^amazon_cf_files_/", $option) && ($option = preg_replace("/^amazon_cf_files_/", "", $option))) {
$cfc[$option] = $option_value;
}
}
$cfc["expires"] = strtotime("+" . apply_filters("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars()));
$cf_extn = strtolower(substr($file, strrpos($file, ".") + 1));
$cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? false : true;
$cf_stream_extn_resource_exclusions = array_unique((array) apply_filters("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array("mp3"), get_defined_vars()));
$cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, ".")) : $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
$cf_url = $stream ? "rtmp" . ($ssl ? "e" : "") . "://" . ($cfc["distro_streaming_cname"] ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"]) . "/cfx/st/" . $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
$cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER["REMOTE_ADDR"]) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc["expires"] . '}}}]}';
$cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
$cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array("+", "=", "/"), array("-", "_", "~"), false);
$cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array("+", "=", "/"), array("-", "_", "~"), false);
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"]))), $cf_url);
}