@@ -27,17 +27,23 @@ class utility
2727 /** @var string */
2828 protected $ php_ext ;
2929
30+ /* @var \phpbb\language\language */
31+ protected $ language ;
32+
3033 /**
3134 * Constructor
3235 * @param string $php_ext
36+ * @param \phpbb\language\language $language
3337 */
3438 function __construct (
3539 $ geshi_dir ,
36- $ php_ext )
40+ $ php_ext ,
41+ \phpbb \language \language $ language )
3742 {
3843 $ this ->geshi_dir = $ geshi_dir ;
3944 $ this ->geshi_list = $ this ->geshi_list ();
4045 $ this ->php_ext = $ php_ext ;
46+ $ this ->language = $ language ;
4147 }
4248
4349
@@ -81,91 +87,21 @@ function geshi_list()
8187 */
8288 function highlight_select ($ default = 'text ' )
8389 {
84- // Programming languages
85- // these are used by geshi
90+ /** Programming languages used by geshi
91+ * Check \phpbbde\pastebin\vendor\easybook\geshi\geshi for more languages
92+ * Add them to the array $programming_langs
93+ * Don't forget to add fitting language variables to \phpbbde\pastebin\language\<iso>\pastebin.php as well
94+ */
8695 $ programming_langs = array (
87- 'text ' => 'Text ' ,
88- 'php ' => 'PHP ' ,
89- 'sql ' => 'SQL ' ,
90- 'html4strict ' => 'HTML ' ,
91- 'css ' => 'CSS ' ,
92- 'javascript ' => 'Javascript ' ,
93- 'xml ' => 'XML ' ,
94- 'diff ' => 'Diff ' ,
95- 'robots ' => 'robots.txt ' ,
96-
97- /**
98- * Wenn eine weitere Sprache aktiviert werden soll, muss die Datei in den includes/geshi/ Ordner
99- * kopiert werden, und der Eintrag der Sprachdatei wieder nach aktiviert werden.
100- */
101-
102- /*
103- 'actionscript' => 'ActionScript',
104- 'ada' => 'Ada',
105- 'apache' => 'Apache',
106- 'applescript' => 'AppleScript',
107- 'asm' => 'x86 Assembler',
108- 'autoit' => 'AutoIt',
109- 'bash' => 'Bash',
110- 'blitzbasic' => 'BlitzBasic',
111- 'bnf' => 'BNF',
112- 'c_mac' => 'C (Mac)',
113- 'caddcl' => 'CAD DCL',
114- 'cadlisp' => 'CAD Lisp',
115- 'cfdg' => 'CFDG',
116- 'cfm' => 'ColdFusion',
117- 'cpp-qt' => 'C++ (QT)',
118- 'css-gen.cfg' => 'C#',
119- 'c_mac' => 'C (Mac)',
120- 'd' => 'D',
121- 'delphi' => 'Delphi',
122- 'div' => 'DIV',
123- 'dos' => 'DOS',
124- 'eiffel' => 'Eiffel',
125- 'fortran' => 'Fortran',
126- 'freebasic' => 'FreeBasic',
127- 'gml' => 'GML',
128- 'groovy' => 'Groovy',
129- 'idl' => 'Uno Idl',
130- 'ini' => 'INI',
131- 'inno' => 'Inno',
132- 'io' => 'Io',
133- 'java5' => 'Java(TM) 2 Platform Standard Edition 5.0',
134- 'latex' => 'LaTeX',
135- 'lisp' => 'Lisp',
136- 'lua' => 'Lua',
137- 'matlab' => 'Matlab M',
138- 'mirc' => 'mIRC Scripting',
139- 'mpasm' => 'Microchip Assembler',
140- 'mysql' => 'MySQL',
141- 'nsis' => 'NSIS',
142- 'objc' => 'Objective C',
143- 'ocaml-brief' => 'OCaml',
144- 'ocaml' => 'OCaml',
145- 'oobas' => 'OpenOffice.org Basic',
146- 'oracle8' => 'Oracle 8 SQL',
147- 'pascal' => 'Pascal',
148- 'php-brief' => 'PHP (brief)',
149- 'ruby' => 'Ruby',
150- 'sas' => 'SAS',
151- 'scheme' => 'Scheme',
152- 'sdlbasic' => 'sdlBasic',
153- 'smalltalk' => 'Smalltalk',
154- 'tcl' => 'TCL',
155- 'thinbasic' => 'thinBasic',
156- 'tsql' => 'T-SQL',
157- 'plsql' => 'PL/SQL',
158- 'python' => 'Python',
159- 'qbasic' => 'QBasic/QuickBASIC',
160- 'rails' => 'Rails',
161- 'reg' => 'Microsoft Registry',
162- 'vbnet' => 'vb.net',
163- 'vhdl' => 'VHDL',
164- 'visualfoxpro' => 'Visual Fox Pro',
165- 'winbatch' => 'Winbatch',
166- 'xpp' => 'X++',
167- 'z80' => 'ZiLOG Z80 Assembler',
168- */
96+ 'text ' ,
97+ 'php ' ,
98+ 'sql ' ,
99+ 'html5 ' ,
100+ 'css ' ,
101+ 'javascript ' ,
102+ 'xml ' ,
103+ 'diff ' ,
104+ 'robots ' ,
169105 );
170106
171107 if (!in_array ($ default , $ this ->geshi_list ))
@@ -174,11 +110,12 @@ function highlight_select($default = 'text')
174110 }
175111
176112 $ output = '' ;
177- foreach ($ programming_langs as $ code => $ name )
113+ $ lang_prefix = 'PASTEBIN_LANGS_ ' ;
114+ foreach ($ programming_langs as $ code )
178115 {
179116 if (in_array ($ code , $ this ->geshi_list ))
180117 {
181- $ output .= '<option ' . (($ default == $ code ) ? ' selected="selected" ' : '' ) . ' value=" ' . htmlentities ($ code , ENT_QUOTES ) . '"> ' . $ name . '</option> ' ;
118+ $ output .= '<option ' . (($ default == $ code ) ? ' selected="selected" ' : '' ) . ' value=" ' . htmlentities ($ code , ENT_QUOTES ) . '"> ' . $ this -> language -> lang ( $ lang_prefix . strtoupper ( $ code )) . '</option> ' ;
182119 }
183120 }
184121
0 commit comments