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


PHP c_ws_plugin__s2member_user_access::user_access_role方法代码示例

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


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

示例1: get_user_field

 /**
  * Retrieves a field value. Also supports Custom Fields.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $field_id Required. A unique Custom Registration/Profile Field ID, that you configured with s2Member.
  * 	Or, this could be set to any property that exists on the WP_User object for a particular User;
  * 	( i.e. `id`, `ID`, `user_login`, `user_email`, `first_name`, `last_name`, `display_name`, `ip`, `IP`,
  * 	`s2member_registration_ip`, `s2member_custom`, `s2member_subscr_id`, `s2member_subscr_or_wp_id`,
  * 	`s2member_subscr_gateway`, `s2member_custom_fields`, `s2member_file_download_access_[log|arc]`,
  * 	`s2member_auto_eot_time`, `s2member_last_payment_time`, `s2member_paid_registration_times`,
  * 	`s2member_access_role`, `s2member_access_level`, `s2member_access_label`,
  * 	`s2member_access_ccaps`, etc, etc. ).
  * @param int|str $user_id Optional. Defaults to the current User's ID.
  * @return mixed The value of the requested field, or false if the field does not exist.
  */
 public static function get_user_field($field_id = FALSE, $user_id = FALSE)
 {
     global $wpdb;
     /* Global database object reference. We'll need this to obtain the right database prefix. */
     /**/
     $current_user = wp_get_current_user();
     /* Current User's object ( used when/if `$user_id` is empty ). */
     /**/
     if (is_object($user = $user_id ? new WP_User($user_id) : $current_user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (isset($user->{$field_id})) {
             /* Immediate User object property? ( most likely ) */
             return $user->{$field_id};
         } else {
             if (isset($user->data->{$field_id})) {
                 /* Also try the data object property. */
                 return $user->data->{$field_id};
             } else {
                 if (isset($user->{$wpdb->prefix . $field_id})) {
                     /* Immediate prefixed? */
                     return $user->{$wpdb->prefix . $field_id};
                 } else {
                     if (isset($user->data->{$wpdb->prefix . $field_id})) {
                         /* Data prefixed? */
                         return $user->data->{$wpdb->prefix . $field_id};
                     } else {
                         if (strcasecmp($field_id, "full_name") === 0) {
                             /* First/last full name? */
                             return trim($user->first_name . " " . $user->last_name);
                         } else {
                             if (preg_match("/^(email|user_email)\$/i", $field_id)) {
                                 /* Email address? */
                                 return $user->user_email;
                             } else {
                                 if (preg_match("/^(login|user_login)\$/i", $field_id)) {
                                     /* Username / login? */
                                     return $user->user_login;
                                 } else {
                                     if (strcasecmp($field_id, "s2member_access_role") === 0) {
                                         /* Role name/ID? */
                                         return c_ws_plugin__s2member_user_access::user_access_role($user);
                                     } else {
                                         if (strcasecmp($field_id, "s2member_access_level") === 0) {
                                             /* Access Level? */
                                             return c_ws_plugin__s2member_user_access::user_access_level($user);
                                         } else {
                                             if (strcasecmp($field_id, "s2member_access_label") === 0) {
                                                 /* Access Label? */
                                                 return c_ws_plugin__s2member_user_access::user_access_label($user);
                                             } else {
                                                 if (strcasecmp($field_id, "s2member_access_ccaps") === 0) {
                                                     /* Custom Caps? */
                                                     return c_ws_plugin__s2member_user_access::user_access_ccaps($user);
                                                 } else {
                                                     if (strcasecmp($field_id, "ip") === 0 && is_object($current_user) && !empty($current_user->ID) && $current_user->ID === ($user_id = $user->ID)) {
                                                         return $_SERVER["REMOTE_ADDR"];
                                                     } else {
                                                         if (strcasecmp($field_id, "s2member_registration_ip") === 0 || strcasecmp($field_id, "reg_ip") === 0 || strcasecmp($field_id, "ip") === 0) {
                                                             return get_user_option("s2member_registration_ip", $user_id);
                                                         } else {
                                                             if (strcasecmp($field_id, "s2member_subscr_or_wp_id") === 0) {
                                                                 return ($subscr_id = get_user_option("s2member_subscr_id", $user_id)) ? $subscr_id : $user_id;
                                                             } else {
                                                                 if (is_array($fields = get_user_option("s2member_custom_fields", $user_id))) {
                                                                     if (isset($fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))])) {
                                                                         return $fields[preg_replace("/[^a-z0-9]/i", "_", strtolower($field_id))];
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /**/
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:utils-users.inc.php

示例2: handle_profile_modifications


//.........这里部分代码省略.........
                     $userdata['user_email'] = $_p['ws_plugin__s2member_profile_email'];
                     if (strcasecmp($userdata['user_email'], $user->user_email) !== 0) {
                         $email_change = TRUE;
                     }
                 }
             }
             if (!empty($_p['ws_plugin__s2member_profile_password1'])) {
                 if ($user->user_login !== 'demo') {
                     // No pass change on demo!
                     $userdata['user_pass'] = $_p['ws_plugin__s2member_profile_password1'];
                 }
             }
             if (!empty($_p['ws_plugin__s2member_profile_first_name'])) {
                 $userdata['first_name'] = $_p['ws_plugin__s2member_profile_first_name'];
             }
             if (!empty($_p['ws_plugin__s2member_profile_display_name'])) {
                 $userdata['display_name'] = $_p['ws_plugin__s2member_profile_display_name'];
             }
             if (!empty($_p['ws_plugin__s2member_profile_last_name'])) {
                 $userdata['last_name'] = $_p['ws_plugin__s2member_profile_last_name'];
             }
             wp_update_user(wp_slash($userdata));
             // OK. Now send this array for an update.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile')) {
                     $fields = array();
                     // Initialize the array of fields.
                     $_existing_fields = get_user_option('s2member_custom_fields', $user_id);
                     foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                         $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                         $field_id_class = preg_replace('/_/', '-', $field_var);
                         if (!in_array($field['id'], $fields_applicable) || strpos($field['editable'], 'no') === 0) {
                             if (isset($_existing_fields[$field_var]) && (is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var]) || is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))) {
                                 $fields[$field_var] = $_existing_fields[$field_var];
                             } else {
                                 unset($fields[$field_var]);
                             }
                         } else {
                             if ($field['required'] === 'yes' && (!isset($_p['ws_plugin__s2member_profile_' . $field_var]) || !is_array($_p['ws_plugin__s2member_profile_' . $field_var]) && !is_string($_p['ws_plugin__s2member_profile_' . $field_var]) || is_array($_p['ws_plugin__s2member_profile_' . $field_var]) && empty($_p['ws_plugin__s2member_profile_' . $field_var]) || is_string($_p['ws_plugin__s2member_profile_' . $field_var]) && !strlen($_p['ws_plugin__s2member_profile_' . $field_var])) || isset($_p['ws_plugin__s2member_profile_' . $field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_' . $field_var]), array($field))) {
                                 if (isset($_existing_fields[$field_var]) && (is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var]) || is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))) {
                                     $fields[$field_var] = $_existing_fields[$field_var];
                                 } else {
                                     unset($fields[$field_var]);
                                 }
                             } else {
                                 if (isset($_p['ws_plugin__s2member_profile_' . $field_var])) {
                                     if ((is_array($_p['ws_plugin__s2member_profile_' . $field_var]) && !empty($_p['ws_plugin__s2member_profile_' . $field_var]) || is_string($_p['ws_plugin__s2member_profile_' . $field_var]) && strlen($_p['ws_plugin__s2member_profile_' . $field_var])) && !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_' . $field_var]), array($field))) {
                                         $fields[$field_var] = $_p['ws_plugin__s2member_profile_' . $field_var];
                                     } else {
                                         unset($fields[$field_var]);
                                     }
                                 } else {
                                     unset($fields[$field_var]);
                                 }
                             }
                         }
                     }
                     if (!empty($fields)) {
                         update_user_option($user_id, 's2member_custom_fields', $fields);
                     } else {
                         // Else delete their Custom Fields?
                         delete_user_option($user_id, 's2member_custom_fields');
                     }
                 }
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action('ws_plugin__s2member_during_handle_profile_modifications', get_defined_vars());
             unset($__refs, $__v);
             clean_user_cache($user_id);
             wp_cache_delete($user_id, 'user_meta');
             $user = new WP_User($user_id);
             // Fresh object.
             if (function_exists('setup_userdata')) {
                 setup_userdata();
             }
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
             if (!empty($_p['ws_plugin__s2member_profile_opt_in']) && $role && $level >= 0) {
                 c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, !empty($userdata['user_pass']) ? $userdata['user_pass'] : '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
             } else {
                 if ($role && $level >= 0 && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in']) {
                     c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, !empty($userdata['user_pass']) ? $userdata['user_pass'] : '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
                 }
             }
             $lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
             $lwp = !$lwp ? get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) : $lwp;
             if (empty($_p['ws_plugin__s2member_sc_profile_save'])) {
                 echo '<script type="text/javascript">' . "\n";
                 echo "if(window.parent && window.parent != window) { window.parent.alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member')) . "'); window.parent.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp) . "'; }";
                 echo "else if(window.opener) { window.alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member')) . "'); window.opener.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp) . "'; window.close(); }";
                 echo "else { alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member')) . "'); window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp) . "'; }";
                 echo '</script>' . "\n";
                 exit;
             }
         }
     }
     do_action('ws_plugin__s2member_after_handle_profile_modifications', get_defined_vars());
 }
开发者ID:codeforest,项目名称:s2member,代码行数:101,代码来源:profile-mods-in.inc.php

示例3: export_users


//.........这里部分代码省略.........
         $export_headers = trim($export_headers, ',');
         // Trim away leading/trailing delimiters.
         $export = $export_headers . "\n";
         // First line of the export file is always the export headers.
         $users = $wpdb->get_results("SELECT `" . $wpdb->users . "`.`ID` FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "` WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id` AND `" . $wpdb->usermeta . "`.`meta_key` = '" . esc_sql($wpdb->prefix . 'capabilities') . "' ORDER BY `" . $wpdb->users . "`.`ID` ASC LIMIT " . $sql_s . ", " . $limit);
         $users = is_array($users) ? $users : array();
         // List of the users on this blog.
         foreach ($users as $_user) {
             $_user_line = '';
             // Initialize the export line for this user.
             if (!is_object($_user = new WP_User($_user->ID)) || !$_user->ID) {
                 continue;
             }
             // Nothing to export for this user.
             foreach ($user_keys as $_user_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_key) {
                     default:
                         // Default handler.
                         $_value = $_user->{$_user_key};
                         break;
                 }
                 $_user_line .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq((string) $_value, 1, '"') . '"';
             }
             unset($_user_key, $_value);
             // Housekeeping.
             foreach ($user_permission_keys as $_user_permission_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_permission_key) {
                     case 'role':
                         // The user's role.
                         $_value = c_ws_plugin__s2member_user_access::user_access_role($_user);
                         break;
                     case 'ccaps':
                         // s2 custom capabilities.
                         $_value = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($_user));
                         break;
                 }
                 $_user_line .= ',"' . c_ws_plugin__s2member_utils_strings::esc_dq($_value, 1, '"') . '"';
             }
             unset($_user_permission_key, $_value);
             // Housekeeping.
             $_user_meta_values = $wpdb->get_results("SELECT `meta_key`, `meta_value` FROM `" . $wpdb->usermeta . "` WHERE `user_id` = '" . esc_sql($_user->ID) . "'", OBJECT_K);
             foreach ($user_meta_keys as $_user_meta_key) {
                 $_value = '';
                 // Intialize value.
                 switch ($_user_meta_key) {
                     case $wpdb->prefix . 'capabilities':
                     case $wpdb->prefix . 's2member_sp_references':
                     case $wpdb->prefix . 's2member_ipn_signup_vars':
                     case $wpdb->prefix . 's2member_access_cap_times':
                     case $wpdb->prefix . 's2member_paid_registration_times':
                     case $wpdb->prefix . 's2member_file_download_access_arc':
                     case $wpdb->prefix . 's2member_file_download_access_log':
                         // This handles JSON-encoding for known array values.
                         if (isset($_user_meta_values[$_user_meta_key]->meta_value[0])) {
                             $_value = json_encode(maybe_unserialize($_user_meta_values[$_user_meta_key]->meta_value));
                         }
                         break;
                     default:
                         // Default handler.
                         if (isset($_user_meta_values[$_user_meta_key]->meta_value[0])) {
                             if ($format === 'readable' && strpos($_user_meta_values[$_user_meta_key]->meta_value, '{')) {
                                 $_value = json_encode(maybe_unserialize($_user_meta_values[$_user_meta_key]->meta_value));
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:67,代码来源:exports-in.inc.php

示例4: configure_user_registration

 /**
  * Configures all new Users.
  *
  * The Hook `user_register` is also fired by calling:
  * ``c_ws_plugin__s2member_registrations::ms_create_existing_user()`` and/or ``wpmu_create_user()``.
  *
  * This function also receives hand-offs from s2Member's handlers for these two Hooks:
  * `wpmu_activate_user` and `wpmu_activate_blog`.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action("user_register");``
  *
  * @param int|str $user_id A numeric WordPress User ID.
  * @param str $password Optional in most cases. A User's plain text Password. If unspecified, attempts are made to collect the plain text Password from other sources.
  * @param array $meta Optional in most cases. Defaults to false. An array of meta data for a User/Member.
  * @return null No return value. Returns `null` in possible every scenario.
  *
  * @todo Impossible to delete cookies when fired inside: `/wp-activate.php`?
  */
 public static function configure_user_registration($user_id = FALSE, $password = FALSE, $meta = FALSE)
 {
     global $wpdb;
     global $pagenow;
     // We need this to detect the current administration page.
     global $current_site, $current_blog;
     // Adds support for Multisite Networking.
     static $email_config, $processed;
     // Static vars prevent duplicate processing.
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_configure_user_registration", get_defined_vars());
     unset($__refs, $__v);
     // With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_[user|blog]`.
     if (!isset($email_config) && ($email_config = true)) {
         // Anytime this routine is fired; we configure email.
         c_ws_plugin__s2member_email_configs::email_config();
     }
     // Configures `From:` email header.
     $_p = isset($_POST) ? $_POST : null;
     $rvs = isset($GLOBALS["ws_plugin__s2member_registration_vars"]) ? $GLOBALS["ws_plugin__s2member_registration_vars"] : null;
     if (!$processed) {
         if (is_array($_p) || is_array($meta) || is_array($rvs)) {
             if (!(is_multisite() && is_blog_admin() && $pagenow === "user-new.php" && isset($_p["noconfirmation"]) && is_super_admin() && !is_array($meta))) {
                 if (!(preg_match("/\\/wp-activate\\.php/", $_SERVER["REQUEST_URI"]) && !is_array($meta))) {
                     if (!(c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page() && !is_array($meta))) {
                         if (!(c_ws_plugin__s2member_utils_conds::pro_is_installed() && c_ws_plugin__s2member_pro_remote_ops::is_remote_op("create_user") && !is_array($rvs))) {
                             if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && ($processed = true)) {
                                 settype($_p, "array") . settype($meta, "array") . settype($rvs, "array");
                                 $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_p));
                                 $meta = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($meta));
                                 $rvs = c_ws_plugin__s2member_utils_strings::trim_deep($rvs);
                                 foreach ($_p as $_key => $_value) {
                                     // Scan ``$_p`` vars; adding `custom_reg_field` keys.
                                     if (preg_match("/^ws_plugin__s2member_user_new_/", $_key)) {
                                         // Look for keys.
                                         if ($_key = str_replace("_user_new_", "_custom_reg_field_", $_key)) {
                                             $_p[$_key] = $_value;
                                         }
                                     }
                                 }
                                 // Add each of these key conversions.
                                 unset($_key, $_value);
                                 if (!is_admin() && (isset($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway"]) || isset($_p["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"]) || isset($_p["ws_plugin__s2member_custom_reg_field_s2member_custom"]) || isset($_p["ws_plugin__s2member_custom_reg_field_s2member_ccaps"]) || isset($_p["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) || isset($_p["ws_plugin__s2member_custom_reg_field_s2member_notes"]))) {
                                     exit(_x("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
                                 }
                                 $_pmr = array_merge($_p, $meta, $rvs);
                                 // Merge all of these arrays together now, in this specific order.
                                 unset($_p, $meta, $rvs);
                                 // These variables can all be unset now; we have them all in the ``$_pmr`` array.
                                 $custom_reg_display_name = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_display_name"];
                                 // Can be configured by the site owner.
                                 if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op("create_user")) && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
                                     /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
                                     			This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
                                     			If processed through `/wp-activate.php`, it could've originated inside the admin — via `/user-new.php`. */
                                     $processed = "yes";
                                     // Mark this as yes.
                                     $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                                     @(list($level, $ccaps, $eotper) = preg_split("/\\:/", $item_number, 3));
                                     $role = "s2member_level" . $level;
                                     // Membership Level.
                                     $email = $user->user_email;
                                     $login = $user->user_login;
                                     $ip = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_registration_ip"];
                                     $ip = !$ip ? $_SERVER["REMOTE_ADDR"] : $ip;
                                     // Else use environment variable.
                                     $cv = preg_split("/\\|/", $custom);
                                     if (!($auto_eot_time = "") && $eotper) {
                                         // If a specific EOT Period is included.
                                         $auto_eot_time = c_ws_plugin__s2member_utils_time::auto_eot_time("", "", "", $eotper);
                                     }
                                     $notes = (string) @$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
                                     $opt_in = !$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] ? true : false;
                                     $opt_in = !$opt_in && !empty($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
                                     if (!($fname = $user->first_name)) {
                                         if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_first_name"])) {
                                             $fname = (string) $_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:registrations.inc.php

示例5: fill_login_redirect_rc_vars

 /**
  * Fills Replacement Codes in Special Redirection URLs.
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  *
  * @param str $url A URL with possible Replacement Codes in it.
  * @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  * @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
  * @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
  */
 public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
     unset($__refs, $__v);
     $url = (string) $url;
     $orig_url = $url;
     $user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
     $user_id = $user ? (string) $user->ID : "";
     $user_login = $user ? (string) strtolower($user->user_login) : "";
     $user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
     $user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
     $user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
     $url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
     $url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
     $url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
     $url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
     $url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
     $url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
     if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
         $url = site_url("/");
     }
     if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
         $url = false;
     }
     return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:41,代码来源:login-redirects.inc.php

示例6: modify_user

 /**
  * Modifies an existing User.
  *
  * @package s2Member\API_Remote_Ops
  * @since 110713
  *
  * @param array An input array of Remote Operation parameters.
  * @return str Returns a serialized array with an `ID` element object on success,
  * 	else returns a string beginning with `Error:` on failure; which will include details regarding the error.
  */
 public static function modify_user($op = NULL)
 {
     if (!empty($op["op"]) && $op["op"] === "modify_user" && !empty($op["data"]) && is_array($op["data"])) {
         if (!empty($op["data"]["user_id"]) && ($_user = new WP_User((int) $op["data"]["user_id"])) && !empty($_user->ID)) {
             $user = $_user;
         } else {
             if (!empty($op["data"]["user_login"]) && ($_user = new WP_User((string) $op["data"]["user_login"])) && !empty($_user->ID)) {
                 $user = $_user;
             } else {
                 return "Error: Modification failed. Unable to obtain WP_User object instance with data supplied (i.e. ID/Username not found).";
             }
         }
         if (is_multisite() && !is_user_member_of_blog($user->ID)) {
             return "Error: Modification failed. Unable to obtain WP_User object instance with data supplied (i.e. ID/Username not a part of this Blog).";
         }
         if (is_super_admin($user->ID) || $user->has_cap("administrator")) {
             return "Error: Modification failed. This API will not modify Administrators.";
         }
         $userdata["ID"] = $user->ID;
         if (!empty($op["data"]["user_email"])) {
             if (is_email((string) $op["data"]["user_email"]) && !email_exists((string) $op["data"]["user_email"])) {
                 $userdata["user_email"] = (string) $op["data"]["user_email"];
             }
         }
         if (!empty($op["data"]["user_pass"])) {
             if ($user->user_login !== "demo") {
                 $userdata["user_pass"] = (string) $op["data"]["user_pass"];
             }
         }
         if (!empty($op["data"]["first_name"])) {
             $userdata["first_name"] = (string) $op["data"]["first_name"];
         }
         if (!empty($op["data"]["display_name"])) {
             $userdata["display_name"] = (string) $op["data"]["display_name"];
         }
         if (!empty($op["data"]["last_name"])) {
             $userdata["last_name"] = (string) $op["data"]["last_name"];
         }
         if (isset($op["data"]["s2member_level"]) && (int) $op["data"]["s2member_level"] === 0) {
             if (c_ws_plugin__s2member_user_access::user_access_role($user) !== get_option("default_role")) {
                 $userdata["role"] = get_option("default_role");
             }
         } else {
             if (!empty($op["data"]["s2member_level"]) && (int) $op["data"]["s2member_level"] > 0) {
                 if (c_ws_plugin__s2member_user_access::user_access_role($user) !== "s2member_level" . (int) $op["data"]["s2member_level"]) {
                     $userdata["role"] = "s2member_level" . (int) $op["data"]["s2member_level"];
                 }
             }
         }
         wp_update_user($userdata);
         $old_user = unserialize(serialize($user));
         $user = new WP_User($user->ID);
         $role = c_ws_plugin__s2member_user_access::user_access_role($user);
         $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
         if (!empty($op["data"]["auto_opt_out_transition"])) {
             $_p["ws_plugin__s2member_custom_reg_auto_opt_out_transitions"] = TRUE;
         }
         if (!empty($userdata["role"])) {
             do_action("ws_plugin__s2member_during_collective_mods", $user->ID, get_defined_vars(), "user-role-change", "modification", $role, $user, $old_user);
         }
         if (!empty($op["data"]["s2member_ccaps"]) && preg_match("/^-all/", str_replace("+", "", (string) $op["data"]["s2member_ccaps"]))) {
             foreach ($user->allcaps as $cap => $cap_enabled) {
                 if (preg_match("/^access_s2member_ccap_/", $cap)) {
                     $user->remove_cap($ccap = $cap);
                 }
             }
         }
         if (!empty($op["data"]["s2member_ccaps"]) && preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", (string) $op["data"]["s2member_ccaps"]))) {
             foreach (preg_split("/[\r\n\t\\s;,]+/", preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", (string) $op["data"]["s2member_ccaps"]))) as $ccap) {
                 if (strlen($ccap = trim(strtolower(preg_replace("/[^a-z_0-9]/i", "", $ccap))))) {
                     $user->add_cap("access_s2member_ccap_" . $ccap);
                 }
             }
         }
         if (isset($op["data"]["s2member_originating_blog"]) && is_multisite()) {
             update_user_meta($user->ID, "s2member_originating_blog", (int) $op["data"]["s2member_originating_blog"]);
         }
         if (isset($op["data"]["s2member_subscr_gateway"])) {
             update_user_option($user->ID, "s2member_subscr_gateway", (string) $op["data"]["s2member_subscr_gateway"]);
         }
         if (isset($op["data"]["s2member_subscr_id"])) {
             update_user_option($user->ID, "s2member_subscr_id", (string) $op["data"]["s2member_subscr_id"]);
         }
         if (isset($op["data"]["s2member_custom"])) {
             update_user_option($user->ID, "s2member_custom", (string) $op["data"]["s2member_custom"]);
         }
         if (isset($op["data"]["s2member_registration_ip"])) {
             update_user_option($user->ID, "s2member_registration_ip", (string) $op["data"]["s2member_registration_ip"]);
         }
         if (isset($op["data"]["s2member_notes"])) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:remote-ops-in.inc.php

示例7: cp


//.........这里部分代码省略.........
             // Not possible.
             /*
             New Subscription with advanced update vars (option_name1, option_selection1)? Used in Subscr. Modifications.
             */
             if (preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1']) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars', get_defined_vars());
                 unset($__refs, $__v);
                 // Housekeeping.
                 $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.';
                 if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     if (!$user->has_cap('administrator')) {
                         $processing = $modifying = $during = TRUE;
                         // Yes, we ARE processing this.
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action('ws_plugin__s2member_during_paypal_return_during_before_subscr_signup_w_update_vars', get_defined_vars());
                         do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), 'rtn-upgrade-downgrade', 'modification', 's2member_level' . $paypal['level']);
                         unset($__refs, $__v);
                         // Housekeeping.
                         $fields = get_user_option('s2member_custom_fields', $user_id);
                         // These will be needed in the routines below.
                         $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                         // Original IP during Registration.
                         $user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
                         // Now merge conditionally.
                         if (is_multisite() && !is_user_member_of_blog($user_id)) {
                             add_existing_user_to_blog(array('user_id' => $user_id, 'role' => 's2member_level' . $paypal['level']));
                             $user = new WP_User($user_id);
                         }
                         $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                         if ($current_role !== 's2member_level' . $paypal['level']) {
                             // Only if we need to.
                             $user->set_role('s2member_level' . $paypal['level']);
                         }
                         if ($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps']))) {
                             foreach ($user->allcaps as $cap => $cap_enabled) {
                                 if (preg_match('/^access_s2member_ccap_/', $cap)) {
                                     $user->remove_cap($ccap = $cap);
                                 }
                             }
                         }
                         if ($paypal['ccaps'] && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) {
                             foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap) {
                                 if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                                     $user->add_cap('access_s2member_ccap_' . $ccap);
                                 }
                             }
                         }
                         update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
                         update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
                         update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
                         update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
                         update_user_option($user_id, 's2member_custom', $paypal['custom']);
                         if (!get_user_option('s2member_registration_ip', $user_id)) {
                             update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
                         }
                         if (!empty($ipn_signup_vars)) {
                             // We should have these from the routines above.
                             update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
                         }
                         delete_user_option($user_id, 's2member_file_download_access_log');
                         if ((preg_match('/^web_accept$/i', $paypal['txn_type']) || $paypal['initial'] <= 0 && $paypal['regular'] <= 0) && $paypal['eotper']) {
开发者ID:codeforest,项目名称:s2member,代码行数:67,代码来源:paypal-return-in-subscr-or-wa-w-level.inc.php

示例8: modify_user

 /**
  * Modifies an existing User.
  *
  * @package s2Member\API_Remote_Ops
  * @since 110713
  *
  * @param array $op An input array of Remote Operation parameters.
  *
  * @return string Returns a serialized array with an `ID` element object on success,
  *   else returns a string beginning with `Error:` on failure; which will include details regarding the error.
  */
 public static function modify_user($op = NULL)
 {
     if (!empty($op['op']) && $op['op'] === 'modify_user' && !empty($op['data']) && is_array($op['data'])) {
         if (!empty($op['data']['user_id']) && ($_user = new WP_User((int) $op['data']['user_id'])) && !empty($_user->ID)) {
             $user = $_user;
         } else {
             if (!empty($op['data']['user_login']) && ($_user = new WP_User((string) $op['data']['user_login'])) && !empty($_user->ID)) {
                 $user = $_user;
             } else {
                 return 'Error: Modification failed. Unable to obtain WP_User object instance with data supplied (i.e., ID/Username not found).';
             }
         }
         if (is_multisite() && !is_user_member_of_blog($user->ID)) {
             return 'Error: Modification failed. Unable to obtain WP_User object instance with data supplied (i.e., ID/Username not a part of this Blog).';
         }
         if (is_super_admin($user->ID) || $user->has_cap('administrator')) {
             return 'Error: Modification failed. This API will not modify Administrators.';
         }
         $userdata['ID'] = $user->ID;
         // Needed for database update.
         if (!empty($op['data']['user_email'])) {
             if (is_email((string) $op['data']['user_email']) && !email_exists((string) $op['data']['user_email'])) {
                 $userdata['user_email'] = (string) $op['data']['user_email'];
             }
         }
         if (!empty($op['data']['user_pass'])) {
             if ($user->user_login !== 'demo') {
                 $userdata['user_pass'] = (string) $op['data']['user_pass'];
             }
         }
         if (!empty($op['data']['first_name'])) {
             $userdata['first_name'] = (string) $op['data']['first_name'];
         }
         if (!empty($op['data']['display_name'])) {
             $userdata['display_name'] = (string) $op['data']['display_name'];
         }
         if (!empty($op['data']['last_name'])) {
             $userdata['last_name'] = (string) $op['data']['last_name'];
         }
         if (isset($op['data']['s2member_level']) && (int) $op['data']['s2member_level'] === 0) {
             if (c_ws_plugin__s2member_user_access::user_access_role($user) !== get_option('default_role')) {
                 $userdata['role'] = get_option('default_role');
             }
         } else {
             if (!empty($op['data']['s2member_level']) && (int) $op['data']['s2member_level'] > 0) {
                 if (c_ws_plugin__s2member_user_access::user_access_role($user) !== 's2member_level' . (int) $op['data']['s2member_level']) {
                     $userdata['role'] = 's2member_level' . (int) $op['data']['s2member_level'];
                 }
             }
         }
         wp_update_user(wp_slash($userdata));
         // OK. Now send this array for an update.
         $old_user = unserialize(serialize($user));
         // Copy existing user obj.
         $user = new WP_User($user->ID);
         // Update our object instance.
         $role = c_ws_plugin__s2member_user_access::user_access_role($user);
         $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
         if (!empty($op['data']['auto_opt_out_transition'])) {
             $_p['ws_plugin__s2member_custom_reg_auto_opt_out_transitions'] = TRUE;
         }
         if (!empty($userdata['role'])) {
             do_action('ws_plugin__s2member_during_collective_mods', $user->ID, get_defined_vars(), 'user-role-change', 'modification', $role, $user, $old_user);
         }
         if (!empty($op['data']['s2member_ccaps']) && preg_match('/^-all/', str_replace('+', '', (string) $op['data']['s2member_ccaps']))) {
             foreach ($user->allcaps as $cap => $cap_enabled) {
                 if (preg_match('/^access_s2member_ccap_/', $cap)) {
                     $user->remove_cap($ccap = $cap);
                 }
             }
         }
         if (!empty($op['data']['s2member_ccaps']) && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', (string) $op['data']['s2member_ccaps']))) {
             foreach (preg_split('/[\\r\\n\\t\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', (string) $op['data']['s2member_ccaps']))) as $ccap) {
                 if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                     $user->add_cap('access_s2member_ccap_' . $ccap);
                 }
             }
         }
         if (isset($op['data']['s2member_originating_blog']) && is_multisite()) {
             update_user_meta($user->ID, 's2member_originating_blog', (int) $op['data']['s2member_originating_blog']);
         }
         if (isset($op['data']['s2member_subscr_gateway'])) {
             update_user_option($user->ID, 's2member_subscr_gateway', (string) $op['data']['s2member_subscr_gateway']);
         }
         if (isset($op['data']['s2member_subscr_id'])) {
             update_user_option($user->ID, 's2member_subscr_id', (string) $op['data']['s2member_subscr_id']);
         }
         if (isset($op['data']['s2member_custom'])) {
             update_user_option($user->ID, 's2member_custom', (string) $op['data']['s2member_custom']);
//.........这里部分代码省略.........
开发者ID:NClaus,项目名称:Ambrose,代码行数:101,代码来源:remote-ops-in.inc.php

示例9: cp

 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  *
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars, EXTR_OVERWRITE | EXTR_REFS);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal['txn_type']) && preg_match('/^(web_accept|subscr_signup)$/i', $paypal['txn_type']) && (!empty($paypal['item_number']) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number'])) && (!empty($paypal['subscr_id']) || !empty($paypal['txn_id']) && ($paypal['subscr_id'] = $paypal['txn_id'])) && (empty($paypal['payment_status']) || empty($payment_status_issues) || !preg_match($payment_status_issues, $paypal['payment_status'])) && (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id'])) && (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id'])) && !empty($paypal['payer_email'])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_signup', get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $processing = $modifying = $during = FALSE;
             // Initialize these flags.
             $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ).';
             @(list($paypal['level'], $paypal['ccaps'], $paypal['eotper']) = preg_split('/\\:/', $paypal['item_number'], 3));
             $paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
             $paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
             $paypal['period1'] = isset($paypal['period1']) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
             $paypal['mc_amount1'] = isset($paypal['mc_amount1']) && $paypal['mc_amount1'] > 0 ? $paypal['mc_amount1'] : '0.00';
             if (preg_match('/^web_accept$/i', $paypal['txn_type'])) {
                 $paypal['period3'] = $paypal['eotper'] ? $paypal['eotper'] : '1 L';
                 // 1 lifetime.
                 $paypal['mc_amount3'] = $paypal['mc_gross'];
                 // The 'Buy Now' amount is the full gross.
             }
             $paypal['initial_term'] = preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['period1'] : '0 D';
             $paypal['initial'] = isset($paypal['mc_amount1'][0]) && preg_match('/^[1-9]/', $paypal['period1']) ? $paypal['mc_amount1'] : $paypal['mc_amount3'];
             $paypal['regular'] = $paypal['mc_amount3'];
             // This is the regular payment amount that is charged to the customer. always required by PayPal.
             $paypal['regular_term'] = $paypal['period3'];
             // This is just set to keep a standard; this way both initial_term & regular_term are available.
             $paypal['recurring'] = !empty($paypal['recurring']) ? $paypal['mc_amount3'] : '0';
             // If non-recurring, this should be zero, otherwise regular.
             $ipn_signup_vars = $paypal;
             // Create array of IPN signup vars w/o s2member_log.
             unset($ipn_signup_vars['s2member_log']);
             /*
             New Subscription with advanced update vars (option_name1, option_selection1)? These variables are used in Subscr. Modifications.
             */
             if (preg_match('/(referenc|associat|updat|upgrad)/i', $paypal['option_name1']) && $paypal['option_selection1']) {
                 foreach (array_keys(get_defined_vars()) as $__v) {
                     $__refs[$__v] =& ${$__v};
                 }
                 do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars', get_defined_vars());
                 unset($__refs, $__v);
                 $paypal['s2member_log'][] = 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/ update vars.';
                 if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'], $paypal['option_selection1'])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                     if (!$user->has_cap('administrator')) {
                         $processing = $modifying = $during = TRUE;
                         // Yes, we ARE processing this.
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action('ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars', get_defined_vars());
                         do_action('ws_plugin__s2member_during_collective_mods', $user_id, get_defined_vars(), 'ipn-upgrade-downgrade', 'modification', 's2member_level' . $paypal['level']);
                         unset($__refs, $__v);
                         $fields = get_user_option('s2member_custom_fields', $user_id);
                         $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                         $user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
                         if (is_multisite() && !is_user_member_of_blog($user_id)) {
                             add_existing_user_to_blog(array('user_id' => $user_id, 'role' => 's2member_level' . $paypal['level']));
                             $user = new WP_User($user_id);
                         }
                         $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                         if ($current_role !== 's2member_level' . $paypal['level']) {
                             $user->set_role('s2member_level' . $paypal['level']);
                         }
                         if ($paypal['ccaps'] && preg_match('/^-all/', str_replace('+', '', $paypal['ccaps']))) {
                             foreach ($user->allcaps as $cap => $cap_enabled) {
                                 if (preg_match('/^access_s2member_ccap_/', $cap)) {
                                     $user->remove_cap($ccap = $cap);
                                 }
                             }
                         }
                         if ($paypal['ccaps'] && preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) {
                             foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', preg_replace('/^-all[' . "\r\n\t" . '\\s;,]*/', '', str_replace('+', '', $paypal['ccaps']))) as $ccap) {
                                 if (strlen($ccap = trim(strtolower(preg_replace('/[^a-z_0-9]/i', '', $ccap))))) {
                                     $user->add_cap('access_s2member_ccap_' . $ccap);
                                 }
                             }
                         }
                         update_user_option($user_id, 's2member_subscr_gateway', $paypal['subscr_gateway']);
                         update_user_option($user_id, 's2member_subscr_id', $paypal['subscr_id']);
                         update_user_option($user_id, 's2member_subscr_baid', $paypal['subscr_baid']);
                         update_user_option($user_id, 's2member_subscr_cid', $paypal['subscr_cid']);
                         update_user_option($user_id, 's2member_custom', $paypal['custom']);
                         if (!get_user_option('s2member_registration_ip', $user_id)) {
                             update_user_option($user_id, 's2member_registration_ip', $paypal['ip']);
                         }
                         update_user_option($user_id, 's2member_ipn_signup_vars', $ipn_signup_vars);
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-notify-in-subscr-or-wa-w-level.inc.php

示例10: cp

 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  *
  * @todo Optimize with ``empty()`` and ``isset()``.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if (!empty($paypal["txn_type"]) && preg_match("/^subscr_modify\$/i", $paypal["txn_type"]) && (!empty($paypal["item_number"]) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"])) && !empty($paypal["subscr_id"]) && !empty($paypal["payer_email"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_ipn = "s2m_ipn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_modify` ).";
             list($paypal["level"], $paypal["ccaps"]) = preg_split("/\\:/", $paypal["item_number"], 2);
             $paypal["ip"] = preg_match("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"] ? $paypal["option_selection2"] : "";
             $paypal["ip"] = !$paypal["ip"] && preg_match("/^[a-z0-9]+~[0-9\\.]+\$/i", $paypal["invoice"]) ? preg_replace("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
             $paypal["period1"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             // Defaults to "0 D" (zero days).
             $paypal["mc_amount1"] = strlen($paypal["mc_amount1"]) && $paypal["mc_amount1"] > 0 ? $paypal["mc_amount1"] : "0.00";
             // "0.00".
             $paypal["initial_term"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             // Defaults to "0 D" (zero days).
             $paypal["initial"] = strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
             $paypal["regular"] = $paypal["mc_amount3"];
             // This is the Regular Payment Amount that is charged to the Customer. Always required by PayPal.
             $paypal["regular_term"] = $paypal["period3"];
             // This is just set to keep a standard; this way both initial_term & regular_term are available.
             $paypal["recurring"] = $paypal["recurring"] ? $paypal["mc_amount3"] : "0";
             // If non-recurring, this should be zero, otherwise Regular.
             $ipn_signup_vars = $paypal;
             unset($ipn_signup_vars["s2member_log"]);
             // Create array of IPN signup vars w/o s2member_log.
             if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal["subscr_id"])) && is_object($user = new WP_User($user_id)) && $user->ID) {
                 if (!$user->has_cap("administrator")) {
                     $processing = $modifying = $during = true;
                     // Yes, we ARE processing this.
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars());
                     do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "ipn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
                     unset($__refs, $__v);
                     $fields = get_user_option("s2member_custom_fields", $user_id);
                     // These will be needed in the routines below.
                     $user_reg_ip = get_user_option("s2member_registration_ip", $user_id);
                     // Original IP during Registration.
                     $user_reg_ip = $paypal["ip"] = $user_reg_ip ? $user_reg_ip : $paypal["ip"];
                     // Now merge conditionally.
                     if (is_multisite() && !is_user_member_of_blog($user_id)) {
                         add_existing_user_to_blog(array("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
                         $user = new WP_User($user_id);
                     }
                     $current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
                     if ($current_role !== "s2member_level" . $paypal["level"]) {
                         // Only if we need to.
                         $user->set_role("s2member_level" . $paypal["level"]);
                     }
                     // (upgrade/downgrade)
                     if ($paypal["ccaps"] && preg_match("/^-all/", str_replace("+", "", $paypal["ccaps"]))) {
                         foreach ($user->allcaps as $cap => $cap_enabled) {
                             if (preg_match("/^access_s2member_ccap_/", $cap)) {
                                 $user->remove_cap($ccap = $cap);
                             }
                         }
                     }
                     if ($paypal["ccaps"] && preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) {
                         foreach (preg_split("/[\r\n\t\\s;,]+/", preg_replace("/^-all[\r\n\t\\s;,]*/", "", str_replace("+", "", $paypal["ccaps"]))) as $ccap) {
                             if (strlen($ccap = trim(strtolower(preg_replace("/[^a-z_0-9]/i", "", $ccap))))) {
                                 $user->add_cap("access_s2member_ccap_" . $ccap);
                             }
                         }
                     }
                     update_user_option($user_id, "s2member_subscr_gateway", $paypal["subscr_gateway"]);
                     update_user_option($user_id, "s2member_subscr_id", $paypal["subscr_id"]);
                     update_user_option($user_id, "s2member_custom", $paypal["custom"]);
                     if (!get_user_option("s2member_registration_ip", $user_id)) {
                         update_user_option($user_id, "s2member_registration_ip", $paypal["ip"]);
                     }
                     update_user_option($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars);
                     delete_user_option($user_id, "s2member_file_download_access_log");
                     delete_user_option($user_id, "s2member_auto_eot_time");
                     $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
                     $pr_times["level"] = !$pr_times["level"] ? time() : $pr_times["level"];
                     // Preserves existing.
                     $pr_times["level" . $paypal["level"]] = !$pr_times["level" . $paypal["level"]] ? time() : $pr_times["level" . $paypal["level"]];
                     update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
                     // Update now.
                     c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, "/^Demoted by s2Member\\:/");
                     c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, "/^Paid Subscr\\. ID @ time of demotion\\:/");
                     $paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-notify-in-subscr-modify-w-level.inc.php

示例11: new_user_notification

 /**
  * Handles new User/Member notifications.
  *
  * @package s2Member\Email_Configs
  * @since 110707
  *
  * @param string|int $user_id A numeric WordPress User ID.
  * @param string $user_pass Optional. A plain text version of the User's password.
  * 	If omitted, only the administrative notification will be sent.
  * @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
  * @param string $user_email Optional. This defaults to the user's currently configured email address.
  * @return bool True if all required parameters are supplied, else false.
  */
 public static function new_user_notification($user_id = 0, $user_pass = '', $notify = array('user', 'admin'), $user_email = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_new_user_notification', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $user_id = (int) $user_id;
     $user_pass = (string) $user_pass;
     $notify = (array) $notify;
     $user_email = (string) $user_email;
     if (!$user_pass && !empty($GLOBALS['ws_plugin__s2member_plain_text_pass'])) {
         $user_pass = (string) $GLOBALS['ws_plugin__s2member_plain_text_pass'];
     }
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && $notify) {
         $is_gte_wp43 = version_compare(get_bloginfo('version'), '4.3', '>=');
         $email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
         c_ws_plugin__s2member_email_configs::email_config_release();
         if (in_array('user', $notify, true) && empty($GLOBALS['ws_plugin__s2member_custom_wp_login_bp_password']) && ($user_pass && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%user_pass%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false || $is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'] = sprintf(_x("Your Username/Password for:\n%s\n\nUsername: %%%%user_login%%%%\nTo set your password, visit: %%%%wp_set_pass_url%%%%\n\n%%%%wp_login_url%%%%", 's2member-front', 's2member'), get_bloginfo('name')), '%%wp_set_pass_url%%') !== false)) {
             if ($is_gte_wp43 && stripos($GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message'], '%%wp_set_pass_url%%') !== false) {
                 remove_filter('random_password', 'c_ws_plugin__s2member_registrations::generate_password');
                 $user_activation_key = wp_generate_password(20, false);
                 // ↑ Make sure it's w/o filter.
                 do_action('retrieve_password_key', $user->user_login, $user_activation_key);
                 if (!class_exists('PasswordHash')) {
                     require_once ABSPATH . WPINC . '/class-phpass.php';
                 }
                 $wp_hasher = new PasswordHash(8, true);
                 $user_activation_key_hash = time() . ':' . $wp_hasher->HashPassword($user_activation_key);
                 $GLOBALS['wpdb']->update($GLOBALS['wpdb']->users, array('user_activation_key' => $user_activation_key_hash), array('user_login' => $user->user_login));
                 $wp_set_pass_url_args = array('action' => 'rp', 'key' => $user_activation_key, 'login' => $user->user_login);
                 $wp_set_pass_url = add_query_arg(urlencode_deep($wp_set_pass_url_args), wp_login_url());
             } else {
                 $wp_set_pass_url = wp_lostpassword_url();
             }
             // Default behavior; and older versions of WordPress.
             $fields = get_user_option('s2member_custom_fields', $user_id);
             $cv = preg_split('/\\|/', get_user_option('s2member_custom', $user_id));
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $label = c_ws_plugin__s2member_user_access::user_access_label($user);
             $level = c_ws_plugin__s2member_user_access::user_access_level($user);
             $ccaps = implode(',', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
             $user->user_email = $user_email ? $user_email : $user->user_email;
             $user_full_name = trim($user->first_name . ' ' . $user->last_name);
             $user_ip = $_SERVER['REMOTE_ADDR'];
             if ($sbj = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_subject']) {
                 if ($sbj = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $sbj)) {
                     if ($sbj = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $sbj)) {
                         if ($sbj = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $sbj)) {
                             if ($sbj = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $sbj)) {
                                 if ($sbj = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $sbj)) {
                                     if ($sbj = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $sbj)) {
                                         if ($sbj = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $sbj)) {
                                             if ($sbj = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $sbj)) {
                                                 if ($sbj = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $sbj)) {
                                                     if ($sbj = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $sbj)) {
                                                         if ($sbj = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $sbj)) {
                                                             if ($sbj = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $sbj)) {
                                                                 if ($sbj = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $sbj)) {
                                                                     if ($sbj = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $sbj)) {
                                                                         if ($sbj = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $sbj)) {
                                                                             if (is_array($fields) && !empty($fields)) {
                                                                                 foreach ($fields as $var => $val) {
                                                                                     // Custom Registration/Profile Fields.
                                                                                     if (!($sbj = preg_replace('/%%' . preg_quote($var, '/') . '%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                         break;
                                                                                     }
                                                                                 }
                                                                             }
                                                                             // Empty; we can stop here.
                                                                             if ($msg = $GLOBALS['WS_PLUGIN__']['s2member']['o']['new_user_email_message']) {
                                                                                 if ($msg = preg_replace('/%%cv([0-9]+)%%/ei', 'trim(@$cv[$1])', $msg)) {
                                                                                     if ($msg = preg_replace('/%%wp_set_pass_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($wp_set_pass_url), $msg)) {
                                                                                         if ($msg = preg_replace('/%%wp_login_url%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(wp_login_url()), $msg)) {
                                                                                             if ($msg = preg_replace('/%%role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($role), $msg)) {
                                                                                                 if ($msg = preg_replace('/%%label%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($label), $msg)) {
                                                                                                     if ($msg = preg_replace('/%%level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($level), $msg)) {
                                                                                                         if ($msg = preg_replace('/%%ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($ccaps), $msg)) {
                                                                                                             if ($msg = preg_replace('/%%user_first_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->first_name), $msg)) {
                                                                                                                 if ($msg = preg_replace('/%%user_last_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->last_name), $msg)) {
                                                                                                                     if ($msg = preg_replace('/%%user_full_name%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_full_name), $msg)) {
                                                                                                                         if ($msg = preg_replace('/%%user_email%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_email), $msg)) {
                                                                                                                             if ($msg = preg_replace('/%%user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user->user_login), $msg)) {
                                                                                                                                 if ($msg = preg_replace('/%%user_pass%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_pass), $msg)) {
                                                                                                                                     if ($msg = preg_replace('/%%user_ip%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_ip), $msg)) {
                                                                                                                                         if ($msg = preg_replace('/%%user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs($user_id), $msg)) {
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:email-configs.inc.php

示例12: fill_login_redirect_rc_vars

 /**
  * Fills Replacement Codes in Special Redirection URLs.
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  *
  * @param str $url A URL with possible Replacement Codes in it.
  * @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  * @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
  * @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
  */
 public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $url = (string) $url;
     /* Force ``$url`` to a string value. */
     $orig_url = $url;
     /* Record the original URL that was passed in. */
     /**/
     $user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
     /**/
     $user_id = $user ? (string) $user->ID : "";
     $user_login = $user ? (string) strtolower($user->user_login) : "";
     /**/
     $user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
     $user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
     $user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
     $user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
     /**/
     $url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
     $url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
     $url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
     $url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
     $url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
     $url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
     /**/
     if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
         $url = site_url("/");
     }
     /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */
     /**/
     if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
         $url = false;
     }
     /* In case we need to return false on root URLs ( i.e. don't protect the Home Page inadvertently ). */
     /**/
     return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:52,代码来源:login-redirects.inc.php

示例13: handle_profile_modifications_4bp

 /**
  * Handles Profile modifications for Custom Fields *(created with s2Member)*; integrated with BuddyPress.
  *
  * @package s2Member\Profiles
  * @since 3.5
  *
  * @attaches-to ``add_action('xprofile_updated_profile');``
  */
 public static function handle_profile_modifications_4bp()
 {
     global $current_user;
     // We'll need to update this global object.
     $user =& $current_user;
     // Shorter reference to the ``$current_user`` object.
     do_action('ws_plugin__s2member_before_handle_profile_modifications_4bp', get_defined_vars());
     if (!empty($_POST['ws_plugin__s2member_profile_4bp_save']) && is_user_logged_in() && is_object($user) && !empty($user->ID) && ($user_id = $user->ID)) {
         if (($nonce = $_POST['ws_plugin__s2member_profile_4bp_save']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-profile-4bp-save')) {
             $GLOBALS['ws_plugin__s2member_profile_4bp_saved'] = TRUE;
             // Global flag as having been saved/updated successfully.
             $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
             // Clean ``$_POST`` vars.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) {
                 if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile')) {
                     $fields = array();
                     // Initialize the array of fields.
                     $_existing_fields = get_user_option('s2member_custom_fields', $user_id);
                     foreach (json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field) {
                         $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
                         $field_id_class = preg_replace('/_/', '-', $field_var);
                         if (!in_array($field['id'], $fields_applicable) || strpos($field['editable'], 'no') === 0) {
                             if (isset($_existing_fields[$field_var]) && (is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var]) || is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))) {
                                 $fields[$field_var] = $_existing_fields[$field_var];
                             } else {
                                 unset($fields[$field_var]);
                             }
                         } else {
                             if ($field['required'] === 'yes' && (!isset($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) || !is_array($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && !is_string($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) || is_array($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && empty($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) || is_string($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && !strlen($_p['ws_plugin__s2member_profile_4bp_' . $field_var])) || isset($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_4bp_' . $field_var]), array($field))) {
                                 if (isset($_existing_fields[$field_var]) && (is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var]) || is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))) {
                                     $fields[$field_var] = $_existing_fields[$field_var];
                                 } else {
                                     unset($fields[$field_var]);
                                 }
                             } else {
                                 if (isset($_p['ws_plugin__s2member_profile_4bp_' . $field_var])) {
                                     if ((is_array($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && !empty($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) || is_string($_p['ws_plugin__s2member_profile_4bp_' . $field_var]) && strlen($_p['ws_plugin__s2member_profile_4bp_' . $field_var])) && !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_4bp_' . $field_var]), array($field))) {
                                         $fields[$field_var] = $_p['ws_plugin__s2member_profile_4bp_' . $field_var];
                                     } else {
                                         unset($fields[$field_var]);
                                     }
                                 } else {
                                     unset($fields[$field_var]);
                                 }
                             }
                         }
                     }
                     if (!empty($fields)) {
                         update_user_option($user_id, 's2member_custom_fields', $fields);
                     } else {
                         // Else delete their Custom Fields?
                         delete_user_option($user_id, 's2member_custom_fields');
                     }
                 }
             }
             foreach (array_keys(get_defined_vars()) as $__v) {
                 $__refs[$__v] =& ${$__v};
             }
             do_action('ws_plugin__s2member_during_handle_profile_modifications_4bp', get_defined_vars());
             unset($__refs, $__v);
             clean_user_cache($user_id);
             wp_cache_delete($user_id, 'user_meta');
             $user = new WP_User($user_id);
             // Fresh object.
             if (function_exists('setup_userdata')) {
                 setup_userdata();
             }
             $role = c_ws_plugin__s2member_user_access::user_access_role($user);
             $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
             if (!empty($_p['ws_plugin__s2member_profile_4bp_opt_in']) && $role && $level >= 0) {
                 c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
             } else {
                 if ($role && $level >= 0 && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in']) {
                     c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
                 }
             }
         }
     }
     do_action('ws_plugin__s2member_after_handle_profile_modifications_4bp', get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:88,代码来源:profile-mods-4bp-in.inc.php

示例14: cp

 /**
  * s2Member's PayPal IPN handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
  *
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars, EXTR_OVERWRITE | EXTR_REFS);
     // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
     if ((!empty($paypal['txn_type']) && preg_match('/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i', $paypal['txn_type']) && ($recurring = TRUE) || !empty($paypal['txn_type']) && preg_match('/^recurring_payment_profile_cancel$/i', $paypal['txn_type']) && !empty($paypal['initial_payment_status']) && preg_match('/^failed$/i', $paypal['initial_payment_status']) && ($recurring = TRUE) || !empty($paypal['txn_type']) && preg_match('/^new_case$/i', $paypal['txn_type']) && !empty($paypal['case_type']) && preg_match('/^chargeback$/i', $paypal['case_type']) && !($recurring = FALSE) || !empty($paypal['payment_status']) && preg_match('/^(refunded|reversed|reversal)$/i', $paypal['payment_status']) && !($recurring = FALSE)) && (!empty($paypal['subscr_id']) || ($paypal['subscr_id'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id($paypal)) || !empty($paypal['parent_txn_id']) && ($paypal['subscr_id'] = $paypal['parent_txn_id'])) && (!empty($paypal['period1']) || ($paypal['period1'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1($paypal, FALSE)) || empty($recurring) || ($paypal['period1'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('period1', FALSE, $paypal['subscr_id'])) || ($paypal['period1'] = '0 D')) && (!empty($paypal['period3']) || ($paypal['period3'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3($paypal, FALSE)) || empty($recurring) || ($paypal['period3'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('period3', FALSE, $paypal['subscr_id'])) || ($paypal['period3'] = '1 D')) && ((!empty($paypal['item_number']) || ($paypal['item_number'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number($paypal)) || ($paypal['item_number'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('item_number', FALSE, $paypal['subscr_id'])) || ($paypal['item_number'] = '1')) && preg_match($GLOBALS['WS_PLUGIN__']['s2member']['c']['membership_item_number_w_level_regex'], $paypal['item_number'])) && (!empty($paypal['item_name']) || ($paypal['item_name'] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name($paypal)) || ($paypal['item_name'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('item_name', FALSE, $paypal['subscr_id'])) || ($paypal['item_name'] = $_SERVER['HTTP_HOST'])) && (!empty($paypal['payer_email']) || ($paypal['payer_email'] = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('payer_email', FALSE, $paypal['subscr_id'])) || ($paypal['payer_email'] = c_ws_plugin__s2member_utils_users::get_user_email_with($paypal['subscr_id']))) && (!empty($paypal['subscr_baid']) || ($paypal['subscr_baid'] = $paypal['subscr_id'])) && (!empty($paypal['subscr_cid']) || ($paypal['subscr_cid'] = $paypal['subscr_id']))) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action('ws_plugin__s2member_during_paypal_notify_before_subscr_eot', get_defined_vars());
         unset($__refs, $__v);
         // Housekeeping.
         if (!get_transient($transient_ipn = 's2m_ipn_' . md5('s2member_transient_' . $_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10)) {
             $is_refund = preg_match('/^refunded$/i', $paypal['payment_status']) && !empty($paypal['parent_txn_id']);
             $is_reversal = preg_match('/^(reversed|reversal)$/i', $paypal['payment_status']) && !empty($paypal['parent_txn_id']);
             $is_reversal = !$is_reversal ? preg_match('/^new_case$/i', $paypal['txn_type']) && preg_match('/^chargeback$/i', $paypal['case_type']) : $is_reversal;
             $is_refund_or_reversal = $is_refund || $is_reversal;
             // If either of the previous tests above evaluated to true; then it's obviously a Refund and/or a Reversal.
             $is_partial_refund = !$is_refund || !empty($paypal['mc_gross']) && ($original_txn_type = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('txn_type', FALSE, $paypal['subscr_id'])) === 'web_accept' && ($original_mc_gross = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_var('mc_gross', FALSE, $paypal['subscr_id'])) <= abs($paypal['mc_gross']) ? FALSE : TRUE;
             $is_delayed_eot = !$is_refund_or_reversal && preg_match('/^(subscr_eot|recurring_payment_expired)$/i', $paypal['txn_type']) && preg_match('/^I-/i', $paypal['subscr_id']);
             if ($is_refund_or_reversal) {
                 $paypal['s2member_log'][] = 's2Member `txn_type` identified as ' . ($identified_as = '( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` )') . '.';
             } else {
                 $paypal['s2member_log'][] = 's2Member `txn_type` identified as ' . ($identified_as = '( `subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment` ) - or - `recurring_payment_profile_cancel` w/ `initial_payment_status` ( `failed` )') . '.';
             }
             if (empty($_REQUEST['s2member_paypal_proxy'])) {
                 $paypal['s2member_log'][] = 'Sleeping for 15 seconds. Waiting for a possible ( `subscr_signup|subscr_modify|recurring_payment_profile_created` ).';
                 sleep(15);
                 // Sleep here for a moment. PayPal sometimes sends a subscr_eot before the subscr_signup, subscr_modify.
                 $paypal['s2member_log'][] = 'Awake. It\'s ' . date('D M j, Y g:i:s a T') . '. s2Member `txn_type` identified as ' . $identified_as . '.';
             }
             $paypal['ip'] = preg_match('/ip address/i', $paypal['option_name2']) && $paypal['option_selection2'] ? $paypal['option_selection2'] : '';
             $paypal['ip'] = !$paypal['ip'] && preg_match('/^[a-z0-9]+~[0-9\\.]+$/i', $paypal['invoice']) ? preg_replace('/^[a-z0-9]+~/i', '', $paypal['invoice']) : $paypal['ip'];
             $paypal['currency'] = strtoupper($paypal['mc_currency']);
             // Normalize input currency.
             $paypal['currency_symbol'] = c_ws_plugin__s2member_utils_cur::symbol($paypal['currency']);
             if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($paypal['subscr_id'])) && is_object($user = new WP_User($user_id)) && !empty($user->ID)) {
                 $fields = get_user_option('s2member_custom_fields', $user_id);
                 // These will be needed below.
                 $user_reg_ip = get_user_option('s2member_registration_ip', $user_id);
                 // Needed below.
                 $user_reg_ip = $paypal['ip'] = $user_reg_ip ? $user_reg_ip : $paypal['ip'];
                 if (!$is_refund_or_reversal && !$is_delayed_eot && !get_user_option('s2member_auto_eot_time', $user_id) || $is_refund_or_reversal && $is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,partial_refunds,reversals' || $is_refund_or_reversal && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,partial_refunds,reversals' || $is_refund_or_reversal && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,reversals' || $is_refund && !$is_partial_refund && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds' || $is_reversal && $GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'reversals') {
                     if (!$user->has_cap('administrator')) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled']) {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_eot_behavior'] === 'demote') {
                                 $processing = $during = TRUE;
                                 // Yes, we ARE processing this.
                                 $eot_del_type = $is_refund_or_reversal ? 'ipn-refund-reversal-demotion' : 'ipn-cancellation-expiration-demotion';
                                 $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_paypal_notify_during_subscr_eot_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) {
                                     // Only if NOT the existing Role.
                                     $user->set_role($demotion_role);
                                 }
                                 // Give User the demotion Role.
                                 if (apply_filters('ws_plugin__s2member_remove_ccaps_during_eot_events', (bool) $GLOBALS['WS_PLUGIN__']['s2member']['o']['eots_remove_ccaps'] || $is_refund_or_reversal, 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', time());
                                 c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Demoted by s2Member: ' . date('D M j, Y g:i a T'));
                                 c_ws_plugin__s2member_user_notes::append_user_notes($user_id, 'Paid Subscr. ID @ time of demotion: ' . $paypal['subscr_gateway'] . ' → ' . $paypal['subscr_id']);
                                 $paypal['s2member_log'][] = 'Member Level/Capabilities demoted to: ' . ucwords(preg_replace('/_/', ' ', $demotion_role)) . '.';
                                 if ($processing && $GLOBALS['WS_PLUGIN__']['s2member']['o']['eot_del_notification_urls'] && is_array($cv = preg_split('/\\|/', $paypal['custom']))) {
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:paypal-notify-in-subscr-or-rp-eots-w-level.inc.php

示例15: 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 = 3)
 {
     global $wpdb;
     global $current_site, $current_blog;
     include_once ABSPATH . "wp-admin/includes/admin.php";
     @set_time_limit(0);
     @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);
     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) {
                     delete_user_option($user_id, "s2member_auto_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";
                             $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);
                             $fields = get_user_option("s2member_custom_fields", $user_id);
                             $user_reg_ip = get_user_option("s2member_registration_ip", $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);
                             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_custom");
                             delete_user_option($user_id, "s2member_subscr_id");
                             delete_user_option($user_id, "s2member_subscr_gateway");
                             delete_user_option($user_id, "s2member_ipn_signup_vars");
                             if (!apply_filters("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars())) {
                                 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_auto_eot_time");
                             delete_user_option($user_id, "s2member_file_download_access_log");
                             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_ds(urlencode("auto-eot-cancellation-expiration-demotion")), $url)) && ($url = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(urlencode($subscr_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);
                                                                 }
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:auto-eots.inc.php


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