本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::strip_2_kb_chars方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::strip_2_kb_chars方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::strip_2_kb_chars怎么用?PHP c_ws_plugin__s2member_utils_strings::strip_2_kb_chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::strip_2_kb_chars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authnet_arb_response
/**
* Calls upon Authorize.Net® ARB, and returns the response.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @param array $post_vars An array of variables to send through the Authorize.Net® API call.
* @return array An array of variables returned from the API call.
*
* @todo Continue optimizing this routine with ``empty()`` and ``isset()``.
*/
public static function authnet_arb_response($post_vars = FALSE)
{
global $current_site, $current_blog;
/* For Multisite support. */
/**/
$url = "https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_sandbox"] ? "apitest.authorize.net" : "api.authorize.net") . "/xml/v1/request.api";
/**/
$post_vars = is_array($post_vars) ? $post_vars : array();
/* Must be in array format. */
/**/
$post_vars["x_login"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"];
$post_vars["x_tran_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_trans_key"];
/**/
$post_vars["x_invoice_num"] = !empty($post_vars["x_invoice_num"]) ? substr($post_vars["x_invoice_num"], 0, 20) : "";
$post_vars["x_description"] = !empty($post_vars["x_description"]) ? substr($post_vars["x_description"], 0, 255) : "";
$post_vars["x_description"] = c_ws_plugin__s2member_utils_strings::strip_2_kb_chars($post_vars["x_description"]);
/**/
$trial = !empty($post_vars["x_trial_occurrences"]) ? true : false;
/* Indicates existence of trial. */
/**/
if (!empty($post_vars["x_method"]) && $post_vars["x_method"] === "create") {
$xml = '<?xml version="1.0" encoding="utf-8"?>';
/**/
$xml .= '<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">';
/**/
$xml .= '<merchantAuthentication>';
$xml .= '<name>' . esc_html($post_vars["x_login"]) . '</name>';
$xml .= '<transactionKey>' . esc_html($post_vars["x_tran_key"]) . '</transactionKey>';
$xml .= '</merchantAuthentication>';
/**/
$xml .= '<refId>' . esc_html($post_vars["x_invoice_num"]) . '</refId>';
/**/
$xml .= '<subscription>';
/**/
$xml .= '<name>' . esc_html($_SERVER["HTTP_HOST"]) . '</name>';
/**/
$xml .= '<paymentSchedule>';
$xml .= '<interval>';
$xml .= '<length>' . esc_html($post_vars["x_length"]) . '</length>';
$xml .= '<unit>' . esc_html($post_vars["x_unit"]) . '</unit>';
$xml .= '</interval>';
$xml .= '<startDate>' . esc_html($post_vars["x_start_date"]) . '</startDate>';
$xml .= '<totalOccurrences>' . esc_html($post_vars["x_total_occurrences"]) . '</totalOccurrences>';
$xml .= $trial ? '<trialOccurrences>' . esc_html($post_vars["x_trial_occurrences"]) . '</trialOccurrences>' : '';
$xml .= '</paymentSchedule>';
/**/
$xml .= '<amount>' . esc_html($post_vars["x_amount"]) . '</amount>';
$xml .= $trial ? '<trialAmount>' . esc_html($post_vars["x_trial_amount"]) . '</trialAmount>' : '';
/**/
$xml .= '<payment>';
$xml .= '<creditCard>';
$xml .= '<cardNumber>' . esc_html($post_vars["x_card_num"]) . '</cardNumber>';
$xml .= '<expirationDate>' . esc_html($post_vars["x_exp_date"]) . '</expirationDate>';
$xml .= '<cardCode>' . esc_html($post_vars["x_card_code"]) . '</cardCode>';
$xml .= '</creditCard>';
$xml .= '</payment>';
/**/
$xml .= '<order>';
$xml .= '<invoiceNumber>' . esc_html($post_vars["x_invoice_num"]) . '</invoiceNumber>';
$xml .= '<description>' . esc_html($post_vars["x_description"]) . '</description>';
$xml .= '</order>';
/**/
$xml .= '<customer>';
$xml .= '<email>' . esc_html($post_vars["x_email"]) . '</email>';
$xml .= '</customer>';
/**/
$xml .= '<billTo>';
$xml .= '<firstName>' . esc_html($post_vars["x_first_name"]) . '</firstName>';
$xml .= '<lastName>' . esc_html($post_vars["x_last_name"]) . '</lastName>';
$xml .= '<address>' . esc_html($post_vars["x_address"]) . '</address>';
$xml .= '<city>' . esc_html($post_vars["x_city"]) . '</city>';
$xml .= '<state>' . esc_html($post_vars["x_state"]) . '</state>';
$xml .= '<zip>' . esc_html($post_vars["x_zip"]) . '</zip>';
$xml .= '<country>' . esc_html($post_vars["x_country"]) . '</country>';
$xml .= '</billTo>';
/**/
$xml .= '</subscription>';
/**/
$xml .= '</ARBCreateSubscriptionRequest>';
} else {
if (!empty($post_vars["x_method"]) && $post_vars["x_method"] === "update") {
$xml = '<?xml version="1.0" encoding="utf-8"?>';
/**/
$xml .= '<ARBUpdateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">';
/**/
$xml .= '<merchantAuthentication>';
$xml .= '<name>' . esc_html($post_vars["x_login"]) . '</name>';
$xml .= '<transactionKey>' . esc_html($post_vars["x_tran_key"]) . '</transactionKey>';
$xml .= '</merchantAuthentication>';
//.........这里部分代码省略.........