当前位置: 首页>>代码示例>>PHP>>正文


PHP c_ws_plugin__s2member_utils_encryption::encrypt方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_utils_encryption::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_encryption::encrypt方法的具体用法?PHP c_ws_plugin__s2member_utils_encryption::encrypt怎么用?PHP c_ws_plugin__s2member_utils_encryption::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_utils_encryption的用法示例。


在下文中一共展示了c_ws_plugin__s2member_utils_encryption::encrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * Handles Registration Links.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection.
  */
 public static function register()
 {
     do_action("ws_plugin__s2member_before_register", get_defined_vars());
     /**/
     if (!empty($_GET["s2member_register"])) {
         eval('while (@ob_end_clean ());');
         /* First we end/clean any output buffers that may exist already. */
         /**/
         $msg_503 = _x('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
         /**/
         if (is_array($register = preg_split("/\\:\\.\\:\\|\\:\\.\\:/", c_ws_plugin__s2member_utils_encryption::decrypt(trim(stripslashes((string) $_GET["s2member_register"])))))) {
             if (count($register) === 6 && $register[0] === "subscr_gateway_subscr_id_custom_item_number_time") {
                 if (is_numeric($register[5]) && $register[5] <= strtotime("now") && $register[5] >= strtotime("-" . apply_filters("ws_plugin__s2member_register_link_exp_time", "2 days", get_defined_vars()))) {
                     $_COOKIE["s2member_subscr_gateway"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[1]);
                     $_COOKIE["s2member_subscr_id"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[2]);
                     $_COOKIE["s2member_custom"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[3]);
                     $_COOKIE["s2member_item_number"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[4]);
                     /**/
                     if (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
                         status_header(200);
                         /* Send a 200 OK status header. */
                         header("Content-Type: text/html; charset=utf-8");
                         /* Content-Type with UTF-8. */
                         /**/
                         setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         /**/
                         do_action("ws_plugin__s2member_during_register", get_defined_vars());
                         /**/
                         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site() && ($location = c_ws_plugin__s2member_utils_urls::wp_signup_url())) {
                             echo '<script type="text/javascript">' . "\n";
                             echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
                             echo '</script>' . "\n";
                         } else {
                             if ($location = c_ws_plugin__s2member_utils_urls::wp_register_url()) {
                                 echo '<script type="text/javascript">' . "\n";
                                 echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
                                 echo '</script>' . "\n";
                             }
                         }
                         exit;
                         /* Clean exit. The browser will now be redirected to ``$location``. */
                     } else {
                         status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
                     }
                 } else {
                     status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
                 }
             } else {
                 status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
             }
         } else {
             status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
         }
     }
     /**/
     do_action("ws_plugin__s2member_after_register", get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:70,代码来源:register-in.inc.php

示例2: sc_google_button

 /**
  * Shortcode `[s2Member-Pro-Google-Button /]`.
  *
  * @package s2Member\Google
  * @since 1.5
  *
  * @attaches-to ``add_shortcode("s2Member-Pro-Google-Button");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string The resulting Google Button Code; HTML markup.
  */
 public static function sc_google_button($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     c_ws_plugin__s2member_no_cache::no_cache_constants(true);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $jwt_attr = c_ws_plugin__s2member_utils_encryption::encrypt(serialize($attr));
     $attr = shortcode_atts(array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "rrt" => "", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "anchor", "success" => "", "failure" => ""), $attr);
     if ($attr["modify"] || $attr["cancel"]) {
         $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-edit-button.png";
         $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-cancellation-button.php")));
         $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
         $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
         $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
         $code = $attr["output"] === "anchor" ? $code : $code;
         if ($attr["output"] === "url" && preg_match('/ href\\="(.*?)"/', $code, $m) && ($href = $m[1])) {
             $code = $url = c_ws_plugin__s2member_utils_urls::n_amps($href);
         }
         unset($href, $url, $m);
     } else {
         if ($attr["sp"]) {
             $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
             $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-sp-checkout-button.php")));
             $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
             $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
             $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
             $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
             $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
         } else {
             if ($attr["level"] === "*") {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-ccaps-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
                 $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
             } else {
                 $default_image = $GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images/google-wallet-co.png";
                 $code = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/templates/buttons/google-checkout-button.php")));
                 $code = preg_replace("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($GLOBALS["WS_PLUGIN__"]["s2member_pro"]["c"]["dir_url"] . "/images")), $code);
                 $code = preg_replace("/%%wpurl%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr(home_url())), $code);
                 $code = preg_replace("/%%jwt_attr%%/", c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($jwt_attr)), $code);
                 $code = preg_replace(array("/%%success%%/", "/%%failure%%/"), array($attr["success"], $attr["failure"]), $code);
                 $code = $_code = $attr["image"] && $attr["image"] !== "default" ? preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($attr["image"])) . '"', $code) : preg_replace('/ src\\="(.*?)"/', ' src="' . c_ws_plugin__s2member_utils_strings::esc_refs(esc_attr($default_image)) . '"', $code);
             }
         }
     }
     return $code;
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:61,代码来源:google-button-in.inc.php

示例3: register_link_gen

 /**
  * Generates Registration Access Links.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @param string $subscr_gateway Payment Gateway associated with a Customer.
  * @param string $subscr_id Unique Subscr. ID associated with Payment Gateway; associated with a Customer.
  * @param string $custom Custom String value *(as supplied in Shortcode)*; must start with installation domain name.
  * @param int|string $item_number An s2Member-generated `item_number` *( i.e. `1` for Level 1, or `level|ccaps|fixed-term`, or `sp|ids|expiration` )*.
  * @param bool $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
  * @return string|bool A Registration Access Link on success, else false on failure.
  */
 public static function register_link_gen($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_register_link_gen", get_defined_vars());
     unset($__refs, $__v);
     if ($subscr_gateway && is_string($subscr_gateway) && $subscr_id && is_string($subscr_id) && $custom && is_string($custom) && $item_number && (is_string($item_number) || is_numeric($item_number))) {
         $register = c_ws_plugin__s2member_utils_encryption::encrypt("subscr_gateway_subscr_id_custom_item_number_time:.:|:.:" . $subscr_gateway . ":.:|:.:" . $subscr_id . ":.:|:.:" . $custom . ":.:|:.:" . $item_number . ":.:|:.:" . strtotime("now"));
         $register_link = site_url("/?s2member_register=" . urlencode($register));
         // Generate long URL/link.
         if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($register_link))) {
             $register_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
         }
     }
     return apply_filters("ws_plugin__s2member_register_link_gen", !empty($register_link) ? $register_link : false, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:30,代码来源:register-access.inc.php

示例4: sp_access_link_gen

 /**
  * Generates Specific Post/Page Access links.
  *
  * @package s2Member\SP_Access
  * @since 3.5
  *
  * @param string|int $sp_ids Comma-delimited list of Specific Post/Page IDs *(numerical)*.
  * @param int|string $hours Optional. A numeric expiration time for this link, in hours. Defaults to `72`.
  * @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API.
  * @return str|bool A Specific Post/Page Access Link, or false on failure.
  */
 public static function sp_access_link_gen($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars());
     unset($__refs, $__v);
     if ((is_string($sp_ids) || is_numeric($sp_ids)) && ($sp_ids = preg_replace("/[^0-9;,]/", "", $sp_ids)) && ($leading_id = preg_replace("/^([0-9]+).*\$/", "\$1", $sp_ids)) && is_numeric($hours)) {
         $sp_access = c_ws_plugin__s2member_utils_encryption::encrypt("sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime("now") . ":.:|:.:" . $hours);
         $sp_access_link = add_query_arg("s2member_sp_access", urlencode($sp_access), get_permalink($leading_id));
         // Generate long URL/link.
         if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($sp_access_link))) {
             $sp_access_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
         }
     }
     return apply_filters("ws_plugin__s2member_sp_access_link_gen", !empty($sp_access_link) ? $sp_access_link : false, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:28,代码来源:sp-access.inc.php

示例5: register_link_gen

 /**
  * Generates Registration Access Links.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @param string     $subscr_gateway Payment Gateway associated with a Customer.
  * @param string     $subscr_id Unique Subscr. ID associated with Payment Gateway; associated with a Customer.
  * @param string     $custom Custom String value *(as supplied in Shortcode)*; must start with installation domain name.
  * @param int|string $item_number An s2Member-generated `item_number` *( i.e., `1` for Level 1, or `level|ccaps|fixed-term`, or `sp|ids|expiration` )*.
  * @param bool       $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
  *
  * @return string|bool A Registration Access Link on success, else false on failure.
  */
 public static function register_link_gen($subscr_gateway = '', $subscr_id = '', $custom = '', $item_number = '', $shrink = TRUE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_register_link_gen', get_defined_vars());
     unset($__refs, $__v);
     if ($subscr_gateway && is_string($subscr_gateway) && $subscr_id && is_string($subscr_id) && $custom && is_string($custom) && $item_number && (is_string($item_number) || is_numeric($item_number))) {
         $register = c_ws_plugin__s2member_utils_encryption::encrypt('subscr_gateway_subscr_id_custom_item_number_time:.:|:.:' . $subscr_gateway . ':.:|:.:' . $subscr_id . ':.:|:.:' . $custom . ':.:|:.:' . $item_number . ':.:|:.:' . strtotime('now'));
         $register_link = home_url('/?s2member_register=' . urlencode($register));
         // Generate long URL/link.
         if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten($register_link))) {
             $register_link = $shorter_url . '#' . $_SERVER['HTTP_HOST'];
         }
     }
     return apply_filters('ws_plugin__s2member_register_link_gen', !empty($register_link) ? $register_link : FALSE, get_defined_vars());
 }
