过期域名预定抢注

 找回密碼
 免费注册

Simple tags重複自動連接問題

[複製鏈接]
發表於 2013-12-6 13:21:01 | 顯示全部樓層 |閱讀模式
請教下高手們,
' r( y/ @# i2 h6 P  [我用Simple tags在後台已經設置了Maximum number of links for the same tag為1,但是文章中照樣會出現同一個標籤被鏈接多次的現象。刷新緩存什麼的都試過多次。
% k7 j+ u0 Y1 J  Z$ h我用的是wordpress3.7.1版本,直接在後台查找從官網下載的simple tags。這個要怎麼解決啊
4 [5 `! H6 S' h. [2 A+ s
4 A4 _8 }5 ^0 e" i- p' L
1 Q# u; z* s, m5 v- U; Y

$ w: W$ _) x" C4 E8 |% y; M( W
 樓主| 發表於 2013-12-6 19:28:44 | 顯示全部樓層
本帖最後由 jeffseo 於 2013-12-6 19:33 編輯 & L; W- f- ]4 I- ~( G' ]

; v, ~/ `% u, C( ~換其它WP的版本也還是這樣,, R4 T- L- K: ?" R8 h& D
另外Maximum number of links per article:這個值也沒讀成功,設置10個TAG,文章中仍然會把所有TAG都鏈接上。
0 X7 q* B$ F% l2 [) k0 k2 k
看代碼似乎都沒什麼問題,
1 ^, E+ M  ~! `% n5 m2 }# X其它用simple tags的哥們也是這樣的嗎
  1.   // there should always be at least one token, but check just in case
    % B1 C7 x" O# }5 ]  i, T$ z  q
  2.                 $anchor_level = 0;
    % u% R1 v3 b5 a6 O& y1 n
  3.                 if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {
    ) X" g2 y. U; P" y" q
  4.                         $i = 0;
    1 B' Q- t9 Q6 u$ r, Z2 w- x
  5.                         foreach ($tokens as $token) {# W" X1 ~& a6 a- ]( R3 U
  6.                                 if (++$i % 2 && $token != '') { // this token is (non-markup) text2 {; u, I- \+ s0 F3 F. o) L2 ?
  7.                                         if ($anchor_level == 0) { // linkify if not inside anchor tags
    2 u# k/ K$ v0 T( ~
  8.                                                 if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 4
    * n" p; G  U* o) l6 \
  9.                                                         $j++;1 k0 }; J" n. N  @  W
  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 !
    / O, B4 M3 Y8 W$ m+ c; k" u% a
  11.                                                                 $token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments- `% R* V* U) ?0 q' i4 W, ~4 }
  12.                                                         }
    # p) I2 v% @/ V: ?1 Y3 y
  13.                                                         $must_tokenize = true; // re-tokenize next time around& X" L! B# @( ~5 J  v
  14.                                                 }; ~6 J8 }, g+ f9 s4 Z
  15.                                         }
    6 V5 |$ ]: |+ r1 [4 l
  16.                                 } else { // this token is markup8 d; @8 s* c/ h0 d* I8 R$ S
  17.                                         if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>- R  V4 P) E" ?/ e  L
  18.                                                 $anchor_level++;
    . o+ B; e* r( P$ z  ~0 [( @- |7 Y5 d0 S
  19.                                         } elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>
    + I6 D3 Z# U( j. q% E( e! m
  20.                                                 $anchor_level--;, N, c  R1 [* @, m; V* B! e
  21.                                         }1 F. k5 e* g8 ^  P) r/ f9 u5 B$ ~
  22.                                 }5 e- w  p, @9 t" K* \2 g
  23.                                 $filtered .= $token; // this token has now been filtered7 w1 l- [% D; u% F' K8 q9 Y, n
  24.                         }
    2 L7 m# a1 B/ A- X: |3 ]0 J
  25.                         $content = $filtered; // filtering completed for this link$ C* M" f! T, S
  26.                 }
複製代碼
QQ截图20131206192511.jpg ' W: H" Y' @# Z4 h7 D

1 Y9 B7 v" n( u" u' t
" L/ C* z+ q4 }: k+ \9 B
回復 给力 爆菊

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 免费注册

本版積分規則

點基跨境 數位編輯創業論壇

GMT+8, 2025-7-15 08:06

By DZ X3.5

小黑屋

快速回復 返回頂部 返回列表