本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::preg_quote_deep方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::preg_quote_deep方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::preg_quote_deep怎么用?PHP c_ws_plugin__s2member_utils_strings::preg_quote_deep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::preg_quote_deep方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ws_plugin__s2member_force_ssl_buffer
function _ws_plugin__s2member_force_ssl_buffer($buffer = FALSE)
{
$o_pcre = @ini_get("pcre.backtrack_limit");
@ini_set("pcre.backtrack_limit", 10000000);
$ssl_entire_tags = array_unique(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_ssl_buffer_entire_tags", array("script", "style", "iframe", "object", "embed", "video"), get_defined_vars())));
$non_ssl_entire_tags = array_unique(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_non_ssl_buffer_entire_tags", array(), get_defined_vars())));
$ssl_attr_only_tags = array_unique(array_diff(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_ssl_buffer_attr_only_tags", array("link", "img", "input"), get_defined_vars())), $ssl_entire_tags));
$non_ssl_attr_only_tags = array_unique(array_diff(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_non_ssl_buffer_attr_only_tags", array("a"), get_defined_vars())), $non_ssl_entire_tags));
$buffer = $ssl_entire_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_entire_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
$buffer = $ssl_attr_only_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]+?\\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
$buffer = $non_ssl_entire_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_entire_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
$buffer = $non_ssl_attr_only_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]+?\\>/i", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
@ini_set("pcre.backtrack_limit", $o_pcre);
return apply_filters("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars());
}
示例2: preg_quote_deep
/**
* Escapes meta characters with ``preg_quote()`` deeply.
*
* @package s2Member\Utilities
* @since 110926
*
* @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
* @param str $delimiter Optional. If a delimiting character is specified, it will also be escaped via ``preg_quote()``.
* @return str|array Either the input string, or the input array; after all data is escaped with ``preg_quote()``.
*/
public static function preg_quote_deep($value = FALSE, $delimiter = FALSE)
{
if (is_array($value)) {
foreach ($value as &$r) {
/* Reference. */
$r = c_ws_plugin__s2member_utils_strings::preg_quote_deep($r, $delimiter);
}
return $value;
/* Return modified array. */
}
return preg_quote((string) $value, (string) $delimiter);
}
示例3: _ws_plugin__s2member_force_ssl_buffer
function _ws_plugin__s2member_force_ssl_buffer($buffer = '')
{
$o_pcre = @ini_get('pcre.backtrack_limit');
// Record existing backtrack limit.
@ini_set('pcre.backtrack_limit', 10000000);
// Increase PCRE backtrack limit for this routine.
$ssl_entire_tags = array_unique(array_map('strtolower', apply_filters('_ws_plugin__s2member_force_ssl_buffer_entire_tags', array('script', 'style', 'iframe', 'object', 'embed', 'video'), get_defined_vars())));
$non_ssl_entire_tags = array_unique(array_map('strtolower', apply_filters('_ws_plugin__s2member_force_non_ssl_buffer_entire_tags', array(), get_defined_vars())));
$ssl_attr_only_tags = array_unique(array_diff(array_map('strtolower', apply_filters('_ws_plugin__s2member_force_ssl_buffer_attr_only_tags', array('link', 'img', 'form', 'input'), get_defined_vars())), $ssl_entire_tags));
$non_ssl_attr_only_tags = array_unique(array_diff(array_map('strtolower', apply_filters('_ws_plugin__s2member_force_non_ssl_buffer_attr_only_tags', array('a'), get_defined_vars())), $non_ssl_entire_tags));
$buffer = $ssl_entire_tags ? preg_replace_callback('/\\<(' . implode('|', c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_entire_tags, '/')) . ')(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is', '_ws_plugin__s2member_force_ssl_buffer_callback', $buffer) : $buffer;
$buffer = $ssl_attr_only_tags ? preg_replace_callback('/\\<(' . implode('|', c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_attr_only_tags, '/')) . ')(?![a-z_0-9\\-])[^\\>]+?\\>/i', '_ws_plugin__s2member_force_ssl_buffer_callback', $buffer) : $buffer;
$buffer = $non_ssl_entire_tags ? preg_replace_callback('/\\<(' . implode('|', c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_entire_tags, '/')) . ')(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is', '_ws_plugin__s2member_force_non_ssl_buffer_callback', $buffer) : $buffer;
$buffer = $non_ssl_attr_only_tags ? preg_replace_callback('/\\<(' . implode('|', c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_attr_only_tags, '/')) . ')(?![a-z_0-9\\-])[^\\>]+?\\>/i', '_ws_plugin__s2member_force_non_ssl_buffer_callback', $buffer) : $buffer;
@ini_set('pcre.backtrack_limit', $o_pcre);
// Restore original PCRE backtrack limit. This just keeps things tidy; probably NOT necessary.
return apply_filters('_ws_plugin__s2member_force_ssl_buffer', $buffer, get_defined_vars());
}
示例4: check_file_download_access
//.........这里部分代码省略.........
// Else return false.
} else {
if ($serving) {
// We only need this section when/if we're actually serving.
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('file', $req['file_download'], 'level', $min_level_4_downloads, $_SERVER['REQUEST_URI']) . exit;
}
}
}
return FALSE;
// Else return false.
} else {
if (preg_match('/(?:^|\\/)access[_\\-]s2member[_\\-]level([0-9]+)\\//', $req['file_download'], $m) && strlen($req_level = $m[1]) && !$user->has_cap('access_s2member_level' . $req_level)) {
if ($serving) {
// We only need this section when/if we're actually serving.
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('file', $req['file_download'], 'level', $req_level, $_SERVER['REQUEST_URI']) . exit;
}
return FALSE;
// Else return false.
} else {
if (preg_match('/(?:^|\\/)access[_\\-]s2member[_\\-]ccap[_\\-](.+?)\\//', $req['file_download'], $m) && strlen($req_ccap = preg_replace('/-/', '_', $m[1])) && !$user->has_cap('access_s2member_ccap_' . $req_ccap)) {
if ($serving) {
// We only need this section when/if we're actually serving.
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars('file', $req['file_download'], 'ccap', $req_ccap, $_SERVER['REQUEST_URI']) . exit;
}
return FALSE;
// Else return false.
} else {
if ($serving || $creating) {
$user_previous_file_downloads = 0;
// Downloads the User has already; in current period/cycle.
$user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = FALSE;
$user_file_download_access_log = is_array($user_file_download_access_log = get_user_option('s2member_file_download_access_log', $user_id)) ? $user_file_download_access_log : array();
$user_file_download_access_arc = is_array($user_file_download_access_arc = get_user_option('s2member_file_download_access_arc', $user_id)) ? $user_file_download_access_arc : array();
$streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep($GLOBALS['WS_PLUGIN__']['s2member']['c']['streaming_file_extns'], '/');
$streaming_variations = '/\\.(' . implode('|', $streaming_file_extns) . ')$/i';
// Only count one streaming media file variation.
foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry) {
if (isset($user_file_download_access_log_entry['date'], $user_file_download_access_log_entry['file'])) {
if (strtotime($user_file_download_access_log_entry['date']) < strtotime('-' . $user_file_downloads['allowed_days'] . ' days')) {
unset($user_file_download_access_log[$user_file_download_access_log_entry_key]);
// Remove it from the `log`.
$user_file_download_access_arc[] = $user_file_download_access_log_entry;
// Move `log` entry to the `archive` now.
} else {
if (strtotime($user_file_download_access_log_entry['date']) >= strtotime('-' . $user_file_downloads['allowed_days'] . ' days')) {
$user_previous_file_downloads++;
// Previous files always count against this User/Member.
$_user_file_download_access_log_entry =& $user_file_download_access_log[$user_file_download_access_log_entry_key];
$_user_already_downloaded_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = FALSE;
if ($user_file_download_access_log_entry['file'] === $req['file_download']) {
// Already downloaded this file? If yes, mark this flag as true.
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = TRUE;
} else {
if (preg_replace($streaming_variations, '', $user_file_download_access_log_entry['file']) === preg_replace($streaming_variations, '', $req['file_download'])) {
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = TRUE;
}
}
if ($updating_user_counter && ($_user_already_downloaded_this_file || $_user_already_downloaded_a_streaming_variation_of_this_file)) {
$_user_file_download_access_log_entry['ltime'] = time();
// First, we update the last download time for this file.
if (!empty($user_file_download_access_log_entry['counter'])) {
// Backward compatibility here. Is this even set?
$_user_file_download_access_log_entry['counter'] = (int) $user_file_download_access_log_entry['counter'] + 1;
} else {
// Backward compatibility here. Default value to `1`, if this is NOT even set yet.
$_user_file_download_access_log_entry['counter'] = 1 + 1;
示例5: _ws_plugin__s2member_force_ssl_buffer
function _ws_plugin__s2member_force_ssl_buffer($buffer = FALSE)
{
$o_pcre = @ini_get("pcre.backtrack_limit");
/* Record existing PCRE backtrack limit. */
@ini_set("pcre.backtrack_limit", 10000000);
/* Increase PCRE backtrack limit for this routine. */
/**/
$ssl_entire_tags = array_unique(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_ssl_buffer_entire_tags", array("script", "style", "iframe", "object", "embed", "video"), get_defined_vars())));
$non_ssl_entire_tags = array_unique(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_non_ssl_buffer_entire_tags", array(), get_defined_vars())));
/**/
$ssl_attr_only_tags = array_unique(array_diff(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_ssl_buffer_attr_only_tags", array("link", "img", "input"), get_defined_vars())), $ssl_entire_tags));
$non_ssl_attr_only_tags = array_unique(array_diff(array_map("strtolower", apply_filters("_ws_plugin__s2member_force_non_ssl_buffer_attr_only_tags", array("a"), get_defined_vars())), $non_ssl_entire_tags));
/**/
$buffer = $ssl_entire_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_entire_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
$buffer = $ssl_attr_only_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]+?\\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
/**/
$buffer = $non_ssl_entire_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_entire_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]*?\\>.*?\\<\\/\\1\\>/is", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
$buffer = $non_ssl_attr_only_tags ? preg_replace_callback("/\\<(" . implode("|", c_ws_plugin__s2member_utils_strings::preg_quote_deep($non_ssl_attr_only_tags, "/")) . ")(?![a-z_0-9\\-])[^\\>]+?\\>/i", "_ws_plugin__s2member_force_non_ssl_buffer_callback", $buffer) : $buffer;
/**/
@ini_set("pcre.backtrack_limit", $o_pcre);
/* Restore original PCRE backtrack limit. This just keeps things tidy; probably NOT necessary. */
/**/
return apply_filters("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars());
}
示例6: check_file_download_access
//.........这里部分代码省略.........
return false;
}
} else {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "level", $min_level_4_downloads, $_SERVER["REQUEST_URI"]) . exit;
} else {
// Else return false.
return false;
}
}
}
} else {
if (preg_match("/(?:^|\\/)access[_\\-]s2member[_\\-]level([0-9]+)\\//", $req["file_download"], $m) && strlen($req_level = $m[1]) && !$user->has_cap("access_s2member_level" . $req_level)) {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "level", $req_level, $_SERVER["REQUEST_URI"]) . exit;
} else {
// Else return false.
return false;
}
} else {
if (preg_match("/(?:^|\\/)access[_\\-]s2member[_\\-]ccap[_\\-](.+?)\\//", $req["file_download"], $m) && strlen($req_ccap = preg_replace("/-/", "_", $m[1])) && !$user->has_cap("access_s2member_ccap_" . $req_ccap)) {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "ccap", $req_ccap, $_SERVER["REQUEST_URI"]) . exit;
} else {
// Else return false.
return false;
}
} else {
if ($serving || $creating) {
$user_previous_file_downloads = 0;
$user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = false;
$user_file_download_access_log = is_array($user_file_download_access_log = get_user_option("s2member_file_download_access_log", $user_id)) ? $user_file_download_access_log : array();
$user_file_download_access_arc = is_array($user_file_download_access_arc = get_user_option("s2member_file_download_access_arc", $user_id)) ? $user_file_download_access_arc : array();
$streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"], "/");
$streaming_variations = "/\\.(" . implode("|", $streaming_file_extns) . ")\$/i";
foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry) {
if (isset($user_file_download_access_log_entry["date"], $user_file_download_access_log_entry["file"])) {
if (strtotime($user_file_download_access_log_entry["date"]) < strtotime("-" . $user_file_downloads["allowed_days"] . " days")) {
unset($user_file_download_access_log[$user_file_download_access_log_entry_key]);
$user_file_download_access_arc[] = $user_file_download_access_log_entry;
} else {
if (strtotime($user_file_download_access_log_entry["date"]) >= strtotime("-" . $user_file_downloads["allowed_days"] . " days")) {
$user_previous_file_downloads++;
// Previous files always count against this User/Member.
$_user_file_download_access_log_entry =& $user_file_download_access_log[$user_file_download_access_log_entry_key];
$_user_already_downloaded_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = false;
if ($user_file_download_access_log_entry["file"] === $req["file_download"]) {
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = true;
} else {
if (preg_replace($streaming_variations, "", $user_file_download_access_log_entry["file"]) === preg_replace($streaming_variations, "", $req["file_download"])) {
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = true;
}
}
if ($updating_user_counter && ($_user_already_downloaded_this_file || $_user_already_downloaded_a_streaming_variation_of_this_file)) {
$_user_file_download_access_log_entry["ltime"] = time();
if (!empty($user_file_download_access_log_entry["counter"])) {
$_user_file_download_access_log_entry["counter"] = (int) $user_file_download_access_log_entry["counter"] + 1;
} else {
// Backward compatibility here. Default value to `1`, if this is NOT even set yet.
$_user_file_download_access_log_entry["counter"] = 1 + 1;
}
}
}
}
} else {
// Weed out empty log entries. Some older versions of s2Member may have corrupt/empty log entries.
示例7: check_file_download_access
//.........这里部分代码省略.........
} else {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "level", $min_level_4_downloads, $_SERVER["REQUEST_URI"]) . exit;
} else {
/* Else return false. */
return false;
}
}
}
} else {
if (preg_match("/^access[_\\-]s2member[_\\-]level([0-9]+)\\//", $req["file_download"], $m) && strlen($req_level = $m[1]) && !$user->has_cap("access_s2member_level" . $req_level)) {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "level", $req_level, $_SERVER["REQUEST_URI"]) . exit;
} else {
/* Else return false. */
return false;
}
} else {
if (preg_match("/^access[_\\-]s2member[_\\-]ccap[_\\-](.+?)\\//", $req["file_download"], $m) && strlen($req_ccap = preg_replace("/-/", "_", $m[1])) && !$user->has_cap("access_s2member_ccap_" . $req_ccap)) {
if ($serving) {
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "ccap", $req_ccap, $_SERVER["REQUEST_URI"]) . exit;
} else {
/* Else return false. */
return false;
}
} else {
if ($serving || $creating) {
$user_previous_file_downloads = 0;
$user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = false;
/**/
$user_file_download_access_log = is_array($user_file_download_access_log = get_user_option("s2member_file_download_access_log", $user_id)) ? $user_file_download_access_log : array();
$user_file_download_access_arc = is_array($user_file_download_access_arc = get_user_option("s2member_file_download_access_arc", $user_id)) ? $user_file_download_access_arc : array();
/**/
$streaming_file_extns = c_ws_plugin__s2member_utils_strings::preg_quote_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"], "/");
$streaming_variations = "/\\.(" . implode("|", $streaming_file_extns) . ")\$/i";
/**/
foreach ($user_file_download_access_log as $user_file_download_access_log_entry_key => $user_file_download_access_log_entry) {
if (isset($user_file_download_access_log_entry["date"], $user_file_download_access_log_entry["file"])) {
if (strtotime($user_file_download_access_log_entry["date"]) < strtotime("-" . $user_file_downloads["allowed_days"] . " days")) {
unset($user_file_download_access_log[$user_file_download_access_log_entry_key]);
$user_file_download_access_arc[] = $user_file_download_access_log_entry;
} else {
if (strtotime($user_file_download_access_log_entry["date"]) >= strtotime("-" . $user_file_downloads["allowed_days"] . " days")) {
$user_previous_file_downloads++;
/* Previous files always count against this User/Member. */
/**/
$_user_file_download_access_log_entry =& $user_file_download_access_log[$user_file_download_access_log_entry_key];
$_user_already_downloaded_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = false;
/**/
if ($user_file_download_access_log_entry["file"] === $req["file_download"]) {
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = true;
} else {
if (preg_replace($streaming_variations, "", $user_file_download_access_log_entry["file"]) === preg_replace($streaming_variations, "", $req["file_download"])) {
$user_already_downloaded_this_file = $_user_already_downloaded_this_file = $user_already_downloaded_a_streaming_variation_of_this_file = $_user_already_downloaded_a_streaming_variation_of_this_file = true;
}
}
/**/
if ($updating_user_counter && ($_user_already_downloaded_this_file || $_user_already_downloaded_a_streaming_variation_of_this_file)) {
$_user_file_download_access_log_entry["ltime"] = time();
/**/
if (!empty($user_file_download_access_log_entry["counter"])) {
$_user_file_download_access_log_entry["counter"] = (int) $user_file_download_access_log_entry["counter"] + 1;
} else {
/* Backward compatiility here. Default value to `1`, if this is NOT even set yet. */
$_user_file_download_access_log_entry["counter"] = 1 + 1;
}