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


PHP c_ws_plugin__s2member_utils_logs::log_entry方法代码示例

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


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

示例1: unsubscribe

 /**
  * Unsubscribe.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return bool True if successful.
  */
 public static function unsubscribe($args)
 {
     if (!($args = self::validate_args($args))) {
         return FALSE;
     }
     // Invalid args.
     if (!$args->opt_out) {
         // Double check.
         return FALSE;
     }
     // Must say explicitly.
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['mailchimp_api_key']) {
         return FALSE;
     }
     // Not possible.
     if (empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_mailchimp_list_ids'])) {
         return FALSE;
     }
     // No list configured at this level.
     if (!($mc_api = self::mc_api())) {
         return FALSE;
     }
     // Unable to acquire API instance.
     $mc_level_list_ids = $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_mailchimp_list_ids'];
     extract((array) $args);
     // Extract the arguments for back compat. w/ filters that relied upon them.
     foreach (preg_split('/[' . "\r\n\t" . ';,]+/', $mc_level_list_ids, NULL, PREG_SPLIT_NO_EMPTY) as $_mc_list) {
         $_mc = array('args' => $args, 'function' => __FUNCTION__, 'list' => trim($_mc_list), 'list_id' => trim($_mc_list), 'api_method' => 'listUnsubscribe', 'api_properties' => $mc_api);
         if (!$_mc['list'] || !$_mc['list_id']) {
             continue;
         }
         // List missing.
         if (strpos($_mc['list'], '::') !== FALSE) {
             list($_mc['list_id'], $_mc['interest_groups_title'], $_mc['interest_groups']) = preg_split('/\\:\\:/', $_mc['list'], 3);
             if ($_mc['interest_groups_title'] = trim($_mc['interest_groups_title'])) {
                 if ($_mc['interest_groups'] = $_mc['interest_groups'] ? preg_split('/\\|/', trim($_mc['interest_groups']), NULL, PREG_SPLIT_NO_EMPTY) : array()) {
                     $_mc['interest_groups'] = array('GROUPINGS' => array(array('name' => $_mc['interest_groups_title'], 'groups' => $_mc['interest_groups'])));
                 }
             }
             if (!$_mc['list_id']) {
                 continue;
             }
             // List ID is missing now; after parsing interest groups.
         }
         try {
             if (($_mc['api_response'] = $mc_api->lists->unsubscribe($_mc['list_id'], array('email' => $args->email), $_mc['api_delete_member'] = apply_filters('ws_plugin__s2member_mailchimp_removal_delete_member', FALSE, get_defined_vars()), $_mc['api_send_goodbye'] = apply_filters('ws_plugin__s2member_mailchimp_removal_send_goodbye', FALSE, get_defined_vars()), $_mc['api_send_notify'] = apply_filters('ws_plugin__s2member_mailchimp_removal_send_notify', FALSE, get_defined_vars()))) && !empty($_mc['api_response']['complete'])) {
                 $_mc['api_success'] = $success = TRUE;
             }
         } catch (Exception $exception) {
             $_mc['exception'] = $exception;
         }
         c_ws_plugin__s2member_utils_logs::log_entry('mailchimp-api', $_mc);
     }
     unset($_mc_list, $_mc);
     // Just a little housekeeping.
     return !empty($success);
     // If one suceeds.
 }
开发者ID:codeforest,项目名称:s2member,代码行数:68,代码来源:mailchimp.inc.php

