本文整理汇总了PHP中c_ws_plugin__s2member_utilities::time_details方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utilities::time_details方法的具体用法?PHP c_ws_plugin__s2member_utilities::time_details怎么用?PHP c_ws_plugin__s2member_utilities::time_details使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utilities
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utilities::time_details方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: http_api_debug
/**
* Logs HTTP communication (if enabled).
*
* @package s2Member\Utilities
* @since 120212
*/
public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
{
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
return;
}
// Logging is NOT enabled in this case.
$is_s2member = !empty($args['s2member']) || strpos($url, 's2member') !== FALSE ? TRUE : FALSE;
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive'] && !$is_s2member) {
return;
}
// Extensive logging is NOT enabled in this case.
global $current_site, $current_blog;
// For Multisite support.
$http_api_debug = array('state' => $state, 'transport_class' => $class, 'args' => $args, 'url' => $url, 'response' => $response);
$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'] . "\n" . 'User-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() ? 'http-api-debug-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'http-api-debug.log';
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, TRUE));
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 ($GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs_extensive']) {
file_put_contents($logs_dir . '/wp-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
if ($is_s2member) {
// Log s2Member HTTP connections separately.
file_put_contents($logs_dir . '/s2-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
}
}
}
示例2: google_return
/**
* Handles Google Return URL processing.
*
* @package s2Member\Google
* @since 131123
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after redirection.
*/
public static function google_return()
{
global $current_site, $current_blog;
if (!empty($_GET["s2member_pro_google_return"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"]) {
$google["s2member_log"][] = "Return URL processed on: " . date("D M j, Y g:i:s a T");
$google["s2member_log"][] = "Piping through s2Member's core/standard PayPal processor with `proxy_use` ( `ty-email` ).";
$google["s2member_log"][] = "Please check PayPal RTN logs for further processing details.";
$rtn_q = "&s2member_paypal_proxy=google&s2member_paypal_proxy_use=standard-emails,ty-email";
if (!empty($_GET["s2member_pro_google_return_success"])) {
$rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_google_return_success"])));
}
$rtn_r = home_url("/?s2member_pro_google_return&s2member_paypal_return=1" . $rtn_q);
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
$google["s2member_log"][] = $rtn_r;
wp_redirect($rtn_r);
$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() ? "google-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "google-rtn.log";
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()) {
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(var_export($google, true)) . "\n\n", FILE_APPEND);
}
}
}
exit;
// Exit now.
}
}
示例3: http_api_debug
/**
* Logs HTTP communication (if enabled).
*
* @package s2Member\Utilities
* @since 120212
*
* @return null Nothing.
*/
public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
{
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
return;
}
// Logging is NOT enabled in this case.
$is_s2member = !empty($args["s2member"]) || strpos($url, "s2member") !== false ? true : false;
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"] && !$is_s2member) {
return;
}
// Extensive logging is NOT enabled in this case.
global $current_site, $current_blog;
$http_api_debug = array("state" => $state, "transport_class" => $class, "args" => $args, "url" => $url, "response" => $response);
$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() ? "http-api-debug-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "http-api-debug.log";
$http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, true));
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 ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"]) {
file_put_contents($logs_dir . "/wp-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
if ($is_s2member) {
// Log s2Member HTTP connections separately.
file_put_contents($logs_dir . "/s2-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
}
}
}
}
示例4: log_entry
/**
* Logs an entry.
*
* @since 130315
* @package s2Member\Utilities
*
* @param string $slug The file name; i.e., a slug.
* e.g., `mailchimp-api`, `s2-http-api-debug`.
*
* @param mixed $data The data to log.
*/
public static function log_entry($slug, $data)
{
if (!($slug = trim((string) $slug))) {
return;
}
// Not possible.
if (!$data) {
return;
}
// Nothing to log.
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
return;
}
// Nothing to do; logging not enabled right now.
if (!is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])) {
return;
}
// Log directory does not exist at this time.
if (!is_writable($logs_dir)) {
return;
}
// Not writable.
$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 = '';
// Initialize.
if (is_multisite() && !is_main_site()) {
// Child blog in a multisite network?
$log4 .= $GLOBALS['current_blog']->domain . $GLOBALS['current_blog']->path . "\n";
}
$log4 .= @$_SERVER['HTTP_HOST'] . @$_SERVER['REQUEST_URI'] . "\n";
$log4 .= 'User-Agent: ' . @$_SERVER['HTTP_USER_AGENT'];
$log2 = $slug . '-api.log';
// Initialize.
if (is_multisite() && !is_main_site()) {
// Child blog in a multisite network?
$log2 = $slug . '-api-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', $GLOBALS['current_blog']->domain . $GLOBALS['current_blog']->path), '-') . '.log';
}
c_ws_plugin__s2member_utils_logs::archive_oversize_log_files();
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(print_r($data, TRUE)) . "\n\n", FILE_APPEND);
// Append to an existing log file; if exists.
}
示例5: paypal_notify
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
}
}
} else {
unset($__refs, $__v);
}
// Else a custom conditional has been applied by Filters.
} else {
if (!empty($paypal['txn_type']) && preg_match('/^recurring_payment_profile_cancel$/i', $paypal['txn_type'])) {
$paypal['s2member_log'][] = 'Transaction type (`recurring_payment_profile_cancel`), but there is no match to an existing account; so verification of `$_SERVER["HTTP_HOST"]` was not possible.';
$paypal['s2member_log'][] = 'It\'s likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.';
} else {
if (!empty($paypal['txn_type']) && preg_match('/^recurring_/i', $paypal['txn_type'])) {
// Otherwise, is this a ^recurring_ txn_type?
$paypal['s2member_log'][] = 'Transaction type (`^recurring_?`), but there is no match to an existing account; so verification of `$_SERVER["HTTP_HOST"]` was not possible.';
} else {
// Else, use the default ``$_SERVER['HTTP_HOST']`` error.
$paypal['s2member_log'][] = 'Unable to verify `$_SERVER["HTTP_HOST"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.';
}
}
}
} else {
$paypal['s2member_log'][] = 'Unable to verify $_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.';
$paypal['s2member_log'][] = 'Please see this KB article: `http://www.s2member.com/kb/server-scanner/`. We suggest that you run the s2Member Server Scanner.';
$paypal['s2member_log'][] = var_export($_REQUEST, TRUE);
// Recording _POST + _GET vars for analysis and debugging.
}
if ($email_configs_were_on) {
// Back on?
c_ws_plugin__s2member_email_configs::email_config();
}
/*
Add IPN proxy (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST['s2member_paypal_proxy'])) {
$paypal['s2member_paypal_proxy'] = esc_html(trim(stripslashes((string) $_REQUEST['s2member_paypal_proxy'])));
}
/*
Add IPN proxy use vars (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST['s2member_paypal_proxy_use'])) {
$paypal['s2member_paypal_proxy_use'] = esc_html(trim(stripslashes((string) $_REQUEST['s2member_paypal_proxy_use'])));
}
/*
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST['s2member_paypal_proxy_coupon'])) {
$paypal['s2member_paypal_proxy_coupon'] = stripslashes_deep((array) $_REQUEST['s2member_paypal_proxy_coupon']);
}
/*
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST['s2member_paypal_proxy_verification'])) {
$paypal['s2member_paypal_proxy_verification'] = esc_html(trim(stripslashes((string) $_REQUEST['s2member_paypal_proxy_verification'])));
}
/*
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
Logging now supports Multisite Networking as well.
*/
$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'] . "\n" . 'User-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() ? 'gateway-core-ipn-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'gateway-core-ipn.log';
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()) {
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(var_export($paypal, TRUE)) . "\n\n", FILE_APPEND);
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_paypal_notify', get_defined_vars());
unset($__refs, $__v);
status_header(200);
// Send a 200 OK status header.
header('Content-Type: text/plain; charset=UTF-8');
// Content-Type text/plain with UTF-8.
while (@ob_end_clean()) {
}
// Clean any existing output buffers.
exit(!empty($paypal['s2member_paypal_proxy_return_url']) ? $paypal['s2member_paypal_proxy_return_url'] : '');
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_after_paypal_notify', get_defined_vars());
unset($__refs, $__v);
}
示例6: authnet_arb_response
//.........这里部分代码省略.........
} 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>';
$xml .= '<subscriptionId>' . esc_html($post_vars["x_subscription_id"]) . '</subscriptionId>';
$xml .= '<subscription>';
$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 .= '<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 .= '</ARBUpdateSubscriptionRequest>';
} else {
if (!empty($post_vars["x_method"]) && $post_vars["x_method"] === "status") {
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= '<ARBGetSubscriptionStatusRequest 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 .= '<subscriptionId>' . esc_html($post_vars["x_subscription_id"]) . '</subscriptionId>';
$xml .= '</ARBGetSubscriptionStatusRequest>';
} else {
if (!empty($post_vars["x_method"]) && $post_vars["x_method"] === "cancel") {
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= '<ARBCancelSubscriptionRequest 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 .= '<subscriptionId>' . esc_html($post_vars["x_subscription_id"]) . '</subscriptionId>';
$xml .= '</ARBCancelSubscriptionRequest>';
}
}
}
}
$req["headers"]["Accept"] = "application/xml; charset=UTF-8";
$req["headers"]["Content-Type"] = "application/xml; charset=UTF-8";
$input_time = date("D M j, Y g:i:s a T");
// Record input time for logging.
$xml = trim(c_ws_plugin__s2member_utils_urls::remote($url, $xml, array_merge($req, array("timeout" => 20))));
$output_time = date("D M j, Y g:i:s a T");
// Now record after output time.
$response = c_ws_plugin__s2member_pro_authnet_utilities::_authnet_parse_arb_response($xml);
if (empty($response["response_code"]) || $response["response_code"] !== "I00001") {
if (strlen($response["response_reason_code"]) || $response["response_reason_text"]) {
// translators: Exclude `%2$s`. This is an English error returned by Authorize.Net. Please 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_pro_authnet_arb_response`.
$response["__error"] = sprintf(_x('Error #%1$s. %2$s.', "s2member-front", "s2member"), $response["response_reason_code"], rtrim($response["response_reason_text"], "."));
} 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");
}
}
/*
If debugging is enabled; we need to maintain a comprehensive log file.
Logging now supports Multisite Networking as well.
*/
$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() ? "authnet-api-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "authnet-api.log";
if (!empty($post_vars["x_card_num"]) && strlen($post_vars["x_card_num"]) > 4) {
// Only log last 4 digits for security.
$post_vars["x_card_num"] = str_repeat("*", strlen($post_vars["x_card_num"]) - 4) . substr($post_vars["x_card_num"], -4);
}
// Then display last 4 digits.
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" . $xml . "\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_pro_authnet_arb_response", c_ws_plugin__s2member_pro_authnet_utilities::_authnet_arb_response_filters($response), get_defined_vars());
}
示例7: clickbank_return
//.........这里部分代码省略.........
$rtn["option_selection2"] = $s2vars["s2_customer_ip"];
$rtn["item_number"] = $s2vars["s2_invoice"];
$rtn["item_name"] = $s2vars["s2_desc"];
$rtn_q = "&s2member_paypal_proxy=clickbank&s2member_paypal_proxy_use=standard-emails";
if (!empty($_GET["s2member_pro_clickbank_return_success"])) {
$rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_clickbank_return_success"])));
}
$rtn_r = add_query_arg(urlencode_deep($rtn), site_url("/?s2member_pro_clickbank_return&s2member_paypal_return=1" . $rtn_q));
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
$clickbank["s2member_log"][] = $rtn_r;
wp_redirect($rtn_r);
} else {
if (preg_match("/^(TEST_)?SALE\$/i", $order["txnType"]) && isset($s2vars["s2_p1"], $s2vars["s2_p3"])) {
$clickbank["s2member_log"][] = "ClickBank transaction identified as ( `SALE/RECURRING` ).";
$clickbank["s2member_log"][] = "Return-Data reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_signup` ).";
$clickbank["s2member_log"][] = "Please check PayPal RTN logs for further processing details.";
$rtn = array();
// Reset.
$rtn["txn_type"] = "subscr_signup";
$rtn["subscr_id"] = $s2vars["s2_subscr_id"];
$rtn["recurring"] = $order["futurePayments"] > 1 ? "1" : "0";
$rtn["txn_id"] = $order["receipt"];
$rtn["custom"] = $s2vars["s2_custom"];
$rtn["period1"] = $s2vars["s2_p1"];
$rtn["period3"] = $s2vars["s2_p3"];
$rtn["mc_amount1"] = number_format($order["amount"], 2, ".", "");
$rtn["mc_amount3"] = @number_format($order["rebillAmount"], 2, ".", "");
$rtn["mc_currency"] = strtoupper($order["currency"]);
$rtn["tax"] = "0.00";
// No tax.
$rtn["payer_email"] = $order["email"];
$rtn["first_name"] = ucwords(strtolower($order["firstName"]));
$rtn["last_name"] = ucwords(strtolower($order["lastName"]));
$rtn["option_name1"] = $s2vars["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
$rtn["option_selection1"] = $s2vars["s2_referencing"] ? $s2vars["s2_referencing"] : $_SERVER["HTTP_HOST"];
$rtn["option_name2"] = "Customer IP Address";
$rtn["option_selection2"] = $s2vars["s2_customer_ip"];
$rtn["item_number"] = $s2vars["s2_invoice"];
$rtn["item_name"] = $s2vars["s2_desc"];
$rtn_q = "&s2member_paypal_proxy=clickbank&s2member_paypal_proxy_use=standard-emails";
if (!empty($_GET["s2member_pro_clickbank_return_success"])) {
$rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_clickbank_return_success"])));
}
$rtn_r = add_query_arg(urlencode_deep($rtn), site_url("/?s2member_pro_clickbank_return&s2member_paypal_return=1" . $rtn_q));
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
$clickbank["s2member_log"][] = $rtn_r;
wp_redirect($rtn_r);
} else {
$clickbank["s2member_log"][] = "Unexpected txnType. The ClickBank txnType did not match a required action.";
$clickbank["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
echo '<script type="text/javascript">' . "\n";
echo "alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("ERROR: Unexpected txnType. Please contact Support for assistance.\n\nThe ClickBank txnType did not match a required action.", "s2member-front", "s2member")) . "');" . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(home_url("/")) . "';";
echo '</script>' . "\n";
}
}
} else {
$clickbank["s2member_log"][] = "Unable to obtain API vars. The ClickBank API may NOT have data for this order yet. Or, your ClickBank API Keys are NOT configured properly under `s2Member -› ClickBank Options`.";
$clickbank["s2member_log"][] = var_export($_REQUEST, true);
// Recording ``$_POST`` + ``$_GET`` vars for analysis and debugging.
$clickbank["s2member_log"][] = "Return-Data reformulated. Piping through s2Member's core/standard PayPal processor with `proxy_use` ( `ty-email` ).";
$clickbank["s2member_log"][] = "Please check PayPal RTN logs for further processing details.";
$rtn_q = "&s2member_paypal_proxy=clickbank&s2member_paypal_proxy_use=standard-emails,ty-email";
if (!empty($_GET["s2member_pro_clickbank_return_success"])) {
$rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_clickbank_return_success"])));
}
$rtn_r = site_url("/?s2member_pro_clickbank_return&s2member_paypal_return=1" . $rtn_q);
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
$clickbank["s2member_log"][] = $rtn_r;
wp_redirect($rtn_r);
}
} else {
$clickbank["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid ClickBank configuration. Please check: s2Member -› ClickBank Options.";
$clickbank["s2member_log"][] = "If you're absolutely SURE that your ClickBank configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to ClickBank over an HTTPS connection.";
$clickbank["s2member_log"][] = "s2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows server.";
$clickbank["s2member_log"][] = var_export($_REQUEST, true);
// Recording _POST + _GET vars for analysis and debugging.
$clickbank["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
echo '<script type="text/javascript">' . "\n";
echo "alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x("ERROR: Unable to verify POST vars. Please contact Support for assistance.\n\nThis is most likely related to an invalid ClickBank configuration. If you are the site owner, please check: s2Member -› ClickBank Options.", "s2member-front", "s2member")) . "');" . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(home_url("/")) . "';";
echo '</script>' . "\n";
}
$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() ? "clickbank-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "clickbank-rtn.log";
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()) {
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(var_export($clickbank, true)) . "\n\n", FILE_APPEND);
}
}
}
exit;
// Exit now.
}
}
示例8: payflow_service
/**
* Connect to and process cancellations/refunds/chargebacks/etc via Payflow.
*
* s2Member's Auto EOT System must be enabled for this to work properly.
*
* If you have a HUGE userbase, increase the max IPNs per process.
* But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
* To increase, use: ``add_filter ("ws_plugin__s2member_pro_payflow_ipns_per_process");``.
*
* @package s2Member\PayPal
* @since 120514
*
* @attaches-to ``add_action("ws_plugin__s2member_after_auto_eot_system");``
*
* @param array $vars Expects an array of defined variables to be passed in by the Action Hook.
* @return null
*/
public static function payflow_service($vars = FALSE)
{
global $wpdb;
// Need global DB obj.
global $current_site, $current_blog;
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_payflow_api_username"]) {
$scan_time = apply_filters("ws_plugin__s2member_pro_payflow_status_scan_time", strtotime("-1 day"), get_defined_vars());
$per_process = apply_filters("ws_plugin__s2member_pro_payflow_ipns_per_process", $vars["per_process"], get_defined_vars());
if (is_array($objs = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_gateway' AND `meta_value` = 'paypal' AND `user_id` NOT IN(SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_last_status_scan' AND `meta_value` > '" . esc_sql($scan_time) . "')"))) {
foreach ($objs as $obj) {
if (($user_id = $obj->ID) && ($counter = (int) $counter + 1)) {
unset($paypal, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $log4, $_log4, $log2, $logs_dir);
if (($subscr_id = get_user_option("s2member_subscr_id", $user_id)) && !get_user_option("s2member_auto_eot_time", $user_id)) {
if (is_array($ipn_sv = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $subscr_id)) && ($paypal = c_ws_plugin__s2member_pro_paypal_utilities::payflow_get_profile($subscr_id)) && is_array($paypal["ipn_signup_vars"] = $ipn_sv)) {
if (preg_match("/expired/i", $paypal["STATUS"])) {
$paypal["s2member_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
$paypal["s2member_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION EXPIRATION` ).";
$paypal["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_eot` ).";
$paypal["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
// Reset.
$ipn["txn_type"] = "subscr_eot";
$ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
$ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
$ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
$ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
$ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
$ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
$ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
$ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
$ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
$ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
$ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
$ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
$ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
$ipn["s2member_paypal_proxy"] = "paypal";
$ipn["s2member_paypal_proxy_use"] = "pro-emails";
$ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
} else {
if (preg_match("/(suspended|canceled|terminated|deactivated)/i", $paypal["STATUS"])) {
$paypal["s2member_log"][] = "Payflow IPN via polling, processed on: " . date("D M j, Y g:i:s a T");
$paypal["s2member_log"][] = "Payflow transaction identified as ( `SUBSCRIPTION " . strtoupper($paypal["STATUS"]) . "` ).";
$paypal["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_cancel` ).";
$paypal["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
// Reset.
$ipn["txn_type"] = "subscr_cancel";
$ipn["subscr_id"] = $paypal["ipn_signup_vars"]["subscr_id"];
$ipn["custom"] = $paypal["ipn_signup_vars"]["custom"];
$ipn["period1"] = $paypal["ipn_signup_vars"]["period1"];
$ipn["period3"] = $paypal["ipn_signup_vars"]["period3"];
$ipn["payer_email"] = $paypal["ipn_signup_vars"]["payer_email"];
$ipn["first_name"] = $paypal["ipn_signup_vars"]["first_name"];
$ipn["last_name"] = $paypal["ipn_signup_vars"]["last_name"];
$ipn["option_name1"] = $paypal["ipn_signup_vars"]["option_name1"];
$ipn["option_selection1"] = $paypal["ipn_signup_vars"]["option_selection1"];
$ipn["option_name2"] = $paypal["ipn_signup_vars"]["option_name2"];
$ipn["option_selection2"] = $paypal["ipn_signup_vars"]["option_selection2"];
$ipn["item_number"] = $paypal["ipn_signup_vars"]["item_number"];
$ipn["item_name"] = $paypal["ipn_signup_vars"]["item_name"];
$ipn["s2member_paypal_proxy"] = "paypal";
$ipn["s2member_paypal_proxy_use"] = "pro-emails";
$ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
} else {
if (!$processed) {
// If nothing was processed, here we add a message to the logs indicating the status; which is being ignored.
$paypal["s2member_log"][] = "Ignoring this status ( `" . $paypal["STATUS"] . "` ). It does NOT require any action on the part of 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-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "paypal-payflow-ipn.log";
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()) {
//.........这里部分代码省略.........
示例9: configure_user_registration
//.........这里部分代码省略.........
}
if ($email_configs_were_on) {
// Back on?
c_ws_plugin__s2member_email_configs::email_config();
}
unset($sbj, $msg, $var, $val, $recipient, $email_configs_were_on);
// Housekeeping.
}
if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"]) {
if ($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) {
if ($url = preg_replace("/%%role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($role)), $url)) {
if ($url = preg_replace("/%%level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($level)), $url)) {
if ($url = preg_replace("/%%ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($ccaps)), $url)) {
if ($url = preg_replace("/%%auto_eot_time%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($auto_eot_time)), $url)) {
if ($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($fname)), $url)) {
if ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($lname)), $url)) {
if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($name)), $url)) {
if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($email)), $url)) {
if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($login)), $url)) {
if ($url = preg_replace("/%%user_pass%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($pass)), $url)) {
if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($ip)), $url)) {
if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_id)), $url)) {
foreach ($fields as $var => $val) {
// Custom Fields.
if (!($url = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
if ($url = trim($url)) {
// Preserve remaining Replacements; because the parent routine may perform replacements too.
$GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
unset($url, $var, $val);
// Housekeeping.
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $login, $pass, $email, $fname, $lname, $ip, $opt_in, true, $user_id);
/*
Suppress errors here in case this routine is fired in unexpected locations; or with odd output buffering techniques.
@todo It may also be impossible to delete cookies when fired inside: `/wp-activate.php`.
*/
if (!headers_sent()) {
@setcookie("s2member_subscr_gateway", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_subscr_gateway", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
@setcookie("s2member_subscr_id", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_subscr_id", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
@setcookie("s2member_custom", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_custom", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
@setcookie("s2member_item_number", "", time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie("s2member_item_number", "", time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
}
/* If debugging/logging is enabled; we need to append ``$reg_vars`` to the log file.
Logging now supports Multisite Networking as well. */
$reg_vars = get_defined_vars();
// All defined vars.
// No need to include these in the logs. Unset before log entry.
unset($reg_vars["wpdb"], $reg_vars["current_site"], $reg_vars["current_blog"]);
$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() ? "reg-handler-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "reg-handler.log";
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()) {
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(var_export($reg_vars, true)) . "\n\n", FILE_APPEND);
}
}
}
unset($logt, $logv, $logm, $log4, $_log4, $log2, $logs_dir, $reg_vars);
// Housekeeping.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_configure_user_registration", get_defined_vars());
unset($__refs, $__v);
}
}
}
}
}
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_after_configure_user_registration", get_defined_vars());
unset($__refs, $__v);
return;
}
示例10: 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());
}
示例11: authnet_notify
/**
* Handles Authorize.Net IPN URL processing.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after handling IPN processing.
*/
public static function authnet_notify()
{
global $current_site, $current_blog;
if (!empty($_GET["s2member_pro_authnet_notify"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"]) {
@ignore_user_abort(true);
// Continue processing even if/when connection is broken by the sender.
if (is_array($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_postvars()) && ($_authnet = $authnet)) {
$authnet["s2member_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
$authnet["s2member_log"][] = "s2Member POST vars verified with Authorize.Net.";
if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && $authnet["x_response_code"] === "1") {
if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
$authnet["s2member_log"][] = "Authorize.Net transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
$authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_payment` ).";
$authnet["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
// Reset.
$ipn["txn_type"] = "subscr_payment";
$ipn["subscr_id"] = $authnet["x_subscription_id"];
$ipn["txn_id"] = $authnet["x_trans_id"];
$ipn["custom"] = $authnet["s2_custom"];
$ipn["mc_gross"] = number_format($authnet["x_amount"], 2, ".", "");
$ipn["mc_currency"] = strtoupper(!empty($authnet["s2_currency"]) ? $authnet["s2_currency"] : "USD");
$ipn["tax"] = number_format($authnet["x_tax"], 2, ".", "");
$ipn["payer_email"] = $authnet["x_email"];
$ipn["first_name"] = $authnet["x_first_name"];
$ipn["last_name"] = $authnet["x_last_name"];
$ipn["option_name1"] = "Referencing Customer ID";
$ipn["option_selection1"] = $authnet["x_subscription_id"];
$ipn["option_name2"] = "Customer IP Address";
$ipn["option_selection2"] = null;
$ipn["item_number"] = $authnet["s2_invoice"];
$ipn["item_name"] = $authnet["x_description"];
$ipn["s2member_paypal_proxy"] = "authnet";
$ipn["s2member_paypal_proxy_use"] = "pro-emails";
$ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
} else {
$authnet["s2member_log"][] = "Authorize.Net transaction identified as ( `ARB / PAYMENT #" . $authnet["x_subscription_paynum"] . "` ).";
$authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
}
} else {
if ($authnet["x_subscription_id"] && $authnet["x_subscription_paynum"] && preg_match("/^(2|3)\$/", $authnet["x_response_code"])) {
if (($_authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_parse_arb_desc($authnet)) && ($authnet = $_authnet)) {
$authnet["s2member_log"][] = "Authorize.Net transaction identified as ( `ARB / FAILED PAYMENT` ).";
$authnet["s2member_log"][] = "s2Member does NOT respond to individual failed payment notifications.";
$authnet["s2member_log"][] = "When multiple consecutive payments fail, s2Member is notified via ARB services.";
$authnet["s2member_log"][] = "This does not require any action (at the moment) on the part of s2Member.";
} else {
$authnet["s2member_log"][] = "Authorize.Net transaction identified as ( `ARB / FAILED PAYMENT` ).";
$authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT contain a valid reference value/desc.";
}
} else {
if (!$processed) {
// If nothing was processed, here we add a message to the logs indicating the IPN was ignored.
$authnet["s2member_log"][] = "Ignoring this IPN. The transaction does NOT require any action on the part of s2Member.";
}
}
}
} else {
$authnet["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid Authorize.Net configuration. Please check: s2Member -› Authorize.Net Options.";
$authnet["s2member_log"][] = "If you're absolutely SURE that your Authorize.Net configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to Authorize.Net over an HTTPS connection.";
$authnet["s2member_log"][] = "s2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows server.";
$authnet["s2member_log"][] = var_export($_REQUEST, true);
// Recording _POST + _GET vars for analysis and debugging.
}
/*
If debugging/logging is enabled; we need to append $authnet to the log file.
Logging now supports Multisite Networking as well.
*/
$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() ? "authnet-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "authnet-ipn.log";
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()) {
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(var_export($authnet, true)) . "\n\n", FILE_APPEND);
}
}
}
status_header(200);
// Send a 200 OK status header.
header("Content-Type: text/plain; charset=UTF-8");
// Content-Type text/plain with UTF-8.
while (@ob_end_clean()) {
}
// Clean any existing output buffers.
//.........这里部分代码省略.........
示例12: ccbill_notify
/**
* Handles ccBill IPN URL processing.
*
* @package s2Member\ccBill
* @since 1.5
*
* @attaches-to ``add_action("init");``
*
* @return null Or exits script execution after handling the Notification.
*/
public static function ccbill_notify()
{
global $current_site, $current_blog;
if (isset($_GET["s2member_pro_ccbill_notify"]) && strlen($_GET["s2member_pro_ccbill_notify"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"]) {
@ignore_user_abort(true);
// Continue processing even if/when connection is broken by the sender.
if (is_array($ccbill = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_postvars()) && ($_ccbill = $ccbill)) {
$ccbill["s2member_log"][] = "IPN received on: " . date("D M j, Y g:i:s a T");
$ccbill["s2member_log"][] = "s2Member POST vars verified with ccBill.";
if (!$ccbill["denialId"] && $ccbill["subscription_id"] && !$ccbill["recurringPeriod"]) {
$ccbill["s2member_log"][] = "ccBill transaction identified as ( `NON-RECURRING/BUY-NOW` ).";
$ccbill["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `web_accept` ).";
$ccbill["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
// Reset.
$ipn["txn_type"] = "web_accept";
$ipn["txn_id"] = $ccbill["subscription_id"];
$ipn["custom"] = $ccbill["s2_custom"];
$ipn["mc_gross"] = number_format($ccbill["initialPrice"], 2, ".", "");
$ipn["mc_currency"] = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_code($ccbill["currencyCode"]);
$ipn["tax"] = number_format("0.00", 2, ".", "");
$ipn["payer_email"] = $ccbill["email"];
$ipn["first_name"] = $ccbill["customer_fname"];
$ipn["last_name"] = $ccbill["customer_lname"];
$ipn["option_name1"] = $ccbill["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
$ipn["option_selection1"] = $ccbill["s2_referencing"] ? $ccbill["s2_referencing"] : $_SERVER["HTTP_HOST"];
$ipn["option_name2"] = "Customer IP Address";
$ipn["option_selection2"] = $ccbill["s2_customer_ip"];
$ipn["item_number"] = $ccbill["s2_invoice"];
$ipn["item_name"] = $ccbill["s2_desc"];
$ipn["s2member_paypal_proxy"] = "ccbill";
$ipn["s2member_paypal_proxy_use"] = "standard-emails";
$ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
} else {
if (!$ccbill["denialId"] && $ccbill["subscription_id"] && $ccbill["recurringPeriod"]) {
$ccbill["s2member_log"][] = "ccBill transaction identified as ( `RECURRING/SUBSCRIPTION` ).";
$ccbill["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal processor as `txn_type` ( `subscr_signup` ).";
$ccbill["s2member_log"][] = "Please check PayPal IPN logs for further processing details.";
$processing = $processed = true;
$ipn = array();
// Reset.
$ipn["txn_type"] = "subscr_signup";
$ipn["subscr_id"] = $ccbill["subscription_id"];
$ipn["recurring"] = "1";
// Yes, recurring.
$ipn["txn_id"] = $ccbill["subscription_id"];
$ipn["custom"] = $ccbill["s2_custom"];
$ipn["period1"] = $ccbill["s2_p1"];
$ipn["period3"] = $ccbill["s2_p3"];
$ipn["mc_amount1"] = number_format($ccbill["initialPrice"], 2, ".", "");
$ipn["mc_amount3"] = number_format($ccbill["recurringPrice"], 2, ".", "");
$ipn["mc_gross"] = preg_match("/^[1-9]/", $ipn["period1"]) ? $ipn["mc_amount1"] : $ipn["mc_amount3"];
$ipn["mc_currency"] = c_ws_plugin__s2member_pro_ccbill_utilities::ccbill_currency_code($ccbill["currencyCode"]);
$ipn["tax"] = number_format("0.00", 2, ".", "");
$ipn["payer_email"] = $ccbill["email"];
$ipn["first_name"] = $ccbill["customer_fname"];
$ipn["last_name"] = $ccbill["customer_lname"];
$ipn["option_name1"] = $ccbill["s2_referencing"] ? "Referencing Customer ID" : "Originating Domain";
$ipn["option_selection1"] = $ccbill["s2_referencing"] ? $ccbill["s2_referencing"] : $_SERVER["HTTP_HOST"];
$ipn["option_name2"] = "Customer IP Address";
$ipn["option_selection2"] = $ccbill["s2_customer_ip"];
$ipn["item_number"] = $ccbill["s2_invoice"];
$ipn["item_name"] = $ccbill["s2_desc"];
$ipn["s2member_paypal_proxy"] = "ccbill";
$ipn["s2member_paypal_proxy_use"] = "standard-emails";
$ipn["s2member_paypal_proxy_use"] .= $ipn["mc_gross"] > 0 ? ",subscr-signup-as-subscr-payment" : "";
$ipn["s2member_paypal_proxy_verification"] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(home_url("/?s2member_paypal_notify=1"), $ipn, array("timeout" => 20));
} else {
if (!$processed) {
// If nothing was processed, here we add a message to the logs indicating the IPN was ignored.
$ccbill["s2member_log"][] = "Ignoring this IPN request. The transaction does NOT require any action on the part of s2Member.";
}
}
}
} else {
$ccbill["s2member_log"][] = "Unable to verify POST vars. This is most likely related to an invalid ccBill configuration. Please check: s2Member → ccBill Options.";
$ccbill["s2member_log"][] = "If you're absolutely SURE that your ccBill configuration is valid, you may want to run some tests on your server, just to be sure \$_POST variables are populated, and that your server is able to connect to ccBill over an HTTPS connection.";
$ccbill["s2member_log"][] = "s2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows server.";
$ccbill["s2member_log"][] = var_export($_REQUEST, true);
// Recording _POST + _GET vars for analysis and debugging.
}
/*
If debugging/logging is enabled; we need to append $ccbill to the log file.
Logging now supports Multisite Networking as well.
*/
$logt = c_ws_plugin__s2member_utilities::time_details();
$logv = c_ws_plugin__s2member_utilities::ver_details();
//.........这里部分代码省略.........
示例13: log_entry
/**
* Logs Stripe API communication.
*
* @param string $function Name of the caller.
*
* @param integer $input_time Input time.
* @param mixed $input_vars Input data/vars.
*
* @param integer $output_time Output time.
* @param mixed $output_vars Output data/vars.
*/
public static function log_entry($function, $input_time, $input_vars, $output_time, $output_vars)
{
global $current_site, $current_blog;
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) {
return;
}
// Nothing to do in this case.
$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'] . "\n" . 'User-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() ? 'stripe-api-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'stripe-api.log';
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 = '-------- Function/Caller: ( ' . $function . ' ) --------' . "\n") {
if ($log .= '-------- Input vars: ( ' . date(DATE_RFC822, $input_time) . ' ) --------' . "\n" . print_r($input_vars, TRUE) . "\n") {
if ($log .= '-------- Output string/vars: ( ' . date(DATE_RFC822, $output_time) . ' ) --------' . "\n" . print_r($output_vars, 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);
}
}
}
}
}
}
示例14: paypal_notify
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
}
}
} else {
// Else a custom conditional has been applied by Filters.
unset($__refs, $__v);
}
} else {
if (!empty($paypal["txn_type"]) && preg_match("/^recurring_payment_profile_cancel\$/i", $paypal["txn_type"])) {
$paypal["s2member_log"][] = "Transaction type ( `recurring_payment_profile_cancel` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
$paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
} else {
if (!empty($paypal["txn_type"]) && preg_match("/^recurring_/i", $paypal["txn_type"])) {
// Otherwise, is this a ^recurring_ txn_type?
$paypal["s2member_log"][] = "Transaction type ( `^recurring_?` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
} else {
// Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
$paypal["s2member_log"][] = "Unable to verify `\$_SERVER[\"HTTP_HOST\"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.";
}
}
}
} else {
$paypal["s2member_log"][] = "Unable to verify \$_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.";
$paypal["s2member_log"][] = "Please see this KB article: `http://www.s2member.com/kb/server-scanner/`. We suggest that you run the s2Member Server Scanner.";
$paypal["s2member_log"][] = var_export($_REQUEST, true);
// Recording _POST + _GET vars for analysis and debugging.
}
if ($email_configs_were_on) {
// Back on?
c_ws_plugin__s2member_email_configs::email_config();
}
/*
Add IPN proxy (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST["s2member_paypal_proxy"])) {
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string) $_REQUEST["s2member_paypal_proxy"])));
}
/*
Add IPN proxy use vars (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST["s2member_paypal_proxy_use"])) {
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string) $_REQUEST["s2member_paypal_proxy_use"])));
}
/*
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST["s2member_paypal_proxy_coupon"])) {
$paypal["s2member_paypal_proxy_coupon"] = stripslashes_deep((array) $_REQUEST["s2member_paypal_proxy_coupon"]);
}
/*
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
*/
if (!empty($_REQUEST["s2member_paypal_proxy_verification"])) {
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string) $_REQUEST["s2member_paypal_proxy_verification"])));
}
/*
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
Logging now supports Multisite Networking as well.
*/
$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() ? "gateway-core-ipn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "gateway-core-ipn.log";
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()) {
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(var_export($paypal, true)) . "\n\n", FILE_APPEND);
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_notify", get_defined_vars());
unset($__refs, $__v);
status_header(200);
// Send a 200 OK status header.
header("Content-Type: text/plain; charset=UTF-8");
// Content-Type text/plain with UTF-8.
while (@ob_end_clean()) {
}
// Clean any existing output buffers.
exit(!empty($paypal["s2member_paypal_proxy_return_url"]) ? $paypal["s2member_paypal_proxy_return_url"] : "");
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_after_paypal_notify", get_defined_vars());
unset($__refs, $__v);
}
示例15: clickbank_return
//.........这里部分代码省略.........
$rtn_r = add_query_arg(urlencode_deep($rtn), home_url('/?s2member_pro_clickbank_return&s2member_paypal_return=1' . $rtn_q));
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, 's2member_paypal_proxy_verification');
$clickbank['s2member_log'][] = $rtn_r;
// Log the full Return redirection URL here.
wp_redirect($rtn_r);
// Proxy this through s2Member's core PayPal processor.
} else {
if (preg_match('/^(TEST_)?SALE$/i', $order['txnType']) && !empty($s2vars['s2_p1']) && !empty($s2vars['s2_p3'])) {
$clickbank['s2member_log'][] = 'ClickBank transaction identified as (`SALE/RECURRING`).';
$clickbank['s2member_log'][] = 'Return-Data reformulated. Piping through s2Member\'s core/standard PayPal processor as `txn_type` (`subscr_signup`).';
$clickbank['s2member_log'][] = 'Please check PayPal RTN logs for further processing details.';
$rtn = array();
// Reset.
$rtn['txn_type'] = 'subscr_signup';
$rtn['subscr_id'] = $s2vars['s2_subscr_id'];
$rtn['recurring'] = $order['futurePayments'] > 1 ? '1' : '0';
$rtn['txn_id'] = $order['receipt'];
$rtn['custom'] = $s2vars['s2_custom'];
$rtn['period1'] = $s2vars['s2_p1'];
$rtn['period3'] = $s2vars['s2_p3'];
$rtn['mc_amount1'] = number_format($order['amount'], 2, '.', '');
$rtn['mc_amount3'] = @number_format($order['rebillAmount'], 2, '.', '');
$rtn['mc_currency'] = strtoupper($order['currency']);
$rtn['tax'] = '0.00';
// No tax.
$rtn['payer_email'] = $order['email'];
$rtn['first_name'] = ucwords(strtolower($order['firstName']));
$rtn['last_name'] = ucwords(strtolower($order['lastName']));
$rtn['option_name1'] = !empty($s2vars['s2_referencing']) ? 'Referencing Customer ID' : 'Originating Domain';
$rtn['option_selection1'] = !empty($s2vars['s2_referencing']) ? $s2vars['s2_referencing'] : $_SERVER['HTTP_HOST'];
$rtn['option_name2'] = 'Customer IP Address';
$rtn['option_selection2'] = $s2vars['s2_customer_ip'];
$rtn['item_number'] = $s2vars['s2_invoice'];
$rtn['item_name'] = $s2vars['s2_desc'];
$rtn_q = '&s2member_paypal_proxy=clickbank&s2member_paypal_proxy_use=standard-emails';
if (!empty($_GET['s2member_pro_clickbank_return_success'])) {
// Using a custom Return URL on success?
$rtn_q .= '&s2member_paypal_return_success=' . rawurlencode(trim(stripslashes($_GET['s2member_pro_clickbank_return_success'])));
}
$rtn_r = add_query_arg(urlencode_deep($rtn), home_url('/?s2member_pro_clickbank_return&s2member_paypal_return=1' . $rtn_q));
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, 's2member_paypal_proxy_verification');
$clickbank['s2member_log'][] = $rtn_r;
// Log the full Return redirection URL here.
wp_redirect($rtn_r);
// Proxy this through s2Member's core PayPal processor.
} else {
$clickbank['s2member_log'][] = 'Unexpected txnType. The ClickBank txnType did not match a required action.';
$clickbank['s2member_log'][] = 'Redirecting Customer to the Home Page, due to an error that occurred.';
echo '<script type="text/javascript">' . "\n";
echo "alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('ERROR: Unexpected txnType. Please contact Support for assistance.\\n\\nThe ClickBank txnType did not match a required action.', 's2member-front', 's2member')) . "');" . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(home_url('/')) . "';";
echo '</script>' . "\n";
}
}
} else {
$clickbank['s2member_log'][] = 'Unable to obtain API vars. The ClickBank API may NOT have data for this order yet. Or, your ClickBank API Keys are NOT configured properly under `s2Member ⥱ ClickBank Options`.';
$clickbank['s2member_log'][] = var_export($_REQUEST, TRUE);
// Recording ``$_POST`` + ``$_GET`` vars for analysis and debugging.
$clickbank['s2member_log'][] = 'Return-Data reformulated. Piping through s2Member\'s core/standard PayPal processor with `proxy_use` (`ty-email`).';
$clickbank['s2member_log'][] = 'Please check PayPal RTN logs for further processing details.';
$rtn_q = '&s2member_paypal_proxy=clickbank&s2member_paypal_proxy_use=standard-emails,ty-email';
if (!empty($_GET['s2member_pro_clickbank_return_success'])) {
$rtn_q .= '&s2member_paypal_return_success=' . rawurlencode(trim(stripslashes($_GET['s2member_pro_clickbank_return_success'])));
}
$rtn_r = home_url('/?s2member_pro_clickbank_return&s2member_paypal_return=1' . $rtn_q);
$rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, 's2member_paypal_proxy_verification');
$clickbank['s2member_log'][] = $rtn_r;
// Log the full Return redirection URL here.
wp_redirect($rtn_r);
// Proxy this through s2Member's core PayPal processor.
}
} else {
$clickbank['s2member_log'][] = 'Unable to verify POST vars. This is most likely related to an invalid ClickBank configuration. Please check: s2Member ⥱ ClickBank Options.';
$clickbank['s2member_log'][] = 'If you\'re absolutely SURE that your ClickBank configuration is valid, you may want to run some tests on your server, just to be sure \\$_POST variables are populated, and that your server is able to connect to ClickBank over an HTTPS connection.';
$clickbank['s2member_log'][] = 's2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows server.';
$clickbank['s2member_log'][] = var_export($_REQUEST, TRUE);
// Recording _POST + _GET vars for analysis and debugging.
$clickbank['s2member_log'][] = 'Redirecting Customer to the Home Page, due to an error that occurred.';
echo '<script type="text/javascript">' . "\n";
echo "alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('ERROR: Unable to verify POST vars. Please contact Support for assistance.\\n\\nThis is most likely related to an invalid ClickBank configuration. If you are the site owner, please check: s2Member ⥱ ClickBank Options.', 's2member-front', 's2member')) . "');" . "\n";
echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq(home_url("/")) . "';";
echo '</script>' . "\n";
}
$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'] . "\n" . 'User-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() ? 'clickbank-rtn-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'clickbank-rtn.log';
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()) {
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(var_export($clickbank, TRUE)) . "\n\n", FILE_APPEND);
}
}
}
exit;
// Clean exit; all done here.
}
}