本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::fill_cvs方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::fill_cvs方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::fill_cvs怎么用?PHP c_ws_plugin__s2member_utils_strings::fill_cvs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::fill_cvs方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cp
//.........这里部分代码省略.........
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);
}
}
}
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_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)) {
示例2: 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_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']);
}
if (!empty($ipn_signup_vars)) {
// We should have these from the routines above.
update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
}
delete_user_option($user_id, 's2member_file_download_access_log');
if ((preg_match('/^web_accept$/i', $paypal['txn_type']) || $paypal['initial'] <= 0 && $paypal['regular'] <= 0) && $paypal['eotper']) {
// Don't update this in the return routine. Leave this for the IPN routine.
// EOT Times might be extended, and we don't want the IPN routine to extend an already-extended EOT Time.
$eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time('', '', '', $paypal['eotper'], '', get_user_option('s2member_auto_eot_time', $user_id));
$paypal['s2member_log'][] = 'Automatic EOT (End Of Term) Time will be set to: ' . date('D M j, Y g:i:s a T', $eot_time) . '.';
} else {
// Otherwise, we need to clear the Auto-EOT Time.
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'];
// Preserve 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);
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 w/ advanced update routines.';
setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['subscr_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.';
if ($processing && $tracking_properties && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code))) {
if (($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code))) {
if (($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
// Custom Registration/Profile Fields.
if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
break;
}
}
}
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_modification_tracking_codes_' . $paypal['subscr_id']), $code, 43200);
}
}
}
}
}
}
}
示例3: cp
/**
* s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
*
* @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);
if (!empty($paypal['txn_type']) && preg_match('/^web_accept$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['sp_access_item_number_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['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_return_before_sp_access', get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_rtn = 's2m_rtn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10)) {
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.';
list(, $paypal['sp_ids'], $paypal['hours']) = 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['ip'] = !$paypal['ip'] && $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : $paypal['ip'];
$paypal['currency'] = strtoupper($paypal['mc_currency']);
// Normalize input currency.
$paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($paypal['sp_ids'], $paypal['hours'], FALSE)) {
$processing = $during = TRUE;
// Yes, we ARE processing this.
setcookie('s2member_sp_tracking', $s2member_sp_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['txn_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_sp_tracking', $s2member_sp_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_sp_tracking'] = $s2member_sp_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `web_accept` ) for Specific Post/Page Access.';
if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['sp_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $code)) && ($code = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
if (($code = preg_replace('/%%txn_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $code)) && ($code = preg_replace('/%%txn_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $code)) {
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Specific Post/Page Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_sp_tracking_codes_' . $paypal['txn_id']), $code, 43200);
}
}
}
}
}
}
}
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_return_during_sp_access', get_defined_vars());
unset($__refs, $__v);
if (apply_filters('ws_plugin__s2member_immediate_sp_access_redirection', FALSE, get_defined_vars())) {
$paypal['s2member_log'][] = 'Redirecting Customer immediately to the Specific Post/Page.';
wp_redirect($sp_access_url);
// Immediate redirection to Specific Post/Page.
} else {
if ($custom_success_redirection) {
$paypal['s2member_log'][] = 'Redirecting Customer to a custom URL on success: ' . $custom_success_redirection;
wp_redirect($custom_success_redirection);
} else {
$paypal['s2member_log'][] = 'Redirecting Customer to the Specific Post/Page (after displaying a thank-you message).';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], _x('<strong>Thank You! Your transaction has been approved.</strong>', 's2member-front', 's2member'), _x('Continue (Click Here)', 's2member-front', 's2member'), $sp_access_url);
}
}
} else {
$paypal['s2member_log'][] = 'Unable to generate Specific Post/Page Access Link. Does your Leading Post/Page still exist?';
$paypal['s2member_log'][] = 'Redirecting Customer to the Home Page (after displaying an error message).';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], _x('<strong>ERROR:</strong> Unable to generate Access Link.<br />Please contact Support for assistance.', 's2member-front', 's2member'), _x('Back To Home Page', 's2member-front', 's2member'), home_url('/'));
}
} else {
$paypal['s2member_log'][] = 'Page Expired. Duplicate Return-Data.';
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept` ) for Specific Post/Page Access.';
$paypal['s2member_log'][] = 'Page Expired. Instructing customer to check their email for further details about how to obtain access to what they purchased.';
echo c_ws_plugin__s2member_return_templates::return_template($paypal['subscr_gateway'], '<strong>' . _x('Thank you! Please check your email for further details regarding your purchase.', 's2member-front', 's2member') . '</strong>', _x('Return to Home Page', 's2member-front', 's2member'), home_url('/'));
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_return_after_sp_access', get_defined_vars());
unset($__refs, $__v);
return apply_filters('c_ws_plugin__s2member_paypal_return_in_web_accept_sp', $paypal, get_defined_vars());
} else {
return apply_filters('c_ws_plugin__s2member_paypal_return_in_web_accept_sp', FALSE, get_defined_vars());
}
}
示例4: 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))) {
//.........这里部分代码省略.........
示例5: cp
/**
* s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
*
* @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);
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_return_before_new_ccaps', get_defined_vars());
unset($__refs, $__v);
if (!get_transient($transient_rtn = 's2m_rtn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_rtn, 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['ip'] = !$paypal['ip'] && $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : $paypal['ip'];
$paypal['currency'] = strtoupper($paypal['mc_currency']);
// Normalize input currency.
$paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
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.
$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.';
setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['txn_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `web_accept` ) w/ update vars for Capabilities w/o Level.';
if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ccap_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%(?:subscr|txn)_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
if (($code = preg_replace('/%%(?:subscr|txn)_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_baid']), $code)) && ($code = preg_replace('/%%(?:subscr|txn)_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $code)) && ($code = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['txn_id']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
break;
}
}
}
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Payment Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_ccap_tracking_codes_' . $paypal['txn_id']), $code, 43200);
}
}
}
}
}
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例6: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @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('/^new_case$/i', $paypal['txn_type']) && !empty($paypal['case_type']) && preg_match('/^chargeback$/i', $paypal['case_type']) || !empty($paypal['payment_status']) && preg_match('/^(refunded|reversed|reversal)$/i', $paypal['payment_status'])) && ((!empty($paypal['item_number']) || ($paypal['item_number'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['sp_access_item_number_regex'], $paypal['item_number'])) && (!empty($paypal['item_name']) || ($paypal['item_name'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal)) || ($paypal['item_name'] = $_SERVER['HTTP_HOST'])) && !empty($paypal['payer_email']) && !empty($paypal['parent_txn_id']) && (!empty($paypal['parent_txn_baid']) || ($paypal['parent_txn_baid'] = $paypal['parent_txn_id'])) && (!empty($paypal['parent_txn_cid']) || ($paypal['parent_txn_cid'] = $paypal['parent_txn_id']))) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal', 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 ( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` ).';
$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']);
$processing = $during = TRUE;
// Yes, we ARE processing this.
/*
Refunds and chargeback reversals. This is excluded from the processing check.
In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
*/
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['sp_ref_rev_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['sp_ref_rev_notification_urls']) as $url) {
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%parent_txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['parent_txn_id'])), $url))) {
if (($url = preg_replace('/%%parent_txn_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['parent_txn_baid'])), $url)) && ($url = preg_replace('/%%parent_txn_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['parent_txn_cid'])), $url))) {
if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
if (($url = preg_replace('/%%-amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_gross'])), $url)) && ($url = preg_replace('/%%-fee%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_fee'])), $url))) {
if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['ip'])), $url)) {
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
$paypal['s2member_log'][] = 'Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.';
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['sp_ref_rev_notification_recipients']) {
$msg = $sbj = '(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal';
$msg .= "\n\n";
// Spacing in the message body.
$msg .= 'parent_txn_id: %%parent_txn_id%%' . "\n";
$msg .= 'parent_txn_baid: %%parent_txn_baid%%' . "\n";
$msg .= 'parent_txn_cid: %%parent_txn_cid%%' . "\n";
$msg .= 'item_number: %%item_number%%' . "\n";
$msg .= 'item_name: %%item_name%%' . "\n";
$msg .= 'currency: %%currency%%' . "\n";
$msg .= 'currency_symbol: %%currency_symbol%%' . "\n";
$msg .= '-amount: %%-amount%%' . "\n";
$msg .= '-fee: %%-fee%%' . "\n";
$msg .= 'first_name: %%first_name%%' . "\n";
$msg .= 'last_name: %%last_name%%' . "\n";
$msg .= 'full_name: %%full_name%%' . "\n";
$msg .= 'payer_email: %%payer_email%%' . "\n";
$msg .= 'user_ip: %%user_ip%%' . "\n";
$msg .= 'cv0: %%cv0%%' . "\n";
$msg .= 'cv1: %%cv1%%' . "\n";
$msg .= 'cv2: %%cv2%%' . "\n";
$msg .= 'cv3: %%cv3%%' . "\n";
$msg .= 'cv4: %%cv4%%' . "\n";
$msg .= 'cv5: %%cv5%%' . "\n";
$msg .= 'cv6: %%cv6%%' . "\n";
$msg .= 'cv7: %%cv7%%' . "\n";
$msg .= 'cv8: %%cv8%%' . "\n";
$msg .= 'cv9: %%cv9%%';
if (($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $paypal['custom'])) && ($msg = preg_replace('/%%parent_txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['parent_txn_id']), $msg))) {
if (($msg = preg_replace('/%%parent_txn_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['parent_txn_baid']), $msg)) && ($msg = preg_replace('/%%parent_txn_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['parent_txn_cid']), $msg))) {
if (($msg = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $msg)) && ($msg = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $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('/%%-amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_gross']), $msg)) && ($msg = preg_replace('/%%-fee%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['mc_fee']), $msg))) {
if (($msg = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $msg)) && ($msg = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $msg))) {
if ($msg = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $msg)) {
if ($msg = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $msg)) {
if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['ip']), $msg)) {
if ($sbj && ($msg = trim(preg_replace('/%%(.+?)%%/i', '', $msg)))) {
// Still have a ``$sbj`` and a ``$msg``?
//.........这里部分代码省略.........
示例7: cp
//.........这里部分代码省略.........
$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);
}
}
}
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_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'];
// Preserve 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);
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 ( `subscr_modify` ), a Subscription Modification.';
setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal['subscr_id']), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
$paypal['s2member_log'][] = 'Transient Tracking Cookie set on ( `subscr_modify` ), a Subscription Modification.';
if ($processing && ($code = $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_tracking_codes'])) {
if (($code = c_ws_plugin__s2member_utils_strings::fill_cvs($code, $paypal['custom'])) && ($code = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_id']), $code))) {
if (($code = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_baid']), $code)) && ($code = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['subscr_cid']), $code))) {
if (($code = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency']), $code)) && ($code = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['currency_symbol']), $code))) {
if (($code = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial']), $code)) && ($code = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular']), $code)) && ($code = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['recurring']), $code))) {
if (($code = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['initial_term']), $code)) && ($code = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['regular_term']), $code))) {
if (($code = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_number']), $code)) && ($code = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['item_name']), $code))) {
if (($code = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['first_name']), $code)) && ($code = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['last_name']), $code))) {
if ($code = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($paypal['first_name'] . ' ' . $paypal['last_name'])), $code)) {
if ($code = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($paypal['payer_email']), $code)) {
if (($code = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $code)) && ($code = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $code))) {
if ($code = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(trim($user->first_name . ' ' . $user->last_name)), $code)) {
if ($code = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $code)) {
if ($code = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $code)) {
if ($code = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_reg_ip), $code)) {
if ($code = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $code)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($code = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $code))) {
break;
}
}
}
if ($code = trim(preg_replace('/%%(.+?)%%/i', '', $code))) {
$paypal['s2member_log'][] = 'Storing Modification Tracking Codes into a Transient Queue. These will be processed on-site.';
set_transient('s2m_' . md5('s2member_transient_modification_tracking_codes_' . $paypal['subscr_id']), $code, 43200);
}
}
}
}
}
}
}
}
示例8: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @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("/^(subscr_cancel|recurring_payment_profile_cancel|mp_cancel)\$/i", $paypal["txn_type"]) && !(preg_match("/^recurring_payment_profile_cancel\$/i", $paypal["txn_type"]) && !empty($paypal["initial_payment_status"]) && preg_match("/^failed\$/i", $paypal["initial_payment_status"])) && ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"])) && (!empty($paypal["period1"]) || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal)) || ($paypal["period1"] = "0 D")) && (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal))) && (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal))) && (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal))) && (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"]))) && (!empty($paypal["subscr_baid"]) || ($paypal["subscr_baid"] = $paypal["subscr_id"])) && (!empty($paypal["subscr_cid"]) || ($paypal["subscr_cid"] = $paypal["subscr_id"]))) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", 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 ( `subscr_cancel|recurring_payment_profile_cancel|mp_cancel` ).";
list($paypal["level"], $paypal["ccaps"]) = 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 (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal["subscr_id"])) && is_object($user = new WP_User($user_id)) && $user->ID) {
if (!$user->has_cap("administrator")) {
$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 (!get_user_option("s2member_auto_eot_time", $user_id)) {
$processing = $during = true;
// Yes, we ARE processing this.
$auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time($user_id, $paypal["period1"], $paypal["period3"]);
update_user_option($user_id, "s2member_auto_eot_time", $auto_eot_time);
// s2Member follows-up later.
$paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date("D M j, Y g:i a T", $auto_eot_time);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars());
unset($__refs, $__v);
} else {
$paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) {
// Handle Cancellation Notifications.
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_id"])), $url))) {
if (($url = preg_replace("/%%subscr_baid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_baid"])), $url)) && ($url = preg_replace("/%%subscr_cid%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["subscr_cid"])), $url))) {
if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal["item_name"])), $url))) {
if (($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . " " . $user->last_name))), $url)) {
if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($url = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace("/%%(.+?)%%/i", "", $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
$paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"]) {
$msg = $sbj = "(s2Member / API Notification Email) - Cancellation";
$msg .= "\n\n";
// Spacing in the message body.
$msg .= "subscr_id: %%subscr_id%%\n";
$msg .= "subscr_baid: %%subscr_baid%%\n";
$msg .= "subscr_cid: %%subscr_cid%%\n";
$msg .= "item_number: %%item_number%%\n";
$msg .= "item_name: %%item_name%%\n";
$msg .= "user_first_name: %%user_first_name%%\n";
$msg .= "user_last_name: %%user_last_name%%\n";
$msg .= "user_full_name: %%user_full_name%%\n";
$msg .= "user_email: %%user_email%%\n";
$msg .= "user_login: %%user_login%%\n";
$msg .= "user_ip: %%user_ip%%\n";
$msg .= "user_id: %%user_id%%\n";
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
$msg .= $var . ": %%" . $var . "%%\n";
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php
示例9: cp
/**
* s2Member's PayPal IPN handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @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('/^(subscr_payment|recurring_payment|merch_pmt)$/i', $paypal['txn_type']) && ((!empty($paypal['item_number']) || ($paypal['item_number'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal))) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number'])) && (!empty($paypal['subscr_id']) || ($paypal['subscr_id'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal))) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status'])) && (!empty($paypal['item_name']) || ($paypal['item_name'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal))) && (!empty($paypal['payer_email']) || ($paypal['payer_email'] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal['subscr_id']))) && (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id'])) && (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id'])) && !empty($paypal['txn_id']) && !empty($paypal['mc_gross'])) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_payment', 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 ' . ($identified_as = '( `subscr_payment|recurring_payment` )') . '.';
if (empty($_REQUEST['s2member_paypal_proxy'])) {
$paypal['s2member_log'][] = 'Sleeping for 15 seconds. Waiting for a possible ( `subscr_signup|subscr_modify|recurring_payment_profile_created` ).';
sleep(15);
// Sleep here for a moment. PayPal sometimes sends a subscr_payment before the subscr_signup, subscr_modify.
$paypal['s2member_log'][] = 'Awake. It\'s ' . date('D M j, Y g:i:s a T') . '. s2Member `txn_type` identified as ' . $identified_as . '.';
}
list($paypal['level'], $paypal['ccaps']) = 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 (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
$processing = $during = TRUE;
// Yes, we ARE processing this.
$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.
if (!get_user_option('s2member_first_payment_txn_id', $user_id)) {
// 1st payment?
update_user_option($user_id, 's2member_first_payment_txn_id', $paypal['txn_id']);
}
update_user_option($user_id, 's2member_last_payment_time', time());
// Also update last payment time.
$paypal['s2member_log'][] = 'Updated Payment Times for this Member.';
// Flag this action in the log.
$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 ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) as $url) {
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url))) {
if (($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url))) {
if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
if (($url = preg_replace('/%%amount%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['mc_gross'])), $url)) && ($url = preg_replace('/%%txn_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['txn_id'])), $url))) {
if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$paypal['s2member_log'][] = 'Payment Notification URLs have been processed.';
}
//.........这里部分代码省略.........
示例10: configure_user_registration
//.........这里部分代码省略.........
$pr_times['level' . $level] = empty($pr_times['level' . $level]) ? time() : $pr_times['level' . $level];
update_user_option($user_id, 's2member_paid_registration_times', $pr_times);
// Update now.
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_configure_user_registration_admin_side', get_defined_vars());
unset($__refs, $__v);
}
}
}
if ($processed === 'yes') {
/**
* If processed, all of these will have been defined by now.
*
* @var $role string Reference for IDEs.
* @var $level string Reference for IDEs.
* @var $ccaps string Reference for IDEs.
* @var $auto_eot_time string|integer Reference for IDEs.
* @var $fname string Reference for IDEs.
* @var $lname string Reference for IDEs.
* @var $name string Reference for IDEs.
* @var $email string Reference for IDEs.
* @var $login string Reference for IDEs.
* @var $pass string Reference for IDEs.
* @var $ip string Reference for IDEs.
* @var $opt_in boolean Reference for IDEs.
* @var $fields array Reference for IDEs.
*/
if ($urls = $GLOBALS['WS_PLUGIN__']['s2member']['o']['registration_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $urls) as $url) {
// Notify each of the URLs.
if ($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $custom, true)) {
if ($url = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($role)), $url)) {
if ($url = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($level)), $url)) {
if ($url = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ccaps)), $url)) {
if ($url = preg_replace('/%%auto_eot_time%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($auto_eot_time)), $url)) {
if ($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($fname)), $url)) {
if ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($lname)), $url)) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($name)), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($login)), $url)) {
if ($url = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($pass)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
foreach ($fields as $var => $val) {
// Custom Fields.
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
}
示例11: cp
//.........这里部分代码省略.........
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');
if ((preg_match('/^web_accept$/i', $paypal['txn_type']) || $paypal['initial'] <= 0 && $paypal['regular'] <= 0) && $paypal['eotper']) {
update_user_option($user_id, 's2member_auto_eot_time', $eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time('', '', '', $paypal['eotper'], '', get_user_option('s2member_auto_eot_time', $user_id)));
$paypal['s2member_log'][] = 'Automatic EOT (End Of Term) Time set to: ' . date('D M j, Y g:i:s a T', $eot_time) . '.';
} else {
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'];
// Preserve 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);
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);
$processed_coupons = TRUE;
// Flag for routines below.
}
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 w/ advanced update routines.';
$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('/%%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_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('/%%full_coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['full_coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_code%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['coupon_code']), $sbj)) && ($sbj = preg_replace('/%%coupon_affiliate_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($coupon['affiliate_id']), $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)) {
示例12: new_user_notification
/**
* Handles new User/Member notifications.
*
* @package s2Member\Email_Configs
* @since 110707
*
* @param string|int $user_id A numeric WordPress User ID.
* @param string $user_pass Optional; plain text pass. No longer suggested, by here for back compat.
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
* @param string $user_email Optional. This defaults to the user's currently configured email address.
* @return bool True if all required parameters are supplied, else false.
*/
public static function new_user_notification($user_id = 0, $user_pass = '', $notify = array('user', 'admin'), $user_email = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_new_user_notification', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$user_id = (int) $user_id;
$user_pass = (string) $user_pass;
$notify = (array) $notify;
$user_email = (string) $user_email;
if (!$user_pass && !empty($GLOBALS['ws_plugin__s2member_plain_text_pass'])) {
$user_pass = (string) $GLOBALS['ws_plugin__s2member_plain_text_pass'];
}
if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && $notify) {
$is_gte_wp43 = version_compare(get_bloginfo('version'), '4.3', '>=');
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
c_ws_plugin__s2member_email_configs::email_config_release();
if (in_array('user', $notify, true) && empty($GLOBALS['ws_plugin__s2member_custom_wp_login_bp_password']) && ($user_pass && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%user_pass%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'] = sprintf(_x("Your Username/Password for:\n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", 's2member-front', 's2member'), get_bloginfo('name')), '%%wp_set_pass_url%%') !== false)) {
if ($is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false) {
remove_filter('random_password', 'c_ws_plugin__s2member_registrations::generate_password');
$user_activation_key = wp_generate_password(20, false);
// ↑ Make sure it's w/o filter.
do_action('retrieve_password_key', $user->user_login, $user_activation_key);
if (!class_exists('PasswordHash')) {
require_once ABSPATH . WPINC . '/class-phpass.php';
}
$wp_hasher = new PasswordHash(8, true);
$user_activation_key_hash = time() . ':' . $wp_hasher->HashPassword($user_activation_key);
$GLOBALS['wpdb']->update($GLOBALS['wpdb']->users, array('user_activation_key' => $user_activation_key_hash), array('user_login' => $user->user_login));
$wp_set_pass_url_args = array('action' => 'rp', 'key' => $user_activation_key, 'login' => $user->user_login);
$wp_set_pass_url = add_query_arg(urlencode_deep($wp_set_pass_url_args), wp_login_url());
} else {
$wp_set_pass_url = wp_lostpassword_url();
}
// Default behavior; and older versions of WordPress.
$fields = get_user_option('s2member_custom_fields', $user_id);
$custom = 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 ($sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_subject']) {
if ($sbj = c_ws_plugin__s2member_utils_strings::fill_cvs($sbj, $custom)) {
if ($sbj = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $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) {
// Custom Registration/Profile Fields.
if (!($sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
break;
}
}
}
// Empty; we can stop here.
if ($msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message']) {
if ($msg = c_ws_plugin__s2member_utils_strings::fill_cvs($msg, $custom)) {
if ($msg = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $msg)) {
if ($msg = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
if ($msg = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
if ($msg = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
if ($msg = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
if ($msg = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
if ($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
if ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
if ($msg = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
if (is_array($fields) && !empty($fields)) {
//.........这里部分代码省略.........
示例13: cp
//.........这里部分代码省略.........
// Only if NOT the existing Role.
$user->set_role($demotion_role);
}
// Give User the demotion Role.
if (apply_filters('ws_plugin__s2member_remove_ccaps_during_eot_events', (bool) $GLOBALS['WS_PLUGIN__']['s2member']['o']['eots_remove_ccaps'] || $is_refund_or_reversal, get_defined_vars())) {
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match('/^access_s2member_ccap_/', $cap)) {
$user->remove_cap($ccap = $cap);
}
}
}
delete_user_option($user_id, 's2member_subscr_gateway');
delete_user_option($user_id, 's2member_subscr_id');
delete_user_option($user_id, 's2member_subscr_baid');
delete_user_option($user_id, 's2member_subscr_cid');
delete_user_option($user_id, 's2member_ipn_signup_vars');
if (!apply_filters('ws_plugin__s2member_preserve_paid_registration_times', TRUE)) {
delete_user_option($user_id, 's2member_paid_registration_times');
}
delete_user_option($user_id, 's2member_last_status_scan');
delete_user_option($user_id, 's2member_first_payment_txn_id');
delete_user_option($user_id, 's2member_last_payment_time');
delete_user_option($user_id, 's2member_last_auto_eot_time');
delete_user_option($user_id, 's2member_auto_eot_time');
delete_user_option($user_id, 's2member_file_download_access_log');
delete_user_option($user_id, 's2member_authnet_payment_failures');
update_user_option($user_id, 's2member_last_auto_eot_time', time());
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Demoted by s2Member: ' . date('D M j, Y g:i a T'));
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Paid Subscr. ID @ time of demotion: ' . $paypal['subscr_gateway'] . ' → ' . $paypal['subscr_id']);
$paypal['s2member_log'][] = 'Member Level/Capabilities demoted to: ' . ucwords(preg_replace('/_/', ' ', $demotion_role)) . '.';
if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) as $url) {
// Handle EOT Notifications.
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($eot_del_type)), $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url))) {
if (($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url))) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
// Custom Registration/Profile Fields.
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
$paypal['s2member_log'][] = 'EOT/Deletion Notification URLs have been processed.';
}
if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_recipients']) {
$msg = $sbj = '(s2Member / API Notification Email) - EOT/Deletion';
$msg .= "\n\n";
示例14: auto_eot_system
//.........这里部分代码省略.........
$user->set_role($demotion_role);
}
if (apply_filters('ws_plugin__s2member_remove_ccaps_during_eot_events', (bool) $GLOBALS['WS_PLUGIN__']['s2member']['o']['eots_remove_ccaps'], get_defined_vars())) {
foreach ($user->allcaps as $cap => $cap_enabled) {
if (preg_match('/^access_s2member_ccap_/', $cap)) {
$user->remove_cap($ccap = $cap);
}
}
}
delete_user_option($user_id, 's2member_subscr_gateway');
delete_user_option($user_id, 's2member_subscr_id');
delete_user_option($user_id, 's2member_subscr_baid');
delete_user_option($user_id, 's2member_subscr_cid');
delete_user_option($user_id, 's2member_ipn_signup_vars');
if (!apply_filters('ws_plugin__s2member_preserve_paid_registration_times', TRUE)) {
delete_user_option($user_id, 's2member_paid_registration_times');
}
delete_user_option($user_id, 's2member_last_status_scan');
delete_user_option($user_id, 's2member_first_payment_txn_id');
delete_user_option($user_id, 's2member_last_payment_time');
delete_user_option($user_id, 's2member_last_auto_eot_time');
delete_user_option($user_id, 's2member_auto_eot_time');
delete_user_option($user_id, 's2member_file_download_access_log');
delete_user_option($user_id, 's2member_authnet_payment_failures');
update_user_option($user_id, 's2member_last_auto_eot_time', $auto_eot_time);
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Demoted by s2Member: ' . date('D M j, Y g:i a T'));
if ($subscr_gateway && $subscr_id) {
// Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Paid Subscr. ID @ time of demotion: ' . $subscr_gateway . ' → ' . $subscr_id);
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) as $url) {
// Handle EOT Notifications.
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $custom, true)) && ($url = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode('auto-eot-cancellation-expiration-demotion')), $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_id)), $url))) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_recipients']) {
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
c_ws_plugin__s2member_email_configs::email_config_release();
$msg = $sbj = '(s2Member / API Notification Email) - EOT/Deletion';
$msg .= "\n\n";
// Spacing in the message body.
$msg .= 'eot_del_type: %%eot_del_type%%' . "\n";