过期域名预定抢注

 找回密碼
 免费注册

Simple tags重複自動連接問題

[複製鏈接]
發表於 2013-12-6 13:21:01 | 顯示全部樓層 |閱讀模式
請教下高手們,
8 }! m6 ?4 ~( U) f我用Simple tags在後台已經設置了Maximum number of links for the same tag為1,但是文章中照樣會出現同一個標籤被鏈接多次的現象。刷新緩存什麼的都試過多次。) Y- i7 O. b# L2 s$ D
我用的是wordpress3.7.1版本,直接在後台查找從官網下載的simple tags。這個要怎麼解決啊

) @/ V2 Q: n( p0 ?4 m
9 M* y  l9 H, _' ^* ?
; v. X  G: B: Q" L+ D: f1 G( ?3 j& A0 V9 `& ?8 g
 樓主| 發表於 2013-12-6 19:28:44 | 顯示全部樓層
本帖最後由 jeffseo 於 2013-12-6 19:33 編輯
7 @) w& \6 T8 x: w* T1 _5 \
) a4 U! ], \% g) y: P; H* `換其它WP的版本也還是這樣,2 Q+ V& c# `$ X" q2 q9 o6 C
另外Maximum number of links per article:這個值也沒讀成功,設置10個TAG,文章中仍然會把所有TAG都鏈接上。
  x  b% [! s& p  H0 T) I
看代碼似乎都沒什麼問題,
; r% U, J. S  c" t+ J其它用simple tags的哥們也是這樣的嗎
  1.   // there should always be at least one token, but check just in case* P% j5 x$ k/ U
  2.                 $anchor_level = 0;
    / N/ r3 W. k- @; P9 o2 F  D; O9 T
  3.                 if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {% i- m8 \0 G1 R/ x% I6 {, c+ Q, q4 t  v5 ]
  4.                         $i = 0;3 V( y3 q6 u( p' Z0 Y% f
  5.                         foreach ($tokens as $token) {
    ! m. `; `5 N# f" m
  6.                                 if (++$i % 2 && $token != '') { // this token is (non-markup) text$ v2 [# S8 J/ M  Q5 h" b) ~
  7.                                         if ($anchor_level == 0) { // linkify if not inside anchor tags$ y) r9 o. }1 u8 l4 Q8 {3 h
  8.                                                 if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 4% p1 b2 q5 D3 E7 q
  9.                                                         $j++;
    5 l2 a; f( h$ V5 J7 k$ w3 z! 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 !
    1 [- p$ M9 K0 N$ x
  11.                                                                 $token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments
    # J- |. \$ e+ v7 y, x( b' N
  12.                                                         }
    1 b! O8 O' @, _1 f3 f6 X
  13.                                                         $must_tokenize = true; // re-tokenize next time around
    % @+ V* }$ P0 k- Y: z( A, C. E, C4 I
  14.                                                 }
    ) w! j4 ?& d5 v6 n3 S5 j
  15.                                         }
    $ o+ a' K& K  E" w
  16.                                 } else { // this token is markup* A: L7 l5 @7 p( _1 s
  17.                                         if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>; _$ C" f# p* c. t: L
  18.                                                 $anchor_level++;
    & Z  v. Z: Z; [) i. s
  19.                                         } elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>
    0 t* I; m$ X* p( x
  20.                                                 $anchor_level--;
    & x. @7 X' Z% j8 K7 _" ^
  21.                                         }& [  `8 R5 ]4 S
  22.                                 }* M( z7 E2 o; u8 n
  23.                                 $filtered .= $token; // this token has now been filtered
    5 F1 }- J5 X; ?7 y6 a
  24.                         }& h" m: b: q6 T* k0 L1 |% i
  25.                         $content = $filtered; // filtering completed for this link4 ~; j6 N4 h0 n8 S: \" p3 B
  26.                 }
複製代碼
QQ截图20131206192511.jpg 1 o7 y! a: u5 j8 n

" e. q, I5 h9 b$ p& ]$ h) E5 J
& A$ H7 @6 X6 q% N& H* S: e9 K, S
回復 给力 爆菊

使用道具 舉報

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

本版積分規則

过期高净值品牌域名预定抢注

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

GMT+8, 2025-9-19 02:53

By DZ X3.5

小黑屋

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