开发者ID:codeforest,项目名称:s2member,代码行数:31,代码来源:register-access.inc.php

示例6: stripe_update

 /**
  * Handles processing of Pro-Form billing updates.
  *
  * @package s2Member\Stripe
  * @since 140617
  *
  * @attaches-to ``add_action('init');``
  */
 public static function stripe_update()
 {
     if (!empty($_POST['s2member_pro_stripe_update']['nonce']) && ($nonce = $_POST['s2member_pro_stripe_update']['nonce']) && wp_verify_nonce($nonce, 's2member-pro-stripe-update')) {
         $GLOBALS['ws_plugin__s2member_pro_stripe_update_response'] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS['ws_plugin__s2member_pro_stripe_update_response'];
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST['s2member_pro_stripe_update']));
         $post_vars['attr'] = !empty($post_vars['attr']) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars['attr'])) : array();
         $post_vars['attr'] = apply_filters('ws_plugin__s2member_pro_stripe_update_post_attr', $post_vars['attr'], get_defined_vars());
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         if (!c_ws_plugin__s2member_pro_stripe_responses::stripe_form_attr_validation_errors($post_vars['attr'])) {
             if (!($form_submission_validation_errors = c_ws_plugin__s2member_pro_stripe_responses::stripe_form_submission_validation_errors('update', $post_vars))) {
                 if (is_user_logged_in() && ($user = wp_get_current_user()) && ($user_id = $user->ID)) {
                     if (($cur__subscr_cid = get_user_option('s2member_subscr_cid')) && ($cur__subscr_id = get_user_option('s2member_subscr_id'))) {
                         if (is_object($stripe_subscription = c_ws_plugin__s2member_pro_stripe_utilities::get_customer_subscription($cur__subscr_cid, $cur__subscr_id)) && !preg_match('/^canceled$/i', $stripe_subscription->status) && !$stripe_subscription->cancel_at_period_end) {
                             unset($_POST['s2member_pro_stripe_update']['source_token']);
                             // These are good one-time only.
                             unset($_POST['s2member_pro_stripe_update']['source_token_summary']);
                             if (is_object($set_customer_source = c_ws_plugin__s2member_pro_stripe_utilities::set_customer_source($cur__subscr_cid, $post_vars['source_token'], $post_vars, $post_vars['attr']['reject_prepaid']))) {
                                 $global_response = array('response' => _x('<strong>Confirmed.</strong> Your billing information has been updated.', 's2member-front', 's2member'));
                                 if ($post_vars['attr']['success'] && ($custom_success_url = str_ireplace(array('%%s_response%%', '%%response%%'), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response['response'])), urlencode($global_response['response'])), $post_vars['attr']['success'])) && ($custom_success_url = trim(preg_replace('/%%(.+?)%%/i', '', $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, 's2p-v')) . exit;
                                 }
                             } else {
                                 $global_response = array('response' => $set_customer_source, 'error' => TRUE);
                             }
                         } else {
                             $global_response = array('response' => _x('<strong>Unable to update.</strong> 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 {
                         $global_response = array('response' => _x('<strong>Oops.</strong> No Customer|Subscr. ID. Please contact Support for assistance.', 's2member-front', 's2member'), 'error' => TRUE);
                     }
                 } else {
                     $global_response = array('response' => _x('You\'re <strong>NOT</strong> logged in.', 's2member-front', 's2member'), 'error' => TRUE);
                 }
             } else {
                 // Input form field validation errors.
                 $global_response = $form_submission_validation_errors;
             }
         }
     }
 }
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:51,代码来源:stripe-update-in.inc.php