示例2: unsubscribe

 /**
  * Unsubscribe.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return bool True if successful.
  */
 public static function unsubscribe($args)
 {
     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_api_type'] === 'email') {
         return c_ws_plugin__s2member_aweber_e::unsubscribe($args);
     }
     if (!($args = self::validate_args($args))) {
         return FALSE;
     }
     // Invalid args.
     if (!$args->opt_out) {
         // Double check.
         return FALSE;
     }
     // Must say explicitly.
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_api_key']) {
         return FALSE;
     }
     // Not possible.
     if (empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'])) {
         return FALSE;
     }
     // No list configured at this level.
     if (!($aw_api = self::aw_api()) || !@$aw_api->___account->id) {
         return FALSE;
     }
     // Unable to acquire API instance.
     $aw_level_list_ids = $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'];
     foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', $aw_level_list_ids, NULL, PREG_SPLIT_NO_EMPTY) as $_aw_list) {
         $_aw = array('args' => $args, 'function' => __FUNCTION__, 'list' => trim($_aw_list), 'list_id' => trim($_aw_list), 'api_method' => 'listUnsubscribe');
         if (!$_aw['list'] || !$_aw['list_id']) {
             continue;
         }
         // List missing.
         try {
             if (self::count($_aw['foundLists'] = $aw_api->___account->lists->find(array('name' => $_aw['list_id'])))) {
                 if ($_aw['listUrl'] = '/accounts/' . $aw_api->___account->id . '/lists/' . $_aw['foundLists'][0]->id) {
                     if ($_aw['list'] = $aw_api->___account->loadFromUrl($_aw['listUrl'])) {
                         $_aw['findSubscriber'] = array('email' => $args->email, 'status' => 'subscribed');
                         if (self::count($_aw['foundSubscribers'] = $_aw['list']->subscribers->find($_aw['findSubscriber']))) {
                             /** @var AWeberEntry $_existing_subscriber */
                             $_existing_subscriber = $_aw['foundSubscribers'][0];
                             $_existing_subscriber->status = 'unsubscribed';
                             // Unsubscribe.
                             if ($_existing_subscriber->save() && ($_aw['subscriber'] = $_existing_subscriber)) {
                                 $_aw['api_success'] = $success = TRUE;
                             }
                             // Flag this as `TRUE`; assists with return value below.
                             unset($_existing_subscriber);
                             // Housekeeping.
                         }
                     }
                 }
             }
         } catch (Exception $exception) {
             $_aw['exception'] = $exception;
         }
         c_ws_plugin__s2member_utils_logs::log_entry('aweber-api', $_aw);
     }
     unset($_aw_list, $_aw);
     // Just a little housekeeping.
     return !empty($success);
     // If one suceeds.
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:73,代码来源:aweber.inc.php

示例3: 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 (!empty($GLOBALS['ws_plugin__s2member_registration_return_url']) && ($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_refs(urlencode($role)), $url)) {
                                                 if ($url = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($level)), $url)) {
                                                     if ($url = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ccaps)), $url)) {
                                                         if ($url = preg_replace('/%%auto_eot_time%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($auto_eot_time)), $url)) {
                                                             if ($url = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($fname)), $url)) {
                                                                 if ($url = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($lname)), $url)) {
                                                                     if ($url = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($name)), $url)) {
                                                                         if ($url = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($email)), $url)) {
                                                                             if ($url = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($login)), $url)) {
                                                                                 if ($url = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($pass)), $url)) {
                                                                                     if ($url = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($ip)), $url)) {
                                                                                         if ($url = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(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_refs(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.
                                     $reg_vars['_COOKIE'] = $_COOKIE;
                                     // Record cookies also.
                                     // No need to include these in the logs. Unset before log entry.
                                     unset($reg_vars['wpdb'], $reg_vars['current_site'], $reg_vars['current_blog']);
                                     c_ws_plugin__s2member_utils_logs::log_entry('reg-handler', $reg_vars);
                                     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);
     // Housekeeping.
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:registrations.inc.php

示例4: 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 {
             if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET' && !empty($_SERVER['HTTP_USER_AGENT'])) {
                 if (preg_match('/(msie|trident|gecko|webkit|presto|konqueror|playstation)[\\/ ]([0-9\\.]+)/i', $_SERVER['HTTP_USER_AGENT'])) {
                     $paypal['s2member_indicator'] = 'This PayPal IPN Handler by s2Member® is active & listening.';
                 }
             }
             $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'])));
         }
         /*
         Log this IPN post-processing event now.
         */
         c_ws_plugin__s2member_utils_logs::log_entry('gateway-core-ipn', $paypal);
         /*
         Hook during core IPN post-processing might be useful for developers.
         */
         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);
         /*
         Output response headers & content body.
         */
         status_header(200);
         // OK status code.
         header('Content-Type: text/plain; charset=UTF-8');
         while (@ob_end_clean()) {
         }
         // Clean output buffers.
         if (!empty($paypal['s2member_paypal_proxy_return_url'])) {
             exit($paypal['s2member_paypal_proxy_return_url']);
         } elseif (!empty($paypal['s2member_indicator'])) {
             exit($paypal['s2member_indicator']);
         } else {
             exit;
             // Default behavior.
         }
     }
     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);
 }
开发者ID:pab44,项目名称:pab44,代码行数:101,代码来源:paypal-notify-in.inc.php

