|
|

楼主 |
发表于 2011-4-12 19:29:40
|
显示全部楼层
function keylink($content, $item) {
global $KEYLINK;
$KEYLINK or $KEYLINK = cache_read('keylink-'.$item.'.php');
if(!$KEYLINK) return $content;
$data = $content;
foreach($KEYLINK as $k=>$v) {
$quote = str_replace(array("'", '-'), array("\'", '\-'), preg_quote($v['title']));
$data = preg_replace('\'(?!(()|([^>]*?)|([^>]*?))\'si', '[url=]'.$v['title'].'[/url]', $data, 1);
if($data == '') $data = $content;
}
return $data;
} |
|