function podPress_xspf_playlist() { global $podPress, $more, $posts, $post, $m; header('HTTP/1.0 200 OK'); header('Content-type: application/xspf+xml; charset=' . get_bloginfo('charset'), true); header('Content-Disposition: attachment; filename="playlist.xspf"'); header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: Wed, 28 Oct 2010 05:00:00 GMT'); // Date in the past $more = 1; echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '" ?' . ">\n"; echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">' . "\n"; echo "\t" . '<title>' . podPress_feedSafeContent(get_bloginfo('blogname')) . '</title>' . "\n"; echo "\t" . '<annotation><![CDATA[' . $podPress->settings['iTunes']['summary'] . ']]></annotation>' . "\n"; if (empty($podPress->settings['iTunes']['author'])) { $creator = get_bloginfo('blogname'); } else { $creator = $podPress->settings['iTunes']['author']; } echo "\t" . '<creator>' . podPress_feedSafeContent($creator) . '</creator>' . "\n"; echo "\t" . '<location>' . get_feed_link('playlist.xspf') . '</location>' . "\n"; if (!empty($podPress->settings['rss_license_url'])) { echo "\t" . '<license>' . $podPress->settings['rss_license_url'] . '</license>' . "\n"; } echo "\t" . '<trackList>' . "\n"; if (isset($posts)) { foreach ($posts as $post) { start_wp(); /* This is a call to a very very old function and it seems to be not necessary if $post is global. */ $enclosureTag = podPress_getEnclosureTags('xspf'); if ($enclosureTag != '') { // if no enclosure tag, no need for track tags $is_password_protected = podpress_post_is_password_protected(); if (FALSE === $is_password_protected) { echo $enclosureTag; } } } } echo "\t" . '</trackList>' . "\n"; echo '</playlist>' . "\n"; exit; }
function podPress_add_nonpodpress_enclosures($feedtype) { global $podPress, $post, $podpress_allowed_ext; if (podpress_post_is_password_protected()) { return; } foreach ((array) get_post_custom() as $key => $val) { if ($key == 'enclosure') { foreach ((array) $val as $enc) { $is_a_link_to_podPress_media = FALSE; $enclosure = explode("\n", $enc); $enclosure_url = trim(htmlspecialchars($enclosure[0])); // do not include non-podPress enclosures if they are not of the right type for the current feed $ext = end(explode('.', $enclosure_url)); if (is_array($podpress_allowed_ext) and FALSE == empty($ext)) { if (FALSE == in_array($ext, $podpress_allowed_ext)) { continue; } } // check whether the enclosure URL is equal to a podPress enclosure URL // If not then print the enclosure tag else don't. if (TRUE == is_array($post->podPressMedia)) { foreach ($post->podPressMedia as $key => $value) { if (TRUE == isset($post->podPressMedia[$key]['URI']) and $enclosure_url == $post->podPressMedia[$key]['URI']) { $is_a_link_to_podPress_media = TRUE; } } } if (FALSE == $is_a_link_to_podPress_media) { // only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3' $t = preg_split('/[ \\t]/', trim($enclosure[2])); $type = $t[0]; switch ($feedtype) { case 'atom': echo apply_filters('nonpodpress_atom_enclosure', "\t\t" . '<link href="' . $enclosure_url . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); break; case 'rss2': default: echo apply_filters('nonpodpress_rss_enclosure', "\t\t" . '<enclosure url="' . $enclosure_url . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n"); break; } } } } } }