$root = $doc->createElement('playlist'); $root->setAttribute('xmlns', 'http://xspf.org/ns/0/'); $root->setAttribute('version', '0'); $doc->appendChild($root); $title = $doc->createElement('title'); if (isset($prefs_struct['banner'])) { $title->appendChild($doc->createTextNode($prefs_struct['banner'])); } else { $title->appendChild($doc->createTextNode('Opentape')); } $root->appendChild($title); $annotation = $doc->createElement('annotation'); if (isset($prefs_struct['caption'])) { $annotation->appendChild($doc->createTextNode($prefs_struct['caption'])); } else { $annotation->appendChild($doc->createTextNode(count($songlist_struct) . "songs, " . get_total_runtime_string())); } $root->appendChild($annotation); $creator = $doc->createElement('creator'); $creator->appendChild($doc->createTextNode("Opentape " . get_version())); $root->appendChild($creator); $info = $doc->createElement('info'); $info->appendChild($doc->createTextNode(get_base_url())); $root->appendChild($info); $location = $doc->createElement('location'); $location->appendChild($doc->createTextNode(get_base_url() . 'code/xspf.php')); $root->appendChild($location); $tracklist = $doc->createElement('trackList'); $root->appendChild($tracklist); foreach ($songlist_struct[get_tape_path()] as $pos => $row) { if (!is_file(get_songs_path() . $row['filename'])) {
header("Content-type: application/rss+xml; charset=UTF-8"); echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; echo '<rss version="2.0">' . "\n"; echo '<channel>' . "\n"; echo '<title>'; if (isset($prefs_struct['banner'])) { echo $prefs_struct['banner']; } else { echo 'Opentape!'; } echo '</title>' . "\n"; echo '<description>' . "\n"; if (isset($prefs_struct['caption'])) { echo ' ' . htmlentities($prefs_struct['caption']); } else { echo ' ' . count($songlist_struct) . "songs, " . get_total_runtime_string(); } echo '</description>' . "\n"; echo '<link>' . get_base_url() . '</link>' . "\n"; foreach ($songlist_struct as $pos => $row) { if (!is_file(constant("SONGS_PATH") . $row['filename'])) { unset($songlist_struct[$pos]); continue; } echo '<item>' . "\n"; echo '<title>'; if (isset($row['opentape_artist'])) { echo $row['opentape_artist'] . ' - '; } else { echo htmlentities($row['artist']) . ' - '; }
<h1><?php if (!empty($prefs_struct['banner'])) { echo $prefs_struct['banner']; } else { echo "OPENTAPE"; } ?> </h1> <h2><?php if (!empty($prefs_struct['caption'])) { echo $prefs_struct['caption']; } else { echo count($songlist_struct); ?> songs, <?php echo get_total_runtime_string(); } ?> </h2> </div> </div> <ul class="songs"> <?php $i = 0; foreach ($songlist_struct as $pos => $row) { if (!is_file(constant("SONGS_PATH") . $row['filename'])) { unset($songlist_struct[$pos]); continue;