本文整理汇总了PHP中CUtil::AdjustPcreBacktrackLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::AdjustPcreBacktrackLimit方法的具体用法?PHP CUtil::AdjustPcreBacktrackLimit怎么用?PHP CUtil::AdjustPcreBacktrackLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::AdjustPcreBacktrackLimit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* @param string $string
* @return string
*/
protected function filter($string)
{
$stringLen = CUtil::BinStrlen($string) * 2;
CUtil::AdjustPcreBacktrackLimit($stringLen);
return preg_replace_callback("/(<script[^>]*>)(.*?)(<\\/script[^>]*>)/is", array($this, "getFilteredScript"), $string);
}
示例2: Analyze
function Analyze(&$content)
{
static $arLocalCache = array();
$content_len = CUtil::BinStrlen($content) * 2;
CUtil::AdjustPcreBacktrackLimit($content_len);
$this->stylewithiframe = preg_match("/<style.*>\\s*iframe/", $content);
$arData = preg_split("/(<script.*?>.*?<\\/script.*?>|<iframe.*?>.*?<\\/iframe.*?>)/is", $content, -1, PREG_SPLIT_DELIM_CAPTURE);
$cData = count($arData);
if ($cData < 2) {
return;
}
$bDataChanged = false;
for ($iData = 1; $iData < $cData; $iData += 2) {
$this->data = $arData[$iData];
//полный код блока, включая ограничивающие теги
// < 1 2 > 3 4
if (!preg_match('/^<(script|iframe)(.*?)>(.*?)(<\\/\\1.*?>)$/is', $this->data, $ret)) {
continue;
}
if ($iData > 1) {
$this->prev = $arData[$iData - 2] . $arData[$iData - 1];
} else {
$this->prev = $arData[$iData - 1];
}
if ($iData < $cData - 2) {
$this->next = $arData[$iData + 1] . $arData[$iData + 2];
} else {
$this->next = $arData[$iData + 1];
}
$this->resultrules = array();
$this->bodylines = false;
$this->atributes = $ret[2];
if (strtolower($ret[1]) == 'script') {
$this->body = $this->returnscriptbody($this->data);
$this->type = 'script';
} else {
$this->body = '';
$this->type = 'iframe';
}
$this->whitelist_id = $this->isinwhitelist();
if (!$this->whitelist_id) {
$cache_id = md5($this->data);
if (!isset($arLocalCache[$cache_id])) {
$arLocalCache[$cache_id] = $this->returnblockrating();
}
if ($arLocalCache[$cache_id] >= $this->maxrating) {
$this->dolog();
$arData[$iData] = $this->end_blkblock();
if ($this->replace) {
$bDataChanged = true;
}
}
}
$this->cnt++;
}
if ($bDataChanged) {
$content = implode('', $arData);
}
}
示例3: AdjustPcreBacktrackLimit
/**
* @param $pString
* @return bool
*/
protected static function AdjustPcreBacktrackLimit($pString)
{
if (!is_string($pString)) {
return false;
}
$strlen = CUtil::BinStrlen($pString) * 2;
CUtil::AdjustPcreBacktrackLimit($strlen);
return true;
}