Replaced uses of the compact() function.

This commit is contained in:
flash 2024-01-28 04:03:42 +00:00
parent 982ee10c1a
commit 71ba6d6326

View file

@ -121,26 +121,27 @@ if(preg_match('#^/sounds2(\.[a-f0-9]{8})?.json$#', $reqPath)) {
etag_data('sounds2', $sndLibData . $sndPackData);
$sounds = new stdClass;
$sndLib = parse_ini_string($sndLibData, true, INI_SCANNER_TYPED);
$sndPacks = parse_ini_string($sndPackData, true, INI_SCANNER_TYPED);
$library = [];
$sounds->library = [];
foreach($sndLib as $name => $info)
$library[] = [
$sounds->library[] = [
'name' => $name,
'title' => $info['title'],
'sources' => $info['sources'],
];
$packs = [];
$sounds->packs = [];
foreach($sndPacks as $name => $info)
$packs[] = [
$sounds->packs[] = [
'name' => $name,
'title' => $info['title'],
'events' => $info['events'],
];
json_out(compact('library', 'packs'));
json_out($sounds);
}
if(preg_match('#^/sounds(\.[a-f0-9]{8})?.json$#', $reqPath)) {
@ -149,10 +150,11 @@ if(preg_match('#^/sounds(\.[a-f0-9]{8})?.json$#', $reqPath)) {
etag_data('sounds', $sndLibData . $sndPackData);
$sounds = new stdClass;
$sndLib = parse_ini_string($sndLibData, true, INI_SCANNER_TYPED);
$sndPacks = parse_ini_string($sndPackData, true, INI_SCANNER_TYPED);
$library = [];
$sounds->library = [];
foreach($sndLib as $name => $info) {
$sources = [];
foreach($info['sources'] as $type => $path) {
@ -162,22 +164,22 @@ if(preg_match('#^/sounds(\.[a-f0-9]{8})?.json$#', $reqPath)) {
];
}
$library[] = [
$sounds->library[] = [
'id' => $name,
'name' => $info['title'],
'sources' => $sources,
];
}
$packs = [];
$sounds->packs = [];
foreach($sndPacks as $name => $info)
$packs[] = [
$sounds->packs[] = [
'id' => $name,
'name' => $info['title'],
'events' => $info['events'],
];
json_out(compact('library', 'packs'));
json_out($sounds);
}
if(preg_match('#^/texttriggers(\.[a-f0-9]{8})?.json$#', $reqPath)) {