本文整理汇总了PHP中c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup方法的具体用法?PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup怎么用?PHP c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_paypal_utilities
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paypal_payflow_api_response
/**
* Calls upon the PayPal PayFlow API, and returns the response.
*
* @package s2Member\PayPal
* @since 120514
*
* @param array $post_vars An array of variables to send through the PayPal PayFlow API call.
* @return array An array of variables returned by the PayPal PayFlow API.
*/
public static function paypal_payflow_api_response($post_vars = FALSE)
{
global $current_site, $current_blog;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_paypal_payflow_api_response", get_defined_vars());
unset($__refs, $__v);
$url = "https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com");
$post_vars = apply_filters("ws_plugin__s2member_paypal_payflow_api_post_vars", $post_vars, get_defined_vars());
$post_vars = is_array($post_vars) ? $post_vars : array();
$post_vars["VERBOSITY"] = "HIGH";
$post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"];
$post_vars["PARTNER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_partner"];
$post_vars["VENDOR"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_vendor"];
$post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_password"];
foreach ($post_vars as $_key => &$_value) {
$_value = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_nv_cleanup($_key, $_value);
}
unset($_key, $_value);
$input_time = date("D M j, Y g:i:s a T");
$nvp_post_vars = "";
foreach ($post_vars as $_key => $_value) {
$nvp_post_vars .= ($nvp_post_vars ? "&" : "") . $_key . "[" . strlen($_value) . "]=" . $_value;
}
unset($_key, $_value);
$nvp = trim(c_ws_plugin__s2member_utils_urls::remote($url, $nvp_post_vars, array("timeout" => 20, "headers" => array("Content-Type" => "text/namevalue"))));
$output_time = date("D M j, Y g:i:s a T");
wp_parse_str($nvp, $response);
$response = c_ws_plugin__s2member_utils_strings::trim_deep($response);
if ($response["RESULT"] !== "0") {
if (strlen($response["RESPMSG"])) {
/* translators: Exclude `%2$s`. These are English details returned by PayPal. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_payflow_api_response`. */
$response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["RESULT"], rtrim($response["RESPMSG"], "."));
} else {
$response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
}
} else {
if (isset($response["TRXRESULT"]) && $response["TRXRESULT"] !== "0") {
if (strlen($response["TRXRESPMSG"])) {
/* translators: Exclude `%2$s`. These are English details returned by PayPal. Replace `%2$s` with: `Unable to process, please try again`, or something to that affect. Or, if you prefer, you could Filter ``$response["__error"]`` with `ws_plugin__s2member_paypal_payflow_api_response`. */
$response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["TRXRESULT"], rtrim($response["TRXRESPMSG"], "."));
} else {
$response["__error"] = _x("Error. Please contact Support for assistance.", "s2member-front", "s2member");
}
}
}
$logt = c_ws_plugin__s2member_utilities::time_details();
$logv = c_ws_plugin__s2member_utilities::ver_details();
$logm = c_ws_plugin__s2member_utilities::mem_details();
$log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . @$_SERVER["HTTP_USER_AGENT"];
$log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
$log2 = is_multisite() && !is_main_site() ? "paypal-payflow-api-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-payflow-api.log";
if (isset($post_vars["ACCT"]) && strlen($post_vars["ACCT"]) > 4) {
$post_vars["ACCT"] = str_repeat("*", strlen($post_vars["ACCT"]) - 4) . substr($post_vars["ACCT"], -4);
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
if (is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files()) {
if ($log = "-------- Input vars: ( " . $input_time . " ) --------\n" . $nvp_post_vars . "\n" . var_export($post_vars, true) . "\n") {
if ($log .= "-------- Output string/vars: ( " . $output_time . " ) --------\n" . $nvp . "\n" . var_export($response, true)) {
file_put_contents($logs_dir . "/" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info($log) . "\n\n", FILE_APPEND);
}
}
}
}
}
return apply_filters("ws_plugin__s2member_paypal_payflow_api_response", c_ws_plugin__s2member_paypal_utilities::_paypal_payflow_api_response_filters($response), get_defined_vars());
}