本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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’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’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’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
|
请发表评论