示例7: paypal_checkout

 /**
  * Handles processing of Pro Form checkouts.
  *
  * @package s2Member\PayPal
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after a custom URL redirection; or upon Express Checkout redirection.
  */
 public static function paypal_checkout()
 {
     if (!empty($_POST["s2member_pro_paypal_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_paypal_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-paypal-checkout") || !empty($_GET["s2member_paypal_xco"]) && $_GET["s2member_paypal_xco"] === "s2member_pro_paypal_checkout_return" && !empty($_GET["token"]) && ($_GET["token"] = esc_html($_GET["token"])) && (empty($_GET["PayerID"]) || ($_GET["PayerID"] = esc_html($_GET["PayerID"]))) && ($xco_post_vars = get_transient("s2m_" . md5("s2member_transient_express_checkout_" . $_GET["token"])))) {
         $GLOBALS["ws_plugin__s2member_pro_paypal_checkout_response"] = array();
         /* This holds the global response details. */
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_checkout_response"];
         /* This is a shorter reference. */
         /**/
         $post_vars = $xco_post_vars ? $xco_post_vars : $_POST["s2member_pro_paypal_checkout"];
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($post_vars));
         /* And Filter. */
         $post_vars["attr"] = !$xco_post_vars ? unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"])) : $post_vars["attr"];
         $post_vars["attr"] = !$xco_post_vars ? apply_filters("ws_plugin__s2member_pro_paypal_checkout_post_attr", $post_vars["attr"], get_defined_vars()) : $post_vars["attr"];
         /**/
         $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"] = preg_replace("/\\s+/", "", sanitize_user($post_vars["username"], is_multisite()));
         /**/
         !empty($_GET["token"]) ? delete_transient("s2m_" . md5("s2member_transient_express_checkout_" . $_GET["token"])) : null;
         /**/
         if (!c_ws_plugin__s2member_pro_paypal_responses::paypal_form_attr_validation_errors($post_vars["attr"])) {
             if (!($error = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_submission_validation_errors("checkout", $post_vars))) {
                 $cp_attr = c_ws_plugin__s2member_pro_paypal_utilities::paypal_apply_coupon($post_vars["attr"], $post_vars["coupon"], "attr", array("affiliates-silent-post"));
                 $cp_2gbp_attr = c_ws_plugin__s2member_pro_paypal_utilities::paypal_maestro_solo_2gbp($cp_attr, $post_vars["card_type"]);
                 $cost_calculations = c_ws_plugin__s2member_pro_paypal_utilities::paypal_cost($cp_2gbp_attr["ta"], $cp_2gbp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_2gbp_attr["cc"], $cp_2gbp_attr["desc"]);
                 /**/
                 $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 (empty($_GET["s2member_paypal_xco"]) && $post_vars["card_type"] === "PayPal") {
                     $return_url = $cancel_url = is_ssl() ? "https://" : "http://";
                     $return_url = $cancel_url = ($return_url = $cancel_url) . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
                     $return_url = $cancel_url = remove_query_arg(array("token", "PayerID"), $return_url = $cancel_url);
                     $return_url = add_query_arg("s2member_paypal_xco", urlencode("s2member_pro_paypal_checkout_return"), $return_url);
                     $cancel_url = add_query_arg("s2member_paypal_xco", urlencode("s2member_pro_paypal_checkout_cancel"), $cancel_url);
                     /**/
                     $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID) ? $user : false;
                     /**/
                     if (!($paypal_set_xco = array())) {
                         $paypal_set_xco["METHOD"] = "SetExpressCheckout";
                         /**/
                         $paypal_set_xco["RETURNURL"] = $return_url;
                         $paypal_set_xco["CANCELURL"] = $cancel_url;
                         /**/
                         $paypal_set_xco["PAGESTYLE"] = $post_vars["attr"]["ps"];
                         $paypal_set_xco["LOCALECODE"] = $post_vars["attr"]["lc"];
                         $paypal_set_xco["NOSHIPPING"] = $post_vars["attr"]["ns"];
                         $paypal_set_xco["ALLOWNOTE"] = "0";
                         /* No notes. */
                         /**/
                         if ($use_recurring_profile) {
                             $paypal_set_xco["L_BILLINGTYPE0"] = "RecurringPayments";
                             $paypal_set_xco["L_BILLINGAGREEMENTDESCRIPTION0"] = $cost_calculations["desc"];
                             /**/
                             if (!$post_vars["attr"]["tp"] || $post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
                                 $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"];
                                 /**/
                                 if ($post_vars["attr"]["tp"] && $cost_calculations["trial_total"] > 0) {
                                     $paypal_set_xco["PAYMENTREQUEST_0_CURRENCYCODE"] = $cost_calculations["cur"];
                                     $paypal_set_xco["PAYMENTREQUEST_0_ITEMAMT"] = $cost_calculations["trial_sub_total"];
                                     $paypal_set_xco["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["trial_tax"];
                                     $paypal_set_xco["PAYMENTREQUEST_0_AMT"] = $cost_calculations["trial_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["trial_sub_total"];
                                 } else {
                                     $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"];
                                 }
                             }
                         } else {
                             $paypal_set_xco["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:paypal-checkout-rdp-in.inc.php

示例8: stripe_checkout

 /**
  * Handles processing of Pro-Form checkouts.
  *
  * @package s2Member\Stripe
  * @since 140617
  *
  * @attaches-to ``add_action('init');``
  */
 public static function stripe_checkout()
 {
     if (!empty($_POST['s2member_pro_stripe_checkout']['nonce']) && ($nonce = $_POST['s2member_pro_stripe_checkout']['nonce']) && wp_verify_nonce($nonce, 's2member-pro-stripe-checkout')) {
         $GLOBALS['ws_plugin__s2member_pro_stripe_checkout_response'] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS['ws_plugin__s2member_pro_stripe_checkout_response'];
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST['s2member_pro_stripe_checkout']));
         $post_vars['attr'] = !empty($post_vars['attr']) ? (array) unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars['attr'])) : array();
         $post_vars['attr'] = apply_filters('ws_plugin__s2member_pro_stripe_checkout_post_attr', $post_vars['attr'], get_defined_vars());
         $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'] = sanitize_user($post_vars['_o_username'] = $post_vars['username'], is_multisite());
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         if (!c_ws_plugin__s2member_pro_stripe_responses::stripe_form_attr_validation_errors($post_vars['attr'])) {
             if (!($form_submission_validation_errors = c_ws_plugin__s2member_pro_stripe_responses::stripe_form_submission_validation_errors('checkout', $post_vars))) {
                 unset($_POST['s2member_pro_stripe_checkout']['source_token']);
                 // Good one-time only.
                 unset($_POST['s2member_pro_stripe_checkout']['source_token_summary']);
                 // Good one-time only.
                 $is_bitcoin = !empty($post_vars['source_token']) && stripos($post_vars['source_token'], 'btcrcv_') === 0;
                 $cp_attr = c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($post_vars['attr'], $post_vars['coupon'], 'attr', array('affiliates-silent-post'));
                 $cost_calculations = c_ws_plugin__s2member_pro_stripe_utilities::cost($cp_attr['ta'], $cp_attr['ra'], $post_vars['state'], $post_vars['country'], $post_vars['zip'], $cp_attr['cc'], $cp_attr['desc'], $is_bitcoin);
                 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_subscription = $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_subscription && $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_subscription && is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
                     $plan_attr = $cp_attr;
                     // For the subscription plan.
                     $plan_attr['ta'] = $cost_calculations['trial_total'];
                     $plan_attr['ra'] = $cost_calculations['total'];
                     $plan_attr['desc'] = $cost_calculations['desc'];
                     update_user_meta($user_id, 'first_name', $post_vars['first_name']);
                     update_user_meta($user_id, 'last_name', $post_vars['last_name']);
                     $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_stripe_utilities::start_time($period1) : c_ws_plugin__s2member_pro_stripe_utilities::start_time($period3);
                     // Or next billing cycle.
                     if (!$global_response) {
                         if ($post_vars['attr']['tp'] && $cost_calculations['trial_total'] > 0 || !$post_vars['attr']['tp'] && $cost_calculations['total'] > 0) {
                             if (!is_object($stripe_customer = c_ws_plugin__s2member_pro_stripe_utilities::get_customer($user_id, $user->user_email, $post_vars['first_name'], $post_vars['last_name'], array(), $post_vars))) {
                                 $global_response = array('response' => $stripe_customer, 'error' => TRUE);
                             } else {
                                 if (!is_object($stripe_customer = $stripe_customer_with_source = c_ws_plugin__s2member_pro_stripe_utilities::set_customer_source($stripe_customer->id, $post_vars['source_token'], $post_vars, $post_vars['attr']['reject_prepaid']))) {
                                     $global_response = array('response' => $stripe_customer, 'error' => TRUE);
                                 } else {
                                     if (!is_object($stripe_charge = c_ws_plugin__s2member_pro_stripe_utilities::create_customer_charge($stripe_customer->id, $post_vars['attr']['tp'] && $cost_calculations['trial_total'] > 0 ? $cost_calculations['trial_total'] : $cost_calculations['total'], $cost_calculations['cur'], $cost_calculations['desc'], array(), $post_vars, $cost_calculations))) {
                                         $global_response = array('response' => $stripe_charge, 'error' => TRUE);
                                     } else {
//.........这里部分代码省略.........
开发者ID:NClaus,项目名称:Ambrose,代码行数:101,代码来源:stripe-checkout-in.inc.php

示例9: 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']) && is_array($cv = preg_split('/\\|/', $paypal['custom']))) {
                             if (($code = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $code)) && ($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);
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:paypal-return-in-wa-ccaps-wo-level.inc.php

示例10: configure_user_registration


//.........这里部分代码省略.........
                                     unset($field, $field_var, $field_id_class);
                                     // Housekeeping.
                                     if (!empty($fields)) {
                                         // Only if NOT empty.
                                         update_user_option($user_id, "s2member_custom_fields", $fields);
                                     }
                                     if ($level > 0) {
                                         $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
                                         $pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
                                         $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.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_signup_vars_" . $subscr_id)) && is_array($ipn_signup_vars = get_transient($transient))) {
                                         update_user_option($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
                                         // For future reference.
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array($subscr_payment = get_transient($transient)) && !empty($subscr_payment["subscr_gateway"])) {
                                         $proxy = array("s2member_paypal_proxy" => stripslashes((string) $subscr_payment["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep($subscr_payment), $proxy), array("timeout" => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (($transient = "s2m_" . md5("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array($subscr_eot = get_transient($transient)) && !empty($subscr_eot["subscr_gateway"])) {
                                         $proxy = array("s2member_paypal_proxy" => stripslashes((string) $subscr_eot["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
                                         c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep($subscr_eot), $proxy), array("timeout" => 20));
                                         delete_transient($transient);
                                         // This can be deleted now.
                                     }
                                     if (!headers_sent()) {
                                         // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
                                         @setcookie("s2member_tracking", $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_tracking", $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
                                     }
                                     foreach (array_keys(get_defined_vars()) as $__v) {
                                         $__refs[$__v] =& ${$__v};
                                     }
                                     do_action("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars());
                                     do_action("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars());
                                     unset($__refs, $__v);
                                 } else {
                                     if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op("create_user"))) {
                                         /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
                                         			This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
                                         			If processed through `/wp-activate.php`, it could've originated inside the admin, via `/user-new.php`. */
                                         $processed = "yes";
                                         // Mark this as yes.
                                         $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                                         $role = "";
                                         // Initialize ``$role`` to an empty string here, before processing.
                                         $role = !$role && ($level = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) > 0 ? "s2member_level" . $level : $role;
                                         $role = !$role && ($level = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"]) === "0" ? "subscriber" : $role;
                                         $role = !$role && $current_role ? $current_role : $role;
                                         // Use existing Role?
                                         $role = !$role ? get_option("default_role") : $role;
                                         // Otherwise default.
                                         $level = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_level"];
                                         $level = !$level && preg_match("/^(administrator|editor|author|contributor)\$/i", $role) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] : $level;
                                         $level = !$level && preg_match("/^s2member_level[1-9][0-9]*\$/i", $role) ? preg_replace("/^s2member_level/", "", $role) : $level;
                                         $level = !$level && preg_match("/^subscriber\$/i", $role) ? "0" : $level;
                                         $level = !$level ? "0" : $level;
                                         $ccaps = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
                                         $email = $user->user_email;
                                         $login = $user->user_login;
                                         $ip = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:67,代码来源:registrations.inc.php

示例11: paypal_cancellation

 /**
  * Handles processing of Pro Form cancellations.
  *
  * @package s2Member\PayPal
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after a custom URL redirection.
  */
 public static function paypal_cancellation()
 {
     if (!empty($_POST["s2member_pro_paypal_cancellation"]["nonce"]) && ($nonce = $_POST["s2member_pro_paypal_cancellation"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-paypal-cancellation")) {
         $GLOBALS["ws_plugin__s2member_pro_paypal_cancellation_response"] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_cancellation_response"];
         // This is a shorter reference.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_paypal_cancellation"]));
         $post_vars["attr"] = unserialize(c_ws_plugin__s2member_utils_encryption::decrypt($post_vars["attr"]));
         // And run a Filter.
         $post_vars["attr"] = apply_filters("ws_plugin__s2member_pro_paypal_cancellation_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"];
         if (!c_ws_plugin__s2member_pro_paypal_responses::paypal_form_attr_validation_errors($post_vars["attr"])) {
             if (!($error = c_ws_plugin__s2member_pro_paypal_responses::paypal_form_submission_validation_errors("cancellation", $post_vars))) {
                 if (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")) {
                         if (($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($cur__subscr_id)) && $paypal["TENDER"] !== "P") {
                             if (preg_match("/^(Active|ActiveProfile)\$/i", $paypal["STATUS"])) {
                                 if (!($ipn = array())) {
                                     $ipn["txn_type"] = "subscr_cancel";
                                     $ipn["subscr_id"] = $paypal["PROFILEID"];
                                     $ipn["custom"] = get_user_option("s2member_custom");
                                     $ipn["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal);
                                     $ipn["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal);
                                     $ipn["payer_email"] = $paypal["EMAIL"];
                                     $ipn["first_name"] = $paypal["FIRSTNAME"];
                                     $ipn["last_name"] = $paypal["LASTNAME"];
                                     $ipn["option_name1"] = "Referencing Customer ID";
                                     $ipn["option_selection1"] = $paypal["PROFILEID"];
                                     $ipn["option_name2"] = "Customer IP Address";
                                     // IP Address.
                                     $ipn["option_selection2"] = get_user_option("s2member_registration_ip");
                                     $ipn["item_name"] = $paypal["DESC"] ? $paypal["DESC"] : $paypal["PROFILENAME"];
                                     $ipn["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal);
                                     $ipn["s2member_paypal_proxy"] = "paypal";
                                     $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                                     $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                                     c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
                                 }
                                 c_ws_plugin__s2member_pro_paypal_utilities::payflow_cancel_profile($paypal["PROFILEID"], $paypal["BAID"]);
                                 $global_response = array("response" => _x('<strong>Billing termination confirmed.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                 if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                 }
                             } else {
                                 $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                 if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                 }
                             }
                         } else {
                             if ($paypal && $paypal["TENDER"] === "P") {
                                 $global_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&amp;alias=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]))), "error" => true);
                             } else {
                                 $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                                 if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                                     wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                                 }
                             }
                         }
                     } else {
                         $global_response = array("response" => _x('<strong>Billing terminated.</strong> Your account has been cancelled.', "s2member-front", "s2member"));
                         if ($post_vars["attr"]["success"] && ($custom_success_url = str_ireplace(array("%%s_response%%", "%%response%%"), array(urlencode(c_ws_plugin__s2member_utils_encryption::encrypt($global_response["response"])), urlencode($global_response["response"])), $post_vars["attr"]["success"])) && ($custom_success_url = trim(preg_replace("/%%(.+?)%%/i", "", $custom_success_url)))) {
                             wp_redirect(c_ws_plugin__s2member_utils_urls::add_s2member_sig($custom_success_url, "s2p-v")) . exit;
                         }
                     }
                 } else {
                     $global_response = array("response" => _x('You\'re <strong>NOT</strong> logged in.', "s2member-front", "s2member"), "error" => true);
                 }
             } else {
                 $global_response = $error;
             }
         }
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:86,代码来源:paypal-cancellation-pf-in.inc.php

示例12: 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

示例13: 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.
  *
  * @todo Optimize with ``empty()`` and ``isset()``.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     if (!empty($paypal["txn_type"]) && preg_match("/^subscr_modify\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"])) && !empty($paypal["subscr_id"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", 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 ( `subscr_modify` ), a Subscription Modification.";
             list($paypal["level"], $paypal["ccaps"]) = preg_split("/\\:/", $paypal["item_number"], 2);
             $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["period1"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             $paypal["mc_amount1"] = strlen($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0 ? $paypal["mc_amount1"] : "0.00";
             if (preg_match("/^web_accept\$/i", $paypal["txn_type"])) {
                 $paypal["period3"] = $paypal["eotper"] ? $paypal["eotper"] : "1 L";
                 $paypal["mc_amount3"] = $paypal["mc_gross"];
             }
             $paypal["initial_term"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             $paypal["initial"] = strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
             $paypal["regular"] = $paypal["mc_amount3"];
             $paypal["regular_term"] = $paypal["period3"];
             $paypal["recurring"] = $paypal["recurring"] ? $paypal["mc_amount3"] : "0";
             $ipn_signup_vars = $paypal;
             /* Create array of wouldbe IPN signup vars w/o s2member_log. */
             unset($ipn_signup_vars["s2member_log"]);
             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")) {
                     $processing = $modifying = $during = true;
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_modify", get_defined_vars());
                     do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "rtn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
                     unset($__refs, $__v);
                     $fields = get_user_option("s2member_custom_fields", $user_id);
                     $user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
                     $user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
                     if (is_multisite() && !is_user_member_of_blog($user_id)) {
                         add_existing_user_to_blog(array("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
                         $user = new WP_User($user_id);
                     }
                     $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                     if ($current_role !== "s2member_level" . $paypal["level"]) {
                         $user->set_role("s2member_level" . $paypal["level"]);
                     }
                     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);
                             }
                         }
                     }
                     update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
                     update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
                     update_user_option($user_id, "s2member_custom", $paypal["custom"]);
                     if (!get_user_option("s2member_registration_ip", $user_id)) {
                         update_user_option($user_id, "s2member_registration_ip", $paypal["ip"]);
                     }
                     update_user_option($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
                     delete_user_option($user_id, "s2member_file_download_access_log");
                     delete_user_option($user_id, "s2member_auto_eot_time");
                     $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
                     $pr_times["level"] = !$pr_times["level"] ? time() : $pr_times["level"];
                     $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"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                         if (($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $code))) {
                             if (($code = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $code)) && ($code = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $code)) && ($code = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $code))) {
                                 if (($code = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $code)) && ($code = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $code))) {
                                     if (($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $code))) {
                                         if (($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $code))) {
                                             if ($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $code)) {
                                                 if ($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $code)) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-return-in-subscr-modify-w-level.inc.php

示例14: 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.
  *
  * @todo Optimize with ``empty()`` and ``isset()``.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     if (!empty($paypal["txn_type"]) && preg_match("/^web_accept\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"])) && (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal["payment_status"])) && (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && !empty($paypal["payer_email"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_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"];
             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;
                         $fields = get_user_option("s2member_custom_fields", $user_id);
                         $user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
                         $user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
                         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["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` ) w/ update vars for Capabilities w/o Level.";
                         if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                             if (($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $code))) {
                                 if (($code = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["mc_gross"]), $code)) && ($code = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["txn_id"]), $code))) {
                                     if (($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $code))) {
                                         if (($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $code))) {
                                             if ($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $code)) {
                                                 if ($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $code)) {
                                                     if (($code = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->first_name), $code)) && ($code = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->last_name), $code))) {
                                                         if ($code = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($user->first_name . " " . $user->last_name)), $code)) {
                                                             if ($code = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_email), $code)) {
                                                                 if ($code = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user->user_login), $code)) {
                                                                     if ($code = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_reg_ip), $code)) {
                                                                         if ($code = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($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_ds(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);
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_paypal_return_during_new_ccaps", get_defined_vars());
                         unset($__refs, $__v);
                         if ($redirection_url_after_capabilities = apply_filters("ws_plugin__s2member_redirection_url_after_capabilities", false, get_defined_vars())) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-return-in-wa-ccaps-wo-level.inc.php

示例15: 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);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal['txn_type']) && preg_match('/^(web_accept|subscr_signup|subscr_payment)$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number'])) && (!empty($paypal['subscr_id']) || !empty($paypal['txn_id']) && ($paypal['subscr_id'] = $paypal['txn_id'])) && (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id'])) && (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id'])) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status']))) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_return_before_subscr_signup', get_defined_vars());
         unset($__refs, $__v);
         // Housekeeping.
         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|subscr_signup|subscr_payment` ).';
             @(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'];
             if (preg_match('/^subscr_payment$/i', $paypal['txn_type']) && !empty($_GET['s2member_paypal_return_tra']) && (($tra = c_ws_plugin__s2member_utils_encryption::decrypt(trim(stripslashes($_GET['s2member_paypal_return_tra'])))) && is_array($tra = maybe_unserialize($tra))) && (count($tra) === 11 && isset($tra['ta'], $tra['tp'], $tra['tt'], $tra['ra'], $tra['rp'], $tra['rt'], $tra['rr'], $tra['rrt'], $tra['rra'], $tra['invoice'], $tra['checksum'])) && $tra['invoice'] === $paypal['invoice'] && $tra['checksum'] === md5($paypal['invoice'] . $paypal['ip'] . $paypal['item_number'])) {
                 $tracking_properties = TRUE;
                 // Yes, these tracking properties ARE being set here.
                 $paypal['period1'] = $tra['rr'] !== 'BN' && $tra['tp'] ? $tra['tp'] . ' ' . $tra['tt'] : '0 D';
                 $paypal['mc_amount1'] = $tra['rr'] !== 'BN' && $tra['tp'] ? number_format($tra['ta'], 2, '.', '') : '0.00';
                 $paypal['period3'] = $tra['rp'] . ' ' . $tra['rt'];
                 $paypal['mc_amount3'] = $tra['ra'];
                 $paypal['recurring'] = $tra['rr'] === '1' ? '1' : '0';
                 $paypal['initial_term'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
                 // Defaults to '0 D' (zero days).
                 $paypal['initial'] = strlen($paypal['mc_amount1']) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['mc_amount1'] : $paypal['mc_amount3'];
                 $paypal['regular'] = $paypal['mc_amount3'];
                 // This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal.
                 $paypal['regular_term'] = $paypal['period3'];
                 // This is just set to keep a standard; this way both initial_term & regular_term are available.
                 $paypal['recurring'] = $paypal['recurring'] ? $paypal['mc_amount3'] : '0';
                 // If non-recurring, this should be zero, otherwise Regular.
                 $paypal['currency'] = strtoupper($paypal['mc_currency']);
                 // Normalize input currency.
                 $paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
                 $ipn_signup_vars = $paypal;
                 // Copy of PayPal vars; used as IPN signup vars.
                 unset($ipn_signup_vars['s2member_log']);
                 // Create array of wouldbe IPN signup vars w/o s2member_log.
             } else {
                 if (preg_match('/^(web_accept|subscr_signup)$/i', $paypal['txn_type'])) {
                     $tracking_properties = TRUE;
                     // Yes, these tracking properties ARE being set here.
                     $paypal['period1'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
                     // Defaults to '0 D' (zero days).
                     $paypal['mc_amount1'] = strlen($paypal['mc_amount1']) && $paypal['mc_amount1'] > 0 ? $paypal['mc_amount1'] : '0.00';
                     if (preg_match('/^web_accept$/i', $paypal['txn_type'])) {
                         $paypal['period3'] = $paypal['eotper'] ? $paypal['eotper'] : '1 L';
                         // 1 Lifetime.
                         $paypal['mc_amount3'] = $paypal['mc_gross'];
                         // The 'Buy Now' amount is the full gross.
                     }
                     $paypal['initial_term'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
                     // Defaults to '0 D' (zero days).
                     $paypal['initial'] = strlen($paypal['mc_amount1']) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['mc_amount1'] : $paypal['mc_amount3'];
                     $paypal['regular'] = $paypal['mc_amount3'];
                     // This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal.
                     $paypal['regular_term'] = $paypal['period3'];
                     // This is just set to keep a standard; this way both initial_term & regular_term are available.
                     $paypal['recurring'] = $paypal['recurring'] ? $paypal['mc_amount3'] : '0';
                     // If non-recurring, this should be zero, otherwise Regular.
                     $paypal['currency'] = strtoupper($paypal['mc_currency']);
                     // Normalize input currency.
                     $paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
                     $ipn_signup_vars = $paypal;
                     // Copy of PayPal vars; used as IPN signup vars.
                     unset($ipn_signup_vars['s2member_log']);
                     // Create array of wouldbe IPN signup vars w/o s2member_log.
                 } else {
                     $tracking_properties = FALSE;
                 }
             }
             // Not possible.
             /*
             New Subscription with advanced update vars (option_name1, option_selection1)? Used in Subscr. Modifications.
             */
             if (preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1']) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars', get_defined_vars());
                 unset($__refs, $__v);
                 // Housekeeping.
                 $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.';
                 if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     if (!$user->has_cap('administrator')) {
                         $processing = $modifying = $during = TRUE;
                         // Yes, we ARE processing this.
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:paypal-return-in-subscr-or-wa-w-level.inc.php


注:本文中的c_ws_plugin__s2member_utils_encryption::encrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。