本文整理汇总了PHP中c_ws_plugin__s2member_paypal_utilities类的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_paypal_utilities类的具体用法?PHP c_ws_plugin__s2member_paypal_utilities怎么用?PHP c_ws_plugin__s2member_paypal_utilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了c_ws_plugin__s2member_paypal_utilities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sc_paypal_button_encryption
/**
* Handles PayPal® Button encryption.
*
* This uses the PayPal® API. s2Member will NOT attempt to encrypt Buttons until there is at least a Business Email Address and API Username configured.
* s2Member also maintains a log of communication with the PayPal® API. If logging is enabled, check: `/wp-content/plugins/s2member-logs/paypal-api.log`.
*
* @package s2Member\PayPal
* @since 3.5
*
* @param str $code The PayPal® Button Code before encryption.
* @param array $vars An array of defined variables in the scope of the calling Filter.
* @return str The Resulting PayPal® Button Code *( possibly encrypted, depending on configuration )*.
*/
public static function sc_paypal_button_encryption($code = FALSE, $vars = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_sc_paypal_button_encryption", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]) {
$cache = apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache", true, get_defined_vars());
/**/
eval('$_code = $vars["_code"]; $attr = $vars["attr"];');
/* Let's unpack ( i.e. use shorter references ) to these two important vars. */
/**/
if ($cache && ($transient = "s2m_btn_" . md5($code . c_ws_plugin__s2member_utilities::ver_checksum())) && ($cache = get_transient($transient))) {
$code = $cache;
} else {
if (is_array($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array($_code)) && !empty($inputs)) {
$paypal = array("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => $attr["sp"] || $attr["rr"] === "BN" ? "BUYNOW" : "SUBSCRIBE");
/**/
$i = 0;
/* Initialize incremental variable counter. PayPal® wants these numbered using L_BUTTONVAR{n}; where {n} starts at zero. */
foreach ($inputs as $input => $value) {
/* Now run through each of the input variables that we parsed from the Full Button Code */
if (!preg_match("/^cmd\$/i", $input)) {
/* The PayPal® API method `BMCreateButton` expects (amount|a1|a3) to include 2 decimal places. */
if (preg_match("/^(amount|a1|a3)\$/i", $input)) {
$value = number_format($value, 2, ".", "");
}
/**/
$paypal["L_BUTTONVAR" . $i] = $input . "=" . $value;
$i++;
/* Increment variable counter. */
}
}
/**/
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"]) && !empty($paypal["WEBSITECODE"]) && ($code = $paypal["WEBSITECODE"])) {
$default_image = "https://www.paypal.com/" . _x("en_US", "s2member-front paypal-button-lang-code", "s2member") . "/i/btn/btn_xpressCheckout.gif";
/**/
$code = preg_replace("/\\<img[^\\>]+\\>/i", "", $code);
/* Remove the 1x1 pixel tracking image that PayPal® sticks in there. */
$code = preg_replace("/(\\<input)([^\\>]+)(\\>)/ie", "'\\1'.rtrim(stripslashes('\\2'),'/').' /\\3'", $code);
/* Use XHTML! */
/**/
$code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_ds(esc_attr($default_image)) . '"', $code);
/**/
$code = $attr["output"] === "anchor" ? '<a href="' . esc_attr(c_ws_plugin__s2member_utils_forms::form_whips_2_url($code)) . '"><img src="' . esc_attr($attr["image"] && $attr["image"] !== "default" ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal®" /></a>' : $code;
$code = $attr["output"] === "url" ? c_ws_plugin__s2member_utils_forms::form_whips_2_url($code) : $code;
/**/
$cache && $transient ? set_transient($transient, $code, apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache_exp_time", 3600, get_defined_vars())) : null;
/* Caching? */
}
}
}
}
/* No WordPress® Filters apply here. */
/* Instead, use: `ws_plugin__s2member_sc_paypal_button`. */
return $code;
/* Button Code. Possibly w/ API encryption now. */
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:72,代码来源:sc-paypal-button-e.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("/^(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
示例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);
/* 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
示例4: s2member_pro_paypal_rbp_for_user
function s2member_pro_paypal_rbp_for_user($user_id = FALSE)
{
$user_id = (int) $user_id;
$user_id = $user_id ? $user_id : get_current_user_id();
if (!$user_id) {
return array();
}
$user_subscr_id = get_user_option('s2member_subscr_id', $user_id);
if (!$user_subscr_id) {
return array();
}
$paypal['METHOD'] = 'GetRecurringPaymentsProfileDetails';
$paypal['PROFILEID'] = $user_subscr_id;
if (is_array($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal['__error'])) {
return $paypal;
}
return array();
}
开发者ID:codeforest,项目名称:s2member-pro,代码行数:18,代码来源:paypal-api-functions.inc.php
示例5: authnet_checkout
/**
* Handles processing of Pro Form checkouts.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after a custom URL redirection.
*
* @todo Build in routine to void first payment if Recurring Profile creation fails for some reason? Seems logical, even though highly unlikely.
*/
public static function authnet_checkout()
{
if (!empty($_POST["s2member_pro_authnet_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_authnet_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-authnet-checkout")) {
$GLOBALS["ws_plugin__s2member_pro_authnet_checkout_response"] = array();
// This holds the global response details.
$global_response =& $GLOBALS["ws_plugin__s2member_pro_authnet_checkout_response"];
// This is a shorter reference.
$post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_authnet_checkout"]));
$post_vars["attr"] = unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"]));
// And Filter.
$post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_authnet_checkout_post_attr", $post_vars["attr"], get_defined_vars());
$post_vars["recaptcha_challenge_field"] = !$post_vars["recaptcha_challenge_field"] ? trim(stripslashes($_POST["recaptcha_challenge_field"])) : $post_vars["recaptcha_challenge_field"];
$post_vars["recaptcha_response_field"] = !$post_vars["recaptcha_response_field"] ? trim(stripslashes($_POST["recaptcha_response_field"])) : $post_vars["recaptcha_response_field"];
$post_vars["name"] = trim($post_vars["first_name"] . " " . $post_vars["last_name"]);
$post_vars["email"] = apply_filters("user_registration_email", sanitize_email($post_vars["email"]), get_defined_vars());
$post_vars["username"] = is_multisite() ? strtolower($post_vars["username"]) : $post_vars["username"];
// Force lowercase.
$post_vars["username"] = preg_replace("/\\s+/", "", sanitize_user($post_vars["_o_username"] = $post_vars["username"], is_multisite()));
if (empty($post_vars["card_expiration"]) && isset($post_vars["card_expiration_month"], $post_vars["card_expiration_year"])) {
$post_vars["card_expiration"] = $post_vars["card_expiration_month"] . "/" . $post_vars["card_expiration_year"];
}
if (!c_ws_plugin__s2member_pro_authnet_responses::authnet_form_attr_validation_errors($post_vars["attr"])) {
if (!($error = c_ws_plugin__s2member_pro_authnet_responses::authnet_form_submission_validation_errors("checkout", $post_vars))) {
$cp_attr = c_ws_plugin__s2member_pro_authnet_utilities::authnet_apply_coupon($post_vars["attr"], $post_vars["coupon"], "attr", array("affiliates-silent-post"));
$cost_calculations = c_ws_plugin__s2member_pro_authnet_utilities::authnet_cost($cp_attr["ta"], $cp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_attr["cc"], $cp_attr["desc"]);
if ($cost_calculations["total"] <= 0 && $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
$post_vars["attr"]["tp"] = "0";
// Ditch the trial period completely.
$cost_calculations["sub_total"] = $cost_calculations["trial_sub_total"];
// Use as regular sub-total (ditch trial sub-total).
$cost_calculations["tax"] = $cost_calculations["trial_tax"];
// Use as regular tax (ditch trial tax).
$cost_calculations["tax_per"] = $cost_calculations["trial_tax_per"];
// Use as regular tax (ditch trial tax).
$cost_calculations["total"] = $cost_calculations["trial_total"];
// Use as regular total (ditch trial).
$cost_calculations["trial_sub_total"] = "0.00";
// Ditch the initial total (using as grand total).
$cost_calculations["trial_tax"] = "0.00";
// Ditch this calculation now also.
$cost_calculations["trial_tax_per"] = "";
// Ditch this calculation now also.
$cost_calculations["trial_total"] = "0.00";
// Ditch this calculation now also.
}
$use_recurring_profile = $post_vars["attr"]["rr"] === "BN" || !$post_vars["attr"]["tp"] && !$post_vars["attr"]["rr"] ? false : true;
$is_independent_ccaps_sale = $post_vars["attr"]["level"] === "*" ? true : false;
// Selling Independent Custom Capabilities?
if ($use_recurring_profile && $cost_calculations["trial_total"] <= 0 && $cost_calculations["total"] <= 0) {
if (!$post_vars["attr"]["rr"] && $post_vars["attr"]["rt"] !== "L") {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 1) {
$post_vars["attr"]["level_ccaps_eotper"] .= ":" . $post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"];
} else {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 0) {
$post_vars["attr"]["level_ccaps_eotper"] .= "::" . $post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"];
}
}
} else {
if ($post_vars["attr"]["rr"] && $post_vars["attr"]["rrt"] && $post_vars["attr"]["rt"] !== "L") {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 1) {
$post_vars["attr"]["level_ccaps_eotper"] .= ":" . $post_vars["attr"]["rp"] * $post_vars["attr"]["rrt"] . " " . $post_vars["attr"]["rt"];
} else {
if (substr_count($post_vars["attr"]["level_ccaps_eotper"], ":") === 0) {
$post_vars["attr"]["level_ccaps_eotper"] .= "::" . $post_vars["attr"]["rp"] * $post_vars["attr"]["rrt"] . " " . $post_vars["attr"]["rt"];
}
}
}
}
}
if ($use_recurring_profile && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
$period1 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($post_vars["attr"]["tp"] . " " . $post_vars["attr"]["tt"]);
$period3 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"]);
$start_time = $post_vars["attr"]["tp"] ? c_ws_plugin__s2member_pro_authnet_utilities::authnet_start_time($period1) : c_ws_plugin__s2member_pro_authnet_utilities::authnet_start_time($period3);
// Or next billing cycle.
$reference = $start_time . ":" . $period1 . ":" . $period3 . "~" . $_SERVER["HTTP_HOST"] . "~" . $post_vars["attr"]["level_ccaps_eotper"] . "~" . $cost_calculations["cur"];
update_user_meta($user_id, "first_name", $post_vars["first_name"]) . update_user_meta($user_id, "last_name", $post_vars["last_name"]);
if (!($_authnet = array()) && (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0)) {
$_authnet["x_type"] = "AUTH_CAPTURE";
$_authnet["x_method"] = "CC";
$_authnet["x_email"] = $user->user_email;
$_authnet["x_first_name"] = $post_vars["first_name"];
$_authnet["x_last_name"] = $post_vars["last_name"];
$_authnet["x_customer_ip"] = $_SERVER["REMOTE_ADDR"];
$_authnet["x_invoice_num"] = "s2-" . uniqid();
$_authnet["x_description"] = $cost_calculations["desc"];
$_authnet["s2_initial_payment"] = "1";
// Initial.
$_authnet["s2_invoice"] = $post_vars["attr"]["level_ccaps_eotper"];
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:authnet-checkout-in.inc.php
示例6: paypal_form_attr_validation_errors
/**
* Validates the configuration of the current form.
*
* Free Registration Forms do NOT require API Credentials.
*
* @package s2Member\PayPal
* @since 1.5
*
* @param array $attr An array of Pro-Form Attributes.
* @return null|array Null if there are no errors, else a response array.
*/
public static function paypal_form_attr_validation_errors($attr = FALSE)
{
if (!($response = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_api_validation_errors($attr)) || !empty($attr["register"])) {
if ($attr["cancel"]) {
if (!is_user_logged_in()) {
$response = array("response" => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to cancel your account.', "s2member-front", "s2member"), esc_attr(wp_login_url($_SERVER["REQUEST_URI"]))), "error" => true);
} else {
if (!is_object($user = wp_get_current_user()) || !($user_id = $user->ID) || !($subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
$response = array("response" => _x('Nothing to cancel. You\'re NOT a paid Member.', "s2member-front", "s2member"), "error" => true);
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
if (!($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id))) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to cancel at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
}
}
} else {
if (is_array($paypal = array("PROFILEID" => $subscr_id, "METHOD" => "GetRecurringPaymentsProfileDetails"))) {
if (!($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) || !empty($paypal["__error"])) {
if ($paypal && !empty($paypal["__error"]) && !empty($paypal["L_ERRORCODE0"]) && $paypal["L_ERRORCODE0"] === "11592") {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to cancel your Subscription.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/cgi-bin/webscr?cmd=_subscr-find&alias=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_merchant_id"]))), "error" => true);
} else {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to cancel at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to cancel. You have NO recurring fees.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
}
}
}
} else {
if ($attr["update"]) {
if (!is_user_logged_in()) {
$response = array("response" => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to update your billing information.', "s2member-front", "s2member"), esc_attr(wp_login_url($_SERVER["REQUEST_URI"]))), "error" => true);
} else {
if (!is_object($user = wp_get_current_user()) || !($user_id = $user->ID) || !($subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
$response = array("response" => _x('Nothing to update. You\'re NOT a paid Member.', "s2member-front", "s2member"), "error" => true);
} else {
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
if (!($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id))) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
} else {
if (!empty($paypal["TENDER"]) && strtoupper($paypal["TENDER"]) === "P") {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to update at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
} else {
if (is_array($paypal = array("PROFILEID" => $subscr_id, "METHOD" => "GetRecurringPaymentsProfileDetails"))) {
if (!($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) || !empty($paypal["__error"]) || empty($paypal["ACCT"]) || strlen($paypal["ACCT"]) !== 4) {
if ($paypal && empty($paypal["__error"]) && (empty($paypal["ACCT"]) || strlen($paypal["ACCT"]) !== 4)) {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
if ($paypal && !empty($paypal["__error"]) && !empty($paypal["L_ERRORCODE0"]) && $paypal["L_ERRORCODE0"] === "11592") {
$response = array("response" => sprintf(_x('Please <a href="%s" rel="nofollow">log in at PayPal</a> to update your billing information.', "s2member-front", "s2member"), esc_attr("https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com") . "/")), "error" => true);
} else {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
} else {
if (!empty($paypal["STATUS"]) && preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('<strong>Unable to update at this time.</strong> Your account is pending other changes. Please try again in 15 minutes.', "s2member-front", "s2member"), "error" => true);
} else {
if (empty($paypal["STATUS"]) || !preg_match("/^(Active|ActiveProfile|Suspended|SuspendedProfile)\$/i", $paypal["STATUS"])) {
$response = array("response" => _x('Nothing to update. You have NO recurring fees. Or, your billing profile is no longer active. Please contact Support if you need assistance.', "s2member-front", "s2member"), "error" => true);
}
}
}
}
//.........这里部分代码省略.........
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:101,代码来源:paypal-responses.inc.php
示例7: paypal_checkout
//.........这里部分代码省略.........
$paypal_set_xco["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal_set_xco["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["level_ccaps_eotper"];
$paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
}
}
} else {
$paypal_set_xco["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
/**/
$paypal_set_xco["PAYMENTREQUEST_0_DESC"] = $cost_calculations["desc"];
$paypal_set_xco["PAYMENTREQUEST_0_CUSTOM"] = $post_vars["attr"]["custom"];
/**/
$paypal_set_xco["PAYMENTREQUEST_0_CURRENCYCODE"] = $cost_calculations["cur"];
$paypal_set_xco["PAYMENTREQUEST_0_ITEMAMT"] = $cost_calculations["sub_total"];
$paypal_set_xco["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["tax"];
$paypal_set_xco["PAYMENTREQUEST_0_AMT"] = $cost_calculations["total"];
/**/
$paypal_set_xco["L_PAYMENTREQUEST_0_QTY0"] = "1";
/* Always (1). */
$paypal_set_xco["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal_set_xco["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["level_ccaps_eotper"];
$paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
}
/**/
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTONAME"] = $post_vars["name"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTREET"] = $post_vars["street"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCITY"] = $post_vars["city"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTATE"] = $post_vars["state"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = $post_vars["country"];
$paypal_set_xco["PAYMENTREQUEST_0_SHIPTOZIP"] = $post_vars["zip"];
/**/
$paypal_set_xco["EMAIL"] = $user ? $user->user_email : $post_vars["email"];
}
/**/
if (($paypal_set_xco = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal_set_xco)) && empty($paypal_set_xco["__error"])) {
set_transient("s2m_" . md5("s2member_transient_express_checkout_" . $paypal_set_xco["TOKEN"]), $post_vars, 10800);
/**/
$endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
/**/
wp_redirect(add_query_arg("token", urlencode($paypal_set_xco["TOKEN"]), "https://" . $endpoint . "/cgi-bin/webscr?cmd=_express-checkout"));
/**/
exit;
/* Clean exit. */
} else {
$global_response = array("response" => $paypal_set_xco["__error"], "error" => true);
}
} else {
if ($use_recurring_profile && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
if (!($cur__subscr_id = get_user_option("s2member_subscr_id")) || !($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response(array("METHOD" => "GetRecurringPaymentsProfileDetails", "PROFILEID" => $cur__subscr_id))) || !empty($paypal["__error"]) || !preg_match("/^(Pending|PendingProfile)\$/i", $paypal["STATUS"])) {
$period1 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($post_vars["attr"]["tp"] . " " . $post_vars["attr"]["tt"]);
$period3 = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($post_vars["attr"]["rp"] . " " . $post_vars["attr"]["rt"]);
/**/
$start_time = $post_vars["attr"]["tp"] ? c_ws_plugin__s2member_pro_paypal_utilities::paypal_start_time($period1) : c_ws_plugin__s2member_pro_paypal_utilities::paypal_start_time($period3);
/* Or next billing cycle. */
/**/
$reference = $start_time . ":" . $period1 . ":" . $period3 . "~" . $_SERVER["HTTP_HOST"] . "~" . $post_vars["attr"]["level_ccaps_eotper"];
/**/
update_user_meta($user_id, "first_name", $post_vars["first_name"]) . update_user_meta($user_id, "last_name", $post_vars["last_name"]);
/**/
if (!($_paypal = array()) && (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0)) {
if ($_GET["s2member_paypal_xco"] === "s2member_pro_paypal_checkout_return" && !empty($_GET["token"]) && ($_paypal_xco_details = array("METHOD" => "GetExpressCheckoutDetails", "TOKEN" => $_GET["token"])) && ($_paypal_xco_details = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($_paypal_xco_details)) && empty($_paypal_xco_details["__error"])) {
$_paypal["METHOD"] = "DoExpressCheckoutPayment";
/**/
$_paypal["TOKEN"] = $_paypal_xco_details["TOKEN"];
$_paypal["PAYERID"] = $_paypal_xco_details["PAYERID"];
/**/
$_paypal["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:67,代码来源:paypal-checkout-rdp-in.inc.php
示例8: paypal_pro_period3
/**
* Get `period3` from either an array with `PROFILEREFERENCE|rp_invoice_id|period3`, or use an existing string.
*
* This will also convert `1 Day`, into `1 D`, and so on.
* This will also convert `1 SemiMonth`, into `2 W`, and so on.
* The Regular Period can never be less than 1 day ( `1 D` ).
*
* @package s2Member\PayPal
* @since 3.5
*
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
* If it's a string, we make sure it is a valid `period term` combination.
* @param string $default Optional. Value if unavailable. Defaults to `1 D`.
* @return string A `period3` string if possible, or defaults to `1 D`.
*/
public static function paypal_pro_period3($array_or_string = FALSE, $default = "1 D")
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars());
unset($__refs, $__v);
if (is_array($array_or_string) && isset($array_or_string["PROFILENAME"])) {
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
}
if (is_array($array = $array_or_string) && !empty($array["period3"])) {
$_period3 = trim($array["period3"]);
} else {
if (is_array($array = $array_or_string) && (!empty($array["PROFILEREFERENCE"]) || !empty($array["rp_invoice_id"]))) {
list($_reference, $_domain, $_item_number) = array_map("trim", preg_split("/~/", !empty($array["PROFILEREFERENCE"]) ? $array["PROFILEREFERENCE"] : $array["rp_invoice_id"], 3));
list($_start_time, $_period1, $_period3) = array_map("trim", preg_split("/\\:/", $_reference, 3));
} else {
if (is_array($array = $array_or_string) && !empty($array["mp_id"]) && ($ipn_signup_var_period3 = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var("period3", FALSE, $array["mp_id"]))) {
$_period3 = trim($ipn_signup_var_period3);
} else {
if (is_string($string = $array_or_string) && !empty($string)) {
$_period3 = trim($string);
}
}
}
}
if (!empty($_period3)) {
list($num, $span) = array_map("trim", preg_split("/ /", $_period3, 2));
if (strtoupper($span) === "SEMIMONTH" && is_numeric($num) && $num >= 1) {
$num = "2";
$span = "W";
}
if (strlen($span) !== 1) {
$span = c_ws_plugin__s2member_paypal_utilities::paypal_std_term($span);
}
$span = preg_match("/^[DWMY]\$/i", $span) ? $span : "";
$num = $span && is_numeric($num) && $num >= 0 ? $num : "";
$period3 = $num && $span ? $num . " " . strtoupper($span) : $default;
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $period3, get_defined_vars());
} else {
return apply_filters("ws_plugin__s2member_paypal_pro_period3", $default, get_defined_vars());
}
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:58,代码来源:paypal-utilities.inc.php
示例9: authnet_arb_service
/**
* Connect to and process ARB service information for Authorize.Net®.
*
* s2Member's Auto EOT System must be enabled for this to work properly.
*
* If you have a HUGE userbase, increase the max IPNs per process.
* But NOTE, this runs ``$per_process`` *( per Blog )* on a Multisite Network.
* To increase, use: ``add_filter ("ws_plugin__s2member_pro_arb_service_ipns_per_process");``.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @attaches-to ``add_action("ws_plugin__s2member_after_auto_eot_system");``
*
* @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
* @return null
*/
public static function authnet_arb_service($vars = FALSE)
{
global $wpdb;
/* Need global DB obj. */
global $current_site, $current_blog;
/* For Multisite support. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"]) {
$scan_time = apply_filters("ws_plugin__s2member_pro_arb_service_status_scan_time", strtotime("-1 day"), get_defined_vars());
$per_process = apply_filters("ws_plugin__s2member_pro_arb_service_ipns_per_process", $vars["per_process"], get_defined_vars());
/**/
if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_gateway' AND `meta_value` = 'authnet' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
foreach ($objs as $obj) {
if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
unset($authnet, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $ipn_q, $log4, $_log4, $log2, $logs_dir);
/* Unset these. */
/**/
if (($authnet = array("x_method" => "status")) && ($authnet[&quo
|
请发表评论