本文整理汇总了PHP中c_ws_plugin__s2member_utils_urls::remote方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_urls::remote方法的具体用法?PHP c_ws_plugin__s2member_utils_urls::remote怎么用?PHP c_ws_plugin__s2member_utils_urls::remote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_urls
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_urls::remote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recaptcha_code_validates
/**
* Verifies a reCAPTCHA™ code via Google®.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param str $challenge The value of `recaptcha_challenge_field` during form submisson.
* @param str $response The value of `recaptcha_response_field` during form submission.
* @return bool True if ``$response`` is valid, else false.
*/
public static function recaptcha_code_validates($challenge = FALSE, $response = FALSE)
{
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys();
$post_vars = array("privatekey" => $keys["private"], "remoteip" => $_SERVER["REMOTE_ADDR"], "challenge" => $challenge, "response" => $response);
/**/
return preg_match("/^true/i", trim(c_ws_plugin__s2member_utils_urls::remote("http://www.google.com/recaptcha/api/verify", $post_vars)));
}
示例2: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|float|string $a The amount, in ``$from``.
* @param string $from Three character currency code.
* @param string $to Three character currency code.
*
* @return string A numeric amount in ``$to``, after having been converted. Else false.
*/
public static function convert($a = 0, $from = '', $to = '')
{
if (is_numeric($a) && strlen($from) === 3 && strlen($to) === 3) {
$q = strtoupper($from . '-' . $to);
// Also need this to test the return value.
$endpoint = 'http://www.freecurrencyconverterapi.com/api/convert?q=' . urlencode($q) . '&compact=y';
if (($json = c_ws_plugin__s2member_utils_urls::remote($endpoint)) && is_object($json = json_decode($json)) && isset($json->{$q}->val) && is_float($conversion = (double) $a * (double) $json->{$q}->val)) {
return number_format($conversion, 2, '.', '');
}
}
return '';
// Default return value.
}
示例3: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|str $a The amount, in ``$from``.
* @param str $from A 3 character Currency Code.
* @param str $to A 3 character Currency Code.
* @return float|str|bool A numeric amount in ``$to``,
* after having been converted. Else false.
*
* @see http://www.techmug.com/ajax-currency-converter-with-google-api/
*/
public static function convert($a = FALSE, $from = FALSE, $to = FALSE)
{
if (is_numeric($a) && strlen($from = strtoupper($from)) === 3 && strlen($to = strtoupper($to)) === 3) {
$q = number_format($a, 2, ".", "") . $from . "=?" . $to;
$api = "http://www.google.com/ig/calculator?hl=en&q=" . urlencode($q);
if (($json = preg_replace('/([{,])\\s*([^"]+?)\\s*:/', '$1"$2":', c_ws_plugin__s2member_utils_urls::remote($api))) && is_array($json = json_decode($json, true)) && !empty($json["icc"]) && isset($json["rhs"]) && strlen($json["rhs"])) {
if (is_numeric($c_a = preg_replace("/ .*\$/", "", trim($json["rhs"]))) && $c_a >= 0) {
return number_format($c_a, 2, ".", "");
}
}
}
return false;
// Default return value.
}
示例4: convert
/**
* Currency converter.
*
* Uses the Google currency conversion API.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param int|float|string $a The amount, in ``$from``.
* @param string $from Three character currency code.
* @param string $to Three character currency code.
*
* @return string A numeric amount in ``$to``, after having been converted. Else false.
*/
public static function convert($a = 0, $from = '', $to = '')
{
if (is_numeric($a) && strlen($from) === 3 && strlen($to) === 3) {
$regex = '/\\<span\\s+class\\s*\\=\\s*(?:["\'])?bld(?:["\'])?\\s*\\>(?P<conversion>[0-9.]+)\\s+' . preg_quote($to, '/') . '\\s*\\<\\/span\\>/i';
$endpoint = 'http://www.google.com/finance/converter?a=' . urlencode($a) . '&from=' . urlencode($from) . '&to=' . urlencode($to);
$prefix = 's2m_cur';
// Transient prefix.
$transient = $prefix . md5('s2member_cur_convert_' . $endpoint);
if (!($response = get_transient($transient))) {
$response = c_ws_plugin__s2member_utils_urls::remote($endpoint);
set_transient($transient, $response, DAY_IN_SECONDS / 2);
}
if ($response && preg_match($regex, $response, $m)) {
return number_format((double) $m['conversion'], 2, '.', '');
}
}
return '';
// Default return value.
}
示例5: auto_eot_system
//.........这里部分代码省略.........
delete_user_option($user_id, 's2member_paid_registration_times');
}
delete_user_option($user_id, 's2member_last_status_scan');
delete_user_option($user_id, 's2member_first_payment_txn_id');
delete_user_option($user_id, 's2member_last_payment_time');
delete_user_option($user_id, 's2member_last_auto_eot_time');
delete_user_option($user_id, 's2member_auto_eot_time');
delete_user_option($user_id, 's2member_file_download_access_log');
delete_user_option($user_id, 's2member_authnet_payment_failures');
update_user_option($user_id, 's2member_last_auto_eot_time', $auto_eot_time);
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Demoted by s2Member: ' . date('D M j, Y g:i a T'));
if ($subscr_gateway && $subscr_id) {
// Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Paid Subscr. ID @ time of demotion: ' . $subscr_gateway . ' → ' . $subscr_id);
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls'] && is_array($cv = preg_split('/\\|/', $custom))) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls']) as $url) {
// Handle EOT Notifications.
if (($url = preg_replace('/%%cv([0-9]+)%%/ei', 'urlencode(trim(@$cv[$1]))', $url)) && ($url = preg_replace('/%%eot_del_type%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode('auto-eot-cancellation-expiration-demotion')), $url)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($subscr_id)), $url))) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_recipients'] && is_array($cv = preg_split('/\\|/', $custom))) {
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
c_ws_plugin__s2member_email_configs::email_config_release();
$msg = $sbj = '(s2Member / API Notification Email) - EOT/Deletion';
$msg .= "\n\n";
// Spacing in the message body.
$msg .= 'eot_del_type: %%eot_del_type%%' . "\n";
$msg .= 'subscr_id: %%subscr_id%%' . "\n";
$msg .= 'subscr_baid: %%subscr_baid%%' . "\n";
$msg .= 'subscr_cid: %%subscr_cid%%' . "\n";
$msg .= 'user_first_name: %%user_first_name%%' . "\n";
$msg .= 'user_last_name: %%user_last_name%%' . "\n";
$msg .= 'user_full_name: %%user_full_name%%' . "\n";
$msg .= 'user_email: %%user_email%%' . "\n";
$msg .= 'user_login: %%user_login%%' . "\n";
$msg .= 'user_ip: %%user_ip%%' . "\n";
$msg .= 'user_id: %%user_id%%' . "\n";
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
$msg .= $var . ': %%' . $var . '%%' . "\n";
}
}
示例6: recaptcha_code_validates
/**
* Verifies a reCAPTCHA™ code via Google.
*
* @package s2Member\Utilities
* @since 3.5
*
* @param string $challenge The value of `recaptcha_challenge_field` during form submisson.
* @param string $response The value of `recaptcha_response_field` during form submission.
* @return bool True if ``$response`` is valid, else false.
*/
public static function recaptcha_code_validates($challenge = '', $response = '')
{
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys();
if (self::recaptcha_version() === '2') {
$api_post_vars = array('secret' => $keys['private'], 'response' => $response, 'remoteip' => $_SERVER['REMOTE_ADDR']);
$api_response = c_ws_plugin__s2member_utils_urls::remote('https://www.google.com/recaptcha/api/siteverify', $api_post_vars);
$api_response = json_decode($api_response);
return is_object($api_response) && !empty($api_response->success);
} else {
$api_post_vars = array('privatekey' => $keys['private'], 'challenge' => $challenge, 'response' => $response, 'remoteip' => $_SERVER['REMOTE_ADDR']);
$api_response = c_ws_plugin__s2member_utils_urls::remote('http://www.google.com/recaptcha/api/verify', $api_post_vars);
return preg_match('/^true/i', trim($api_response));
}
}
示例7: shorten
/**
* Shortens a long URL, based on s2Member configuration.
*
* @package s2Member\Utilities
* @since 111002
*
* @param str $url A full/long URL to be shortened.
* @param str $api_sp Optional. A specific URL shortening API to use. Defaults to that which is configured in the s2Member Dashboard. Normally `tiny_url`, by default.
* @param bool $try_backups Defaults to true. If a failure occurs with the first API, we'll try others until we have success.
* @return str|bool The shortened URL on success, else false on failure.
*/
public static function shorten($url = FALSE, $api_sp = FALSE, $try_backups = TRUE)
{
$url = $url && is_string($url) ? $url : false;
$api_sp = $api_sp && is_string($api_sp) ? strtolower($api_sp) : false;
/**/
$default_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_url_shortener"];
$default_custom_str_url_shortener = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["default_custom_str_url_shortener"];
/**/
$apis = array("tiny_url", "goo_gl");
/**/
if ($url && ($api = $api_sp ? $api_sp : $default_url_shortener)) {
if (!$api_sp && ($custom_url = trim(apply_filters("ws_plugin__s2member_url_shorten", false, get_defined_vars()))) && stripos($custom_url, "http") === 0) {
return $shorter_url = $custom_url;
} else {
if (!$api_sp && stripos($default_custom_str_url_shortener, "http") === 0 && ($custom_url = trim(c_ws_plugin__s2member_utils_urls::remote(str_ireplace(array("%%s2_long_url%%", "%%s2_long_url_md5%%"), array(rawurlencode($url), urlencode(md5($url))), $default_custom_str_url_shortener)))) && stripos($custom_url, "http") === 0) {
return $shorter_url = $custom_url;
} else {
if ($api === "tiny_url" && ($tiny_url = trim(c_ws_plugin__s2member_utils_urls::remote("http://tinyurl.com/api-create.php?url=" . rawurlencode($url)))) && stripos($tiny_url, "http") === 0) {
return $shorter_url = $tiny_url;
} else {
if ($api === "goo_gl" && ($goo_gl = json_decode(trim(c_ws_plugin__s2member_utils_urls::remote("https://www.googleapis.com/urlshortener/v1/url" . (($goo_gl_key = apply_filters("ws_plugin__s2member_url_shorten_api_goo_gl_key", false)) ? "?key=" . urlencode($goo_gl_key) : ""), json_encode(array("longUrl" => $url)), array("headers" => array("Content-Type" => "application/json")))), true)) && !empty($goo_gl["id"]) && is_string($goo_gl_url = $goo_gl["id"]) && stripos($goo_gl_url, "http") === 0) {
return $shorter_url = $goo_gl_url;
} else {
if ($try_backups && count($apis) > 1) {
/**/
foreach (array_diff($apis, array($api)) as $backup) {
if ($backup = c_ws_plugin__s2member_utils_urls::shorten($url, $backup, false)) {
return $shorter_url = $backup;
}
}
}
}
}
}
}
}
return false;
}
示例8: stripe_checkout
//.........这里部分代码省略.........
}
if (empty($new__subscr_id)) {
$new__subscr_id = strtoupper('free-' . uniqid());
}
$ipn['txn_type'] = 'subscr_signup';
$ipn['subscr_cid'] = $new__subscr_cid;
$ipn['subscr_id'] = $new__subscr_id;
$ipn['custom'] = $post_vars['attr']['custom'];
$ipn['txn_cid'] = !empty($new__txn_cid) ? $new__txn_cid : $new__subscr_cid;
$ipn['txn_id'] = !empty($new__txn_id) ? $new__txn_id : $new__subscr_id;
$ipn['period1'] = $period1;
$ipn['period3'] = $period3;
$ipn['mc_amount1'] = $cost_calculations['trial_total'];
$ipn['mc_amount3'] = $cost_calculations['total'];
$ipn['mc_gross'] = preg_match('/^[1-9]/', $ipn['period1']) ? $ipn['mc_amount1'] : $ipn['mc_amount3'];
$ipn['mc_currency'] = $cost_calculations['cur'];
$ipn['tax'] = $cost_calculations['tax'];
$ipn['recurring'] = $post_vars['attr']['rr'] ? '1' : '';
$ipn['payer_email'] = $user->user_email;
$ipn['first_name'] = $post_vars['first_name'];
$ipn['last_name'] = $post_vars['last_name'];
$ipn['option_name1'] = 'Referencing Customer ID';
$ipn['option_selection1'] = $old__subscr_or_wp_id;
$ipn['option_name2'] = 'Customer IP Address';
$ipn['option_selection2'] = $_SERVER['REMOTE_ADDR'];
$ipn['item_name'] = $cost_calculations['desc'];
$ipn['item_number'] = $post_vars['attr']['level_ccaps_eotper'];
$ipn['s2member_paypal_proxy'] = 'stripe';
$ipn['s2member_paypal_proxy_use'] = 'pro-emails';
$ipn['s2member_paypal_proxy_use'] .= $ipn['mc_gross'] > 0 ? ',subscr-signup-as-subscr-payment' : '';
$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_stripe_proxy_return_url'] = trim(c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20)));
if (!empty($stripe_subscription_failed_charge_succeeded)) {
update_user_option($user_id, 's2member_auto_eot_time', $start_time);
}
if ($old__subscr_cid && $old__subscr_id && apply_filters('s2member_pro_cancels_old_rp_before_new_rp', TRUE, get_defined_vars())) {
c_ws_plugin__s2member_pro_stripe_utilities::cancel_customer_subscription($old__subscr_cid, $old__subscr_id, FALSE);
}
c_ws_plugin__s2member_list_servers::process_list_servers_against_current_user((bool) @$post_vars['custom_fields']['opt_in'], TRUE, TRUE);
setcookie('s2member_tracking', $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($new__subscr_id), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie('s2member_tracking', $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE['s2member_tracking'] = $s2member_tracking);
$global_response = array('response' => sprintf(_x('<strong>Thank you.</strong> Your account has been updated :-)', 's2member-front', 's2member'), esc_attr(wp_login_url())));
if ($post_vars['attr']['success'] && substr($ipn['s2member_stripe_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_stripe_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 {
if ($use_subscription && !is_user_logged_in()) {
$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'];
$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(0, $post_vars['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 {
示例9: sp_checkout
//.........这里部分代码省略.........
$paypal["PAYMENTREQUEST_0_TAXAMT"] = $cost_calculations["tax"];
$paypal["PAYMENTREQUEST_0_AMT"] = $cost_calculations["total"];
$paypal["L_PAYMENTREQUEST_0_QTY0"] = "1";
// Always (1).
$paypal["L_PAYMENTREQUEST_0_NAME0"] = $cost_calculations["desc"];
$paypal["L_PAYMENTREQUEST_0_NUMBER0"] = $post_vars["attr"]["sp_ids_exp"];
$paypal["L_PAYMENTREQUEST_0_AMT0"] = $cost_calculations["sub_total"];
} else {
$paypal["METHOD"] = "DoDirectPayment";
$paypal["PAYMENTACTION"] = "Sale";
$paypal["EMAIL"] = $post_vars["email"];
$paypal["FIRSTNAME"] = $post_vars["first_name"];
$paypal["LASTNAME"] = $post_vars["last_name"];
$paypal["IPADDRESS"] = $_SERVER["REMOTE_ADDR"];
$paypal["DESC"] = $cost_calculations["desc"];
$paypal["CUSTOM"] = $post_vars["attr"]["custom"];
$paypal["INVNUM"] = $post_vars["attr"]["invoice"];
$paypal["CURRENCYCODE"] = $cost_calculations["cur"];
$paypal["ITEMAMT"] = $cost_calculations["sub_total"];
$paypal["TAXAMT"] = $cost_calculations["tax"];
$paypal["AMT"] = $cost_calculations["total"];
$paypal["L_QTY0"] = "1";
// Always (1).
$paypal["L_NAME0"] = $cost_calculations["desc"];
$paypal["L_NUMBER0"] = $post_vars["attr"]["sp_ids_exp"];
$paypal["L_AMT0"] = $cost_calculations["sub_total"];
$paypal["CREDITCARDTYPE"] = $post_vars["card_type"];
$paypal["ACCT"] = preg_replace("/[^0-9]/", "", $post_vars["card_number"]);
$paypal["EXPDATE"] = preg_replace("/[^0-9]/", "", $post_vars["card_expiration"]);
$paypal["CVV2"] = $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"])) {
$paypal["STARTDATE"] = preg_replace("/[^0-9]/", "", $post_vars["card_start_date_issue_number"]);
} else {
// Otherwise, we assume they provided an Issue Number instead.
$paypal["ISSUENUMBER"] = $post_vars["card_start_date_issue_number"];
}
}
$paypal["STREET"] = $post_vars["street"];
$paypal["CITY"] = $post_vars["city"];
$paypal["STATE"] = $post_vars["state"];
$paypal["COUNTRYCODE"] = $post_vars["country"];
$paypal["ZIP"] = $post_vars["zip"];
}
}
if ($cost_calculations["total"] <= 0 || ($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response($paypal)) && empty($paypal["__error"])) {
if ($cost_calculations["total"] <= 0) {
$new__txn_id = strtoupper('free-' . uniqid());
} else {
$new__txn_id = !empty($paypal["PAYMENTINFO_0_TRANSACTIONID"]) ? $paypal["PAYMENTINFO_0_TRANSACTIONID"] : false;
$new__txn_id = !$new__txn_id && !empty($paypal["TRANSACTIONID"]) ? $paypal["TRANSACTIONID"] : $new__txn_id;
}
if (!($ipn = array())) {
$ipn["txn_type"] = "web_accept";
$ipn["txn_id"] = $new__txn_id;
$ipn["custom"] = $post_vars["attr"]["custom"];
$ipn["invoice"] = $post_vars["attr"]["invoice"];
$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"] = "paypal";
$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_paypal_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 />— 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_paypal_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_paypal_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 {
$global_response = array("response" => _x('<strong>Oops.</strong> Unable to generate Access Link. Please contact Support for assistance.', "s2member-front", "s2member"), "error" => true);
}
} else {
$global_response = array("response" => $paypal["__error"], "error" => true);
}
}
} else {
$global_response = $error;
}
}
}
}
示例10: 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 />— 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 {
//.........这里部分代码省略.........
示例11: authnet_arb_service
/**
* Connect to and process ARB service information for Authorize.Net®.
*
* 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_arb_service_ipns_per_process");``.
*
* @package s2Member\AuthNet
* @since 1.5
*
* @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 authnet_arb_service($vars = FALSE)
{
global $wpdb;
/* Need global DB obj. */
global $current_site, $current_blog;
/* For Multisite support. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_authnet_api_login_id"]) {
$scan_time = apply_filters("ws_plugin__s2member_pro_arb_service_status_scan_time", strtotime("-1 day"), get_defined_vars());
$per_process = apply_filters("ws_plugin__s2member_pro_arb_service_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` = 'authnet' 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($authnet, $subscr_id, $ipn_sv, $processing, $processed, $ipn, $ipn_q, $log4, $_log4, $log2, $logs_dir);
/* Unset these. */
/**/
if (($authnet = array("x_method" => "status")) && ($authnet["x_subscription_id"] = $subscr_id = get_user_option("s2member_subscr_id", $user_id))) {
if (!get_user_option("s2member_auto_eot_time", $user_id) && is_array($ipn_sv = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(false, $subscr_id))) {
if (($authnet = c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response($authnet)) && empty($authnet["__error"]) && $authnet["subscription_status"] && is_array($authnet["arb_ipn_signup_vars"] = $ipn_sv)) {
if (preg_match("/^expired\$/i", $authnet["subscription_status"])) {
$authnet["s2member_log"][] = "Authorize.Net® ARB/IPN processed on: " . date("D M j, Y g:i:s a T");
/**/
$authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `SUBSCRIPTION EXPIRATION` ).";
$authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal® processor as `txn_type` ( `subscr_eot` ).";
$authnet["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"] = $authnet["arb_ipn_signup_vars"]["subscr_id"];
/**/
$ipn["custom"] = $authnet["arb_ipn_signup_vars"]["custom"];
/**/
$ipn["period1"] = $authnet["arb_ipn_signup_vars"]["period1"];
$ipn["period3"] = $authnet["arb_ipn_signup_vars"]["period3"];
/**/
$ipn["payer_email"] = $authnet["arb_ipn_signup_vars"]["payer_email"];
$ipn["first_name"] = $authnet["arb_ipn_signup_vars"]["first_name"];
$ipn["last_name"] = $authnet["arb_ipn_signup_vars"]["last_name"];
/**/
$ipn["option_name1"] = $authnet["arb_ipn_signup_vars"]["option_name1"];
$ipn["option_selection1"] = $authnet["arb_ipn_signup_vars"]["option_selection1"];
/**/
$ipn["option_name2"] = $authnet["arb_ipn_signup_vars"]["option_name2"];
$ipn["option_selection2"] = $authnet["arb_ipn_signup_vars"]["option_selection2"];
/**/
$ipn["item_number"] = $authnet["arb_ipn_signup_vars"]["item_number"];
$ipn["item_name"] = $authnet["arb_ipn_signup_vars"]["item_name"];
/**/
$ipn_q = "&s2member_paypal_proxy=authnet&s2member_paypal_proxy_use=pro-emails";
$ipn_q .= "&s2member_paypal_proxy_verification=" . urlencode(c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen());
/**/
c_ws_plugin__s2member_utils_urls::remote(site_url("/?s2member_paypal_notify=1" . $ipn_q), $ipn, array("timeout" => 20));
} else {
if (preg_match("/^(suspended|canceled|terminated)\$/i", $authnet["subscription_status"])) {
$authnet["s2member_log"][] = "Authorize.Net® ARB/IPN processed on: " . date("D M j, Y g:i:s a T");
/**/
$authnet["s2member_log"][] = "Authorize.Net® transaction identified as ( `SUBSCRIPTION " . strtoupper($authnet["subscription_status"]) . "` ).";
$authnet["s2member_log"][] = "IPN reformulated. Piping through s2Member's core/standard PayPal® processor as `txn_type` ( `subscr_cancel` ).";
$authnet["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"] = $authnet["arb_ipn_signup_vars"]["subscr_id"];
/**/
$ipn["custom"] = $authnet["arb_ipn_signup_vars"]["custom"];
/**/
$ipn["period1"] = $authnet["arb_ipn_signup_vars"]["period1"];
$ipn["period3"] = $authnet["arb_ipn_signup_vars"]["period3"];
/**/
$ipn["payer_email"] = $authnet["arb_ipn_signup_vars"]["payer_email"];
$ipn["first_name"] = $authnet["arb_ipn_signup_vars"]["first_name"];
$ipn["last_name"] = $authnet["arb_ipn_signup_vars"]["last_name"];
/**/
$ipn["option_name1"] = $authnet["arb_ipn_signup_vars"]["option_name1"];
$ipn["option_selection1"] = $authnet["arb_ipn_signup_vars"]["option_selection1"];
/**/
//.........这里部分代码省略.........
示例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: cp
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
$paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
}
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url) {
if (($url = preg_replace("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["subscr_id"])), $url))) {
if (($url = preg_replace("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["mc_gross"])), $url)) && ($url = preg_replace("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["txn_id"])), $url))) {
if (($url = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_number"])), $url)) && ($url = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["item_name"])), $url))) {
if (($url = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["first_name"])), $url)) && ($url = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["last_name"])), $url))) {
if ($url = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($paypal["first_name"] . " " . $paypal["last_name"]))), $url)) {
if ($url = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($paypal["payer_email"])), $url)) {
if (($url = preg_replace("/%%full_coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["full_coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_code%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["coupon_code"])), $url)) && ($url = preg_replace("/%%coupon_affiliate_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($coupon["affiliate_id"])), $url))) {
if (($url = preg_replace("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->first_name)), $url)) && ($url = preg_replace("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->last_name)), $url))) {
if ($url = preg_replace("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode(trim($user->first_name . " " . $user->last_name))), $url)) {
if ($url = preg_replace("/%%user_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_email)), $url)) {
if ($url = preg_replace("/%%user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user->user_login)), $url)) {
if ($url = preg_replace("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
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(preg_replace("/%%(.+?)%%/i", "", $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
}
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
$msg .= "\n\n";
// Spacing in the message body.
$msg .= "subscr_id: %%subscr_id%%\n";
$msg .= "amount: %%amount%%\n";
$msg .= "txn_id: %%txn_id%%\n";
$msg .= "item_number: %%item_number%%\n";
$msg .= "item_name: %%item_name%%\n";
$msg .= "first_name: %%first_name%%\n";
$msg .= "last_name: %%last_name%%\n";
$msg .= "full_name: %%full_name%%\n";
$msg .= "payer_email: %%payer_email%%\n";
$msg .= "full_coupon_code: %%full_coupon_code%%\n";
$msg .= "coupon_code: %%coupon_code%%\n";
示例14: 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"]) . "¬ify_id=" . urlencode($postvars["notify_id"]), "", array("timeout" => 20))))) {
return $postvars;
} else {
// Nope.
return false;
}
} else {
// Nope.
return false;
}
}
示例15: cp
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls']) {
foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_urls']) as $url) {
if (($url = c_ws_plugin__s2member_utils_strings::fill_cvs($url, $paypal['custom'], true)) && ($url = preg_replace('/%%subscr_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_id'])), $url))) {
if (($url = preg_replace('/%%subscr_baid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_baid'])), $url)) && ($url = preg_replace('/%%subscr_cid%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['subscr_cid'])), $url))) {
if (($url = preg_replace('/%%currency%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency'])), $url)) && ($url = preg_replace('/%%currency_symbol%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['currency_symbol'])), $url))) {
if (($url = preg_replace('/%%initial%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial'])), $url)) && ($url = preg_replace('/%%regular%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular'])), $url)) && ($url = preg_replace('/%%recurring%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['recurring'])), $url))) {
if (($url = preg_replace('/%%initial_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['initial_term'])), $url)) && ($url = preg_replace('/%%regular_term%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['regular_term'])), $url))) {
if (($url = preg_replace('/%%item_number%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_number'])), $url)) && ($url = preg_replace('/%%item_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['item_name'])), $url))) {
if (($url = preg_replace('/%%first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['first_name'])), $url)) && ($url = preg_replace('/%%last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['last_name'])), $url))) {
if ($url = preg_replace('/%%full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($paypal['first_name'] . ' ' . $paypal['last_name']))), $url)) {
if ($url = preg_replace('/%%payer_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($paypal['payer_email'])), $url)) {
if (($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->first_name)), $url)) && ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->last_name)), $url))) {
if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(trim($user->first_name . ' ' . $user->last_name))), $url)) {
if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_email)), $url)) {
if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user->user_login)), $url)) {
if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_reg_ip)), $url)) {
if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url)) {
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $var => $val) {
if (!($url = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode(maybe_serialize($val))), $url))) {
break;
}
}
}
if ($url = trim(preg_replace('/%%(.+?)%%/i', '', $url))) {
c_ws_plugin__s2member_utils_urls::remote($url);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$paypal['s2member_log'][] = 'Modification Notification URLs have been processed.';
}
if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['modification_notification_recipients']) {
$msg = $sbj = '(s2Member / API Notification Email) - Modification';
$msg .= "\n\n";
// Spacing in the message body.
$msg .= 'subscr_id: %%subscr_id%%' . "\n";
$msg .= 'subscr_baid: %%subscr_baid%%' . "\n";
$msg .= 'subscr_cid: %%subscr_cid%%' . "\n";
$msg .= 'currency: %%currency%%' . "\n";
$msg .= 'currency_symbol: %%currency_symbol%%' . "\n";
$msg .= 'initial: %%initial%%' . "\n";
$msg .= 'regular: %%regular%%' . "\n";
$msg .= 'recurring: %%recurring%%' . "\n";
$msg .= 'initial_term: %%initial_term%%' . "\n";