过期域名预定抢注

 找回密碼
 免费注册

Simple tags重複自動連接問題

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

# f5 x7 N# Q+ [8 P1 v$ H
( F) P' O% U/ U( l& j: y6 y4 O7 _3 \* y5 d3 M% p+ q5 ]* n
 樓主| 發表於 2013-12-6 19:28:44 | 顯示全部樓層
本帖最後由 jeffseo 於 2013-12-6 19:33 編輯 # w! \9 _% A* S7 [" z6 H

; A, [# u  M: i+ L換其它WP的版本也還是這樣," m( [* v# l; |# e
另外Maximum number of links per article:這個值也沒讀成功,設置10個TAG,文章中仍然會把所有TAG都鏈接上。

8 V3 C8 g' {* V, m6 S8 g0 h看代碼似乎都沒什麼問題,0 \: c+ q9 z8 Z/ b
其它用simple tags的哥們也是這樣的嗎
  1.   // there should always be at least one token, but check just in case8 z# u; @) ~4 L" j/ [
  2.                 $anchor_level = 0;! I' _9 T. e  p/ q% x" E+ o
  3.                 if (isset($tokens) && is_array($tokens) && count($tokens) > 0) {
    7 e3 `5 W4 J8 ~' L0 [4 a( A
  4.                         $i = 0;
    - l$ {. z# |% C2 I; C
  5.                         foreach ($tokens as $token) {
    9 G/ f) t0 T5 A$ h0 o
  6.                                 if (++$i % 2 && $token != '') { // this token is (non-markup) text4 U4 d' D# z/ h" J, [
  7.                                         if ($anchor_level == 0) { // linkify if not inside anchor tags
    6 ^6 a3 U# _& `
  8.                                                 if (preg_match($match, $token)) { // use preg_match for compatibility with PHP 4. u' u* F  ~8 o" M2 r. K# _
  9.                                                         $j++;$ l$ w& `$ p8 b2 h+ ?% O
  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 !
    6 G3 z9 w+ @: v- O1 m
  11.                                                                 $token = preg_replace($match, $substitute, $token); // only PHP 5 supports calling preg_replace with 5 arguments
    1 W8 n4 |4 y2 \4 W2 w8 U
  12.                                                         }
    : c  k2 ^+ l$ ]0 ~& k+ o" @
  13.                                                         $must_tokenize = true; // re-tokenize next time around
    6 i8 Y/ \( Z9 B& ?6 w: p- G. r' R8 k
  14.                                                 }
    ( n# q1 A* ~2 T
  15.                                         }
    2 I3 i  M, [* Y( z) F
  16.                                 } else { // this token is markup
    $ T8 p; G  j1 i7 `, k! X+ A+ T
  17.                                         if (preg_match("#<\s*a\s+[^>]*>#i", $token)) { // found <a ...>
    ; k- y7 L( |1 C. X/ J9 A
  18.                                                 $anchor_level++;" Q, X1 u- y( \
  19.                                         } elseif (preg_match("#<\s*/\s*a\s*>#i", $token)) { // found </a>8 R0 I9 o" a& k2 q, [6 n: n6 Z
  20.                                                 $anchor_level--;$ ?' B/ a0 s/ i* k5 k. h' ]' |+ t
  21.                                         }) E. t! A. l/ k/ _- l$ B
  22.                                 }2 f# a! x) X: E5 L: ]6 v! n" w
  23.                                 $filtered .= $token; // this token has now been filtered
    & T2 W; k$ N9 o$ L% T
  24.                         }
    " i& D7 D: H/ X5 Q5 L; ?3 T4 G
  25.                         $content = $filtered; // filtering completed for this link
    * b+ d; S6 B* l" W8 Q# S
  26.                 }
複製代碼
QQ截图20131206192511.jpg 8 Y) R% q0 A- t2 L
/ {1 C4 L# ?$ \, y0 S, A9 f

: k, ^! e1 v6 h6 K* r: \5 z
回復 给力 爆菊

使用道具 舉報

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

本版積分規則

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

GMT+8, 2025-5-26 05:32

By DZ X3.5

小黑屋

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