?> <description><![CDATA[<?php the_excerpt_rss(); ?> ]]></description> <?php } else { ?> <description><![CDATA[<?php the_excerpt_rss(); ?> ]]></description> <?php $content = get_the_content_feed('rss2'); ?> <?php if (strlen($content) > 0) { ?> <content:encoded><![CDATA[<?php echo $content; ?> ]]></content:encoded> <?php } else { ?> <content:encoded><![CDATA[<?php
function podPress_rss2_item() { global $podPress, $post, $post_meta_cache, $blog_id, $wp_version; $enclosureTag = podPress_getEnclosureTags(); if ($enclosureTag != '') { // if no enclosure tag, no need for iTunes tags $is_password_protected = podpress_post_is_password_protected(); if (FALSE === $is_password_protected) { echo $enclosureTag; } if ($post->podPressPostSpecific['itunes:subtitle'] == '##PostExcerpt##') { if (TRUE === $is_password_protected) { $post->podPressPostSpecific['itunes:subtitle'] = __('This post is password protected.', 'podPress'); } else { $post->podPressPostSpecific['itunes:subtitle'] = trim(podpress_get_excerpt_rss()); } } if (TRUE == empty($post->podPressPostSpecific['itunes:subtitle'])) { $post->podPressPostSpecific['itunes:subtitle'] = get_the_title_rss(); } echo ' <itunes:subtitle>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:subtitle']), FALSE, TRUE), 254, '[...]', TRUE) . '</itunes:subtitle>' . "\n"; if (FALSE == isset($post->podPressPostSpecific['itunes:summary'])) { $post->podPressPostSpecific['itunes:summary'] = '##PostContentShortened##'; } switch ($post->podPressPostSpecific['itunes:summary']) { case '##Global##': $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary']; break; case '##PostExcerpt##': if (TRUE === $is_password_protected) { $post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress'); } else { $post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_excerpt_rss()); } break; case '##PostContentShortened##': if (post_password_required($post)) { $post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress'); } else { if (TRUE == version_compare($wp_version, '2.9', '>=')) { $post->podPressPostSpecific['itunes:summary'] = get_the_content_feed(); } else { $post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_content_rss()); } } break; } if (FALSE == empty($post->podPressPostSpecific['itunes:summary'])) { echo ' <itunes:summary>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:summary']), FALSE, TRUE), 4000, '[...]', TRUE) . '</itunes:summary>' . "\n"; } switch ($post->podPressPostSpecific['itunes:keywords']) { default: case '##WordPressCats##': $categories = get_the_category(); $post->podPressPostSpecific['itunes:keywords'] = ''; if (TRUE == is_array($categories) and FALSE == empty($categories)) { $category_names = array(); $b = ''; foreach ($categories as $category) { $result = preg_match('/\\S+\\s+\\S+/', $category->cat_name, $b); // take the category name only if it does not contain inner white spaces (if it does not consist of more than one word) if (TRUE == empty($b)) { $category_names[] = $category->cat_name; } } if (TRUE == is_array($category_names) and FALSE == empty($category_names)) { $nr_category_names = count($category_names); if ($nr_category_names > 1) { for ($i = 0; $i < min($nr_category_names, 12); $i++) { // max. 12 keywords are allowed if (0 == $i) { $post->podPressPostSpecific['itunes:keywords'] = $category_names[$i]; } else { $post->podPressPostSpecific['itunes:keywords'] .= ', ' . $category_names[$i]; } } } elseif ($nr_category_names === 1) { $post->podPressPostSpecific['itunes:keywords'] = $category_names[0]; } } } break; case '##post_tags##': $posttags = get_the_tags(); $post->podPressPostSpecific['itunes:keywords'] = ''; if (is_array($posttags) and FALSE == empty($posttags)) { $posttags_nr = count($posttags); $i = 0; foreach ($posttags as $tag) { if ($i == $posttags_nr - 1) { $post->podPressPostSpecific['itunes:keywords'] .= $tag->name; } else { $post->podPressPostSpecific['itunes:keywords'] .= $tag->name . ', '; } $i++; } } break; case '##Global##': $post->podPressPostSpecific['itunes:keywords'] = $podPress->settings['iTunes']['keywords']; break; } if (FALSE == empty($post->podPressPostSpecific['itunes:keywords'])) { echo ' <itunes:keywords>' . podPress_feedSafeContent($podPress->cleanup_itunes_keywords(stripslashes($post->podPressPostSpecific['itunes:keywords']), '', FALSE)) . '</itunes:keywords>' . "\n"; } if ($post->podPressPostSpecific['itunes:author'] == '##Global##') { $post->podPressPostSpecific['itunes:author'] = $podPress->settings['iTunes']['author']; if (empty($post->podPressPostSpecific['itunes:author'])) { $post->podPressPostSpecific['itunes:author'] = stripslashes(get_option('admin_email')); } } echo ' <itunes:author>' . podPress_feedSafeContent($post->podPressPostSpecific['itunes:author']) . '</itunes:author>' . "\n"; if ($post->podPressPostSpecific['itunes:explicit'] == 'Default') { $post->podPressPostSpecific['itunes:explicit'] = $podPress->settings['iTunes']['explicit']; } if ('' == trim($post->podPressPostSpecific['itunes:explicit']) or '' != trim($post->podPressPostSpecific['itunes:explicit']) and 'no' != strtolower($post->podPressPostSpecific['itunes:explicit']) and 'yes' != strtolower($post->podPressPostSpecific['itunes:explicit']) and 'clean' != strtolower($post->podPressPostSpecific['itunes:explicit'])) { $post->podPressPostSpecific['itunes:explicit'] = 'No'; } echo ' <itunes:explicit>' . podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:explicit'])) . '</itunes:explicit>' . "\n"; if ($post->podPressPostSpecific['itunes:block'] == 'Default') { $post->podPressPostSpecific['itunes:block'] = $podPress->settings['iTunes']['block']; } if ('' == trim($post->podPressPostSpecific['itunes:block']) or '' != trim($post->podPressPostSpecific['itunes:block']) and 'no' != strtolower($post->podPressPostSpecific['itunes:block']) and 'yes' != strtolower($post->podPressPostSpecific['itunes:block'])) { $post->podPressPostSpecific['itunes:block'] = 'No'; } echo ' <itunes:block>' . podPress_feedSafeContent(strtolower($post->podPressPostSpecific['itunes:block'])) . '</itunes:block>' . "\n"; //echo '<comments>'. get_comments_link() .'</comments>'."\n"; $episodeLicenseTags = podPress_getEpisodeLicenseTags(); if ($episodeLicenseTags != '') { echo $episodeLicenseTags; } } if (isset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold'])) { $post_meta_cache[$blog_id][$post->ID]['enclosure'] = $post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']; unset($post_meta_cache[$blog_id][$post->ID]['enclosure_podPressHold']); } // add the enclosures which are not added with podPress at last podPress_add_nonpodpress_enclosures('rss2'); }
/** * Display the post content for feeds. * * @since 2.9.0 * * @param string $feed_type The type of feed. rss2 | atom | rss | rdf */ function the_content_feed($feed_type = null) { echo get_the_content_feed($feed_type); }
/** * Make sure no content is returned for lessons in the feeds. */ public function testLessonFeedContentPermissions() { global $post; $post = get_post($this->lessons[1]); setup_postdata($post); // Check rss2 feed. $the_content = get_the_content_feed('rss2'); $this->assertEquals('', $the_content); // Check atom feed. $the_content = get_the_content_feed('atom'); $this->assertEquals('', $the_content); // Check rss feed. $the_content = get_the_content_feed('rss'); $this->assertEquals('', $the_content); // Check rdf feed. $the_content = get_the_content_feed('rdf'); $this->assertEquals('', $the_content); wp_reset_postdata(); }
} ?> <?php while (have_posts()) { the_post(); ?> <?php $post_id = get_the_ID(); $episode_number = get_post_meta($post_id, 'episode_number', true); $episode_subtitle = get_post_meta($post_id, 'episode_subtitle', true); // Get Episode Media Source $episode_attachment_id = get_post_meta($post_id, 'episode_file', true); $episode_external_file = get_post_meta($post_id, 'external_episode_file', true); $episode_cleaned_content = strip_tags(get_the_content_feed()); $episode_cleaned_subtitle = strip_tags($episode_subtitle); if (!empty($episode_attachment_id)) { $player_src = wp_get_attachment_url($episode_attachment_id); } elseif (!empty($episode_external_file)) { $player_src = $episode_external_file; } $media_info = wp_get_attachment_metadata($episode_attachment_id); $episode_artwork_src = $podcast_artwork_src; $episode_artwork_id = get_post_thumbnail_id($post_id); if (!empty($episode_artwork_id)) { $episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail'); $episode_artwork_src = $episode_artwork[0]; } ?>
function override_feed_entry($hook, $podcast, $feed, $format) { add_action($hook, function () use($podcast, $feed, $format) { global $post; $cache = \Podlove\Cache\TemplateCache::get_instance(); echo $cache->cache_for('feed_item_' . $feed->slug . '_' . $post->ID, function () use($podcast, $feed, $format, $post) { $xml = ""; $episode = Model\Episode::find_one_by_post_id($post->ID); $asset = $feed->episode_asset(); $file = Model\MediaFile::find_by_episode_id_and_episode_asset_id($episode->id, $asset->id); $asset_assignment = Model\AssetAssignment::get_instance(); if (!$file) { return; } $enclosure_file_size = $file->size; $cover_art_url = ""; if ($cover_art = $episode->cover_art()) { $cover_art_url = $cover_art->url(); } if (isset($_REQUEST['tracking']) && $_REQUEST['tracking'] == 'no') { $enclosure_url = $episode->enclosure_url($feed->episode_asset(), null, null); } else { $enclosure_url = $episode->enclosure_url($feed->episode_asset(), "feed", $feed->slug); } $deep_link = Model\Feed::get_link_tag(array('prefix' => 'atom', 'rel' => 'http://podlove.org/deep-link', 'type' => '', 'title' => '', 'href' => get_permalink() . "#")); $xml .= apply_filters('podlove_deep_link', $deep_link, $feed); $xml .= apply_filters('podlove_feed_enclosure', '', $enclosure_url, $enclosure_file_size, $format->mime_type, $file); $duration = sprintf('<itunes:duration>%s</itunes:duration>', $episode->get_duration('HH:MM:SS')); $xml .= apply_filters('podlove_feed_itunes_duration', $duration); $author = apply_filters('podlove_feed_content', $podcast->author_name); $author = sprintf('<itunes:author>%s</itunes:author>', $author); $xml .= apply_filters('podlove_feed_itunes_author', $author); $subtitle = apply_filters('podlove_feed_content', \Podlove\PHP\escape_shortcodes(strip_tags($episode->subtitle))); $subtitle = sprintf('<itunes:subtitle>%s</itunes:subtitle>', $subtitle); $xml .= apply_filters('podlove_feed_itunes_subtitle', $subtitle); $summary = apply_filters('podlove_feed_content', \Podlove\PHP\escape_shortcodes(strip_tags($episode->summary))); $summary = sprintf('<itunes:summary>%s</itunes:summary>', $summary); $xml .= apply_filters('podlove_feed_itunes_summary', $summary); if (\Podlove\get_setting('metadata', 'enable_episode_explicit')) { $itunes_explicit = apply_filters('podlove_feed_content', $episode->explicit_text()); $itunes_explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', $itunes_explicit); $xml .= apply_filters('podlove_feed_itunes_explicit', $itunes_explicit); } if ($cover_art_url) { $cover_art = sprintf('<itunes:image href="%s" />', $cover_art_url); } else { $cover_art = ''; } $xml .= apply_filters('podlove_feed_itunes_image', $cover_art); if ($feed->embed_content_encoded) { add_filter('the_content_feed', function ($content, $feed_type) { return preg_replace('#<style(.*?)>(.*?)</style>#is', '', $content); }, 10, 2); $content_encoded = '<content:encoded><![CDATA[' . get_the_content_feed('rss2') . ']]></content:encoded>'; $xml .= apply_filters('podlove_feed_content_encoded', $content_encoded); } ob_start(); do_action('podlove_append_to_feed_entry', $podcast, $episode, $feed, $format); $xml .= ob_get_contents(); ob_end_clean(); return $xml; }, 15 * MINUTE_IN_SECONDS); }, 11); }