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


PHP c_ws_plugin__s2member_utilities::mms_options方法代码示例

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


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

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

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


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