强大号码库资源任选,方便,快捷,快速开通。
咨询热线:400-1100-266
在include/arc.archives.class.php这个文件中 有两个函数需要修改ReplaceKeyword 和 _highlight
把这两个函数 第1014行开始到倒数第二行结束修改为
function ReplaceKeyword($kw,&$body)
{
global $cfg_cmspath;
$maxkey = 5;
$kws = explode(",",trim($kw)); //以分好为间隔符
$i=0;
$karr = $kaarr = $GLOBALS['replaced'] = array();
//暂时屏蔽超链接
$body = preg_replace("/(<a(.*))(>)(.*)(<)(\/a>)/isU", '\\1-]-\\4-[-\\6', $body);
global $dsql;
$query="SELECT * FROMdede_keywordsWHERE rpurl<>'' and sta=1 ORDER BY length(keyword)desc";
$dsql->SetQuery($query);
$dsql->Execute();
while($row = $dsql->GetArray())
{
$key = trim($row['keyword']);
$key_url=trim($row['rpurl']);
$karr[] = $key;
$kaarr[] = "<b><a href='$key_url' target='_blank'>$key</a></b>";
}
foreach ($karr as $key => $word)
{
$body = preg_replace("/(^|>)([^<]+)(?=<|$)/sUe", "_highlight('\\2', \$karr[$key], \$kaarr[$key], '\\1')", $body);
//echo $body."<br/>";
//恢复超链接
$body = preg_replace("/(<a(.*))-\]-(.*)-\[-(\/a>)/isU", '\\1>\\3<\\4', $body);
//暂时屏蔽超链接
$body = preg_replace("/(<a(.*))(>)(.*)(<)(\/a>)/isU", '\\1-]-\\4-[-\\6', $body);
}
//恢复超链接
$body = preg_replace("/(<a(.*))-\]-(.*)-\[-(\/a>)/isU", '\\1>\\3<\\4', $body);
return $body;
}
}//End Archives
//高亮专用, 替换多次是可能不能达到最多次
function _highlight($string, $words, $result, $pre)
{
global $cfg_replace_num;
$string = str_replace('\&;', '"', $string);
if($GLOBALS['replaced'][$words] == 1)
{
return $pre.$string;
}
if($cfg_replace_num > 0)
{
$string = preg_replace("/".preg_quote($words)."/", $result, $string, $cfg_replace_num);
if(strpos($string, $words) !== false)
{
$GLOBALS['replaced'][$words] = 1;
//echo $words;
}
}
else
{
$string = str_replace($words, $result, $string);
}
return $pre.$string;
}
保存替换就可以了
时间:9:00-21:00 (节假日不休)
版权所有:巨人网络(扬州)科技有限公司
总部地址:江苏省信息产业基地11号楼四层
《增值电信业务经营许可证》 苏B2-20120278