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


PHP c_ws_plugin__s2member_utils_strings::trim_deep方法代码示例

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


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

示例1: alipay_postvars

 /**
  * Get ``$_POST`` or ``$_REQUEST`` vars from AliPay.
  *
  * @package s2Member\AliPay
  * @since 1.5
  *
  * @return array|bool An array of verified AliPay ``$_POST`` or ``$_REQUEST`` vars, else false.
  */
 public static function alipay_postvars()
 {
     if (!empty($_REQUEST["notify_id"]) && !empty($_REQUEST["notify_type"]) && preg_match("/^trade_status_sync\$/i", $_REQUEST["notify_type"]) && !empty($_REQUEST["sign"])) {
         $postvars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_REQUEST));
         foreach ($postvars as $var => $value) {
             if (preg_match("/^s2member_/", $var)) {
                 unset($postvars[$var]);
             }
         }
         ksort($postvars) . reset($postvars);
         $_q = "";
         // Initialize unencoded query.
         $gateway = "https://www.alipay.com/cooperate/gateway.do";
         foreach ($postvars as $var => $value) {
             if ($var && strlen($value) && !preg_match("/^(sign|sign_type)\$/", $var)) {
                 $_q .= ($_q ? "&" : "") . $var . "=" . $value;
             }
         }
         if ($postvars["sign"] === md5($_q . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_security_code"]) && preg_match("/true\$/i", trim(c_ws_plugin__s2member_utils_urls::remote($gateway . "?service=notify_verify&partner=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_partner_id"]) . "&notify_id=" . urlencode($postvars["notify_id"]), "", array("timeout" => 20))))) {
             return $postvars;
         } else {
             // Nope.
             return false;
         }
     } else {
         // Nope.
         return false;
     }
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:37,代码来源:alipay-utilities.inc.php

示例2: membership_options_page

 /**
  * Forces a redirection to the Membership Options Page for s2Member.
  *
  * This can be used by 3rd party apps that are not aware of which Page is currently set as the Membership Options Page.
  * Example usage: `http://example.com/?s2member_membership_options_page=1`
  *
  * Redirection URLs containing array brackets MUST be URL encoded to get through: ``wp_sanitize_redirect()``.
  * 	So we pass everything to ``urlencode_deep()``, as an array. It handles this via ``_http_build_query()``.
  * 	See bug report here: {@link http://core.trac.wordpress.org/ticket/17052}
  *
  * @package s2Member\Membership_Options_Page
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection w/ `301` status.
  */
 public static function membership_options_page()
 {
     do_action("ws_plugin__s2member_before_membership_options_page", get_defined_vars());
     if (!empty($_GET["s2member_membership_options_page"]) && is_array($_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_GET)))) {
         $args = array();
         foreach ($_g as $var => $value) {
             // Include all of the `_?s2member_` variables.
             // Do NOT include `s2member_membership_options_page`; creates a redirection loop.
             if (preg_match("/^_?s2member_/", $var) && $var !== "s2member_membership_options_page") {
                 $args[$var] = $value;
             }
         }
         wp_redirect(add_query_arg(urlencode_deep($args), get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), 301) . exit;
     }
     do_action("ws_plugin__s2member_after_membership_options_page", get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:33,代码来源:mo-page-in.inc.php

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

示例4: reg_access_link_via_ajax

 /**
  * Generates Registration Access Links via AJAX.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action('wp_ajax_ws_plugin__s2member_reg_access_link_via_ajax');``
  *
  * @return null Exits script execution after output is generated for AJAX caller.
  */
 public static function reg_access_link_via_ajax()
 {
     do_action('ws_plugin__s2member_before_reg_access_link_via_ajax', get_defined_vars());
     status_header(200);
     // Send a 200 OK status header.
     header('Content-Type: text/plain; charset=UTF-8');
     // Content-Type with UTF-8.
     while (@ob_end_clean()) {
     }
     // Clean any existing output buffers.
     if (current_user_can('create_users')) {
         // Check privileges as well. Ability to create Users?
         if (!empty($_POST['ws_plugin__s2member_reg_access_link_via_ajax']) && is_string($nonce = $_POST['ws_plugin__s2member_reg_access_link_via_ajax']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-reg-access-link-via-ajax')) {
             if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST))) && isset($_p['s2member_reg_access_link_subscr_gateway'], $_p['s2member_reg_access_link_subscr_id'], $_p['s2member_reg_access_link_custom'], $_p['s2member_reg_access_link_item_number'])) {
                 $register_link = c_ws_plugin__s2member_register_access::register_link_gen((string) $_p['s2member_reg_access_link_subscr_gateway'], (string) $_p['s2member_reg_access_link_subscr_id'], (string) $_p['s2member_reg_access_link_custom'], (string) $_p['s2member_reg_access_link_item_number']);
             }
         }
     }
     exit(apply_filters('ws_plugin__s2member_reg_access_link_via_ajax', !empty($register_link) ? $register_link : '', get_defined_vars()));
 }
