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


PHP c_ws_plugin__s2member_utils_urls::parse_uri方法代码示例

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


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

示例1: check_specific_ruri_level_access

 /**
  * Handles URI Level Access *(for specific URIs)*.
  *
  * @package s2Member\URIs
  * @since 3.5
  *
  * @param string $uri A URI, or a full URL is also fine.
  * @param bool   $check_user Test permissions against the current User? Defaults to true.
  *
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_ruri_level_access($uri = '', $check_user = TRUE)
 {
     do_action('ws_plugin__s2member_before_check_specific_ruri_level_access', get_defined_vars());
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : FALSE;
     $excluded = apply_filters('ws_plugin__s2member_check_specific_ruri_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && !empty($uri) && is_string($uri) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(NULL, $uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             // Current User's object.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0'))) {
                 return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', array('s2member_level_req' => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(NULL, $uri)) {
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                             // URIs configured at this Level?
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                 if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             do_action('ws_plugin__s2member_during_check_specific_ruri_level_access', get_defined_vars());
         }
     }
     return apply_filters('ws_plugin__s2member_check_specific_ruri_level_access', NULL, get_defined_vars());
 }
开发者ID:codeforest,项目名称:s2member,代码行数:42,代码来源:ruris-sp.inc.php

示例2: check_specific_ruri_level_access

 /**
  * Handles URI Level Access *(for specific URIs)*.
  *
  * @package s2Member\URIs
  * @since 3.5
  *
  * @param string $uri A URI, or a full URL is also fine.
  * @param bool $check_user Test permissions against the current User? Defaults to true.
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_ruri_level_access($uri = FALSE, $check_user = TRUE)
 {
     do_action("ws_plugin__s2member_before_check_specific_ruri_level_access", get_defined_vars());
     $uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : false;
     $excluded = apply_filters("ws_plugin__s2member_check_specific_ruri_level_access_excluded", false, get_defined_vars());
     if (!$excluded && !empty($uri) && is_string($uri) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             // Current User's object.
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
                 return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $uri)) {
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                             // URIs configured at this Level?
                             foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                 if ($str && preg_match("/" . preg_quote($str, "/") . "/", $uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             do_action("ws_plugin__s2member_during_check_specific_ruri_level_access", get_defined_vars());
         }
     }
     return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", null, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:40,代码来源:ruris-sp.inc.php

示例3: check_specific_catg_level_access

 /**
  * Handles Category Level Access *( for specific Categories )*.
  *
  * @package s2Member\Categories
  * @since 3.5
  *
  * @param int|str $cat_id Numeric Category ID.
  * @param bool $check_user Test permissions against the current User? Defaults to true.
  * @return null|array Non-empty array ( with details ) if access is denied, else null if access is allowed.
  */
 public static function check_specific_catg_level_access($cat_id = FALSE, $check_user = TRUE)
 {
     do_action("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars());
     /**/
     $excluded = apply_filters("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars());
     /**/
     if (!$excluded && is_numeric($cat_id) && ($cat_id = (int) $cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         $cat_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_category_link($cat_id));
         /* Get a full valid URI for this Category. */
         /**/
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $cat_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             /* Current User's object. */
             /**/
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
                 return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $cat_uri)) {
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                             return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, $catgs = preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                 return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                             } else {
                                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) {
                                     /* Check Category ancestry. */
                                     foreach (preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg) {
                                         if ($catg && cat_is_ancestor_of($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     /**/
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                             /* URIs configured at this Level? */
                             /**/
                             foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                 if ($str && preg_match("/" . preg_quote($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             /**/
             do_action("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars());
         }
     }
     /**/
     return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:67,代码来源:catgs-sp.inc.php

示例4: login_redirection_uri

 /**
  * Parses a Special Login Redirection URI.
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  *
  * @param object $user Optional. A WP_User object. Defaults to the current User, if logged-in.
  * @param bool   $root_returns_false Defaults to false. True if the function should return false when a URI is reduced to the site root.
  *
  * @return string|bool A Special Login Redirection URI with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URI is the site root.
  */
 public static function login_redirection_uri($user = NULL, $root_returns_false = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_login_redirection_uri', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     if ($url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user, $root_returns_false)) {
         $uri = c_ws_plugin__s2member_utils_urls::parse_uri($url);
     }
     return apply_filters('ws_plugin__s2member_login_redirection_uri', !empty($uri) ? $uri : FALSE, get_defined_vars());
 }
开发者ID:codeforest,项目名称:s2member,代码行数:24,代码来源:login-redirects.inc.php

示例5: check_specific_page_level_access

 /**
  * Handles Page Level Access *(for specific Pages)*.
  *
  * @package s2Member\Pages
  * @since 3.5
  *
  * @param int|str $page_id Numeric Page ID.
  * @param bool $check_user Test permissions against the current User? Defaults to true.
  * @return null|array Non-empty array (with details) if access is denied, else null if access is allowed.
  *
  * @todo Provide more information in the return array (like MOP Vars).
  */
 public static function check_specific_page_level_access($page_id = FALSE, $check_user = TRUE)
 {
     do_action("ws_plugin__s2member_before_check_specific_page_level_access", get_defined_vars());
     $excluded = apply_filters("ws_plugin__s2member_check_specific_page_level_access_excluded", false, get_defined_vars());
     if (!$excluded && is_numeric($page_id) && ($page_id = (int) $page_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         $page_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_page_link($page_id));
         // Get a full valid URI for this Page now.
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($page_id, $page_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             // Current User's object.
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
                 return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars());
             } else {
                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $page_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
                     return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars());
                 } else {
                     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
                         return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars());
                     } else {
                         if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page($page_id, $page_uri)) {
                             for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                 } else {
                                     if (strpos($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array("all-page", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-pages", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                         return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                     } else {
                                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             if (has_tag("", $page_id)) {
                                 for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                                     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                         return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                     } else {
                                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag(preg_split("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                                 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                                     // URIs configured at this Level?
                                     foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                         if ($str && preg_match("/" . preg_quote($str, "/") . "/", $page_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                             return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             if (is_array($ccaps_req = get_post_meta($page_id, "s2member_ccaps_req", true)) && !empty($ccaps_req)) {
                                 foreach ($ccaps_req as $ccap) {
                                     // The ``$user`` MUST satisfy ALL Custom Capabilities.
                                     if (strlen($ccap) && (!$check_user || !$user || !$user->has_cap("access_s2member_ccap_" . $ccap))) {
                                         return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_ccap_req" => $ccap), get_defined_vars());
                                     }
                                 }
                             }
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access($page_id, "read-only"))) {
                                 return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_sp_req" => $page_id), get_defined_vars());
                             }
                         }
                     }
                 }
             }
             do_action("ws_plugin__s2member_during_check_specific_page_level_access", get_defined_vars());
         }
     }
     return apply_filters("ws_plugin__s2member_check_specific_page_level_access", null, get_defined_vars());
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:86,代码来源:pages-sp.inc.php

示例6: check_specific_ptag_level_access

 /**
  * Handles Tag Level Access *(for specific Tags)*.
  *
  * @package s2Member\Tags
  * @since 3.5
  *
  * @param int|string $_tag Numeric Tag ID, Tag Slug, or Tag Name.
  * @param bool $check_user Test permissions against the current User? Defaults to true.
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_ptag_level_access($_tag = FALSE, $check_user = TRUE)
 {
     do_action("ws_plugin__s2member_before_check_specific_ptag_level_access", get_defined_vars());
     if ($_tag && is_numeric($_tag) && is_object($term = get_term_by("id", $_tag, "post_tag"))) {
         $tag_id = (int) $_tag;
         // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
         $tag_slug = $term->slug;
         // Tag slug.
         $tag_name = $term->name;
         // Tag name.
     } else {
         if ($_tag && is_string($_tag) && is_object($term = get_term_by("name", $_tag, "post_tag"))) {
             $tag_name = $_tag;
             // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
             $tag_id = (int) $term->term_id;
             // Tag ID.
             $tag_slug = $term->slug;
             // Tag slug.
         } else {
             if ($_tag && is_string($_tag) && is_object($term = get_term_by("slug", $_tag, "post_tag"))) {
                 $tag_slug = $_tag;
                 // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
                 $tag_id = (int) $term->term_id;
                 // Tag ID.
                 $tag_name = $term->name;
                 // Tag name.
             }
         }
     }
     $excluded = apply_filters("ws_plugin__s2member_check_specific_ptag_level_access_excluded", false, get_defined_vars());
     if (!$excluded && !empty($tag_id) && !empty($tag_slug) && !empty($tag_name) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
         $tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_tag_link($tag_id));
         // Get a full valid URI for this Tag.
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(null, $tag_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false;
             // Current User's object.
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $tag_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0"))) {
                 return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(null, $tag_uri)) {
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                             return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (in_array($tag_name, $tags = preg_split("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) || in_array($tag_slug, $tags)) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                 return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars());
                             }
                         }
                     }
                     for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) {
                             // URIs configured at this Level?
                             foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) {
                                 if ($str && preg_match("/" . preg_quote($str, "/") . "/", $tag_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) {
                                     return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             do_action("ws_plugin__s2member_during_check_specific_ptag_level_access", get_defined_vars());
         }
     }
     return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", null, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:76,代码来源:ptags-sp.inc.php

示例7: is_systematic_use_specific_page

 /**
  * Determines if a specific Post/Page ID, or URI, is Systematic in any way.
  *
  * @package s2Member\Systematics
  * @since 3.5
  *
  * @param int|string $singular_id Optional. A numeric Post/Page ID in WordPress.
  * @param string $uri Optional. A request URI to test against.
  * @return bool True if Systematic, else false.
  *
  * @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
  * 	Don't think this is required though; as it's already handled in other areas, correct?
  */
 public static function is_systematic_use_specific_page($singular_id = FALSE, $uri = FALSE)
 {
     global $bp;
     // If BuddyPress is installed, we'll need this global reference.
     $singular_id = $singular_id && is_numeric($singular_id) ? (int) $singular_id : false;
     // Force types.
     $uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : false;
     if (c_ws_plugin__s2member_systematics_sp::is_s2_systematic_use_specific_page($singular_id, $uri)) {
         return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
     } else {
         if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($singular_id, $uri)) {
             return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
         } else {
             if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed() && preg_match("/\\/(?:" . preg_quote(trim(function_exists("bp_get_signup_slug") ? bp_get_signup_slug() : BP_REGISTER_SLUG, "/"), "/") . "|" . preg_quote(trim(function_exists("bp_get_activate_slug") ? bp_get_activate_slug() : BP_ACTIVATION_SLUG, "/"), "/") . ")(?:\\/|\\?|\$)/", $uri)) {
                 return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
             } else {
                 if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed() && (!empty($bp->pages->register->id) && $singular_id === (int) $bp->pages->register->id || !empty($bp->pages->activate->id) && $singular_id === (int) $bp->pages->activate->id)) {
                     return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
                 } else {
                     if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $singular_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) {
                         return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
                     } else {
                         if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $singular_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) {
                             return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
                         } else {
                             if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $singular_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]) {
                                 return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
                             } else {
                                 if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri(false, "root-returns-false")) && preg_match("/^" . preg_quote($_lro, "/") . "\$/", $uri)) {
                                     return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars());
                                 } else {
                                     // Otherwise, we return false (i.e. it's NOT a Systematic Use Page in any way).
                                     return $is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:55,代码来源:systematics-sp.inc.php

示例8: check_specific_ptag_level_access

 /**
  * Handles Tag Level Access *(for specific Tags)*.
  *
  * @package s2Member\Tags
  * @since 3.5
  *
  * @param int|string $_tag Numeric Tag ID, Tag Slug, or Tag Name.
  * @param bool       $check_user Test permissions against the current User? Defaults to true.
  *
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_ptag_level_access($_tag = '', $check_user = TRUE)
 {
     do_action('ws_plugin__s2member_before_check_specific_ptag_level_access', get_defined_vars());
     if ($_tag && is_numeric($_tag) && is_object($term = get_term_by('id', $_tag, 'post_tag'))) {
         $tag_id = (int) $_tag;
         // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
         $tag_slug = $term->slug;
         // Tag slug.
         $tag_name = $term->name;
         // Tag name.
     } else {
         if ($_tag && is_string($_tag) && is_object($term = get_term_by('name', $_tag, 'post_tag'))) {
             $tag_name = $_tag;
             // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
             $tag_id = (int) $term->term_id;
             // Tag ID.
             $tag_slug = $term->slug;
             // Tag slug.
         } else {
             if ($_tag && is_string($_tag) && is_object($term = get_term_by('slug', $_tag, 'post_tag'))) {
                 $tag_slug = $_tag;
                 // Need ``$tag_id``, ``$tag_slug``, and also the ``$tag_name``.
                 $tag_id = (int) $term->term_id;
                 // Tag ID.
                 $tag_name = $term->name;
                 // Tag name.
             }
         }
     }
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $excluded = apply_filters('ws_plugin__s2member_check_specific_ptag_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && !empty($tag_id) && !empty($tag_slug) && !empty($tag_name) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         $tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_tag_link($tag_id));
         // Get a full valid URI for this Tag.
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page(NULL, $tag_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             // Current User's object.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $tag_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0'))) {
                 return apply_filters('ws_plugin__s2member_check_specific_ptag_level_access', array('s2member_level_req' => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page(NULL, $tag_uri)) {
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                             return apply_filters('ws_plugin__s2member_check_specific_ptag_level_access', array('s2member_level_req' => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] && (in_array($tag_name, $tags = preg_split('/[' . "\r\n\t" . ';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'])) || in_array($tag_slug, $tags)) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_ptag_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             }
                         }
                     }
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                             // URIs configured at this Level?
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                 if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $tag_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_ptag_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
             do_action('ws_plugin__s2member_during_check_specific_ptag_level_access', get_defined_vars());
         }
     }
     return apply_filters('ws_plugin__s2member_check_specific_ptag_level_access', NULL, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:78,代码来源:ptags-sp.inc.php

示例9: login_redirection_uri

 /**
  * Parses a Special Login Redirection URI.
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  *
  * @param obj $user Optional. A WP_User object. Defaults to the current User, if logged-in.
  * @param bool $root_returns_false Defaults to false. True if the function should return false when a URI is reduced to the site root.
  * @return str|bool A Special Login Redirection URI with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URI is the site root.
  */
 public static function login_redirection_uri($user = FALSE, $root_returns_false = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     if ($url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user, $root_returns_false)) {
         $uri = c_ws_plugin__s2member_utils_urls::parse_uri($url);
     }
     /**/
     return apply_filters("ws_plugin__s2member_login_redirection_uri", !empty($uri) ? $uri : false, get_defined_vars());
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:23,代码来源:login-redirects.inc.php

示例10: check_specific_post_level_access

 /**
  * Handles Post Level Access *(for specific Posts)*.
  *
  * @package s2Member\Posts
  * @since 3.5
  *
  * @param int|string $post_id Numeric Post ID.
  * @param bool       $check_user Test permissions against the current User? Defaults to true.
  *
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_post_level_access($post_id = 0, $check_user = TRUE)
 {
     do_action('ws_plugin__s2member_before_check_specific_post_level_access', get_defined_vars());
     $excluded = apply_filters('ws_plugin__s2member_check_specific_post_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && is_numeric($post_id) && ($post_id = (int) $post_id) && ($post = get_post($post_id)) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         $post_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_permalink($post->ID));
         // Get a full valid URI for this Post now.
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($post->ID, $post_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             // Current User's object.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/', $post_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0'))) {
                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => 0), get_defined_vars());
             } else {
                 if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page($post->ID, $post_uri)) {
                     $bbpress_restrictions_enable = apply_filters('ws_plugin__s2member_bbpress_restrictions_enable', TRUE);
                     $bbpress_installed = c_ws_plugin__s2member_utils_conds::bbp_is_installed();
                     // bbPress is installed?
                     $bbpress_forum_post_type = $bbpress_installed ? bbp_get_forum_post_type() : '';
                     // Acquire the current post type for forums.
                     $bbpress_topic_post_type = $bbpress_installed ? bbp_get_topic_post_type() : '';
                     // Acquire the current post type for topics.
                     $bbpress_topic_forum_id = $bbpress_installed && $post->post_type === $bbpress_topic_post_type ? bbp_get_topic_forum_id($post->ID) : 0;
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                             return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                         } else {
                             if (strpos($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'], 'all-') !== FALSE && $post->post_type && (in_array('all-' . $post->post_type, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'])) || in_array('all-' . $post->post_type . 's', preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts']))) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             } else {
                                 if ($bbpress_restrictions_enable && $bbpress_installed && $post->post_type === $bbpress_topic_post_type && strpos($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'], 'all-') !== FALSE && (in_array('all-' . $bbpress_forum_post_type, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'])) || in_array('all-' . $bbpress_forum_post_type . 's', preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts']))) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 } else {
                                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'] && in_array($post->ID, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'])) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                         return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                     }
                                 }
                             }
                         }
                     }
                     if ($bbpress_restrictions_enable && $bbpress_installed && $post->post_type === $bbpress_topic_post_type && $bbpress_topic_forum_id) {
                         for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'] && in_array($bbpress_topic_forum_id, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'])) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             }
                         }
                     }
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                             return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                         } else {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs'] && (in_category($catgs = preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_catgs']), $post->ID) || c_ws_plugin__s2member_utils_conds::in_descendant_category($catgs, $post->ID)) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             }
                         }
                     }
                     if (has_tag('', $post->ID)) {
                         for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                             } else {
                                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] && has_tag(preg_split('/[' . "\r\n\t" . ';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags']), $post->ID) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                     for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                             // URIs configured at this Level?
                             foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                 if ($str && preg_match('/' . preg_quote($str, '/') . '/', $post_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 }
                             }
                         }
                     }
                     if (is_array($ccaps_req = get_post_meta($post->ID, 's2member_ccaps_req', TRUE)) && !empty($ccaps_req)) {
                         foreach ($ccaps_req as $ccap) {
                             // The $user MUST satisfy ALL Custom Capabilities. Serialized array.
                             if (strlen($ccap) && (!$check_user || !$user || !$user->has_cap('access_s2member_ccap_' . $ccap))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_post_level_access', array('s2member_ccap_req' => $ccap), get_defined_vars());
                             }
                         }
                     }
                     if ($bbpress_restrictions_enable && $bbpress_installed && $post->post_type === $bbpress_topic_post_type && $bbpress_topic_forum_id) {
                         if (is_array($ccaps_req = get_post_meta($bbpress_topic_forum_id, 's2member_ccaps_req', TRUE)) && !empty($ccaps_req)) {
                             foreach ($ccaps_req as $ccap) {
                                 // The $user MUST satisfy ALL Custom Capabilities. Serialized array.
                                 if (strlen($ccap) && (!$check_user || !$user || !$user->has_cap('access_s2member_ccap_' . $ccap))) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:posts-sp.inc.php

示例11: check_specific_page_level_access

 /**
  * Handles Page Level Access *(for specific Pages)*.
  *
  * @package s2Member\Pages
  * @since 3.5
  *
  * @param int|string $page_id Numeric Page ID.
  * @param bool       $check_user Test permissions against the current User? Defaults to true.
  *
  * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
  */
 public static function check_specific_page_level_access($page_id = 0, $check_user = TRUE)
 {
     do_action('ws_plugin__s2member_before_check_specific_page_level_access', get_defined_vars());
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $excluded = apply_filters('ws_plugin__s2member_check_specific_page_level_access_excluded', FALSE, get_defined_vars());
     if (!$excluded && is_numeric($page_id) && ($page_id = (int) $page_id) && ($page = get_post($page_id)) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         $page_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_page_link($page->ID));
         // Get a full valid URI for this Page now.
         if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($page->ID, $page_uri)) {
             $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : FALSE;
             // Current User's object.
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'] && $page->ID === (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'] && (!$check_user || !$user || !$user->has_cap('access_s2member_level0')) && $page->ID !== (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
                 return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => 0), get_defined_vars());
             } else {
                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, 'root-returns-false')) && preg_match('/^' . preg_quote($login_redirection_uri, '/') . '$/' . $ci, $page_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level0')) && $page->ID !== (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
                     return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => 0), get_defined_vars());
                 } else {
                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page'] && $page->ID === (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page'] && (!$check_user || !$user || !$user->has_cap('access_s2member_level0')) && $page->ID !== (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
                         return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => 0), get_defined_vars());
                     } else {
                         if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page($page->ID, $page_uri)) {
                             for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_pages'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                     return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                 } else {
                                     if (strpos($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'], 'all-') !== FALSE && (in_array('all-page', preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts'])) || in_array('all-pages', preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_posts']))) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                         return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                     } else {
                                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_pages'] && in_array($page->ID, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_pages'])) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                             return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             if (has_tag('', $page->ID)) {
                                 for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                                     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] === 'all' && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                         return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                     } else {
                                         if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags'] && has_tag(preg_split('/[' . "\r\n\t" . ';,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ptags']), $page->ID) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                             return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             for ($n = $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n >= 0; $n--) {
                                 if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris']) {
                                     // URIs configured at this Level?
                                     foreach (preg_split('/[' . "\r\n\t" . ']+/', c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_ruris'], $user)) as $str) {
                                         if ($str && preg_match('/' . preg_quote($str, '/') . '/' . $ci, $page_uri) && (!$check_user || !$user || !$user->has_cap('access_s2member_level' . $n))) {
                                             return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_level_req' => $n), get_defined_vars());
                                         }
                                     }
                                 }
                             }
                             if (is_array($ccaps_req = get_post_meta($page->ID, 's2member_ccaps_req', TRUE)) && !empty($ccaps_req)) {
                                 foreach ($ccaps_req as $ccap) {
                                     // The ``$user`` MUST satisfy ALL Custom Capabilities.
                                     if (strlen($ccap) && (!$check_user || !$user || !$user->has_cap('access_s2member_ccap_' . $ccap))) {
                                         return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_ccap_req' => $ccap), get_defined_vars());
                                     }
                                 }
                             }
                             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'] && in_array($page->ID, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access($page->ID, 'read-only'))) {
                                 return apply_filters('ws_plugin__s2member_check_specific_page_level_access', array('s2member_sp_req' => $page->ID), get_defined_vars());
                             }
                         }
                     }
                 }
             }
             do_action('ws_plugin__s2member_during_check_specific_page_level_access', get_defined_vars());
         }
     }
     return apply_filters('ws_plugin__s2member_check_specific_page_level_access', NULL, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:86,代码来源:pages-sp.inc.php

示例12: is_systematic_use_specific_page

 /**
  * Determines if a specific Post/Page ID, or URI, is Systematic in any way.
  *
  * @package s2Member\Systematics
  * @since 3.5
  *
  * @param int|string $singular_id Optional. A numeric Post/Page ID in WordPress.
  * @param string     $uri Optional. A request URI to test against.
  *
  * @return bool True if Systematic, else false.
  *
  * @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
  *   Don't think this is required though; as it's already handled in other areas, correct?
  */
 public static function is_systematic_use_specific_page($singular_id = '', $uri = '')
 {
     global $bp;
     // If BuddyPress is installed, we'll need this global reference.
     $ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
     $singular_id = $singular_id && is_numeric($singular_id) ? (int) $singular_id : FALSE;
     // Force types.
     $uri = $uri && is_string($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri($uri)) ? $uri : FALSE;
     if (c_ws_plugin__s2member_systematics_sp::is_s2_systematic_use_specific_page($singular_id, $uri)) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($singular_id, $uri)) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed() && preg_match('/\\/(?:' . preg_quote(trim(function_exists('bp_get_signup_slug') ? bp_get_signup_slug() : BP_REGISTER_SLUG, '/'), '/') . '|' . preg_quote(trim(function_exists('bp_get_activate_slug') ? bp_get_activate_slug() : BP_ACTIVATION_SLUG, '/'), '/') . ')(?:\\/|\\?|$)/' . $ci, $uri)) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed() && (!empty($bp->pages->register->id) && $singular_id === (int) $bp->pages->register->id || !empty($bp->pages->activate->id) && $singular_id === (int) $bp->pages->activate->id)) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($singular_id && $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'] && $singular_id === (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($singular_id && $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page'] && $singular_id === (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($singular_id && $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page'] && $singular_id === (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page']) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     if ($uri && $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_override'] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri(NULL, 'root-returns-false')) && preg_match('/^' . preg_quote($_lro, '/') . '$/' . $ci, $uri)) {
         return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', TRUE, get_defined_vars());
     }
     return $is_systematic = apply_filters('ws_plugin__s2member_is_systematic_use_specific_page', FALSE, get_defined_vars());
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:48,代码来源:systematics-sp.inc.php


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