过期域名预定抢注

 找回密碼
 免费注册

Simple tags重複自動連接問題

[複製鏈接]
發表於 2013-12-6 13:21:01 | 顯示全部樓層 |閱讀模式
請教下高手們,
4 R5 C& ?) }; H* X0 I! T. [+ i. B我用Simple tags在後台已經設置了Maximum number of links for the same tag為1,但是文章中照樣會出現同一個標籤被鏈接多次的現象。刷新緩存什麼的都試過多次。
( V. v# Q* F2 x# @) r5 P我用的是wordpress3.7.1版本,直接在後台查找從官網下載的simple tags。這個要怎麼解決啊

6 _$ x9 F; R$ ~4 p  N- `- d) d2 l

: g' w* Y/ D0 E# v2 P) W
8 W$ A9 _0 t, K, ^1 k
 樓主| 發表於 2013-12-6 19:28:44 | 顯示全部樓層
本帖最後由 jeffseo 於 2013-12-6 19:33 編輯
7 L! d- y9 A9 q& i' |8 S% R- ]$ l1 a0 m& N2 v. n( m
換其它WP的版本也還是這樣,
: x; I- H8 M8 k. B; K# Q另外Maximum number of links per article:這個值也沒讀成功,設置10個TAG,文章中仍然會把所有TAG都鏈接上。

2 q, @% [$ w$ n7 k6 ?( \看代碼似乎都沒什麼問題,8 W) f) \; O. {1 s1 m% w
其它用simple tags的哥們也是這樣的嗎
  1.   // there should always be at least one token, but check just in case! k/ [) c3 w; N2 O( t, X
  2.                 $anchor_level = 0;
    0 K, x; _& R) h
  3.                 if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {: b/ ~! }3 X5 k+ c7 X( f
  4.                         $i = 0;, y( n- s0 [, ^* }
  5.                         foreach ($tokens as $token) {( M/ E* s( o8 _) k2 M
  6.                                 if (++$i % 2 && $token != '') { // this token is (non-markup) text
    - I) |3 m0 s# T- p$ t
  7.                                         if ($anchor_level == 0) { // linkify if not inside anchor tags( L3 @. F8 n7 v1 M
  8.                                                 if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 47 e2 v7 a0 z3 [4 g! s- D+ o
  9.                                                         $j++;! X( l' y. V- k
  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 !& G5 E! m, `6 K1 u" F3 s2 S7 Y
  11.                                                                 $token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments5 I) c! n) T* p+ [1 o& m
  12.                                                         }  \% y* k- `& m5 p0 ^3 l. |+ f. q
  13.                                                         $must_tokenize = true; // re-tokenize next time around1 ^/ Z: F3 Q. v0 i7 e/ [1 X
  14.                                                 }5 z/ A9 {' \& H) I
  15.                                         }( a$ C9 Q5 n( N1 z! E2 }  f
  16.                                 } else { // this token is markup3 P1 Q6 b  d/ P' [; }! I
  17.                                         if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>
    3 ~9 x) M$ t3 i. l
  18.                                                 $anchor_level++;
    ( P8 j' g+ u! f/ _/ [# K
  19.                                         } elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>
    : A/ B" @. l2 x6 {
  20.                                                 $anchor_level--;3 g) G, a: R1 J# J
  21.                                         }
    3 u3 W# S# j; N5 W' I- T
  22.                                 }
    ) K. W& i) q* D$ @; U
  23.                                 $filtered .= $token; // this token has now been filtered- K! Q: n: D+ c; P" |7 w7 ?/ _' o
  24.                         }
    * r5 j0 g* N, ^
  25.                         $content = $filtered; // filtering completed for this link4 e+ Q; N7 W. _
  26.                 }
複製代碼
QQ截图20131206192511.jpg
* R3 _. ^) K  k4 k+ e

' ~) t0 b- ?. u- O* t' w1 z- b: i" g: Q& _4 g' d8 u- @5 U
回復 给力 爆菊

使用道具 舉報

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

本版積分規則

點基

GMT+8, 2025-11-24 14:27

By DZ X3.5

小黑屋

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