本文整理汇总了PHP中c_ws_plugin__s2member_utils_users::get_user_email_with方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_users::get_user_email_with方法的具体用法?PHP c_ws_plugin__s2member_utils_users::get_user_email_with怎么用?PHP c_ws_plugin__s2member_utils_users::get_user_email_with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_users
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_users::get_user_email_with方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
/* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
/**/
if (!empty($paypal["txn_type"]) && preg_match("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)\$/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["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"])))) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __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_failed|recurring_payment_failed|recurring_payment_skipped` ).";
/**/
$processing = $during = true;
/* Yes, we ARE processing this. */
/**/
$paypal["s2member_log"][] = "This `txn_type` does not require any action on the part of s2Member.";
$paypal["s2member_log"][] = "s2Member does NOT respond to individual failed payments, only multiple consecutive failed payments.";
$paypal["s2member_log"][] = "When multiple consecutive payments fail, a special IPN response will be triggered.";
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
} else {
$paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_failed|recurring_payment_failed|recurring_payment_skipped` ).";
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", $paypal, get_defined_vars());
} else {
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", false, get_defined_vars());
}
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:50,代码来源:paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php
示例2: 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);
/* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
/**/
if (!empty($paypal["txn_type"]) && preg_match("/^recurring_payment_profile_created\$/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["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"])))) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __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 ( `recurring_payment_profile_created` ).";
/**/
$processing = $during = true;
/* Yes, we ARE processing this. */
/**/
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
$paypal["s2member_log"][] = "s2Member Pro handles this event on-site, with an IPN proxy.";
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_during_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
} else {
$paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `recurring_payment_profile_created` ).";
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", $paypal, get_defined_vars());
} else {
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", false, get_defined_vars());
}
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:49,代码来源:paypal-notify-in-rec-profile-creation-w-level.inc.php
示例3: 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)\$/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 5 seconds. Waiting for a possible ( `subscr_signup|subscr_modify|recurring_payment_profile_created` ).";
sleep(5);
// 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"];
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"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url) {
if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $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("/%%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.";
}
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
$msg .= "\n\n";
// Spacing in the message body.
$msg .= "subscr_id: %%subscr_id%%\n";
$msg .= "subscr_baid: %%subscr_baid%%\n";
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-notify-in-subscr-or-rp-payment-w-level.inc.php
示例4: 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"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) {
// Handle Cancellation Notifications.
if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim(@$cv[$1]))', $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("/%%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"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
$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:adnandot,项目名称:intenseburn,代码行数:101,代码来源:paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php
示例5: 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_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i', $paypal['txn_type']) && ($recurring = TRUE) || !empty($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']) && ($recurring = TRUE) || !empty($paypal['txn_type']) && preg_match('/^new_case$/i', $paypal['txn_type']) && !empty($paypal['case_type']) && preg_match('/^chargeback$/i', $paypal['case_type']) && !($recurring = FALSE) || !empty($paypal['payment_status']) && preg_match('/^(refunded|reversed|reversal)$/i', $paypal['payment_status']) && !($recurring = FALSE)) && (!empty($paypal['subscr_id']) || ($paypal['subscr_id'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal)) || !empty($paypal['parent_txn_id']) && ($paypal['subscr_id'] = $paypal['parent_txn_id'])) && (!empty($paypal['period1']) || ($paypal['period1'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal, FALSE)) || empty($recurring) || ($paypal['period1'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('period1', FALSE, $paypal['subscr_id'])) || ($paypal['period1'] = '0 D')) && (!empty($paypal['period3']) || ($paypal['period3'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal, FALSE)) || empty($recurring) || ($paypal['period3'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('period3', FALSE, $paypal['subscr_id'])) || ($paypal['period3'] = '1 D')) && ((!empty($paypal['item_number']) || ($paypal['item_number'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal)) || ($paypal['item_number'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('item_number', FALSE, $paypal['subscr_id'])) || ($paypal['item_number'] = '1')) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_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'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('item_name', FALSE, $paypal['subscr_id'])) || ($paypal['item_name'] = $_SERVER['HTTP_HOST'])) && (!empty($paypal['payer_email']) || ($paypal['payer_email'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('payer_email', FALSE, $paypal['subscr_id'])) || ($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_eot', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
$is_refund = preg_match('/^refunded$/i', $paypal['payment_status']) && !empty($paypal['parent_txn_id']);
$is_reversal = preg_match('/^(reversed|reversal)$/i', $paypal['payment_status']) && !empty($paypal['parent_txn_id']);
$is_reversal = !$is_reversal ? preg_match('/^new_case$/i', $paypal['txn_type']) && preg_match('/^chargeback$/i', $paypal['case_type']) : $is_reversal;
$is_refund_or_reversal = $is_refund || $is_reversal;
// If either of the previous tests above evaluated to true; then it's obviously a Refund and/or a Reversal.
$is_partial_refund = !$is_refund || !empty($paypal['mc_gross']) && ($original_txn_type = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('txn_type', FALSE, $paypal['subscr_id'])) === 'web_accept' && ($original_mc_gross = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('mc_gross', FALSE, $paypal['subscr_id'])) <= abs($paypal['mc_gross']) ? FALSE : TRUE;
$is_delayed_eot = !$is_refund_or_reversal && preg_match('/^(subscr_eot|recurring_payment_expired)$/i', $paypal['txn_type']) && preg_match('/^I-/i', $paypal['subscr_id']);
if ($is_refund_or_reversal) {
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ' . ($identified_as = '( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` )') . '.';
} else {
$paypal['s2member_log'][] = 's2Member `txn_type` identified as ' . ($identified_as = '( `subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment` ) - or - `recurring_payment_profile_cancel` w/ `initial_payment_status` ( `failed` )') . '.';
}
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_eot 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 . '.';
}
$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)) && !empty($user->ID)) {
$fields = get_user_option('s2member_custom_fields', $user_id);
// These will be needed below.
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
// Needed below.
$user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
if (!$is_refund_or_reversal && !$is_delayed_eot && !get_user_option('s2member_auto_eot_time', $user_id) || $is_refund_or_reversal && $is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,partial_refunds,reversals' || $is_refund_or_reversal && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,partial_refunds,reversals' || $is_refund_or_reversal && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,reversals' || $is_refund && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds' || $is_reversal && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'reversals') {
if (!$user->has_cap('administrator')) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled']) {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_eot_behavior'] === 'demote') {
$processing = $during = TRUE;
// Yes, we ARE processing this.
$eot_del_type = $is_refund_or_reversal ? 'ipn-refund-reversal-demotion' : 'ipn-cancellation-expiration-demotion';
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role('subscriber');
$existing_role = c_ws_plugin__s2member_user_access::user_access_role($user);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote', get_defined_vars());
do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), $eot_del_type, 'modification', $demotion_role);
do_action('ws_plugin__s2member_during_collective_eots', $user_id, get_defined_vars(), $eot_del_type, 'modification');
unset($__refs, $__v);
// Housekeeping.
if ($existing_role !== $demotion_role) {
// 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'] && is_array($cv = preg_split('/\\|/', $paypal['custom']))) {
//.........这里部分代码省略.........
示例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('/^(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.';
}
//.........这里部分代码省略.........
示例7: 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.
*
* @todo Optimize with ``empty()`` and ``isset()``.
*/
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_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)\$/i", $paypal["txn_type"]) && ($recurring = true) || !empty($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"]) && ($recurring = true) || !empty($paypal["txn_type"]) && preg_match("/^new_case\$/i", $paypal["txn_type"]) && !empty($paypal["case_type"]) && preg_match("/^chargeback\$/i", $paypal["case_type"]) && !($recurring = false) || !empty($paypal["payment_status"]) && preg_match("/^(refunded|reversed|reversal)\$/i", $paypal["payment_status"]) && !($recurring = false)) && (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal)) || !empty($paypal["parent_txn_id"]) && ($paypal["subscr_id"] = $paypal["parent_txn_id"])) && (!empty($paypal["period1"]) || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal, false)) || empty($recurring) || ($paypal["period1"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period1", false, $paypal["subscr_id"])) || ($paypal["period1"] = "0 D")) && (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal, false)) || empty($recurring) || ($paypal["period3"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period3", false, $paypal["subscr_id"])) || ($paypal["period3"] = "1 D")) && ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal)) || ($paypal["item_number"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_number", false, $paypal["subscr_id"])) || ($paypal["item_number"] = "1")) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_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"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("item_name", false, $paypal["subscr_id"])) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"])) && (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("payer_email", false, $paypal["subscr_id"])) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal["subscr_id"])))) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", 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)) {
$is_refund = preg_match("/^refunded\$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"];
$is_reversal = preg_match("/^(reversed|reversal)\$/i", $paypal["payment_status"]) && $paypal["parent_txn_id"];
$is_reversal = !$is_reversal ? preg_match("/^new_case\$/i", $paypal["txn_type"]) && preg_match("/^chargeback\$/i", $paypal["case_type"]) : $is_reversal;
$is_refund_or_reversal = $is_refund || $is_reversal;
// If either of the previous tests above evaluated to true; then it's obviously a Refund and/or a Reversal.
$is_partial_refund = !$is_refund || !empty($paypal["mc_gross"]) && ($original_txn_type = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("txn_type", FALSE, $paypal["subscr_id"])) === "web_accept" && ($original_mc_gross = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("mc_gross", FALSE, $paypal["subscr_id"])) <= abs($paypal["mc_gross"]) ? FALSE : TRUE;
$is_delayed_eot = !$is_refund_or_reversal && preg_match("/^(subscr_eot|recurring_payment_expired)\$/i", $paypal["txn_type"]) && preg_match("/^I-/i", $paypal["subscr_id"]);
if ($is_refund_or_reversal) {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as " . ($identified_as = "( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` )") . ".";
} else {
$paypal["s2member_log"][] = "s2Member `txn_type` identified as " . ($identified_as = "( `subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment` ) - or - `recurring_payment_profile_cancel` w/ `initial_payment_status` ( `failed` )") . ".";
}
if (empty($_REQUEST["s2member_paypal_proxy"])) {
$paypal["s2member_log"][] = "Sleeping for 10 seconds. Waiting for a possible ( `subscr_signup|subscr_modify|recurring_payment_profile_created` ).";
sleep(10);
// Sleep here for a moment. PayPal sometimes sends a subscr_eot 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 . ".";
}
$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)) && !empty($user->ID)) {
$fields = get_user_option("s2member_custom_fields", $user_id);
// These will be needed below.
$user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
// Needed below.
$user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
if (!$is_refund_or_reversal && !$is_delayed_eot && !get_user_option("s2member_auto_eot_time", $user_id) || $is_refund_or_reversal && $is_partial_refund && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds,partial_refunds,reversals" || $is_refund_or_reversal && !$is_partial_refund && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds,reversals" || $is_refund && !$is_partial_refund && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds" || $is_reversal && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "reversals") {
if (!$user->has_cap("administrator")) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote") {
$processing = $during = true;
// Yes, we ARE processing this.
$eot_del_type = $is_refund_or_reversal ? "ipn-refund-reversal-demotion" : "ipn-cancellation-expiration-demotion";
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role("subscriber");
$existing_role = c_ws_plugin__s2member_user_access::user_access_role($user);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", get_defined_vars());
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), $eot_del_type, "modification", $demotion_role);
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars(), $eot_del_type, "modification");
unset($__refs, $__v);
if ($existing_role !== $demotion_role) {
// 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_custom");
delete_user_option($user_id, "s2member_subscr_id");
delete_user_option($user_id, "s2member_subscr_baid");
delete_user_option($user_id, "s2member_subscr_gateway");
delete_user_option($user_id, "s2member_ipn_signup_vars");
if (!apply_filters("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars())) {
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_auto_eot_time");
delete_user_option($user_id, "s2member_file_download_access_log");
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"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) {
// Handle EOT Notifications.
if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($eot_del_type)), $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["subscr_id"])), $url))) {
if (($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->last_name)), $url))) {
if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($user->first_name . " " . $user->last_name))), $url)) {
if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_email)), $url)) {
if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_login)), $url)) {
//.........这里部分代码省略.........