示例5: unsubscribe

 /**
  * Unsubscribe.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return bool True if successful.
  */
 public static function unsubscribe($args)
 {
     if (!($args = self::validate_args($args))) {
         return FALSE;
     }
     // Invalid args.
     if (!$args->opt_out) {
         // Double check.
         return FALSE;
     }
     // Must say explicitly.
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key']) {
         return FALSE;
     }
     // Not possible.
     if (empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_getresponse_list_ids'])) {
         return FALSE;
     }
     // No list configured at this level.
     $gr_level_list_ids = $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_getresponse_list_ids'];
     extract((array) $args);
     // Extract the arguments for back compat. w/ filters that relied upon them.
     foreach (preg_split('/[' . "\r\n\t" . ';,]+/', $gr_level_list_ids, NULL, PREG_SPLIT_NO_EMPTY) as $_gr_list) {
         $_gr = array('args' => $args, 'function' => __FUNCTION__, 'list' => trim($_gr_list), 'list_id' => trim($_gr_list), 'api_method' => 'delete_contact');
         if (!$_gr['list'] || !$_gr['list_id']) {
             continue;
         }
         // List missing.
         $_gr['api_method'] = 'get_contacts';
         // Check if exists.
         $_gr['api_headers'] = array('Content-Type' => 'application/json');
         $_gr['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('campaigns' => array($_gr['list_id']), 'email' => array('EQUALS' => $args->email)));
         $_gr['api_request'] = json_encode(array('method' => $_gr['api_method'], 'params' => $_gr['api_params'], 'id' => uniqid('', TRUE)));
         if (is_object($_gr['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $_gr['api_request'], array('headers' => $_gr['api_headers'])))) && empty($_gr['api_response']->error) && ($_gr['api_response_contact_ids'] = array_keys((array) $_gr['api_response']->result)) && ($_gr['api_response_contact_id'] = $_gr['api_response_contact_ids'][0])) {
             $_gr['api_method'] = 'delete_contact';
             // Delete.
             $_gr['api_headers'] = array('Content-Type' => 'application/json');
             $_gr['api_params'] = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['getresponse_api_key'], array('contact' => $_gr['api_response_contact_id']));
             $_gr['api_request'] = json_encode(array('method' => $_gr['api_method'], 'params' => $_gr['api_params'], 'id' => uniqid('', TRUE)));
             if (is_object($_gr['api_response'] = json_decode(c_ws_plugin__s2member_utils_urls::remote('https://api2.getresponse.com', $_gr['api_request'], array('headers' => $_gr['api_headers'])))) && empty($_gr['api_response']->error) && $_gr['api_response']->result->deleted) {
                 $_gr['api_success'] = $success = TRUE;
             }
             // Flag this as `TRUE`; assists with return value below.
         }
         c_ws_plugin__s2member_utils_logs::log_entry('getresponse-api', $_gr);
     }
     unset($_gr_list, $_gr);
     // Just a little housekeeping.
     return !empty($success);
     // If one suceeds.
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:61,代码来源:getresponse.inc.php

示例6: unsubscribe

 /**
  * Unsubscribe.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return bool True if successful.
  */
 public static function unsubscribe($args)
 {
     if (!($args = self::validate_args($args))) {
         return FALSE;
     }
     // Invalid args.
     if (!$args->opt_out) {
         // Double check.
         return FALSE;
     }
     // Must say explicitly.
     if (empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'])) {
         return FALSE;
     }
     // No list configured at this level.
     $aw_level_list_ids = $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'];
     $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
     if (!$email_configs_were_on) {
         c_ws_plugin__s2member_email_configs::email_config();
     }
     // MUST be ON for removal requests.
     // `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
     foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', $aw_level_list_ids, NULL, PREG_SPLIT_NO_EMPTY) as $_aw_list) {
         $_aw = array('args' => $args, 'function' => __FUNCTION__, 'list' => trim($_aw_list), 'list_id' => trim($_aw_list), 'api_method' => 'listUnsubscribe');
         if (!$_aw['list']) {
             continue;
         }
         // List missing.
         $_aw['removal_bcc'] = apply_filters('ws_plugin__s2member_aweber_removal_bcc', FALSE, get_defined_vars());
         if ($_aw['wp_mail_response'] = wp_mail($_aw['list_id'] . '@aweber.com', $_aw['wp_mail_sbj'] = apply_filters('ws_plugin__s2member_aweber_removal_sbj', 'REMOVE#' . $args->email . '#s2Member#' . $_aw['list_id'], get_defined_vars()), $_aw['wp_mail_msg'] = 'REMOVE', $_aw['wp_mail_headers'] = 'From: "' . preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '" <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>' . ($_aw['removal_bcc'] ? "\r\n" . 'Bcc: ' . $_aw['removal_bcc'] : '') . "\r\n" . 'Content-Type: text/plain; charset=UTF-8')) {
             $_aw['wp_mail_success'] = $success = TRUE;
         }
         // Flag this as `TRUE`; assists with return value below.
         c_ws_plugin__s2member_utils_logs::log_entry('aweber-api', $_aw);
     }
     unset($_aw_list, $_aw);
     // Just a little housekeeping.
     if (!$email_configs_were_on) {
         // Turn them off now?
         c_ws_plugin__s2member_email_configs::email_config_release();
     }
     return !empty($success);
     // If one suceeds.
 }
开发者ID:codeforest,项目名称:s2member,代码行数:54,代码来源:aweber-e.inc.php

示例7: paypal_return


//.........这里部分代码省略.........
                             } else {
                                 if ($_paypal_cp = c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level::cp(get_defined_vars())) {
                                     $paypal = $_paypal_cp;
                                 } else {
                                     if ($_paypal_cp = c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level::cp(get_defined_vars())) {
                                         $paypal = $_paypal_cp;
                                     } else {
                                         $paypal["s2member_log"][] = "Unexpected `txn_type/status`. The `txn_type/status` did not match a required action.";
                                         $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after displaying an error message).";
                                         echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>ERROR:</strong> Unexpected <code>txn_type/status</code>.<br />The <code>txn_type/status</code> did not meet requirements.<br />Please contact Support for assistance.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                                     }
                                 }
                             }
                         }
                     } else {
                         unset($__refs, $__v);
                     }
                     // Else a custom conditional has been applied by filters.
                 } else {
                     if ($paypal["custom"] && ($paypal["custom"] === "www." . $_SERVER["HTTP_HOST"] || "www." . $paypal["custom"] === $_SERVER["HTTP_HOST"])) {
                         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice("<strong>s2Member:</strong> Post-processing failed on at least one transaction. It appears that you have a PayPal Button configured with a <code>custom=\"\"</code> Shortcode Attribute that does NOT match up with your installation domain name. If your site uses the <code>www.</code> prefix, please include that. If it does not, please exclude the <code>www.</code> prefix. You should have <code>custom=\"" . preg_replace("/\\:([0-9]+)\$/", "", $_SERVER["HTTP_HOST"]) . "\"</code>", "*:*", true);
                     }
                     $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.';
                     $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after displaying an error message).";
                     echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>ERROR:</strong> Unable to verify <code>$_SERVER["HTTP_HOST"]</code>.<br />Please contact Support for assistance.<br /><br />If you are the site owner, please check the <code>custom</code> value in your Button Code. It MUST start with your domain name.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                 }
             } else {
                 // In this case ... a Proxy has explicitly requested `ty-email` processing.
                 $paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_ty_email::cp(get_defined_vars());
             }
         } else {
             if (!empty($_GET["s2member_paypal_proxy"]) && !empty($_GET["s2member_paypal_proxy_use"]) && preg_match("/x-preview/", $_GET["s2member_paypal_proxy_use"]) && ($paypal["subscr_gateway"] = esc_html(trim(stripslashes($_GET["s2member_paypal_proxy"]))))) {
                 $paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_x_preview::cp(get_defined_vars());
             } else {
                 if (empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"]) && ($paypal["subscr_gateway"] = "paypal")) {
                     $paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_no_tx_data::cp(get_defined_vars());
                 } else {
                     if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]) {
                         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice("<strong>s2Member:</strong> You have no PayPal PDT Identity Token configured. PayPal Auto-Return handling failed. Please update your PayPal PDT Identity Key. See: <strong>s2Member → PayPal Options → PayPal PDT/Auto-Return Integration</strong>. Thank you!", "*:*", true);
                     }
                     $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 make sure that you configure a PayPal PDT Identity Token for your installation of s2Member. See: `s2Member → PayPal Options → PayPal PDT/Auto-Return Integration`.";
                     $paypal["s2member_log"][] = "See also, 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);
                     $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after displaying an error message).";
                     echo c_ws_plugin__s2member_return_templates::return_template("default", _x('<strong>ERROR:</strong> Unable to verify <code>$_POST</code> vars.<br />Please contact Support for assistance.<br /><br />This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility. If you are the site owner, and you\'re absolutely SURE that your configuration is valid, you may want to run some tests on your server, just to be sure <code>$_POST</code> variables are populated, and that your server is able to connect/communicate with your Payment Gateway over an HTTPS connection.<br /><br />s2Member uses the <code>WP_Http</code> class for remote connections; which will try to use <code>cURL</code> first, and then fall back on the <code>FOPEN</code> method when <code>cURL</code> is not available. On a Windows server, you may have to disable your <code>cURL</code> extension; and instead, set <code>allow_url_fopen = yes</code> in your php.ini file. The <code>cURL</code> extension (usually) does NOT support SSL connections on a Windows server.<br /><br />Please see <a href="http://www.s2member.com/forums/topic/ideal-server-configuration-for-s2member/" target="_blank">this thread</a> for details regarding the ideal server configuration for s2Member.', "s2member-front", "s2member"), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
                 }
             }
         }
         /*
         Add RTN proxy (when available) to the ``$paypal`` array.
         */
         if (!empty($_GET["s2member_paypal_proxy"])) {
             $paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string) $_GET["s2member_paypal_proxy"])));
         }
         /*
         Add IPN proxy use vars (when available) to the ``$paypal`` array.
         */
         if (!empty($_GET["s2member_paypal_proxy_use"])) {
             $paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string) $_GET["s2member_paypal_proxy_use"])));
         }
         /*
         Also add RTN proxy self-verification (when available) to the ``$paypal`` array.
         */
         if (!empty($_GET["s2member_paypal_proxy_verification"])) {
             $paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string) $_GET["s2member_paypal_proxy_verification"])));
         }
         /*
         Also add RTN success redirection URL (when available) to the ``$paypal`` array.
         */
         if (!empty($_GET["s2member_paypal_return_success"])) {
             $paypal["s2member_paypal_return_success"] = esc_html(trim(stripslashes((string) $_GET["s2member_paypal_return_success"])));
         }
         /*
         Also add RTN t and r Attributes (when available) to the ``$paypal`` array.
         */
         if (!empty($_GET["s2member_paypal_return_tra"])) {
             $paypal["s2member_paypal_return_tra"] = esc_html(trim(stripslashes((string) $_GET["s2member_paypal_return_tra"])));
         }
         /*
         Log this IPN post-processing event now.
         */
         c_ws_plugin__s2member_utils_logs::log_entry('gateway-core-rtn', $paypal);
         /*
         Hook during core RTN post-processing might be useful for developers.
         */
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_return", get_defined_vars());
         unset($__refs, $__v);
         exit;
         // Clean exit now.
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_after_paypal_return", get_defined_vars());
     unset($__refs, $__v);
 }
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:paypal-return-in.inc.php

