Skip to content

Commit c5be078

Browse files
committed
Put sort() outside of while() and use php_ext
1 parent b2f58c9 commit c5be078

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
class: phpbbde\pastebin\functions\utility
1010
arguments:
1111
- '%phpbbde.pastebin.geshilangs%'
12+
- '%core.php_ext%'
1213
phpbbde.pastebin.functions.pastebin:
1314
class: phpbbde\pastebin\functions\pastebin
1415
arguments:

functions/utility.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ class utility
3131
*/
3232
var $geshi_list = array();
3333

34+
/** @var string */
35+
protected $php_ext;
36+
3437
/**
3538
* Constructor
39+
* @param string $php_ext
3640
*/
37-
function __construct($geshi_dir)
41+
function __construct($geshi_dir, $php_ext)
3842
{
3943
$this->geshi_dir = $geshi_dir;
4044
$this->geshi_list = $this->geshi_list();
45+
$this->php_ext = $php_ext;
4146
}
4247

4348

@@ -54,8 +59,6 @@ function geshi_check($needle)
5459
*/
5560
function geshi_list()
5661
{
57-
global $phpEx;
58-
5962
$geshi_list = array();
6063

6164
$d = dir($this->geshi_dir);
@@ -66,13 +69,15 @@ function geshi_list()
6669
continue;
6770
}
6871

69-
if (($substr_end = strpos($file, ".$phpEx")) !== false)
72+
if (($substr_end = strpos($file, ".$this->php_ext")) !== false)
7073
{
71-
@sort($geshi_list[] = substr($file, 0, $substr_end));
74+
$geshi_list[] = substr($file, 0, $substr_end);
7275
}
7376
}
7477
$d->close();
7578

79+
sort($geshi_list);
80+
7681
return $geshi_list;
7782
}
7883

0 commit comments

Comments
 (0)