Show
Ignore:
Timestamp:
02/16/09 14:39:14 (3 years ago)
Author:
daris
Message:

geshi highlight: fixed bug with not replacing ' as single quote and releasing 1.0.3'

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/geshi_highlight/manifest.xml

    r44 r53  
    44        <id>geshi_highlight</id> 
    55        <title>GeSHi Highlight</title> 
    6         <version>1.0.2</version> 
     6        <version>1.0.3</version> 
    77        <description>Highlights code tags in posts using GeSHi highlighter.</description> 
    88        <author>Daris</author> 
     
    2020                        if (!function_exists('htmlspecialchars_decode')) 
    2121                        { 
    22                                 function htmlspecialchars_decode($str) 
     22                                function htmlspecialchars_decode($str, $quote_style = ENT_COMPAT) 
    2323                                { 
    24                                         return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS))); 
     24                                        return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); 
    2525                                } 
    2626                        } 
     
    2929                        { 
    3030                                $lang = $matches[1]; 
    31                                 $source = htmlspecialchars_decode(trim($matches[2])); 
     31                                $source = htmlspecialchars_decode(trim($matches[2]), ENT_QUOTES); 
     32                                $source = str_replace('&#039;', '\'', $source); // geshi uses &#039; as single quote instead of &#39; 
    3233                                $geshi = new GeSHi($source, $lang); 
    3334                                $code = $geshi->parse_code(); 
    34                                 $code = substr($code, strpos($code, 'monospace;">') + 12); 
    35                                 $code = substr($code, 0, strpos($code, '</pre>')); 
    36                                 return '[code]'.$code.'[/code]'; 
     35                                return '</p><div class="codebox">'.$code.'</div><p>'; 
    3736                        } 
    3837