示例8: remind


//.........这里部分代码省略.........
            self::$now = time();
            // Current UTC timestamp.
            self::$recipients = json_decode($options['pro_eot_reminder_email_recipients']);
            self::$subject = json_decode($options['pro_eot_reminder_email_subject']);
            self::$message = json_decode($options['pro_eot_reminder_email_message']);
            if (!is_object(self::$recipients) || !is_object(self::$subject) || !is_object(self::$message)) {
                return;
                // Not possible. Possible corruption in the DB.
            }
            if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name'] || !$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email']) {
                return;
                // Not possible. Email configuration is incomplete.
            }
            $days = preg_split('/[;,\\s]+/', trim($options['pro_eot_reminder_email_days']), -1, PREG_SPLIT_NO_EMPTY);
            $scan_time = apply_filters('ws_plugin__s2member_pro_eot_reminders_scan_time', strtotime('-1 day', self::$now), get_defined_vars());
            $per_process = apply_filters('ws_plugin__s2member_pro_eot_reminders_per_process', $vars['per_process'], get_defined_vars());
            $message_bytes_in_log = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_message_bytes_in_log', 100);
            $mail_from = '"' . str_replace('"', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '"' . ' <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>';
            $user_ids_to_exclude = '
                SELECT DISTINCT `user_id` AS `ID` FROM `' . $wpdb->usermeta . '`
                    WHERE
                        (`meta_key` = \'' . $wpdb->prefix . 's2member_last_reminder_scan\' AND `meta_value` >= \'' . esc_sql($scan_time) . '\')
                        OR (`meta_key` = \'' . $wpdb->prefix . 's2member_reminders_enable\' AND `meta_value` = \'0\')
            ';
            $additional_user_ids_to_exclude = apply_filters('ws_plugin__s2member_pro_eot_reminders_exclude_user_ids', array(), get_defined_vars());
            $sql = '
                SELECT DISTINCT `user_id` AS `ID` FROM `' . $wpdb->usermeta . '`
                    WHERE `user_id` NOT IN(' . $user_ids_to_exclude . ')

                        ' . ($additional_user_ids_to_exclude ? 'AND `user_id` NOT IN(\'' . implode("','", $additional_user_ids_to_exclude) . '\')' : '') . '
                        AND (
                              (`meta_key` = \'' . $wpdb->prefix . 's2member_subscr_gateway\' AND `meta_value` != \'\')
                              OR (`meta_key` = \'' . $wpdb->prefix . 's2member_auto_eot_time\' AND `meta_value` != \'\')
                              OR (`meta_key` = \'' . $wpdb->prefix . 's2member_last_auto_eot_time\' AND `meta_value` != \'\')
                            )
                    LIMIT ' . esc_sql($per_process) . '
            ';
            if (!($user_ids = $wpdb->get_col($sql))) {
                return;
                // Nothing to do here.
            }
            $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
            c_ws_plugin__s2member_email_configs::email_config();
            foreach ($user_ids as $_user_id) {
                $_eot = $_day = $_recipients = $_subject = $_message = null;
                if (!($_user = new WP_User($_user_id)) || !$_user->ID) {
                    continue;
                    // Possible DB corruption.
                }
                update_user_option($_user->ID, 's2member_last_reminder_scan', self::$now);
                $_eot = c_ws_plugin__s2member_utils_users::get_user_eot($_user->ID);
                if (!$_eot || !$_eot['type'] || !$_eot['time'] || !$_eot['tense']) {
                    continue;
                    // Nothing to do; i.e., no EOT or NPT time.
                } elseif ($_eot['type'] === 'next' && !$options['pro_eot_reminder_email_on_npt_also']) {
                    continue;
                    // Nothing to do; i.e., not an EOT time and no NPTs.
                } elseif (!($_day = self::calculate_day($_eot['time'])) && $_day !== '0') {
                    continue;
                    // Unable to calculate day.
                } elseif (!in_array($_day, $days, true)) {
                    continue;
                    // Nothing on this day.
                } elseif (!($_recipients = self::get_recipients_for_day($_day))) {
                    continue;
                    // No recipients.
                } elseif (!($_subject = self::get_subject_for_day($_day))) {
                    continue;
                    // No subject.
                } elseif (!($_message = self::get_message_for_day($_day))) {
                    continue;
                    // No message.
                }
                //
                self::fill_replacement_codes($_user, $_eot, $_recipients, $_subject, $_message);
                $_mail_from = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_from', $mail_from, get_defined_vars());
                $_recipients = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_recipients', $_recipients, get_defined_vars());
                $_subject = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_subject', $_subject, get_defined_vars());
                $_message = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_message', $_message, get_defined_vars());
                if (!$_recipients || !$_subject || !$_message || !$_mail_from) {
                    continue;
                    // Final validation must not fail.
                }
                foreach (c_ws_plugin__s2member_utils_strings::parse_emails($_recipients) as $_recipient) {
                    wp_mail($_recipient, $_subject, $_message, 'From: ' . $_mail_from . "\r\n" . 'Content-Type: text/plain; charset=utf-8');
                    $_log_entry = array('eot' => $_eot, 'eot_rfc822' => date(DATE_RFC822, $_eot['time']), 'day' => $_day, 'now' => self::$now, 'user_id' => $_user->ID, 'user_login' => $_user->user_login, 'user_email' => $_user->user_email, 'user_first_name' => $_user->first_name, 'user_last_name' => $_user->last_name, 'mail_from' => $_mail_from, 'recipient' => $_recipient, 'subject' => $_subject);
                    if (strlen($_message) > $message_bytes_in_log) {
                        $_log_entry['message_clip'] = substr($_message, 0, $message_bytes_in_log) . '...';
                    } else {
                        $_log_entry['message'] = $_message;
                        // Full message.
                    }
                    c_ws_plugin__s2member_utils_logs::log_entry('eot-reminders', $_log_entry);
                }
            }
            unset($_user_id, $_user, $_eot, $_day, $_mail_from, $_recipients, $_recipient, $_subject, $_message, $_log_entry);
            if (!$email_configs_were_on) {
                c_ws_plugin__s2member_email_configs::email_config_release();
            }
        }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:reminders.inc.php

示例9: auto_eot_system

 /**
  * Processed by WP_Cron; this handles Auto-EOTs *(EOT = End Of Term)*.
  *
  * If you have a HUGE userbase, increase the max EOTs per process.
  * But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
  * To increase, use: ``add_filter ('ws_plugin__s2member_auto_eot_system_per_process');``.
  *
  * This function makes an important Hook available: `ws_plugin__s2member_after_auto_eot_system`.
  * This Hook is used by some of s2Member Pro's Gateway integrations; allowing CRON processing
  * to run for important communications; which poll Payment Gateway APIs for possible EOTs.
  *
  * @package s2Member\Auto_EOT_System
  * @since 3.5
  *
  * @param int $per_process Number of database records to process each time.
  *   Can also be Filtered with `ws_plugin__s2member_auto_eot_system_per_process`.
  *
  * @return null
  */
 public static function auto_eot_system($per_process = 6)
 {
     global $wpdb;
     /** @var $wpdb \wpdb */
     global $current_site, $current_blog;
     include_once ABSPATH . 'wp-admin/includes/admin.php';
     @set_time_limit(0);
     // Make time for processing a larger userbase.
     @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_auto_eot_system', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled']) {
         $per_process = apply_filters('ws_plugin__s2member_auto_eot_system_per_process', $per_process, get_defined_vars());
         if (is_array($eots = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . esc_sql(strtotime("now")) . "' LIMIT " . $per_process))) {
             foreach ($eots as $eot) {
                 if (($user_id = $eot->ID) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     $auto_eot_time = get_user_option('s2member_auto_eot_time', $user_id);
                     delete_user_option($user_id, 's2member_last_auto_eot_time');
                     delete_user_option($user_id, 's2member_auto_eot_time');
                     $log_entry = array('user' => (array) $user);
                     // Intialize.
                     $log_entry['auto_eot_time'] = $auto_eot_time;
                     // Record EOT time.
                     if (!$user->has_cap('administrator')) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_eot_behavior'] === 'demote') {
                             $eot_del_type = 'auto-eot-cancellation-expiration-demotion';
                             // Set EOT/Del type.
                             $log_entry['eot_del_type'] = $eot_del_type;
                             // Deleting user in this case.
                             $custom = get_user_option('s2member_custom', $user_id);
                             $subscr_gateway = get_user_option('s2member_subscr_gateway', $user_id);
                             $subscr_id = get_user_option('s2member_subscr_id', $user_id);
                             $subscr_baid = get_user_option('s2member_subscr_baid', $user_id);
                             $subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
                             $fields = get_user_option('s2member_custom_fields', $user_id);
                             $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                             $ipn_signup_vars = get_user_option('s2member_ipn_signup_vars', $user_id);
                             $demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role('subscriber');
                             $existing_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                             foreach (array_keys(get_defined_vars()) as $__v) {
                                 $__refs[$__v] =& ${$__v};
                             }
                             do_action('ws_plugin__s2member_during_auto_eot_system_during_before_demote', get_defined_vars());
                             do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), $eot_del_type, 'modification', $demotion_role);
                             do_action('ws_plugin__s2member_during_collective_eots', $user_id, get_defined_vars(), $eot_del_type, 'modification');
                             unset($__refs, $__v);
                             // Housekeeping.
                             if ($existing_role !== $demotion_role) {
                                 $user->set_role($demotion_role);
                             }
                             if (apply_filters('ws_plugin__s2member_remove_ccaps_during_eot_events', (bool) $GLOBALS['WS_PLUGIN__']['s2member']['o']['eots_remove_ccaps'], get_defined_vars())) {
                                 foreach ($user->allcaps as $cap => $cap_enabled) {
                                     if (preg_match('/^access_s2member_ccap_/', $cap)) {
                                         $user->remove_cap($ccap = $cap);
                                     }
                                 }
                             }
                             delete_user_option($user_id, 's2member_subscr_gateway');
                             delete_user_option($user_id, 's2member_subscr_id');
                             delete_user_option($user_id, 's2member_subscr_baid');
                             delete_user_option($user_id, 's2member_subscr_cid');
                             delete_user_option($user_id, 's2member_ipn_signup_vars');
                             if (!apply_filters('ws_plugin__s2member_preserve_paid_registration_times', TRUE)) {
                                 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);
//.........这里部分代码省略.........
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:auto-eots.inc.php

示例10: stripe_notify


//.........这里部分代码省略.........
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $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(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['s2member_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through s2Member\'s core gateway processor as `txn_type` (`' . $ipn['txn_type'] . '`).';
                         $stripe['s2member_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'charge.refunded':
                     // Customer refund (partial or full).
                     if (!empty($event->data->object) && ($stripe_charge = $event->data->object) instanceof Stripe_Charge && !empty($strip_charge->amount_refunded) && !empty($stripe_charge->customer) && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(0, $stripe_charge->customer))) {
                         $processing = TRUE;
                         $ipn['payment_status'] = 'refunded';
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['parent_txn_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['mc_fee'] = '-' . number_format('0.00', 2, '.', '');
                         $ipn['mc_gross'] = '-' . number_format(abs($strip_charge->amount), 2, '.', '');
                         $ipn['mc_currency'] = strtoupper($strip_charge->currency);
                         $ipn['tax'] = '-' . number_format('0.00', 2, '.', '');
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $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(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['s2member_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through s2Member\'s core gateway processor.';
                         $stripe['s2member_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
                 // Break switch handler.
                 case 'charge.dispute.created':
                     // Customer dispute (chargeback).
                     if (!empty($event->data->object->charge) && ($stripe_charge = c_ws_plugin__s2member_pro_stripe_utilities::get_charge($event->data->object->charge)) instanceof Stripe_Charge && !empty($stripe_charge->customer) && ($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars(0, $stripe_charge->customer))) {
                         $processing = TRUE;
                         $ipn['payment_status'] = 'reversed';
                         $ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
                         $ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['parent_txn_id'] = $ipn_signup_vars['subscr_id'];
                         $ipn['custom'] = $ipn_signup_vars['custom'];
                         $ipn['mc_fee'] = '-' . number_format('0.00', 2, '.', '');
                         $ipn['mc_gross'] = '-' . number_format(abs($strip_charge->amount), 2, '.', '');
                         $ipn['mc_currency'] = strtoupper($strip_charge->currency);
                         $ipn['tax'] = '-' . number_format('0.00', 2, '.', '');
                         $ipn['period1'] = $ipn_signup_vars['period1'];
                         $ipn['period3'] = $ipn_signup_vars['period3'];
                         $ipn['payer_email'] = $ipn_signup_vars['payer_email'];
                         $ipn['first_name'] = $ipn_signup_vars['first_name'];
                         $ipn['last_name'] = $ipn_signup_vars['last_name'];
                         $ipn['option_name1'] = $ipn_signup_vars['option_name1'];
                         $ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
                         $ipn['option_name2'] = $ipn_signup_vars['option_name2'];
                         $ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
                         $ipn['item_name'] = $ipn_signup_vars['item_name'];
                         $ipn['item_number'] = $ipn_signup_vars['item_number'];
                         $ipn['s2member_paypal_proxy'] = 'stripe';
                         $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(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
                         $stripe['s2member_log'][] = 'Stripe Webhook/IPN event type identified as: `' . $event->type . '` on: ' . date('D M j, Y g:i:s a T');
                         $stripe['s2member_log'][] = 'Webhook/IPN event `' . $event->type . '` reformulated. Piping through s2Member\'s core gateway processor.';
                         $stripe['s2member_log'][] = 'Please check core IPN logs for further processing details.';
                     }
                     break;
                     // Break switch handler.
             }
             if (empty($processing)) {
                 $stripe['s2member_log'][] = 'Ignoring this Webhook/IPN. The event does NOT require any action on the part of s2Member.';
             }
         } else {
             $stripe['s2member_log'][] = 'Unable to verify Webhook/IPN event ID. This is most likely related to an invalid Stripe configuration. Please check: s2Member → Stripe Options.';
             $stripe['s2member_log'][] = 'If you\'re absolutely SURE that your Stripe configuration is valid, you may want to run some tests on your server, just to be sure \\$_POST variables (and php://input) are populated; and that your server is able to connect to Stripe over an HTTPS connection.';
             $stripe['s2member_log'][] = 's2Member uses the Stripe SDK for remote connections; which relies upon the cURL extension for PHP. Please make sure that your installation of PHP has the cURL extension; and that it\'s configured together with OpenSSL for HTTPS communication.';
             $stripe['s2member_log'][] = var_export($_REQUEST, TRUE) . "\n" . var_export(json_decode(@file_get_contents('php://input')), TRUE);
         }
         c_ws_plugin__s2member_utils_logs::log_entry('stripe-ipn', $stripe);
         status_header(200);
         header('Content-Type: text/plain; charset=UTF-8');
         while (@ob_end_clean()) {
         }
         exit;
     }
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:101,代码来源:stripe-notify-in.inc.php


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