Simple tags重复自动连接问题
请教下高手们,我用Simple tags在后台已经设置了Maximum number of links for the same tag为1,但是文章中照样会出现同一个标签被链接多次的现象。刷新缓存什么的都试过多次。
我用的是wordpress3.7.1版本,直接在后台查找从官网下载的simple tags。这个要怎么解决啊
本帖最后由 jeffseo 于 2013-12-6 19:33 编辑
换其它WP的版本也还是这样,
另外Maximum number of links per article:这个值也没读成功,设置10个TAG,文章中仍然会把所有TAG都链接上。
看代码似乎都没什么问题,
其它用simple tags的哥们也是这样的吗// there should always be at least one token, but check just in case
$anchor_level = 0;
if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {
$i = 0;
foreach ($tokens as $token) {
if (++$i % 2 && $token != '') { // this token is (non-markup) text
if ($anchor_level == 0) { // linkify if not inside anchor tags
if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 4
$j++;
if ($j <= SimpleTags_Plugin::get_option_value('auto_link_max_by_tag') || SimpleTags_Plugin::get_option_value('auto_link_max_by_tag') == 0) {// Limit replacement at 1 by default, or options value !
$token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments
}
$must_tokenize = true; // re-tokenize next time around
}
}
} else { // this token is markup
if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>
$anchor_level++;
} elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>
$anchor_level--;
}
}
$filtered .= $token; // this token has now been filtered
}
$content = $filtered; // filtering completed for this link
}
页:
[1]