GeshiHighlight.php

From Fxp Wiki

Jump to: navigation, search


 
 
<?php
# GeSHiHighlight.php
# 
# By: E. Rogan Creswick (aka: Largos)
# largos@ciscavate.org
# ciscavate.org/wiki/
#
# License: GeSHi Highlight is released under the Gnu Public License (GPL), and comes with no warranties.
# The text of the GPL can be found here: http://www.gnu.org/licenses/gpl.html
# Loosely based on SyntaxHighlight.php by Coffman, (www.wickle.com)
 
 
                                                                                                                                         
#$wgSyntaxSettings = new SyntaxSettings;
$wgExtensionFunctions[] = "wfSyntaxExtension";                                                                                                                 
                                                                                                                                                               
function wfSyntaxExtension() {                                                                                                                                 
        global $wgParser;
 
        $langArray = array("actionscript","ada","apache","asm","asp","bash",
                           "caddcl","cadlisp","c","cpp","css","delphi",
                           "html4strict","html4","java","javascript","lisp", "lua",
                           "nsis","oobas","pascal","perl","php-brief","php",
                           "python","qbasic","sql","vb","visualfoxpro","xml");
        
        foreach ( $langArray as $lang ){                                                       
                                                                                                                                        
                $wgParser->setHook( $lang, create_function( '$text', '$geshi = new GeSHi($text, ' . $lang . ', "extensions/geshi/geshi"); $geshi->enable_classes(); $geshi->set_header_type(GESHI_HEADER_PRE); $geshi->set_overall_class("code"); $geshi->set_url_for_keyword_group(1, ""); $geshi->set_url_for_keyword_group(2, ""); $geshi->set_encoding("utf-8"); $geshi->set_url_for_keyword_group(3, ""); $geshi->set_url_for_keyword_group(4, "");return $geshi->parse_code();'));
        }                                                                                                                                                      
}                                                                                                                                                              
?>
 
Personal tools