Simple tags重复自动连接问题

[复制链接]
查看: 604   回复: 1
发表于 2013-12-6 13:21:01 | 显示全部楼层 |阅读模式
请教下高手们,
我用Simple tags在后台已经设置了Maximum number of links for the same tag为1,但是文章中照样会出现同一个标签被链接多次的现象。刷新缓存什么的都试过多次。
我用的是wordpress3.7.1版本,直接在后台查找从官网下载的simple tags。这个要怎么解决啊




 楼主| 发表于 2013-12-6 19:28:44 | 显示全部楼层
本帖最后由 jeffseo 于 2013-12-6 19:33 编辑

换其它WP的版本也还是这样,
另外Maximum number of links per article:这个值也没读成功,设置10个TAG,文章中仍然会把所有TAG都链接上。

看代码似乎都没什么问题,
其它用simple tags的哥们也是这样的吗
  1.   // there should always be at least one token, but check just in case
  2.                 $anchor_level = 0;
  3.                 if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {
  4.                         $i = 0;
  5.                         foreach ($tokens as $token) {
  6.                                 if (++$i % 2 && $token != '') { // this token is (non-markup) text
  7.                                         if ($anchor_level == 0) { // linkify if not inside anchor tags
  8.                                                 if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 4
  9.                                                         $j++;
  10.                                                         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 !
  11.                                                                 $token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments
  12.                                                         }
  13.                                                         $must_tokenize = true; // re-tokenize next time around
  14.                                                 }
  15.                                         }
  16.                                 } else { // this token is markup
  17.                                         if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>
  18.                                                 $anchor_level++;
  19.                                         } elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>
  20.                                                 $anchor_level--;
  21.                                         }
  22.                                 }
  23.                                 $filtered .= $token; // this token has now been filtered
  24.                         }
  25.                         $content = $filtered; // filtering completed for this link
  26.                 }
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则