Changeset 7098

Show
Ignore:
Timestamp:
11/29/08 11:25:31 (6 weeks ago)
Author:
inureyes
Message:

refs #1158

  • [7088]을 1.7 트리에 반영
Location:
branches/1.7/plugins
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.7/plugins/FM_Markdown/ttml.php

    r6688 r7098  
    2626    } 
    2727    return $content; 
     28} 
     29 
     30class FM_TTML_KeywordBinder { 
     31    var $_replaceOnce; 
     32    var $_binded = array(); 
     33 
     34    function FM_TTML_KeywordBinder($replaceOnce = true) { 
     35        $this->_replaceOnce = $replaceOnce; 
     36    } 
     37 
     38    function replace($matches) { 
     39        $keyword = $matches[0]; 
     40        if (!$this->_replaceOnce || !array_key_exists($keyword, $this->_binded)) { 
     41            $this->_binded[$keyword] = null; 
     42            $keyword = fireEvent('BindKeyword', $keyword); 
     43        } 
     44        return $keyword; 
     45    } 
    2846} 
    2947 
     
    5775    foreach ($keywords as $keyword) 
    5876        $pattern[] = preg_quote($keyword, '/'); 
    59     $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/e'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
     77    $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
    6078 
    6179    // list of unbindable & (always) singleton elements 
     
    6987    $i = 0; 
    7088    $bindable = true; 
     89    $binder = new FM_TTML_KeywordBinder(); 
    7190    while (true) { 
    7291        if ($bindable) { 
    73             $buf .= preg_replace($pattern, "fireEvent('BindKeyword', '\\0')", $result[$i]); 
     92            $buf .= preg_replace_callback($pattern, array($binder, 'replace'), $result[$i]); 
    7493        } else { 
    7594            $buf .= $result[$i]; 
  • branches/1.7/plugins/FM_TTML/ttml.php

    r6688 r7098  
    2626    } 
    2727    return $content; 
     28} 
     29 
     30class FM_TTML_KeywordBinder { 
     31    var $_replaceOnce; 
     32    var $_binded = array(); 
     33 
     34    function FM_TTML_KeywordBinder($replaceOnce = true) { 
     35        $this->_replaceOnce = $replaceOnce; 
     36    } 
     37 
     38    function replace($matches) { 
     39        $keyword = $matches[0]; 
     40        if (!$this->_replaceOnce || !array_key_exists($keyword, $this->_binded)) { 
     41            $this->_binded[$keyword] = null; 
     42            $keyword = fireEvent('BindKeyword', $keyword); 
     43        } 
     44        return $keyword; 
     45    } 
    2846} 
    2947 
     
    5775    foreach ($keywords as $keyword) 
    5876        $pattern[] = preg_quote($keyword, '/'); 
    59     $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/e'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
     77    $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
    6078 
    6179    // list of unbindable & (always) singleton elements 
     
    6987    $i = 0; 
    7088    $bindable = true; 
     89    $binder = new FM_TTML_KeywordBinder(); 
    7190    while (true) { 
    7291        if ($bindable) { 
    73             $buf .= preg_replace($pattern, "fireEvent('BindKeyword', '\\0')", $result[$i]); 
     92            $buf .= preg_replace_callback($pattern, array($binder, 'replace'), $result[$i]); 
    7493        } else { 
    7594            $buf .= $result[$i]; 
  • branches/1.7/plugins/FM_Textile/ttml.php

    r6688 r7098  
    2626    } 
    2727    return $content; 
     28} 
     29 
     30class FM_TTML_KeywordBinder { 
     31    var $_replaceOnce; 
     32    var $_binded = array(); 
     33 
     34    function FM_TTML_KeywordBinder($replaceOnce = true) { 
     35        $this->_replaceOnce = $replaceOnce; 
     36    } 
     37 
     38    function replace($matches) { 
     39        $keyword = $matches[0]; 
     40        if (!$this->_replaceOnce || !array_key_exists($keyword, $this->_binded)) { 
     41            $this->_binded[$keyword] = null; 
     42            $keyword = fireEvent('BindKeyword', $keyword); 
     43        } 
     44        return $keyword; 
     45    } 
    2846} 
    2947 
     
    5775    foreach ($keywords as $keyword) 
    5876        $pattern[] = preg_quote($keyword, '/'); 
    59     $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/e'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
     77    $pattern = '/(?<![a-zA-Z\x80-\xff])(?:'.implode('|',$pattern).')/'; // 대소문자 구별 및 키워드의 단어 첫머리 처리 
    6078 
    6179    // list of unbindable & (always) singleton elements 
     
    6987    $i = 0; 
    7088    $bindable = true; 
     89    $binder = new FM_TTML_KeywordBinder(); 
    7190    while (true) { 
    7291        if ($bindable) { 
    73             $buf .= preg_replace($pattern, "fireEvent('BindKeyword', '\\0')", $result[$i]); 
     92            $buf .= preg_replace_callback($pattern, array($binder, 'replace'), $result[$i]); 
    7493        } else { 
    7594            $buf .= $result[$i];