本文整理汇总了PHP中c_ws_plugin__s2member_utils_conds::is_site_root方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_conds::is_site_root方法的具体用法?PHP c_ws_plugin__s2member_utils_conds::is_site_root怎么用?PHP c_ws_plugin__s2member_utils_conds::is_site_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_conds
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_conds::is_site_root方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_s2_systematic_use_specific_page
/**
* Determines if a specific Post/Page ID, or URI, is s2Member Systematic.
*
* @package s2Member\Systematics
* @since 111115
*
* @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 s2Member Systematic, else false.
*/
public static function is_s2_systematic_use_specific_page($singular_id = '', $uri = '')
{
$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 ($uri && ($_q = c_ws_plugin__s2member_utils_urls::parse_url($uri, PHP_URL_QUERY)) && preg_match('/[\\?&]s2member/' . $ci, $_q) && c_ws_plugin__s2member_utils_conds::is_site_root($uri)) {
return $is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_specific_page', TRUE, get_defined_vars());
}
return $is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_specific_page', FALSE, get_defined_vars());
}
示例2: is_s2_systematic_use_specific_page
/**
* Determines if a specific Post/Page ID, or URI, is s2Member Systematic.
*
* @package s2Member\Systematics
* @since 111115
*
* @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 s2Member Systematic, else false.
*/
public static function is_s2_systematic_use_specific_page($singular_id = FALSE, $uri = FALSE)
{
$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 ($uri && ($_q = c_ws_plugin__s2member_utils_urls::parse_url($uri, PHP_URL_QUERY)) && preg_match("/[\\?&]s2member/", $_q) && c_ws_plugin__s2member_utils_conds::is_site_root($uri)) {
return $is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_specific_page", true, get_defined_vars());
} else {
// Otherwise, we return false (i.e. it's NOT an s2Member Systematic Use Page).
return $is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_specific_page", false, get_defined_vars());
}
}
示例3: is_s2_systematic_use_page
/**
* Determines if the current page is s2Member Systematic.
*
* @package s2Member\Systematics
* @since 111115
*
* @return bool True if s2Member Systematic, else false.
*
* @note The results of this function are cached staticially.
* Do NOT call upon this until the `init` Hook is fired.
*/
public static function is_s2_systematic_use_page()
{
static $is_s2_systematic;
// For optimization.
if (isset($is_s2_systematic)) {
// Already cached statically? Saves time.
return $is_s2_systematic;
}
// Filters will have already been applied here.
$ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
if (!empty($_SERVER['QUERY_STRING']) && preg_match('/[\\?&]s2member/' . $ci, $_SERVER['QUERY_STRING']) && c_ws_plugin__s2member_utils_conds::is_site_root($_SERVER['REQUEST_URI'])) {
return $is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_page', TRUE, get_defined_vars());
}
return $is_s2_systematic = apply_filters('ws_plugin__s2member_is_s2_systematic_use_page', FALSE, get_defined_vars());
}
示例4: is_s2_systematic_use_page
/**
* Determines if the current page is s2Member Systematic.
*
* @package s2Member\Systematics
* @since 111115
*
* @return bool True if s2Member Systematic, else false.
*
* @note The results of this function are cached staticially.
* Do NOT call upon this until the `init` Hook is fired.
*/
public static function is_s2_systematic_use_page()
{
static $is_s2_systematic;
// For optimization.
if (isset($is_s2_systematic)) {
return $is_s2_systematic;
// Filters will have already been applied here.
} else {
if (!empty($_SERVER["QUERY_STRING"]) && preg_match("/[\\?&]s2member/", $_SERVER["QUERY_STRING"]) && c_ws_plugin__s2member_utils_conds::is_site_root($_SERVER["REQUEST_URI"])) {
return $is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_page", true, get_defined_vars());
} else {
// Otherwise, we return false (it's NOT an s2Member Systematic Use Page).
return $is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_page", false, get_defined_vars());
}
}
}
示例5: fill_login_redirect_rc_vars
/**
* Fills Replacement Codes in Special Redirection URLs.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @param string $url A URL with possible Replacement Codes in it.
* @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 URL is reduced to the site root.
*
* @return string|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
*/
public static function fill_login_redirect_rc_vars($url = '', $user = NULL, $root_returns_false = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_fill_login_redirect_rc_vars', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$url = (string) $url;
// Force ``$url`` to a string value.
$orig_url = $url;
// Record the original URL that was passed in.
$user = (is_object($user) || is_object($user = wp_get_current_user())) && !empty($user->ID) ? $user : NULL;
$user_id = $user ? (string) $user->ID : '';
$user_login = $user ? (string) strtolower($user->user_login) : '';
$user_nicename = $user ? (string) strtolower($user->user_nicename) : '';
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode('-', c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option('s2member_login_counter', $user_id) : '-1';
$url = preg_replace('/%%current_user_login%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_login)), $url);
$url = preg_replace('/%%current_user_nicename%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_nicename)), $url);
$url = preg_replace('/%%current_user_id%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_id)), $url);
$url = preg_replace('/%%current_user_level%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_level)), $url);
$url = preg_replace('/%%current_user_role%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_role)), $url);
$url = preg_replace('/%%current_user_ccaps%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_ccaps)), $url);
$url = preg_replace('/%%current_user_logins%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(urlencode($user_logins)), $url);
if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, FALSE)) || !empty($parse['path']) && strpos($parse['path'], '//') !== FALSE)) {
$url = home_url('/');
}
// Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e., with `//` ).
if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
// Used by s2Member's security gate.
$url = FALSE;
}
// In case we need to return false on root URLs (i.e., don't protect the Home Page inadvertently).
return apply_filters('ws_plugin__s2member_fill_login_redirect_rc_vars', $url, get_defined_vars());
}
示例6: fill_login_redirect_rc_vars
/**
* Fills Replacement Codes in Special Redirection URLs.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @param str $url A URL with possible Replacement Codes in it.
* @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
*/
public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
unset($__refs, $__v);
$url = (string) $url;
$orig_url = $url;
$user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
$user_id = $user ? (string) $user->ID : "";
$user_login = $user ? (string) strtolower($user->user_login) : "";
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
$url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
$url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
$url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
$url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
$url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
$url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
$url = site_url("/");
}
if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
$url = false;
}
return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
}
示例7: fill_login_redirect_rc_vars
/**
* Fills Replacement Codes in Special Redirection URLs.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @param str $url A URL with possible Replacement Codes in it.
* @param obj $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
*/
public static function fill_login_redirect_rc_vars($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
$url = (string) $url;
/* Force ``$url`` to a string value. */
$orig_url = $url;
/* Record the original URL that was passed in. */
/**/
$user = (is_object($user) || is_object($user = is_user_logged_in() ? wp_get_current_user() : false)) && !empty($user->ID) ? $user : false;
/**/
$user_id = $user ? (string) $user->ID : "";
$user_login = $user ? (string) strtolower($user->user_login) : "";
/**/
$user_level = (string) c_ws_plugin__s2member_user_access::user_access_level($user);
$user_role = (string) c_ws_plugin__s2member_user_access::user_access_role($user);
$user_ccaps = (string) implode("-", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
$user_logins = $user ? (string) (int) get_user_option("s2member_login_counter", $user_id) : "-1";
/**/
$url = preg_replace("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_login), $url);
$url = preg_replace("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_id), $url);
$url = preg_replace("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_level), $url);
$url = preg_replace("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_role), $url);
$url = preg_replace("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_ccaps), $url);
$url = preg_replace("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds($user_logins), $url);
/**/
if ($url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url($url, -1, false)) || !empty($parse["path"]) && strpos($parse["path"], "//") !== false)) {
$url = site_url("/");
}
/* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */
/**/
if ($root_returns_false && c_ws_plugin__s2member_utils_conds::is_site_root($url)) {
$url = false;
}
/* In case we need to return false on root URLs ( i.e. don't protect the Home Page inadvertently ). */
/**/
return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars());
}