Show
Ignore:
Timestamp:
02/14/09 08:47:18 (3 years ago)
Author:
daris
Message:

geshi highlight: workaround for php4 which doesnt have htmlspecialchars_decode function

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/geshi_highlight/manifest.xml

    r14 r44  
    44        <id>geshi_highlight</id> 
    55        <title>GeSHi Highlight</title> 
    6         <version>1.0.1</version> 
     6        <version>1.0.2</version> 
    77        <description>Highlights code tags in posts using GeSHi highlighter.</description> 
    88        <author>Daris</author> 
     
    1717                <hook id="ps_start"><![CDATA[ 
    1818                        require_once $ext_info['path'].'/geshi.php'; 
    19                          
     19 
     20                        if (!function_exists('htmlspecialchars_decode')) 
     21                        { 
     22                                function htmlspecialchars_decode($str) 
     23                                { 
     24                                        return strtr($str, array_flip(get_html_translation_table(HTML_SPECIALCHARS))); 
     25                                } 
     26                        } 
     27 
    2028                        function geshi_syntax_highlight($matches) 
    2129                        { 
    22                                 global $lang_common; 
    23                                  
    2430                                $lang = $matches[1]; 
    2531                                $source = htmlspecialchars_decode(trim($matches[2])); 
     
    3036                                return '[code]'.$code.'[/code]'; 
    3137                        } 
     38 
    3239                ]]></hook> 
    33                  
     40 
    3441                <hook id="ps_parse_message_pre_split"><![CDATA[ 
    3542                        $text = preg_replace_callback('#\[code=([^\[]+?)\](.*?)\[/code\]#s', 'geshi_syntax_highlight', $text);