<?php
include_once "tadtools_header.php";

class syntaxhighlighter{

	//建構函數
	function syntaxhighlighter(){

	}

	//產生語法
	function render(){
    $xoopsModuleConfig=TadToolsXoopsModuleConfig();
    $syntaxhighlighter_themes=!empty($xoopsModuleConfig['syntaxhighlighter_themes'])?$xoopsModuleConfig['syntaxhighlighter_themes']:'shThemeDefault';
		$syntaxhighlighter="
    <link type='text/css' rel='stylesheet' href='".TADTOOLS_URL."/syntaxhighlighter/styles/shCore.css'/>
    <link type='text/css' rel='stylesheet' href='".TADTOOLS_URL."/syntaxhighlighter/styles/{$syntaxhighlighter_themes}.css'/>
    <script type='text/javascript' src='".TADTOOLS_URL."/syntaxhighlighter/scripts/shCore.js'></script>
  	<script type='text/javascript' src='".TADTOOLS_URL."/syntaxhighlighter/scripts/shAutoloader.js'></script>
    <style>
    .syntaxhighlighter table .container:before {
        display: none !important;
    }
    </style>
    <script type='text/javascript'>
    function path()
    {
        var args = arguments,
        result = [];
        for(var i = 0; i < args.length; i++)
            result.push(args[i].replace('@', '".TADTOOLS_URL."/syntaxhighlighter/scripts/'));
        return result
    };

    $(document).ready(function(){
        SyntaxHighlighter.autoloader.apply(null, path(
        'applescript            @shBrushAppleScript.js',
        'actionscript3 as3      @shBrushAS3.js',
        'bash shell             @shBrushBash.js',
        'coldfusion cf          @shBrushColdFusion.js',
        'cpp c                  @shBrushCpp.js',
        'c# c-sharp csharp      @shBrushCSharp.js',
        'css                    @shBrushCss.js',
        'delphi pascal          @shBrushDelphi.js',
        'diff patch pas         @shBrushDiff.js',
        'erl erlang             @shBrushErlang.js',
        'groovy                 @shBrushGroovy.js',
        'java                   @shBrushJava.js',
        'jfx javafx             @shBrushJavaFX.js',
        'js jscript javascript  @shBrushJScript.js',
        'perl pl                @shBrushPerl.js',
        'php                    @shBrushPhp.js',
        'text plain             @shBrushPlain.js',
        'py python              @shBrushPython.js',
        'ruby rails ror rb      @shBrushRuby.js',
        'sass scss              @shBrushSass.js',
        'scala                  @shBrushScala.js',
        'sql                    @shBrushSql.js',
        'vb vbnet               @shBrushVb.js',
        'xml xhtml xslt html    @shBrushXml.js'
        ));
        SyntaxHighlighter.defaults['smart-tabs'] = true;
        SyntaxHighlighter.defaults['tab-size'] = 2;
        SyntaxHighlighter.defaults['toolbar'] = false;

        SyntaxHighlighter.all();
    });
    </script>";

    return $syntaxhighlighter;
  }
}
?>
