帝国cms管理关键词内容解决把alt的关键词替换
1、打开e/class/functions.php
2、查找'/'.$r[keyname].'/i'替换为'/'.$r[keyname].'(?!(1>)|(1< a="">))/i'
function ReplaceKey($newstext,$classid=0){
global $empire,$dbtbpre,$public_r,$class_r;
if(empty($newstext)||$class_r[$classid]['keycid']==-1)
{return $newstext;}
$where=' where keyurl!=""';
if(!empty($class_r[$classid]['keycid']))
{
$where=" where keyurl!='' and cid='".$class_r[$classid]['keycid']."'";
}
$sql=$empire->query("select keyname,keyurl from {$dbtbpre}enewskey".$where);
while($r=$empire->fetch($sql))
{
if(STR_IREPLACE)
{
$newstext=empty($public_r[repkeynum])?str_ireplace($r[keyname],'<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext):preg_replace('/'.$r[keyname].'(?!([^<]*>)|([^<]*<\ a="">))/i','<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext,$public_r[repkeynum]);
}
else
{
$newstext=empty($public_r[repkeynum])?str_replace($r[keyname],'<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext):preg_replace('/'.$r[keyname].'(?!([^<]*>)|([^<]*<\ a="">))/i','<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext,$public_r[repkeynum]);
}
}
return $newstext;
}
- < ↩