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


PHP c_ws_plugin__s2member_user_access类代码示例

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


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

示例1: synchronize_paid_reg_times

 /**
  * Synchronizes Paid Registration Times with Role assignments.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action("set_user_role");``
  *
  * @param integer|string $user_id A numeric WordPress User ID should be passed in by the Action Hook.
  * @param string         $role A WordPress Role ID/Name should be passed in by the Action Hook.
  *
  * @return null
  */
 public static function synchronize_paid_reg_times($user_id = FALSE, $role = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
     unset($__refs, $__v);
     if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level($user)) > 0) {
         $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
         $pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
         $pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
         update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
         // Update now.
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:28,代码来源:registration-times.inc.php

示例2: synchronize_paid_reg_times

 /**
  * Synchronizes Paid Registration Times with Role assignments.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action("set_user_role");``
  *
  * @param int|str $user_id A numeric WordPress® User ID should be passed in by the Action Hook.
  * @param str $role A WordPress® Role ID/Name should be passed in by the Action Hook.
  * @return null
  */
 public static function synchronize_paid_reg_times($user_id = FALSE, $role = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level($user)) > 0) {
         $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
         $pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
         $pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
         update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
         /* Update now. */
     }
     /**/
     return;
     /* Return for uniformity. */
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:30,代码来源:registration-times.inc.php

示例3: login_redirect

 /**
  * Handles Pro login redirections.
  *
  * @package s2Member\Login_Redirects
  * @since 110720
  *
  * @attaches-to ``add_filter("ws_plugin__s2member_login_redirect");``
  *
  * @param bool|str $redirect Expects a boolean value of true|false, or a non-empty string, passed through by the Filter.
  * @param array $vars Expects an array of defined variables, passed in by the Filter.
  * @return bool|str A One-Time-Offer redirection URL, else the original value.
  */
 public static function login_redirect($redirect = FALSE, $vars = FALSE)
 {
     if ($redirect && ($user = $vars["user"]) && ($logins = $vars["logins"])) {
         foreach (preg_split("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_login_welcome_page_otos"]) as $oto) {
             if (($oto = trim($oto)) && preg_match("/^(?:([0-9]+)\\:)(?:([0-9]+)\\:)?(.+)\$/", $oto, $m)) {
                 list(, $number_of_logins, $level, $url) = $m;
                 // Assign variables.
                 if ((int) $number_of_logins === (int) $logins) {
                     // One-Time-Offer applies?
                     if (!is_numeric($level) || c_ws_plugin__s2member_user_access::user_access_level($user) === (int) $level) {
                         if ($url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars($url, $user)) {
                             return $redirect = $url;
                         }
                     }
                 }
             }
         }
     }
     return $redirect;
     // Return ``$redirect`` value.
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:33,代码来源:login-redirects.inc.php

示例4: login_redirect

 /**
  * Handles Pro login redirections.
  *
  * @package s2Member\Login_Redirects
  * @since 110720
  *
  * @attaches-to ``add_filter('ws_plugin__s2member_login_redirect');``
  *
  * @param bool|string $redirect Expects a boolean value of true|false, or a non-empty string, passed through by the Filter.
  * @param array       $vars Expects an array of defined variables, passed in by the Filter.
  *
  * @return bool|string A One-Time-Offer redirection URL, else the original value.
  */
 public static function login_redirect($redirect = FALSE, $vars = array())
 {
     if ($redirect && !empty($vars['user']) && !empty($vars['logins'])) {
         foreach (preg_split('/[' . "\r\n\t" . ']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_login_welcome_page_otos']) as $oto) {
             if (($oto = trim($oto)) && preg_match('/^(?:([0-9]+)\\:)(?:([0-9]+)\\:)?(.+)$/', $oto, $m)) {
                 list(, $number_of_logins, $level, $url) = $m;
                 // Assign variables.
                 if ((int) $number_of_logins === (int) $vars['logins']) {
                     // One-Time-Offer applies?
                     if (!is_numeric($level) || c_ws_plugin__s2member_user_access::user_access_level($vars['user']) === (int) $level) {
                         if ($url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars($url, $vars['user'])) {
                             return $redirect = $url;
                         }
                     }
                 }
             }
         }
     }
     return $redirect;
     // Return ``$redirect`` value.
 }
