data); } function next_renderExperience(array $modules) { foreach ($modules as $m) { next_renderModule($m); } } function next_renderModule(stdClass $module) { $type = strtr($module->type, '_', '-'); $titleTag = $type == 'inline-header-module' ? 'h1' : 'h2'; echo "<$type id=\"$module->id\" module-style=\"$module->style\">"; echo "<$titleTag>" . htmlspecialchars($module->title ?? '[no title]') . ""; if (isset($module->description)) { echo '' . htmlspecialchars($module->description) . ''; } echo ''; if (!is_array($module->data)) { next_renderItem($module->data); } else { foreach ($module->data as $item) { next_renderItem($item); } } echo ""; } function next_renderItem(stdClass $item) { $type = strtr($item->type, '_', '-'); $primaryTag = $type == 'segment-item' ? 'primary-title' : 'h3'; echo "<$type id=\"$item->id\">"; echo ''; echo "<$primaryTag>" . htmlspecialchars($item->titles?->primary ?? '[no primary]') . ""; if (isset($item->network)) { echo '' . htmlspecialchars($item->network->short_title) . ''; } echo ''; if (isset($item->titles->secondary)) { echo '' . htmlspecialchars($item->titles->secondary) . ''; } if (isset($item->titles->tertiary)) { echo '' . htmlspecialchars($item->titles->tertiary) . ''; } echo ''; if (isset($item->synopses?->short, $item->synopses?->medium)) { echo '
' . htmlspecialchars($item->synopses->short) . '' . htmlspecialchars($item->synopses->long ?? $item->synopses->medium) . '
'; } elseif (isset($item->synopses?->short)) { echo '' . htmlspecialchars($item->synopses->short) . ''; } if (isset($item->item)) { next_renderItem($item->item); } if (isset($item->offset)) { echo '' . gmdate('H:i:s', $item->offset->start) . ''; echo '' . gmdate('H:i:s', $item->offset->end) . ''; } if ($type == 'container-item') { $href = '?path=' . RMS_SOUNDS_CONTAINER . '/' . $item->urn; echo "View"; } elseif ($type == 'playable-item') { $pid = explode(':', $item->urn)[4]; $href = '?path=' . RMS_SOUNDS_PLAYABLE . '/' . $pid; echo "Listen"; } foreach ($item->uris ?? [] as $uri) { if ($uri->type != 'link') continue; echo '' . htmlspecialchars($uri->label) . ''; } if (isset($item->download) && $item->download->type == 'non_drm') { $variant = $item->download->quality_variants->high; echo '' . "Download ($variant->label)"; } echo ""; }