diff --git a/public/index.php b/public/index.php index f606a3b..f552c5f 100644 --- a/public/index.php +++ b/public/index.php @@ -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)) {