开发者ID:codeforest,项目名称:s2member-pro,代码行数:34,代码来源:login-redirects.inc.php

示例5: translation_mangler

 /**
  * Handles internal translations via `gettext` Filter.
  *
  * Important note. Because this routine also uses translation functionality by WordPress,
  * anything translated by this routine MUST be different, otherwise it will result in a recursive loop,
  * because the ``__()`` family of functions would be called upon recursively by this routine.
  *
  * If you're translating s2Member into a different language, your MO file for s2Member will automagically deal with
  * everything you see below. No worries. Just build your translation file for s2Member, and you're all set.
  *
  * @package s2Member\Translations
  * @since 3.5
  *
  * @attaches-to ``add_filter("gettext");``
  *
  * @param string $translated Expects already-translated string passed in by Filter.
  * @param string $original Expects original text string passed in by Filter.
  * @param string $domain Expects translation domain passed in by Filter.
  *
  * @return string Translated string, possibly modified by this routine.
  */
 public static function translation_mangler($translated = '', $original = '', $domain = '')
 {
     global $current_site, $current_blog;
     // In support of Multisite Networking.
     static $s = array();
     // This static array optimizes all of these routines.
     if (isset($s["is_wp_login"]) && $s["is_wp_login"] || !isset($s["is_wp_login"]) && ($s["is_wp_login"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && empty($_REQUEST["action"]) && empty($_REQUEST["checkemail"]) ? TRUE : FALSE)) {
         if ($original === "Username") {
             $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Username:", "s2member-front", "s2member"), get_defined_vars());
         } else {
             if ($original === "Password") {
                 $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("My Password:", "s2member-front", "s2member"), get_defined_vars());
             }
         }
     } else {
         if (isset($s["is_wp_login_register"]) && $s["is_wp_login_register"] || !isset($s["is_wp_login_register"]) && ($s["is_wp_login_register"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && !empty($_REQUEST["action"]) && $_REQUEST["action"] === "register" ? TRUE : FALSE)) {
             if ($original === "Username") {
                 $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Username *", "s2member-front", "s2member"), get_defined_vars());
             } else {
                 if ($original === "Password") {
                     $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Password *", "s2member-front", "s2member"), get_defined_vars());
                 } else {
                     if ($original === "E-mail") {
                         $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Email Address *", "s2member-front", "s2member"), get_defined_vars());
                     }
                 }
             }
         } else {
             if (isset($s["is_wp_login_checkemail"]) && $s["is_wp_login_checkemail"] || !isset($s["is_wp_login_checkemail"]) && ($s["is_wp_login_checkemail"] = strpos($_SERVER["REQUEST_URI"], "/wp-login.php") !== FALSE && empty($_REQUEST["action"]) && !empty($_REQUEST["checkemail"]) && $_REQUEST["checkemail"] === "registered" ? TRUE : FALSE)) {
                 if ($original === "Registration complete. Please check your e-mail." && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) {
                     $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("Registration complete. Please log in.", "s2member-front", "s2member"), get_defined_vars());
                 }
             } else {
                 if (isset($s["is_user_new"]) && $s["is_user_new"] || !isset($s["is_user_new"]) && ($s["is_user_new"] = strpos($_SERVER["REQUEST_URI"], "/wp-admin/user-new.php") !== FALSE ? TRUE : FALSE)) {
                     if ($original === "Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n" && !empty($_REQUEST["role"]) && preg_match("/^(subscriber|s2member_level[0-9]+)\$/", $_REQUEST["role"])) {
                         $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x("You have been invited to join `%1\$s` at\n%2\$s as a Member.\nPlease click the following link to confirm the invite:\n%4\$s\n", "s2member-front", "s2member"), get_defined_vars());
                     }
                 } else {
                     if (isset($s["is_wp_activate"]) && $s["is_wp_activate"] || !isset($s["is_wp_activate"]) && ($s["is_wp_activate"] = strpos($_SERVER["REQUEST_URI"], "/wp-activate.php") !== FALSE ? TRUE : FALSE)) {
                         if ($original === 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>') {
                             $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('Your account is now active. <a href="%1$s">Visit site</a> or <a href="%2$s">Log in</a>.', "s2member-front", "s2member"), get_defined_vars());
                         }
                     } else {
                         if (isset($s["is_wp_signup"]) && $s["is_wp_signup"] || !isset($s["is_wp_signup"]) && ($s["is_wp_signup"] = strpos($_SERVER["REQUEST_URI"], "/wp-signup.php") !== FALSE ? TRUE : FALSE)) {
                             if ($original === "If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!") {
                                 $translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars());
                             } else {
                                 if ($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!") {
                                     if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
                                         $mms_options = c_ws_plugin__s2member_utilities::mms_options();
                                         $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
                                         $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                                         $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                                         // NOT less than zero.
                                         $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                                         $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . ($blogs_allowed > 1 ? '<br />' . sprintf(_nx('You may create <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
                                     }
                                 }
                             }
                         } else {
                             if (isset($s["is_bp_blog_creation"]) && $s["is_bp_blog_creation"] || !isset($s["is_bp_blog_creation"]) && ($s["is_bp_blog_creation"] = c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_create_blog() ? TRUE : FALSE)) {
                                 if ($original === "If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!") {
                                     $translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars());
                                 } else {
                                     if ($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!") {
                                         if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
                                             $mms_options = c_ws_plugin__s2member_utilities::mms_options();
                                             $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
                                             $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                                             $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                                             // NOT less than zero.
                                             $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                                             $translated = apply_filters("ws_plugin__s2member_translation_mangler", _x('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . ($blogs_allowed > 1 ? '<br />' . sprintf(_nx('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:translations.inc.php

示例6: 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

示例7: cp

 /**
  * s2Member's PayPal Auto-Return/PDT 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_return_in::paypal_return()}.
  * @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);
     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"])) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_rtn = "s2m_rtn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10)) {
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `subscr_modify` ), a Subscription Modification.";
             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["ip"] = !$paypal["ip"] && $_SERVER["REMOTE_ADDR"] ? $_SERVER["REMOTE_ADDR"] : $paypal["ip"];
             $paypal["period1"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             $paypal["mc_amount1"] = strlen($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";
                 $paypal["mc_amount3"] = $paypal["mc_gross"];
             }
             $paypal["initial_term"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
             $paypal["initial"] = strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
             $paypal["regular"] = $paypal["mc_amount3"];
             $paypal["regular_term"] = $paypal["period3"];
             $paypal["recurring"] = $paypal["recurring"] ? $paypal["mc_amount3"] : "0";
             $ipn_signup_vars = $paypal;
             /* Create array of wouldbe IPN signup vars w/o s2member_log. */
             unset($ipn_signup_vars["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;
                     foreach (array_keys(get_defined_vars()) as $__v) {
                         $__refs[$__v] =& ${$__v};
                     }
                     do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_modify", 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);
                     $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_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"];
                     $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);
                     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 ( `subscr_modify` ), a Subscription Modification.";
                     setcookie("s2member_tracking", $s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt($paypal["subscr_id"]), time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_tracking", $s2member_tracking, time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
                     $paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `subscr_modify` ), a Subscription Modification.";
                     if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split("/\\|/", $paypal["custom"]))) {
                         if (($code = preg_replace("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["subscr_id"]), $code))) {
                             if (($code = preg_replace("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial"]), $code)) && ($code = preg_replace("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular"]), $code)) && ($code = preg_replace("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["recurring"]), $code))) {
                                 if (($code = preg_replace("/%%initial_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["initial_term"]), $code)) && ($code = preg_replace("/%%regular_term%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["regular_term"]), $code))) {
                                     if (($code = preg_replace("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_number"]), $code)) && ($code = preg_replace("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["item_name"]), $code))) {
                                         if (($code = preg_replace("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["first_name"]), $code)) && ($code = preg_replace("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["last_name"]), $code))) {
                                             if ($code = preg_replace("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(trim($paypal["first_name"] . " " . $paypal["last_name"])), $code)) {
                                                 if ($code = preg_replace("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($paypal["payer_email"]), $code)) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-return-in-subscr-modify-w-level.inc.php

示例8: constants

 /**
  * Defines several API Constants for s2Member.
  *
  * These are also duplicated into the JavaScript API for s2Member.
  * Except for a few that would pose a security issue. Such as the PayPal API Credentials;
  * those are NOT included in the JavaScript API.
  *
  * @package s2Member\API_Constants
  * @since 3.5
  *
  * @attaches-to ``add_action('init');``
  *
  * @return null
  */
 public static function constants()
 {
     do_action('ws_plugin__s2member_before_constants', get_defined_vars());
     $c = array();
     // Initialize configuration values array.
     $links = c_ws_plugin__s2member_cache::cached_page_links();
     $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID ? $user : FALSE;
     $level = c_ws_plugin__s2member_user_access::user_access_level($user);
     $file_downloads = c_ws_plugin__s2member_files::user_downloads($user);
     $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
     $custom = $user ? get_user_option('s2member_custom', $user->ID) : '';
     $subscr_id = $user ? get_user_option('s2member_subscr_id', $user->ID) : '';
     $subscr_gateway = $user ? get_user_option('s2member_subscr_gateway', $user->ID) : '';
     $registration_ip = $user ? get_user_option('s2member_registration_ip', $user->ID) : '';
     $custom_fields = $user ? get_user_option('s2member_custom_fields', $user->ID) : array();
     $paid_registration_times = $user ? get_user_option('s2member_paid_registration_times', $user->ID) : array();
     $login_counter = $user ? (int) get_user_option('s2member_login_counter') : -1;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_during_constants', get_defined_vars());
     unset($__refs, $__v);
     /**
      * Current version of s2Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_VERSION; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_VERSION" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_VERSION);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\WS_PLUGIN__S2MEMBER_VERSION
      */
     if (!defined('S2MEMBER_VERSION')) {
         define('S2MEMBER_VERSION', $c[] = (string) WS_PLUGIN__S2MEMBER_VERSION);
     }
     /**
      * The number of times the current User has logged into your site.
      *
      * Negative `-1` through number of times logged-in.
      * Negative `-1` indicates they are NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_LOGIN_COUNTER; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN_COUNTER" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_LOGIN_COUNTER);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 110720
      *
      * @var int
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_login_counter')`
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_LOGIN_COUNTER')) {
         define('S2MEMBER_CURRENT_USER_LOGIN_COUNTER', $c[] = (int) $login_counter);
     }
     /**
      * Is the current User logged-in at all.
      *
      * True if the current User IS logged-in, else false.
      *
      * ———— Quick PHP Code Sample ————
//.........这里部分代码省略.........
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:101,代码来源:constants.inc.php

示例9: check_mms_register_access

 /**
  * Allows access to the main Multisite Registration Form.
  *
  * @package s2Member\Option_Forces
  * @since 3.5
  *
  * @attaches-to ``add_filter("pre_site_option_registration");``
  *
  * @param string $users_can_register Expects *( `none`, `all`, `blog`, `user` )*, passed through by the Filter.
  * @return string One of `none|all|user`; depending on several factors.
  */
 public static function check_mms_register_access($users_can_register = FALSE)
 {
     global $wpdb;
     // Global database object reference
     global $current_site, $current_blog;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_check_register_access", get_defined_vars());
     unset($__refs, $__v);
     $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
     if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && is_multisite() && !c_ws_plugin__s2member_utils_conds::is_multisite_farm()) {
         return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = c_ws_plugin__s2member_option_forces::check_register_access() ? "user" : "none", get_defined_vars());
     } else {
         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm()) {
             // Blog Farm?
             return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "none", get_defined_vars());
         } else {
             if (!is_network_admin() && $users_can_register !== "all") {
                 if (is_main_site() && current_user_can("create_users") || is_super_admin()) {
                     return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
                 } else {
                     if (is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID && $user->has_cap("access_s2member_level1")) {
                         $mms_options = c_ws_plugin__s2member_utilities::mms_options();
                         $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
                         $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                         $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                         // NOT less than zero.
                         $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                         if ($user_blogs < $blogs_allowed) {
                             return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
                         }
                     } else {
                         if (!is_user_logged_in() && is_main_site() && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
                             if (preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $m[1]])) {
                                 return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "all", get_defined_vars());
                             } else {
                                 return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "user", get_defined_vars());
                             }
                         }
                     }
                 }
             } else {
                 if (!is_network_admin() && $users_can_register === "all") {
                     if (is_user_logged_in() && !(is_main_site() && current_user_can("create_users")) && !is_super_admin() && is_object($user = wp_get_current_user()) && $user->ID && is_object($user = new WP_User($user->ID, $current_site->blog_id)) && $user->ID) {
                         $mms_options = c_ws_plugin__s2member_utilities::mms_options();
                         $blogs_allowed = (int) @$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level($user)];
                         $user_blogs = is_array($blogs = get_blogs_of_user($user->ID)) ? count($blogs) - 1 : 0;
                         $user_blogs = $user_blogs >= 0 ? $user_blogs : 0;
                         // NOT less than zero.
                         $blogs_allowed = $blogs_allowed >= 0 ? $blogs_allowed : 0;
                         if ($user_blogs >= $blogs_allowed) {
                             return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register = "none", get_defined_vars());
                         }
                     }
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:72,代码来源:option-forces.inc.php

示例10: users_list_update_cols

 /**
  * Saves Custom Fields after an admin updates Profile.
  *
  * @package s2Member\Users_List
  * @since 3.5
  *
  * @attaches-to ``add_action("edit_user_profile_update");``
  * @attaches-to ``add_action("personal_options_update");``
  *
  * @param int|str $user_id Expects a numeric WordPress User ID passed in by the Action Hook.
  * @return null
  */
 public static function users_list_update_cols($user_id = FALSE)
 {
     global $current_site, $current_blog;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars());
     unset($__refs, $__v);
     $user = new WP_User($user_id);
     $current_user = is_user_logged_in() ? wp_get_current_user() : false;
     if (is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && is_object($current_user) && !empty($current_user->ID)) {
         if (current_user_can("edit_users") && (!is_multisite() || is_super_admin() || is_user_member_of_blog($user_id))) {
             if (!empty($_POST) && is_array($_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)))) {
                 $old_user = unserialize(serialize($user));
                 $old_role = c_ws_plugin__s2member_user_access::user_access_role($old_user);
                 $role = isset($_p["role"]) && $_p["role"] !== $old_role ? $_p["role"] : $old_role;
                 $level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
                 $user->roles = isset($_p["role"]) && $_p["role"] !== $old_role ? array($_p["role"]) : $old_user->roles;
                 $user->user_email = isset($_p["email"]) && is_email($_p["email"]) && $_p["email"] !== $old_user->user_email && !email_exists($_p["email"]) ? $_p["email"] : $old_user->user_email;
                 $user->first_name = isset($_p["first_name"]) && $_p["first_name"] !== $old_user->first_name ? $_p["first_name"] : $old_user->first_name;
                 $user->last_name = isset($_p["last_name"]) && $_p["last_name"] !== $old_user->last_name ? $_p["last_name"] : $old_user->last_name;
                 $auto_eot_time = !empty($_p["ws_plugin__s2member_profile_s2member_auto_eot_time"]) ? strtotime($_p["ws_plugin__s2member_profile_s2member_auto_eot_time"]) : "";
                 if ($role !== $old_role) {
                     // In this case, we need to fire Hook: `ws_plugin__s2member_during_collective_mods`.
                     do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "user-role-change", "modification", $role, $user, $old_user);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_originating_blog"]) && is_multisite() && is_super_admin()) {
                     update_user_meta($user_id, "s2member_originating_blog", $_p["ws_plugin__s2member_profile_s2member_originating_blog"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_subscr_gateway"])) {
                     update_user_option($user_id, "s2member_subscr_gateway", $_p["ws_plugin__s2member_profile_s2member_subscr_gateway"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_subscr_id"])) {
                     update_user_option($user_id, "s2member_subscr_id", $_p["ws_plugin__s2member_profile_s2member_subscr_id"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_custom"])) {
                     update_user_option($user_id, "s2member_custom", $_p["ws_plugin__s2member_profile_s2member_custom"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_registration_ip"])) {
                     update_user_option($user_id, "s2member_registration_ip", $_p["ws_plugin__s2member_profile_s2member_registration_ip"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_notes"])) {
                     update_user_option($user_id, "s2member_notes", $_p["ws_plugin__s2member_profile_s2member_notes"]);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_auto_eot_time"]) && isset($auto_eot_time)) {
                     update_user_option($user_id, "s2member_auto_eot_time", $auto_eot_time);
                 }
                 if (isset($_p["ws_plugin__s2member_profile_s2member_ccaps"])) {
                     foreach ($user->allcaps as $cap => $cap_enabled) {
                         if (preg_match("/^access_s2member_ccap_/", $cap)) {
                             $user->remove_cap($ccap = $cap);
                         }
                     }
                     if (!empty($_p["ws_plugin__s2member_profile_s2member_ccaps"])) {
                         foreach (preg_split("/[\r\n\t\\s;,]+/", $_p["ws_plugin__s2member_profile_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 ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
                     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 (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])) {
                                 $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 {
                     delete_user_option($user_id, "s2member_custom_fields");
                 }
                 if ($level > 0) {
                     $pr_times = get_user_option("s2member_paid_registration_times", $user_id);
                     $pr_times["level"] = empty($pr_times["level"]) ? time() : $pr_times["level"];
                     $pr_times["level" . $level] = empty($pr_times["level" . $level]) ? time() : $pr_times["level" . $level];
                     update_user_option($user_id, "s2member_paid_registration_times", $pr_times);
                     // Update now.
                 }
//.........这里部分代码省略.........
开发者ID:donwea,项目名称:nhap.org,代码行数:101,代码来源:users-list-in.inc.php

示例11: 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

示例12: custom_fields_configured_at_level

 /**
  * Determines which Custom Fields apply to a specific Level.
  *
  * @package s2Member\Custom_Reg_Fields
  * @since 3.5
  *
  * @param string|int $_level Optional. Defaults to the current User's Access Level number.
  * 	You can either pass in a numeric Level number, or the string `auto-detection`.
  * @param string $_editable_context Optional. One of `profile|profile-view|registration`.
  * @param boolean $full_config Optional. Defaults to a `FALSE` value. `TRUE` to get a full array for each field configuration.
  * @return array Array of Custom Field IDs applicable.
  */
 public static function custom_fields_configured_at_level($_level = "auto-detection", $_editable_context = FALSE, $full_config = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars());
     unset($__refs, $__v);
     $level = $_level === "auto-detection" ? c_ws_plugin__s2member_user_access::user_access_level() : $_level;
     if ($_level === "auto-detection" && $level < 0 && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty($m[1]) && is_numeric($m[1])) {
         $level = $m[1];
     }
     $level = $level !== "any" && (!is_numeric($level) || $level < 0) ? 0 : $level;
     if (($level === "any" || is_numeric($level) && $level >= 0) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) {
         foreach (json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field) {
             if ($level === "any" || $field["levels"] === "all" || in_array($level, preg_split("/[;,]+/", preg_replace("/[^0-9;,]/", "", $field["levels"])))) {
                 if (empty($_editable_context) || $_editable_context === "administrative" || $_editable_context === "registration" && $field["editable"] !== "no-always-invisible" && $field["editable"] !== "yes-invisible" || ($_editable_context === "profile" || $_editable_context === "profile-view") && $field["editable"] !== "no-invisible" && $field["editable"] !== "no-always-invisible") {
                     $configured[] = $full_config ? $field : $field["id"];
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_custom_fields_configured_at_level", !empty($configured) ? $configured : array(), get_defined_vars());
 }
开发者ID:codeforest,项目名称:s2member,代码行数:35,代码来源:custom-reg-fields.inc.php

示例13: cp

 /**
  * s2Member's PayPal Auto-Return/PDT 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_return_in::paypal_return()}.
  * @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);
     if (!empty($paypal["txn_type"]) && preg_match("/^(web_accept|subscr_signup|subscr_payment)\$/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"]))) {
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars());
         unset($__refs, $__v);
         if (!get_transient($transient_rtn = "s2m_rtn_" . md5("s2member_transient_" . $_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10)) {
             $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ).";
             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["ip"] = !$paypal["ip"] && $_SERVER["REMOTE_ADDR"] ? $_SERVER["REMOTE_ADDR"] : $paypal["ip"];
             if (preg_match("/^subscr_payment\$/i", $paypal["txn_type"]) && !empty($_GET["s2member_paypal_return_tra"]) && (($tra = c_ws_plugin__s2member_utils_encryption::decrypt(trim(stripslashes($_GET["s2member_paypal_return_tra"])))) && is_array($tra = maybe_unserialize($tra))) && (count($tra) === 11 && isset($tra["ta"], $tra["tp"], $tra["tt"], $tra["ra"], $tra["rp"], $tra["rt"], $tra["rr"], $tra["rrt"], $tra["rra"], $tra["invoice"], $tra["checksum"])) && $tra["invoice"] === $paypal["invoice"] && $tra["checksum"] === md5($paypal["invoice"] . $paypal["ip"] . $paypal["item_number"])) {
                 $tracking_properties = true;
                 $paypal["period1"] = $tra["rr"] !== "BN" && $tra["tp"] ? $tra["tp"] . " " . $tra["tt"] : "0 D";
                 $paypal["mc_amount1"] = $tra["rr"] !== "BN" && $tra["tp"] ? number_format($tra["ta"], 2, ".", "") : "0.00";
                 $paypal["period3"] = $tra["rp"] . " " . $tra["rt"];
                 $paypal["mc_amount3"] = $tra["ra"];
                 $paypal["recurring"] = $tra["rr"] === "1" ? "1" : "0";
                 $paypal["initial_term"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
                 $paypal["initial"] = strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
                 $paypal["regular"] = $paypal["mc_amount3"];
                 $paypal["regular_term"] = $paypal["period3"];
                 $paypal["recurring"] = $paypal["recurring"] ? $paypal["mc_amount3"] : "0";
                 $ipn_signup_vars = $paypal;
                 /* Create array of wouldbe IPN signup vars w/o s2member_log. */
                 unset($ipn_signup_vars["s2member_log"]);
             } else {
                 if (preg_match("/^(web_accept|subscr_signup)\$/i", $paypal["txn_type"])) {
                     $tracking_properties = true;
                     $paypal["period1"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
                     $paypal["mc_amount1"] = strlen($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";
                         $paypal["mc_amount3"] = $paypal["mc_gross"];
                     }
                     $paypal["initial_term"] = preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["period1"] : "0 D";
                     $paypal["initial"] = strlen($paypal["mc_amount1"]) && preg_match("/^[1-9]/", $paypal["period1"]) ? $paypal["mc_amount1"] : $paypal["mc_amount3"];
                     $paypal["regular"] = $paypal["mc_amount3"];
                     $paypal["regular_term"] = $paypal["period3"];
                     $paypal["recurring"] = $paypal["recurring"] ? $paypal["mc_amount3"] : "0";
                     $ipn_signup_vars = $paypal;
                     /* Create array of wouldbe IPN signup vars w/o s2member_log. */
                     unset($ipn_signup_vars["s2member_log"]);
                 }
             }
             /*
             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);
                 $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;
                         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);
                         $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))))) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:paypal-return-in-subscr-or-wa-w-level.inc.php

示例14: 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 = FALSE, $user_pass = FALSE, $notify = array("user", "admin"), $user_email = FALSE)
 {
     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);
     if ($user_id && ($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify)) {
         $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) && $user_pass) {
             $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_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) {
                                                                                 if (!($sbj = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $sbj))) {
                                                                                     break;
                                                                                 }
                                                                             }
                                                                         }
                                                                         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_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)) {
                                                                                                                                     if (is_array($fields) && !empty($fields)) {
                                                                                                                                         foreach ($fields as $var => $val) {
                                                                                                                                             if (!($msg = preg_replace("/%%" . preg_quote($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_refs(maybe_serialize($val)), $msg))) {
                                                                                                                                                 break;
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                     if (($sbj = trim(preg_replace("/%%(.+?)%%/i", "", $sbj))) && ($msg = trim(preg_replace("/%%(.+?)%%/i", "", $msg)))) {
                                                                                                                                         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
                                                                                                                                             $sbj = c_ws_plugin__s2member_utilities::evl($sbj, get_defined_vars());
                                                                                                                                             $msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
                                                                                                                                         }
                                                                                                                                         c_ws_plugin__s2member_email_configs::email_config() . wp_mail($user->user_email, apply_filters("ws_plugin__s2member_welcome_email_sbj", $sbj, get_defined_vars()), apply_filters("ws_plugin__s2member_welcome_email_msg", $msg, get_defined_vars()), "From: \"" . preg_replace('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release();
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
//.........这里部分代码省略.........
开发者ID:NClaus,项目名称:Ambrose,代码行数:101,代码来源:email-configs.inc.php

示例15: fill_ruri_level_access_rc_vars

 /**
  * Fills Replacement Code variables in URIs; collectively.
  *
  * @package s2Member\URIs
  * @since 3.5
  *
  * @param string $uris A URI string, or a string of multiple URIs is also fine.
  * @param object $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
  *
  * @return string Collective string of input URIs, with Replacement Codes having been filled.
  */
 public static function fill_ruri_level_access_rc_vars($uris = '', $user = NULL)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_fill_ruri_level_access_rc_vars', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $uris = (string) $uris;
     // Force ``$uris`` to a string value.
     $orig_uris = $uris;
     // Record the original URIs that were passed in; collectively.
     $user = (is_object($user) || is_object($user = wp_get_current_user())) && !empty($user->ID) ? $user : NULL;
     $user_id = $user ? (string) $user->ID : '';
     $user_login = $user ? (string) strtolower($user->user_login) : '';
     $user_nicename = $user ? (string) strtolower($user->user_nicename) : '';
     $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';
     $uris = strlen($user_login) ? preg_replace('/%%current_user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_login)), $uris) : $uris;
     $uris = strlen($user_nicename) ? preg_replace('/%%current_user_nicename%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_nicename)), $uris) : $uris;
     $uris = strlen($user_id) ? preg_replace('/%%current_user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $uris) : $uris;
     $uris = strlen($user_level) ? preg_replace('/%%current_user_level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_level)), $uris) : $uris;
     $uris = strlen($user_role) ? preg_replace('/%%current_user_role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_role)), $uris) : $uris;
     $uris = strlen($user_ccaps) ? preg_replace('/%%current_user_ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_ccaps)), $uris) : $uris;
     $uris = strlen($user_logins) ? preg_replace('/%%current_user_logins%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_logins)), $uris) : $uris;
     return apply_filters('ws_plugin__s2member_fill_ruri_level_access_rc_vars', $uris, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:40,代码来源:ruris.inc.php


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