Skip to content

Commit 63ff87e

Browse files
authored
Merge pull request #48 from Crizz0/issue/47
Add programming lang array to utility, remove lang-service
2 parents 937e155 + 72ad7e5 commit 63ff87e

File tree

6 files changed

+91
-182
lines changed

6 files changed

+91
-182
lines changed

config/services.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ services:
1010
arguments:
1111
- '%phpbbde.pastebin.geshilangs%'
1212
- '%core.php_ext%'
13-
- '@language'
1413
phpbbde.pastebin.functions.pastebin:
1514
class: phpbbde\pastebin\functions\pastebin
1615
arguments:

controller/main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private function display_pb()
273273

274274
$filedata = $this->request->file('fileupload');
275275

276-
if (!empty($this->request->file('fileupload')) && $filedata['name'] != 'none' && trim($filedata['name']))
276+
if (!empty($filedata) && $filedata['name'] != 'none' && trim($filedata['name']))
277277
{
278278
$upload = $this->factory->get('files.upload');
279279

functions/pastebin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,6 @@ function offsetSet($offset, $value)
253253

254254
function offsetUnset($offset)
255255
{
256-
256+
// still needed, even if empty
257257
}
258258
}

functions/utility.php

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,17 @@ class utility
2727
/** @var string */
2828
protected $php_ext;
2929

30-
/* @var \phpbb\language\language */
31-
public $language;
32-
3330
/**
3431
* Constructor
3532
* @param string $php_ext
36-
* @param \phpbb\language\language $language
3733
*/
3834
function __construct(
3935
$geshi_dir,
40-
$php_ext,
41-
\phpbb\language\language $language)
36+
$php_ext)
4237
{
4338
$this->geshi_dir = $geshi_dir;
4439
$this->geshi_list = $this->geshi_list();
4540
$this->php_ext = $php_ext;
46-
$this->language = $language;
4741
}
4842

4943

@@ -87,13 +81,100 @@ function geshi_list()
8781
*/
8882
function highlight_select($default = 'text')
8983
{
84+
// Programming languages
85+
// these are used by geshi
86+
$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+
*/
169+
);
170+
90171
if (!in_array($default, $this->geshi_list))
91172
{
92173
$default = 'text';
93174
}
94175

95176
$output = '';
96-
foreach ($this->language->lang['PASTEBIN_LANGUAGES'] as $code => $name)
177+
foreach ($programming_langs as $code => $name)
97178
{
98179
if (in_array($code, $this->geshi_list))
99180
{

language/de/pastebin.php

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -102,89 +102,3 @@
102102
'PASTEBIN_SNIPPET_PRUNABLE_EXPLAIN' => 'Wenn diese Option deaktiviert ist, wird der Eintrag nicht in die monatlich automatisch zu löschenden Einträge aufgenommen.',
103103
'PASTEBIN_SNIPPET_SUBMITTED' => 'Dein Eintrag wurde erfolgreich erstellt.',
104104
));
105-
106-
// these are used by geshi
107-
$lang['PASTEBIN_LANGUAGES'] = array(
108-
'text' => 'Text',
109-
'php' => 'PHP',
110-
'sql' => 'SQL',
111-
'html4strict' => 'HTML',
112-
'css' => 'CSS',
113-
'javascript' => 'Javascript',
114-
'xml' => 'XML',
115-
'diff' => 'Diff',
116-
'robots' => 'robots.txt',
117-
118-
/**
119-
* Wenn eine weitere Sprache aktiviert werden soll, muss die Datei in den includes/geshi/ Ordner
120-
* kopiert werden, und der Eintrag der Sprachdatei wieder nach aktiviert werden.
121-
*/
122-
123-
/*
124-
'actionscript' => 'ActionScript',
125-
'ada' => 'Ada',
126-
'apache' => 'Apache',
127-
'applescript' => 'AppleScript',
128-
'asm' => 'x86 Assembler',
129-
'autoit' => 'AutoIt',
130-
'bash' => 'Bash',
131-
'blitzbasic' => 'BlitzBasic',
132-
'bnf' => 'BNF',
133-
'c_mac' => 'C (Mac)',
134-
'caddcl' => 'CAD DCL',
135-
'cadlisp' => 'CAD Lisp',
136-
'cfdg' => 'CFDG',
137-
'cfm' => 'ColdFusion',
138-
'cpp-qt' => 'C++ (QT)',
139-
'css-gen.cfg' => 'C#',
140-
'c_mac' => 'C (Mac)',
141-
'd' => 'D',
142-
'delphi' => 'Delphi',
143-
'div' => 'DIV',
144-
'dos' => 'DOS',
145-
'eiffel' => 'Eiffel',
146-
'fortran' => 'Fortran',
147-
'freebasic' => 'FreeBasic',
148-
'gml' => 'GML',
149-
'groovy' => 'Groovy',
150-
'idl' => 'Uno Idl',
151-
'ini' => 'INI',
152-
'inno' => 'Inno',
153-
'io' => 'Io',
154-
'java5' => 'Java(TM) 2 Platform Standard Edition 5.0',
155-
'latex' => 'LaTeX',
156-
'lisp' => 'Lisp',
157-
'lua' => 'Lua',
158-
'matlab' => 'Matlab M',
159-
'mirc' => 'mIRC Scripting',
160-
'mpasm' => 'Microchip Assembler',
161-
'mysql' => 'MySQL',
162-
'nsis' => 'NSIS',
163-
'objc' => 'Objective C',
164-
'ocaml-brief' => 'OCaml',
165-
'ocaml' => 'OCaml',
166-
'oobas' => 'OpenOffice.org Basic',
167-
'oracle8' => 'Oracle 8 SQL',
168-
'pascal' => 'Pascal',
169-
'php-brief' => 'PHP (brief)',
170-
'ruby' => 'Ruby',
171-
'sas' => 'SAS',
172-
'scheme' => 'Scheme',
173-
'sdlbasic' => 'sdlBasic',
174-
'smalltalk' => 'Smalltalk',
175-
'tcl' => 'TCL',
176-
'thinbasic' => 'thinBasic',
177-
'tsql' => 'T-SQL',
178-
'plsql' => 'PL/SQL',
179-
'python' => 'Python',
180-
'qbasic' => 'QBasic/QuickBASIC',
181-
'rails' => 'Rails',
182-
'reg' => 'Microsoft Registry',
183-
'vbnet' => 'vb.net',
184-
'vhdl' => 'VHDL',
185-
'visualfoxpro' => 'Visual Fox Pro',
186-
'winbatch' => 'Winbatch',
187-
'xpp' => 'X++',
188-
'z80' => 'ZiLOG Z80 Assembler',
189-
*/
190-
);

