2011-11-16 3 views
1

나는 wordpress 용 bbcode 플러그인이 있습니다. bbcode 플러그인으로 대체되는 문자

그러나 어떤 이유로

, 내가 게시 할 경우, 나는이 문제를 해결할 수있는 방법 X의 다른 종류입니다

[i]v497212he2x2MfMi[/i]은 "X"문자가 ×로 출력되고, 같은?

플러그인 코드는 다음과 같습니다 :

class BBCode { 

    // Plugin initialization 
    function BBCode() { 
     // This version only supports WP 2.5+ (learn to upgrade please!) 
     if (!function_exists('add_shortcode')) return; 

     // Register the shortcodes 
     add_shortcode('b' , array(&$this, 'shortcode_bold')); 
     add_shortcode('i' , array(&$this, 'shortcode_italics')); 
    } 


    // No-name attribute fixing 
    function attributefix($atts = array()) { 
     if (empty($atts[0])) return $atts; 

     if (0 !== preg_match('#=("|\')(.*?)("|\')#', $atts[0], $match)) 
      $atts[0] = $match[2]; 

     return $atts; 
    } 


    // Bold shortcode 
    function shortcode_bold($atts = array(), $content = NULL) { 
     if (NULL === $content) return ''; 

     return '<strong>' . do_shortcode($content) . '</strong>'; 
    } 


    // Italics shortcode 
    function shortcode_italics($atts = array(), $content = NULL) { 
     if (NULL === $content) return ''; 

     return '<em>' . do_shortcode($content) . '</em>'; 
    } 

} 

// Start this plugin once all other plugins are fully loaded 
add_action('plugins_loaded', create_function('', 'global $BBCode; $BBCode = new BBCode();')); 
+0

오류가있는 데이터를 좀 더 제공 할 수 있습니까? –

+2

제공 한 BBCode 클래스가 예상대로 작동합니다. 문제는 다른 곳에서 발생하고 있습니다. – dossy

답변

1

이 변환 때문에 스마트 따옴표, 작은 따옴표, 대시, 타원, 상표 기호에 따옴표의 변환과 텍스트를 주어진 반환 워드 프레스의 wptexturize() 기능의 자리를 복용하고, 곱셈 기호.

이 WP 내지 3.2.1 WP-포함/formatting.php 라인 55 :

$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/'); 
$dynamic_replacements = array('&#8217;$1','&#8217;$1', '$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2'); 

$dynamic_characters 그 배열의 마지막 정규식 ×

로에 "X"를 선회 하나이다 wptexturize ... "[t]ext enclosed in the tags <pre>, <code>, <kbd>, <style>, <script>, <tt>, and [code] will be skipped."의 기능 페이지에 명시된 바와 같이 해당 태그에 bbcode를 넣거나 wptexturize를 비활성화 할 수있는 플러그인 (예 : InScript 또는 Disabler 또는 Disable wptexturize)을 사용하여이 문제를 해결할 수 있습니다.