开发者ID:codeforest,项目名称:s2member,代码行数:30,代码来源:register-access.inc.php

示例5: sp_access_link_via_ajax

 /**
  * Generates Specific Post/Page Access links via AJAX.
  *
  * @package s2Member\SP_Access
  * @since 3.5
  *
  * @attaches-to ``add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax");``
  *
  * @return null Exits script execution after returning data for AJAX caller.
  */
 public static function sp_access_link_via_ajax()
 {
     do_action("ws_plugin__s2member_before_sp_access_link_via_ajax", get_defined_vars());
     status_header(200);
     // Send a 200 OK status header.
     header("Content-Type: text/plain; charset=UTF-8");
     // Content-Type with UTF-8.
     while (@ob_end_clean()) {
     }
     // Clean any existing output buffers.
     if (current_user_can("create_users")) {
         // Check privileges as well. Ability to create Users?
         if (!empty($_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && is_string($nonce = $_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-sp-access-link-via-ajax")) {
             if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST))) && isset($_p["s2member_sp_access_link_ids"], $_p["s2member_sp_access_link_hours"])) {
                 $sp_access_link = c_ws_plugin__s2member_sp_access::sp_access_link_gen((string) $_p["s2member_sp_access_link_ids"], (string) $_p["s2member_sp_access_link_hours"]);
             }
         }
     }
     exit(apply_filters("ws_plugin__s2member_sp_access_link_via_ajax", !empty($sp_access_link) ? $sp_access_link : "", get_defined_vars()));
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:30,代码来源:sp-access.inc.php

