Skip to content

Commit 5c7a15d

Browse files
authored
Merge pull request #44 from Crizz0/issue/43
Remove global from functions/utility.php
2 parents 23d9154 + d819775 commit 5c7a15d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
arguments:
1111
- '%phpbbde.pastebin.geshilangs%'
1212
- '%core.php_ext%'
13+
- '@language'
1314
phpbbde.pastebin.functions.pastebin:
1415
class: phpbbde\pastebin\functions\pastebin
1516
arguments:

functions/utility.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,23 @@ class utility
3434
/** @var string */
3535
protected $php_ext;
3636

37+
/* @var \phpbb\language\language */
38+
public $language;
39+
3740
/**
3841
* Constructor
3942
* @param string $php_ext
43+
* @param \phpbb\language\language $language
4044
*/
41-
function __construct($geshi_dir, $php_ext)
45+
function __construct(
46+
$geshi_dir,
47+
$php_ext,
48+
\phpbb\language\language $language)
4249
{
4350
$this->geshi_dir = $geshi_dir;
4451
$this->geshi_list = $this->geshi_list();
4552
$this->php_ext = $php_ext;
53+
$this->language = $language;
4654
}
4755

4856

@@ -86,14 +94,13 @@ function geshi_list()
8694
*/
8795
function highlight_select($default = 'text')
8896
{
89-
global $user;
9097
if (!in_array($default, $this->geshi_list))
9198
{
9299
$default = 'text';
93100
}
94101

95102
$output = '';
96-
foreach ($user->lang['PASTEBIN_LANGUAGES'] as $code => $name)
103+
foreach ($this->language->lang['PASTEBIN_LANGUAGES'] as $code => $name)
97104
{
98105
if (in_array($code, $this->geshi_list))
99106
{

0 commit comments

Comments
 (0)