1: <?php
2: 3: 4: 5:
6:
7:
8: class Pastie_Highlighter_TextHighlighter extends Pastie_Highlighter {
9: public static function output($text, $syntax = 'none') {
10: if ($syntax == 'none') {
11: return '<pre>' . $text . '</pre>';
12: } else {
13:
14:
15: $syntax = strtoupper($syntax);
16: $highlighter = Text_Highlighter::factory($syntax);
17: if ($highlighter instanceof PEAR_Error) {
18: throw new Horde_Exception_Wrapped($highlighter);
19: }
20: $renderer = new Text_Highlighter_Renderer_Html(array(
21: "numbers" => HL_NUMBERS_LI
22: ));
23: if ($renderer instanceof PEAR_Error) {
24: throw new Horde_Exception_Wrapped($renderer);
25: }
26: $highlighter->setRenderer($renderer);
27: return $highlighter->highlight($text);
28: }
29: }
30:
31: public static function getSyntaxes()
32: {
33: return array(
34: "ABAP",
35: "CPP",
36: "CSS",
37: "DIFF",
38: "DTD",
39: "Generator",
40: "HTML",
41: "JAVA",
42: "JAVASCRIPT",
43: "MYSQL",
44: "PERL",
45: "PHP",
46: "PYTHON",
47: "RUBY",
48: "SH",
49: "SQL",
50: "VBSCRIPT",
51: "XML"
52: );
53: }
54: }