示例6: _admin_user_new_fields

 /**
  * Callback adds Custom Fields to `/wp-admin/user-new.php`.
  *
  * We have to buffer because `/user-new.php` has NO Hooks.
  *
  * @package s2Member\New_Users
  * @since 3.5
  *
  * @attaches-to ``ob_start("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");``
  *
  * @return string Output buffer.
  */
 public static function _admin_user_new_fields($buffer = FALSE)
 {
     global $pagenow;
     // The current admin page file name.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("_ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars());
     unset($__refs, $__v);
     if (is_blog_admin() && $pagenow === "user-new.php" && current_user_can("create_users")) {
         $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
         $unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
         $unfs .= '<h3 style="position:relative;"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/large-icon.png" title="s2Member (a Membership management system for WordPress)" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . (is_multisite() ? ' (for this Blog)' : '') . '</h3>' . "\n";
         $unfs .= '<table class="form-table">' . "\n";
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_before", get_defined_vars());
         unset($__refs, $__v);
         if (is_multisite()) {
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_first_name", get_defined_vars());
             unset($__refs, $__v);
             $unfs .= '<tr>' . "\n";
             $unfs .= '<th><label for="ws-plugin--s2member-user-new-first-name">First Name:</label></th>' . "\n";
             $unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_first_name" id="ws-plugin--s2member-user-new-first-name" value="' . esc_attr($_p["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
             $unfs .= '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_first_name", get_defined_vars());
             unset($__refs, $__v);
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_last_name", get_defined_vars());
             unset($__refs, $__v);
             $unfs .= '<tr>' . "\n";
             $unfs .= '<th><label for="ws-plugin--s2member-user-new-last-name">Last Name:</label></th>' . "\n";
             $unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_last_name" id="ws-plugin--s2member-user-new-last-name" value="' . esc_attr($_p["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
             $unfs .= '</tr>' . "\n";
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_last_name", get_defined_vars());
             unset($__refs, $__v);
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_gateway", get_defined_vars());
         unset($__refs, $__v);
         $unfs .= '<tr>' . "\n";
         $unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
         $unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:25em;"><option value=""></option>' . "\n";
         foreach (apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars()) as $gateway => $gateway_name) {
             $unfs .= '<option value="' . esc_attr($gateway) . '"' . ($gateway === $_p["ws_plugin__s2member_user_new_s2member_subscr_gateway"] ? ' selected="selected"' : '') . '>' . esc_html($gateway_name) . '</option>' . "\n";
         }
         $unfs .= '</select>' . "\n";
         $unfs .= '</td>' . "\n";
         $unfs .= '</tr>' . "\n";
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_gateway", get_defined_vars());
         unset($__refs, $__v);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_id", get_defined_vars());
         unset($__refs, $__v);
         $unfs .= '<tr>' . "\n";
         $unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... if there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
         $unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_s2member_subscr_id" id="ws-plugin--s2member-user-new-s2member-subscr-id" value="' . format_to_edit($_p["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
         $unfs .= '</tr>' . "\n";
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_id", get_defined_vars());
         unset($__refs, $__v);
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_custom", get_defined_vars());
         unset($__refs, $__v);
         $unfs .= '<tr>' . "\n";
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:user-new-in.inc.php

示例7: update_all_options

 /**
  * Saves all options from any menu page.
  *
  * Can also be self-verified; and configured extensively with function parameters.
  *
  * @package s2Member\Menu_Pages
  * @since 3.5
  *
  * @param null|array $new_options Optional. Force feed an array of new options. Defaults to ``$_POST`` vars.
  *   If ``$new_options`` are passed in, be SURE that you've already applied ``stripslashes_deep()``.
  * @param bool       $verified Optional. Defaults to false. If true, ``wp_verify_nonce()`` is skipped in this routine.
  * @param bool       $update_other Optional. Defaults to true. If false, other option-dependent routines will not be processed.
  * @param bool|array $display_notices Optional. Defaults to true. Can be false, or an array of certain notices that can be displayed.
  * @param bool|array $enqueue_notices Optional. Defaults to false. Can be true, or an array of certain notices that should be enqueued.
  * @param bool       $request_refresh Optional. Defaults to false. If true, resulting `success` notice will include a link to refresh the menu page.
  *
  * @return bool True if all s2Member options were updated successfully, else false.
  */
 public static function update_all_options($new_options = NULL, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE, $request_refresh = FALSE)
 {
     $updated_all_options = FALSE;
     // Initializing this variable here makes it an available reference-variable to Hooks/Filters.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_update_all_options', get_defined_vars());
     // If you use this Hook, be sure to use ``wp_verify_nonce()``.
     unset($__refs, $__v);
     // Housekeeping.
     if ($verified || !empty($_POST['ws_plugin__s2member_options_save']) && ($nonce = $_POST['ws_plugin__s2member_options_save']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-options-save')) {
         $options = $GLOBALS['WS_PLUGIN__']['s2member']['o'];
         // Acquire the full existing configuration options array here.
         $new_options = is_array($new_options) ? $new_options : (!empty($_POST) && is_array($_POST) ? stripslashes_deep($_POST) : array());
         $new_options = c_ws_plugin__s2member_utils_strings::trim_deep($new_options);
         foreach ($new_options as $key => $value) {
             // Find all keys contained within ``$new_options`` matching `^ws_plugin__s2member_`.
             if (strpos($key, 'ws_plugin__s2member_') === 0) {
                 // A relevant ``$new_options`` key matching `^ws_plugin__s2member_`?
                 if ($key === 'ws_plugin__s2member_configured') {
                     // s2Member is now configured (according to these options)?
                     ($GLOBALS['WS_PLUGIN__']['s2member']['c']['configured'] = $value) . update_option('ws_plugin__s2member_configured', $value);
                 } else {
                     if (!is_array($value) || is_array($value) && array_shift($value) === 'update-signal') {
                         // Updating an array?
                         $options[preg_replace('/^' . preg_quote('ws_plugin__s2member_', '/') . '/', '', $key)] = $value;
                     }
                 }
             }
         }
         unset($key, $value);
         // Unset these utility variables now. This prevents bleeding vars into Hooks/Filters that are of no use.
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_update_all_options', get_defined_vars());
         unset($__refs, $__v);
         // Housekeeping.
         $options = ws_plugin__s2member_configure_options_and_their_defaults($options = array_merge($options, array('options_version' => (string) ($options['options_version'] + 0.001))));
         update_option('ws_plugin__s2member_options', $options) . (is_multisite() && is_main_site() ? update_site_option('ws_plugin__s2member_options', $options) : NULL) . update_option('ws_plugin__s2member_cache', array());
         if ($update_other === TRUE || in_array('auto_eot_system', (array) $update_other)) {
             // Handle the Auto-EOT System now (enable/disable).
             $options['auto_eot_system_enabled'] == 1 ? c_ws_plugin__s2member_auto_eots::add_auto_eot_system() : c_ws_plugin__s2member_auto_eots::delete_auto_eot_system();
         }
         if (($display_notices === TRUE || in_array('success', (array) $display_notices)) && ($notice = '<strong>Options saved.' . ($request_refresh ? ' Please <a href="' . esc_attr($_SERVER['REQUEST_URI']) . '">refresh</a>.' : '') . '</strong>')) {
             $enqueue_notices === TRUE || in_array('success', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*') : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice);
         }
         if (empty($_GET['page']) || $_GET['page'] !== 'ws-plugin--s2member-mms-ops') {
             if (!$options['membership_options_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <strong>s2Member → General Options → Membership Options Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['login_welcome_page'] && $options['login_welcome_page'] === $options['membership_options_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page is the same as your Membership Options Page. Please correct this. See: <strong>s2Member → General Options → Login Welcome Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['membership_options_page'] && (string) get_option('page_on_front') === $options['membership_options_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Membership Options Page is currently configured as your Home Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this. See: <strong>WordPress → Reading Options</strong>. Or change: <strong>s2Member → General Options → Membership Options Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['login_welcome_page'] && (string) get_option('page_on_front') === $options['login_welcome_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page is currently configured as your Home Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this. See: <strong>WordPress → Reading Options</strong>. Or change: <strong>s2Member → General Options → Login Welcome Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['membership_options_page'] && (string) get_option('page_for_posts') === $options['membership_options_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Membership Options Page is currently configured as your Posts Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this. See: <strong>WordPress → Reading Options</strong>. Or change: <strong>s2Member → General Options → Membership Options Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['login_welcome_page'] && (string) get_option('page_for_posts') === $options['login_welcome_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Login Welcome Page is currently configured as your Posts Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this. See: <strong>WordPress → Reading Options</strong>. Or change: <strong>s2Member → General Options → Login Welcome Page</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
             if ($options['file_download_limit_exceeded_page'] && $options['file_download_limit_exceeded_page'] === $options['membership_options_page'] && ($display_notices === TRUE || in_array('page-conflict-warnings', (array) $display_notices)) && ($notice = '<strong>s2Member:</strong> Your Download Limit Exceeded Page is the same as your Membership Options Page. Please correct this. See: <strong>s2Member → Download Options</strong>.')) {
                 $enqueue_notices === TRUE || in_array('page-conflict-warnings', (array) $enqueue_notices) ? c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, '*:*', TRUE) : c_ws_plugin__s2member_admin_notices::display_admin_notice($notice, TRUE);
             }
         }
         $updated_all_options = TRUE;
         // Flag indicating this routine was processed successfully; and that all s2Member options have been updated successfully.
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_after_update_all_options', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     return apply_filters('ws_plugin__s2member_update_all_options', $updated_all_options ? TRUE : FALSE, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:100,代码来源:menu-pages.inc.php

示例8: sp_checkout

 /**
  * Handles processing of Pro-Forms for Specific Post/Page checkout.
  *
  * @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 sp_checkout()
 {
     if (!empty($_POST["s2member_pro_paypal_sp_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_paypal_sp_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-paypal-sp-checkout") || !empty($_GET["s2member_paypal_xco"]) && $_GET["s2member_paypal_xco"] === "s2member_pro_paypal_sp_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_sp_checkout_response"] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_sp_checkout_response"];
         // This is a shorter reference.
         if (!empty($xco_post_vars)) {
             // A customer is returning from Express Checkout @ PayPal?
             $_POST = $xco_post_vars;
         }
         // POST vars from submission prior to Express Checkout.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_paypal_sp_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_paypal_sp_checkout_post_attr", $post_vars["attr"], get_defined_vars());
         if (!empty($xco_post_vars)) {
             $post_vars["attr"]["captcha"] = "0";
         }
         // No need to revalidate captcha in this case.
         $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());
         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"];
         }
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         !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("sp-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(null, $cp_2gbp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_2gbp_attr["cc"], $cp_2gbp_attr["desc"]);
                 if (empty($_GET["s2member_paypal_xco"]) && $post_vars["card_type"] === "PayPal" && $cost_calculations["total"] > 0) {
                     $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_sp_checkout_return"), $return_url);
                     $cancel_url = add_query_arg("s2member_paypal_xco", urlencode("s2member_pro_paypal_sp_checkout_cancel"), $cancel_url);
                     $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && ($user_id = $user->ID) ? $user : false;
                     $post_vars["attr"]["invoice"] = uniqid() . "~" . $_SERVER["REMOTE_ADDR"];
                     // Unique invoice w/ IP address too.
                     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["SOLUTIONTYPE"] = "Sole";
                         $paypal_set_xco["LANDINGPAGE"] = "Billing";
                         $paypal_set_xco["ALLOWNOTE"] = "0";
                         $paypal_set_xco["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
                         $paypal_set_xco["MAXAMT"] = $cost_calculations["total"];
                         $paypal_set_xco["PAYMENTREQUEST_0_DESC"] = $cost_calculations["desc"];
                         $paypal_set_xco["PAYMENTREQUEST_0_CUSTOM"] = $post_vars["attr"]["custom"];
                         $paypal_set_xco["PAYMENTREQUEST_0_INVNUM"] = $post_vars["attr"]["invoice"];
                         $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"]["sp_ids_exp"];
                         $paypal_set_xco["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTONAME"] = $post_vars["name"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTREET"] = $post_vars["street"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCITY"] = $post_vars["city"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTOSTATE"] = $post_vars["state"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = $post_vars["country"];
                         $paypal_set_xco["PAYMENTREQUEST_0_SHIPTOZIP"] = $post_vars["zip"];
                         $paypal_set_xco["EMAIL"] = $post_vars["email"];
                     }
                     if (($paypal_set_xco = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal_set_xco)) && empty($paypal_set_xco["__error"])) {
                         set_transient("s2m_" . md5("s2member_transient_express_checkout_" . $paypal_set_xco["TOKEN"]), $_POST, 10800);
                         $endpoint = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "www.sandbox.paypal.com" : "www.paypal.com";
                         wp_redirect(add_query_arg("token", urlencode($paypal_set_xco["TOKEN"]), "https://" . $endpoint . "/cgi-bin/webscr?cmd=_express-checkout"));
                         exit;
                         // Clean exit.
                     } else {
                         $global_response = array("response" => $paypal_set_xco["__error"], "error" => true);
                     }
                 } else {
                     if (empty($post_vars["attr"]["invoice"])) {
                         // Only if it's empty.
                         $post_vars["attr"]["invoice"] = uniqid() . "~" . $_SERVER["REMOTE_ADDR"];
                     }
                     if (!($paypal = array())) {
                         if (!empty($_GET["s2member_paypal_xco"]) && $_GET["s2member_paypal_xco"] === "s2member_pro_paypal_sp_checkout_return" && !empty($_GET["token"]) && ($paypal_xco_details = array("METHOD" => "GetExpressCheckoutDetails", "TOKEN" => $_GET["token"])) && ($paypal_xco_details = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal_xco_details)) && empty($paypal_xco_details["__error"])) {
                             $paypal["METHOD"] = "DoExpressCheckoutPayment";
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:paypal-sp-checkout-in.inc.php

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

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

示例11: authnet_sp_checkout

 /**
  * Handles processing of Pro-Forms for Specific Post/Page checkout.
  *
  * @package s2Member\AuthNet
  * @since 1.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after a custom URL redirection.
  */
 public static function authnet_sp_checkout()
 {
     if (!empty($_POST["s2member_pro_authnet_sp_checkout"]["nonce"]) && ($nonce = $_POST["s2member_pro_authnet_sp_checkout"]["nonce"]) && wp_verify_nonce($nonce, "s2member-pro-authnet-sp-checkout")) {
         $GLOBALS["ws_plugin__s2member_pro_authnet_sp_checkout_response"] = array();
         // This holds the global response details.
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_authnet_sp_checkout_response"];
         // This is a shorter reference.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_authnet_sp_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_authnet_sp_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());
         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"];
         }
         $post_vars["recaptcha_challenge_field"] = isset($_POST["recaptcha_challenge_field"]) ? trim(stripslashes($_POST["recaptcha_challenge_field"])) : "";
         $post_vars["recaptcha_response_field"] = isset($_POST["recaptcha_response_field"]) ? trim(stripslashes($_POST["recaptcha_response_field"])) : "";
         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("sp-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(null, $cp_attr["ra"], $post_vars["state"], $post_vars["country"], $post_vars["zip"], $cp_attr["cc"], $cp_attr["desc"]);
                 if (!($authnet = array())) {
                     $authnet["x_type"] = "AUTH_CAPTURE";
                     $authnet["x_method"] = "CC";
                     $authnet["x_email"] = $post_vars["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_invoice"] = $post_vars["attr"]["sp_ids_exp"];
                     $authnet["s2_custom"] = $post_vars["attr"]["custom"];
                     $authnet["x_tax"] = $cost_calculations["tax"];
                     $authnet["x_amount"] = $cost_calculations["total"];
                     $authnet["x_currency_code"] = $cost_calculations["cur"];
                     $authnet["x_card_num"] = preg_replace("/[^0-9]/", "", $post_vars["card_number"]);
                     $authnet["x_exp_date"] = c_ws_plugin__s2member_pro_authnet_utilities::authnet_exp_date($post_vars["card_expiration"]);
                     $authnet["x_card_code"] = $post_vars["card_verification"];
                     #if (in_array($post_vars["card_type"], array("Maestro", "Solo")))
                     #	if (preg_match ("/^[0-9]{2}\/[0-9]{4}$/", $post_vars["card_start_date_issue_number"]))
                     #		$authnet["x_card_start_date"] = preg_replace ("/[^0-9]/", "", $post_vars["card_start_date_issue_number"]);
                     #	else // Otherwise, we assume they provided an issue number instead.
                     #		$authnet["x_card_issue_number"] = $post_vars["card_start_date_issue_number"];
                     $authnet["x_address"] = $post_vars["street"];
                     $authnet["x_city"] = $post_vars["city"];
                     $authnet["x_state"] = $post_vars["state"];
                     $authnet["x_country"] = $post_vars["country"];
                     $authnet["x_zip"] = $post_vars["zip"];
                 }
                 if ($cost_calculations["total"] <= 0 || ($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_aim_response($authnet)) && empty($authnet["__error"])) {
                     if ($cost_calculations["total"] <= 0) {
                         $new__txn_id = strtoupper('free-' . uniqid());
                     } else {
                         $new__txn_id = $authnet["transaction_id"];
                     }
                     if (!($ipn = array())) {
                         $ipn["txn_type"] = "web_accept";
                         $ipn["txn_id"] = $new__txn_id;
                         $ipn["custom"] = $post_vars["attr"]["custom"];
                         $ipn["mc_gross"] = $cost_calculations["total"];
                         $ipn["mc_currency"] = $cost_calculations["cur"];
                         $ipn["tax"] = $cost_calculations["tax"];
                         $ipn["payer_email"] = $post_vars["email"];
                         $ipn["first_name"] = $post_vars["first_name"];
                         $ipn["last_name"] = $post_vars["last_name"];
                         if (is_user_logged_in() && ($referencing = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id())) {
                             $ipn["option_name1"] = "Referencing Customer ID";
                             $ipn["option_selection1"] = $referencing;
                         } else {
                             $ipn["option_name1"] = "Originating Domain";
                             $ipn["option_selection1"] = $_SERVER["HTTP_HOST"];
                         }
                         $ipn["option_name2"] = "Customer IP Address";
                         $ipn["option_selection2"] = $_SERVER["REMOTE_ADDR"];
                         $ipn["item_name"] = $cost_calculations["desc"];
                         $ipn["item_number"] = $post_vars["attr"]["sp_ids_exp"];
                         $ipn["s2member_paypal_proxy"] = "authnet";
                         $ipn["s2member_paypal_proxy_use"] = "pro-emails";
                         $ipn["s2member_paypal_proxy_coupon"] = array("coupon_code" => $cp_attr["_coupon_code"], "full_coupon_code" => $cp_attr["_full_coupon_code"], "affiliate_id" => $cp_attr["_coupon_affiliate_id"]);
                         $ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
                         $ipn["s2member_paypal_proxy_return_url"] = $post_vars["attr"]["success"];
                         $ipn["s2member_authnet_proxy_return_url"] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20)));
                     }
                     if ($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen($post_vars["attr"]["ids"], $post_vars["attr"]["exp"])) {
                         setcookie("s2member_sp_tracking", $s2member_sp_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__txn_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_sp_tracking", $s2member_sp_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_sp_tracking"] = $s2member_sp_tracking);
                         $global_response = array("response" => sprintf(_x('<strong>Thank you.</strong> Your purchase has been approved.<br />&mdash; Please <a href="%s" rel="nofollow">click here</a> to proceed.', "s2member-front", "s2member"), esc_attr($sp_access_url)));
                         if ($post_vars["attr"]["success"] && substr($ipn["s2member_authnet_proxy_return_url"], 0, 2) === substr($post_vars["attr"]["success"], 0, 2) && ($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"])), $ipn["s2member_authnet_proxy_return_url"])) && ($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 {
//.........这里部分代码省略.........
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:101,代码来源:authnet-sp-checkout-in.inc.php

示例12: ws_plugin__s2member_trim_deep

/**
* Deprecated in s2Member v3.5+.
*
* Needed by the s2Member Pro upgrader prior to s2Member Pro v1.5+.
*
* @package s2Member
* @since 3.0
*
* @deprecated Starting with s2Member v3.5+, please use:
* 	``c_ws_plugin__s2member_utils_strings::trim_deep()``
*
* @see s2Member\Utilities\c_ws_plugin__s2member_utils_strings::trim_deep()
*/
function ws_plugin__s2member_trim_deep($data = FALSE)
{
    return c_ws_plugin__s2member_utils_strings::trim_deep($data);
}
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:17,代码来源:deprecated.inc.php

示例13: import_users

 /**
  * Handles the importation of Users/Members.
  *
  * @package s2Member\Imports
  * @since 110815
  */
 public static function import_users()
 {
     if (!empty($_POST['ws_plugin__s2member_pro_import_users']) && ($nonce = $_POST['ws_plugin__s2member_pro_import_users']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-pro-import-users') && current_user_can('create_users')) {
         global $wpdb;
         // Global database object reference.
         /** @var \wpdb $wpdb This line for IDEs that need a reference. */
         global $current_site, $current_blog;
         // Multisite Networking.
         @set_time_limit(0);
         // Make time for processing large import files.
         @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
         remove_all_actions('profile_update') . remove_all_actions('user_register');
         remove_all_actions('added_existing_user') . remove_all_actions('add_user_to_blog');
         if (!empty($_FILES['ws_plugin__s2member_pro_import_users_file']) && empty($_FILES['ws_plugin__s2member_pro_import_users_file']['error'])) {
             $file = fopen($_FILES['ws_plugin__s2member_pro_import_users_file']['tmp_name'], 'r');
         } else {
             if (!empty($_POST['ws_plugin__s2member_pro_import_users_direct_input'])) {
                 fwrite($file = tmpfile(), trim(stripslashes($_POST['ws_plugin__s2member_pro_import_users_direct_input']))) . fseek($file, 0);
             }
         }
         $imported = $line = $line_index = 0;
         // Initialize these counters.
         $headers = array();
         // Initialize the array of CSV import file headers.
         $user_keys = array();
         // Initialize array of user keys.
         if (is_object($_user_row = $wpdb->get_row("SELECT * FROM `" . $wpdb->users . "` LIMIT 1"))) {
             foreach (array_keys((array) $_user_row) as $_user_key) {
                 $user_keys[] = $_user_key;
             }
         }
         unset($_user_row, $_user_key);
         // Housekeeping.
         $user_keys = array_unique($user_keys);
         // Only unique keys please.
         if (isset($file) && is_resource($file)) {
             while (($_csv_data = version_compare(PHP_VERSION, '5.3', '>=') ? fgetcsv($file, 0, ',', '"', '"') : fgetcsv($file, 0, ',', '"')) !== FALSE) {
                 $line_index = (int) $line_index + 1;
                 // CSV lines.
                 $line = (int) $line + 1;
                 // CSV lines.
                 $_csv_data = c_ws_plugin__s2member_utils_strings::trim_deep($_csv_data);
                 if ($line_index === 1 && isset($_csv_data[0])) {
                     $line = $line - 1;
                     foreach ($_csv_data as $_header) {
                         $headers[] = $_header;
                     }
                     unset($_header);
                     // Housekeeping.
                     continue;
                     // We've got the headers now; let's move to the next line.
                 }
                 if ($line_index >= 1 && (!$headers || !in_array('ID', $headers, TRUE) && !in_array('user_login', $headers, TRUE))) {
                     $errors[] = 'Line #' . $line . '. Missing first-line CSV headers; please try again.' . ' Please note that your CSV headers MUST contain (at a minimum), one of: "ID", or "user_login"';
                     break;
                     // Stop here; we have no headers in this importation.
                 }
                 $_user_ID_key = array_search('ID', $headers);
                 $_user_id = $_user_ID_key !== FALSE && !empty($_csv_data[$_user_ID_key]) ? (int) $_csv_data[$_user_ID_key] : 0;
                 unset($_user_ID_key);
                 // Housekeeping.
                 $_user_login_key = array_search('user_login', $headers);
                 $_user_login = $_user_login_key !== FALSE && !empty($_csv_data[$_user_login_key]) ? $_csv_data[$_user_login_key] : '';
                 unset($_user_login_key);
                 // Housekeeping.
                 $_user_pass_key = array_search('user_pass', $headers);
                 $_user_pass = $_user_pass_key !== FALSE && !empty($_csv_data[$_user_pass_key]) ? $_csv_data[$_user_pass_key] : '';
                 unset($_user_pass_key);
                 // Housekeeping.
                 $_user_email_key = array_search('user_email', $headers);
                 $_user_email = $_user_email_key !== FALSE && !empty($_csv_data[$_user_email_key]) ? $_csv_data[$_user_email_key] : '';
                 unset($_user_email_key);
                 // Housekeeping.
                 $_user_role_key = array_search('role', $headers);
                 $_user_role = $_user_role_key !== FALSE && !empty($_csv_data[$_user_role_key]) ? $_csv_data[$_user_role_key] : '';
                 $_user_role = is_numeric($_user_role) ? $_user_role == 0 ? 'subscriber' : 's2member_level' . $_user_role : $_user_role;
                 unset($_user_role_key);
                 // Housekeeping.
                 $_user_ccaps_key = array_search('ccaps', $headers);
                 $_user_ccaps = $_user_ccaps_key !== FALSE && !empty($_csv_data[$_user_ccaps_key]) ? $_csv_data[$_user_ccaps_key] : '';
                 unset($_user_ccaps_key);
                 // Housekeeping.
                 if ($_user_login) {
                     if (is_multisite()) {
                         $_user_login = strtolower($_user_login);
                     }
                     $_user_login = sanitize_user($_user_login, is_multisite());
                 }
                 if ($_user_email) {
                     $_user_email = sanitize_email($_user_email);
                 }
                 $_user_id_exists_but_not_on_blog = 0;
                 // Initialize.
                 if (!$_user_id && $_user_login && $_user_email && is_multisite()) {
//.........这里部分代码省略.........
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:101,代码来源:imports-in.inc.php

示例14: configure_user_registration

 /**
  * Configures all new Users.
  *
  * The Hook `user_register` is also fired by calling:
  * ``c_ws_plugin__s2member_registrations::ms_create_existing_user()`` and/or ``wpmu_create_user()``.
  *
  * This function also receives hand-offs from s2Member's handlers for these two Hooks:
  * `wpmu_activate_user` and `wpmu_activate_blog`.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action('user_register');``
  *
  * @param int|string $user_id A numeric WordPress User ID.
  * @param string     $password Optional in most cases. A User's plain text Password. If unspecified, attempts are made to collect the plain text Password from other sources.
  * @param array      $meta Optional in most cases. Defaults to false. An array of meta data for a User/Member.
  *
  * @TODO Impossible to delete cookies when fired inside: `/wp-activate.php`?
  */
 public static function configure_user_registration($user_id = '', $password = '', $meta = array())
 {
     global $wpdb;
     // Global database object reference.
     global $pagenow;
     // We need this to detect the current administration page.
     global $current_site, $current_blog;
     // Adds support for Multisite Networking.
     static $email_config, $processed;
     // Static vars prevent duplicate processing.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_configure_user_registration', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     // With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_[user|blog]`.
     if (!isset($email_config) && ($email_config = TRUE)) {
         // Anytime this routine is fired; we configure email.
         c_ws_plugin__s2member_email_configs::email_config();
     }
     // Configures `From:` email header.
     $_p = isset($_POST) ? $_POST : NULL;
     // Grab global ``$_POST`` array here, if it's possible to do so.
     $rvs = isset($GLOBALS['ws_plugin__s2member_registration_vars']) ? $GLOBALS['ws_plugin__s2member_registration_vars'] : NULL;
     if (!$processed) {
         if (is_array($_p) || is_array($meta) || is_array($rvs)) {
             if (!(is_multisite() && is_blog_admin() && $pagenow === 'user-new.php' && isset($_p['noconfirmation']) && is_super_admin() && !is_array($meta))) {
                 if (!(preg_match('/\\/wp-activate\\.php/', $_SERVER['REQUEST_URI']) && !is_array($meta))) {
                     if (!(c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page() && !is_array($meta))) {
                         if (!(c_ws_plugin__s2member_utils_conds::pro_is_installed() && c_ws_plugin__s2member_pro_remote_ops::is_remote_op('create_user') && !is_array($rvs))) {
                             if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && ($processed = TRUE)) {
                                 settype($_p, 'array') . settype($meta, 'array') . settype($rvs, 'array');
                                 // Force arrays here.
                                 $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_p));
                                 $meta = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($meta));
                                 $rvs = c_ws_plugin__s2member_utils_strings::trim_deep($rvs);
                                 foreach ($_p as $_key => $_value) {
                                     // Scan ``$_p`` vars; adding `custom_reg_field` keys.
                                     if (preg_match('/^ws_plugin__s2member_user_new_/', $_key)) {
                                         // Look for keys.
                                         if ($_key = str_replace('_user_new_', '_custom_reg_field_', $_key)) {
                                             $_p[$_key] = $_value;
                                         }
                                     }
                                 }
                                 // Add each of these key conversions.
                                 unset($_key, $_value);
                                 if (!is_admin() && (isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_id']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_baid']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_cid']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_custom']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_ccaps']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_notes']))) {
                                     exit(_x('s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!', 's2member-front', 's2member'));
                                 }
                                 $_pmr = array_merge($_p, $meta, $rvs);
                                 // Merge all of these arrays together now, in this specific order.
                                 unset($_p, $meta, $rvs);
                                 // These variables can all be unset now; we have them all in the ``$_pmr`` array.
                                 $custom_reg_display_name = $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_display_name'];
                                 // Can be configured by the site owner.
                                 if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op('create_user')) && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
                                     /* 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`. */
                                     /**
                                      * @var $subscr_gateway string Reference for IDEs.
                                      * @var $subscr_id string Reference for IDEs.
                                      * @var $custom string Reference for IDEs.
                                      * @var $item_number string Reference for IDEs.
                                      */
                                     $processed = 'yes';
                                     // Mark this as yes.
                                     $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                                     @(list($level, $ccaps, $eotper) = preg_split('/\\:/', $item_number, 3));
                                     $role = 's2member_level' . $level;
                                     // Membership Level.
                                     $email = $user->user_email;
                                     $login = $user->user_login;
                                     $ip = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_registration_ip'];
                                     $ip = !$ip ? $_SERVER['REMOTE_ADDR'] : $ip;
                                     // Else use environment variable.
                                     $subscr_baid = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_subscr_baid'];
                                     $subscr_cid = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_subscr_cid'];
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:registrations.inc.php

示例15: 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();
         $global_response =& $GLOBALS["ws_plugin__s2member_pro_paypal_checkout_response"];
         if (!empty($xco_post_vars)) {
             // A customer is returning from Express Checkout @ PayPal?
             $_POST = $xco_post_vars;
         }
         // POST vars from submission prior to Express Checkout.
         $post_vars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST["s2member_pro_paypal_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_paypal_checkout_post_attr", $post_vars["attr"], get_defined_vars());
         if (!empty($xco_post_vars)) {
             $post_vars["attr"]["captcha"] = "0";
         }
         // No need to revalidate captcha in this case.
         $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());
         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"];
         }
         $post_vars = c_ws_plugin__s2member_utils_captchas::recaptcha_post_vars($post_vars);
         // Collect reCAPTCHA™ post vars.
         if (!empty($_GET["token"])) {
             delete_transient("s2m_" . md5("s2member_transient_express_checkout_" . $_GET["token"]));
         }
         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"]);
                 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;
                 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 (empty($_GET["s2member_paypal_xco"]) && $post_vars["card_type"] === "PayPal" && ($cost_calculations["trial_total"] > 0 || $cost_calculations["total"] > 0)) {
                     $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", "s2p-option"), $return_url = $cancel_url);
                     $return_url = add_query_arg("s2p-option", urlencode((string) @$_REQUEST["s2p-option"]), $return_url);
                     $return_url = add_query_arg("s2member_paypal_xco", urlencode("s2member_pro_paypal_checkout_return"), $return_url);
                     $cancel_url = add_query_arg("s2p-option", urlencode((string) @$_REQUEST["s2p-option"]), $cancel_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;
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:paypal-checkout-in.inc.php


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