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


PHP c_ws_plugin__s2member_paypal_utilities::paypal_api_nv_cleanup方法代码示例

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


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

示例1: paypal_api_response

 /**
  * Calls upon the PayPal API, and returns the response.
  *
  * @package s2Member\PayPal
  * @since 3.5
  *
  * @param array $post_vars An array of variables to send through the PayPal API call.
  * @return array An array of variables returned by the PayPal API.
  *
  * @todo Optimize this routine with ``empty()`` and ``isset()``.
  * @todo Possibly integrate this API: {@link http://msdn.microsoft.com/en-us/library/ff512417.aspx}.
  */
 public static function paypal_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_api_response", get_defined_vars());
     unset($__refs, $__v);
     $url = "https://" . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com") . "/nvp";
     $post_vars = apply_filters("ws_plugin__s2member_paypal_api_post_vars", $post_vars, get_defined_vars());
     $post_vars = is_array($post_vars) ? $post_vars : array();
     $post_vars["VERSION"] = "71.0";
     $post_vars["USER"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"];
     $post_vars["PWD"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"];
     $post_vars["SIGNATURE"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"];
     foreach ($post_vars as $_key => &$_value) {
         $_value = c_ws_plugin__s2member_paypal_utilities::paypal_api_nv_cleanup($_key, $_value);
     }
     unset($_key, $_value);
     $input_time = date("D M j, Y g:i:s a T");
     $nvp = trim(c_ws_plugin__s2member_utils_urls::remote($url, $post_vars, array("timeout" => 20)));
     $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["ACK"] || !preg_match("/^(Success|SuccessWithWarning)\$/i", $response["ACK"])) {
         if (strlen($response["L_ERRORCODE0"]) || $response["L_SHORTMESSAGE0"] || $response["L_LONGMESSAGE0"]) {
             /* translators: Exclude `%2$s` and `%3$s`. These are English details returned by PayPal. Replace `%2$s` and `%3$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_api_response`. */
             $response["__error"] = sprintf(_x('Error #%1$s. %2$s. %3$s.', "s2member-front", "s2member"), $response["L_ERRORCODE0"], rtrim($response["L_SHORTMESSAGE0"], "."), rtrim($response["L_LONGMESSAGE0"], "."));
         } else {
             // Else, generate an error messsage - so something is reported back to the Customer.
             $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-api-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-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" . 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_api_response", c_ws_plugin__s2member_paypal_utilities::_paypal_api_response_filters($response), get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:67,代码来源:paypal-utilities.inc.php


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