language/en/pastebin.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -101,88 +101,3 @@
101101
'PASTEBIN_SNIPPET_PRUNABLE_EXPLAIN' => 'If this option is disabled, the entry will not be entered in the monthly list of prunable entries.',
102102
'PASTEBIN_SNIPPET_SUBMITTED' => 'Your entry was sucessfully created.',
103103
));
104-
105-
// these are used by geshi
106-
$lang['PASTEBIN_LANGUAGES'] = array(
107-
'text' => 'Text',
108-
'php' => 'PHP',
109-
'sql' => 'SQL',
110-
'html4strict' => 'HTML',
111-
'css' => 'CSS',
112-
'javascript' => 'Javascript',
113-
'xml' => 'XML',
114-
'diff' => 'Diff',
115-
'robots' => 'robots.txt',
116-
117-
/**
118-
* You can activate further languages by uncommenting any of these lines.
119-
*/
120-
121-
/*
122-
'actionscript' => 'ActionScript',
123-
'ada' => 'Ada',
124-
'apache' => 'Apache',
125-
'applescript' => 'AppleScript',
126-
'asm' => 'x86 Assembler',
127-
'autoit' => 'AutoIt',
128-
'bash' => 'Bash',
129-
'blitzbasic' => 'BlitzBasic',
130-
'bnf' => 'BNF',
131-
'c_mac' => 'C (Mac)',
132-
'caddcl' => 'CAD DCL',
133-
'cadlisp' => 'CAD Lisp',
134-
'cfdg' => 'CFDG',
135-
'cfm' => 'ColdFusion',
136-
'cpp-qt' => 'C++ (QT)',
137-
'css-gen.cfg' => 'C#',
138-
'c_mac' => 'C (Mac)',
139-
'd' => 'D',
140-
'delphi' => 'Delphi',
141-
'div' => 'DIV',
142-
'dos' => 'DOS',
143-
'eiffel' => 'Eiffel',
144-
'fortran' => 'Fortran',
145-
'freebasic' => 'FreeBasic',
146-
'gml' => 'GML',
147-
'groovy' => 'Groovy',
148-
'idl' => 'Uno Idl',
149-
'ini' => 'INI',
150-
'inno' => 'Inno',
151-
'io' => 'Io',
152-
'java5' => 'Java(TM) 2 Platform Standard Edition 5.0',
153-
'latex' => 'LaTeX',
154-
'lisp' => 'Lisp',
155-
'lua' => 'Lua',
156-
'matlab' => 'Matlab M',
157-
'mirc' => 'mIRC Scripting',
158-
'mpasm' => 'Microchip Assembler',
159-
'mysql' => 'MySQL',
160-
'nsis' => 'NSIS',
161-
'objc' => 'Objective C',
162-
'ocaml-brief' => 'OCaml',
163-
'ocaml' => 'OCaml',
164-
'oobas' => 'OpenOffice.org Basic',
165-
'oracle8' => 'Oracle 8 SQL',
166-
'pascal' => 'Pascal',
167-
'php-brief' => 'PHP (brief)',
168-
'ruby' => 'Ruby',
169-
'sas' => 'SAS',
170-
'scheme' => 'Scheme',
171-
'sdlbasic' => 'sdlBasic',
172-
'smalltalk' => 'Smalltalk',
173-
'tcl' => 'TCL',
174-
'thinbasic' => 'thinBasic',
175-
'tsql' => 'T-SQL',
176-
'plsql' => 'PL/SQL',
177-
'python' => 'Python',
178-
'qbasic' => 'QBasic/QuickBASIC',
179-
'rails' => 'Rails',
180-
'reg' => 'Microsoft Registry',
181-
'vbnet' => 'vb.net',
182-
'vhdl' => 'VHDL',
183-
'visualfoxpro' => 'Visual Fox Pro',
184-
'winbatch' => 'Winbatch',
185-
'xpp' => 'X++',
186-
'z80' => 'ZiLOG Z80 Assembler',
187-
*/
188-
);

0 commit comments

Comments
 (0)