}
        ?>

<?php 
    }
    ?>

		<wfw:commentRss><?php 
    echo esc_url(get_post_comments_feed_link(null, 'rss2'));
    ?>
</wfw:commentRss>
		<slash:comments><?php 
    echo get_comments_number();
    ?>
</slash:comments>
<?php 
    rss_enclosure();
    ?>

	<?php 
    do_action('rss2_item');
    ?>

	</item>
	<?php 
}
?>

</channel>
</rss>
	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
	<language><?php echo get_option('rss_language'); ?></language>
	<?php do_action('rss2_head'); ?>
	<?php while( have_posts()) : the_post(); ?>
	<item>
		<title><?php the_title_rss() ?></title>
		<link><?php permalink_single_rss() ?></link>
		<comments><?php comments_link(); ?></comments>
		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
		<dc:creator><?php the_author() ?></dc:creator>
		<?php the_category_rss() ?>

		<guid isPermaLink="false"><?php the_guid(); ?></guid>
<?php if (get_option('rss_use_excerpt')) : ?>
		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php else : ?>
		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
	<?php if ( strlen( $post->post_content ) > 0 ) : ?>
		<content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
	<?php else : ?>
		<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
	<?php endif; ?>
<?php endif; ?>
		<wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
<?php rss_enclosure(); ?>
	<?php do_action('rss2_item'); ?>
	</item>
	<?php endwhile; ?>
</channel>
</rss>
/**
 * Output an RSS2 feed of topics, based on the query passed.
 *
 * @since bbPress (r3171)
 *
 * @uses bbp_version()
 * @uses bbp_is_single_topic()
 * @uses bbp_user_can_view_forum()
 * @uses bbp_get_topic_forum_id()
 * @uses bbp_show_load_topic()
 * @uses bbp_topic_permalink()
 * @uses bbp_topic_title()
 * @uses bbp_get_topic_reply_count()
 * @uses bbp_topic_content()
 * @uses bbp_has_topics()
 * @uses bbp_topics()
 * @uses bbp_the_topic()
 * @uses get_wp_title_rss()
 * @uses get_option()
 * @uses bloginfo_rss
 * @uses self_link()
 * @uses the_author()
 * @uses get_post_time()
 * @uses rss_enclosure()
 * @uses do_action()
 * @uses apply_filters()
 *
 * @param array $topics_query
 */
function bbp_display_topics_feed_rss2($topics_query = array())
{
    // User cannot access this forum
    if (bbp_is_single_forum() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_forum_id()))) {
        return;
    }
    // Display the feed
    header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
    header('Status: 200 OK');
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>

	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

		<?php 
    do_action('bbp_feed');
    ?>
	>

	<channel>

		<title><?php 
    bloginfo_rss('name');
    ?>
 &#187; <?php 
    _e('All Topics', 'bbpress');
    ?>
</title>
		<atom:link href="<?php 
    self_link();
    ?>
" rel="self" type="application/rss+xml" />
		<link><?php 
    self_link();
    ?>
</link>
		<description><?php 
    //
    ?>
</description>
		<pubDate><?php 
    echo mysql2date('D, d M Y H:i:s O', current_time('mysql'), false);
    ?>
</pubDate>
		<generator>http://bbpress.org/?v=<?php 
    bbp_version();
    ?>
</generator>
		<language><?php 
    bloginfo_rss('language');
    ?>
</language>

		<?php 
    do_action('bbp_feed_head');
    ?>

		<?php 
    if (bbp_has_topics($topics_query)) {
        ?>

			<?php 
        while (bbp_topics()) {
            bbp_the_topic();
            ?>

				<item>
					<guid><?php 
            bbp_topic_permalink();
            ?>
</guid>
					<title><![CDATA[<?php 
            bbp_topic_title();
            ?>
]]></title>
					<link><?php 
            bbp_topic_permalink();
            ?>
</link>
					<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_post_meta(bbp_get_topic_id(), '_bbp_last_active_time', true));
            ?>
</pubDate>
					<dc:creator><?php 
            the_author();
            ?>
</dc:creator>

					<?php 
            if (!post_password_required()) {
                ?>

					<description>
						<![CDATA[
						<p><?php 
                printf(esc_html__('Replies: %s', 'bbpress'), bbp_get_topic_reply_count());
                ?>
</p>
						<?php 
                bbp_topic_content();
                ?>
						]]>
					</description>

					<?php 
                rss_enclosure();
                ?>

					<?php 
            }
            ?>

					<?php 
            do_action('bbp_feed_item');
            ?>

				</item>

				<?php 
        }
        ?>
			<?php 
    }
    ?>

		<?php 
    do_action('bbp_feed_footer');
    ?>

	</channel>
	</rss>

<?php 
    exit;
}
/**
 * Output an RSS2 feed of replies, based on the query passed.
 *
 * @since bbPress (r3171)
 *
 * @uses bbp_version()
 * @uses bbp_is_single_topic()
 * @uses bbp_user_can_view_forum()
 * @uses bbp_get_topic_forum_id()
 * @uses bbp_show_load_topic()
 * @uses bbp_topic_permalink()
 * @uses bbp_topic_title()
 * @uses bbp_get_topic_reply_count()
 * @uses bbp_topic_content()
 * @uses bbp_has_replies()
 * @uses bbp_replies()
 * @uses bbp_the_reply()
 * @uses bbp_reply_url()
 * @uses bbp_reply_title()
 * @uses bbp_reply_content()
 * @uses get_wp_title_rss()
 * @uses get_option()
 * @uses bloginfo_rss
 * @uses self_link()
 * @uses the_author()
 * @uses get_post_time()
 * @uses rss_enclosure()
 * @uses do_action()
 * @uses apply_filters()
 *
 * @param array $replies_query
 */
function bbp_display_replies_feed_rss2($replies_query = array())
{
    // User cannot access forum this topic is in
    if (bbp_is_single_topic() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
        return;
    }
    // Adjust the title based on context
    if (bbp_is_single_topic() && bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
        $title = apply_filters('wp_title_rss', get_wp_title_rss(' &#187; '));
    } elseif (!bbp_show_lead_topic()) {
        $title = ' &#187; ' . __('All Posts', 'bbpress');
    } else {
        $title = ' &#187; ' . __('All Replies', 'bbpress');
    }
    // Display the feed
    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
    header('Status: 200 OK');
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>

	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

		<?php 
    do_action('bbp_feed');
    ?>
	>

	<channel>
		<title><?php 
    bloginfo_rss('name');
    echo $title;
    ?>
</title>
		<atom:link href="<?php 
    self_link();
    ?>
" rel="self" type="application/rss+xml" />
		<link><?php 
    self_link();
    ?>
</link>
		<description><?php 
    //
    ?>
</description>
		<pubDate><?php 
    echo mysql2date('D, d M Y H:i:s O', current_time('mysql'), false);
    ?>
</pubDate>
		<generator>http://bbpress.org/?v=<?php 
    bbp_version();
    ?>
</generator>
		<language><?php 
    bloginfo_rss('language');
    ?>
</language>

		<?php 
    do_action('bbp_feed_head');
    ?>

		<?php 
    if (bbp_is_single_topic()) {
        ?>
			<?php 
        if (bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
            ?>
				<?php 
            if (bbp_show_lead_topic()) {
                ?>

					<item>
						<guid><?php 
                bbp_topic_permalink();
                ?>
</guid>
						<title><![CDATA[<?php 
                bbp_topic_title();
                ?>
]]></title>
						<link><?php 
                bbp_topic_permalink();
                ?>
</link>
						<pubDate><?php 
                echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
                ?>
</pubDate>
						<dc:creator><?php 
                the_author();
                ?>
</dc:creator>

						<description>
							<![CDATA[
							<p><?php 
                printf(__('Replies: %s', 'bbpress'), bbp_get_topic_reply_count());
                ?>
</p>
							<?php 
                bbp_topic_content();
                ?>
							]]>
						</description>

						<?php 
                rss_enclosure();
                ?>

						<?php 
                do_action('bbp_feed_item');
                ?>

					</item>

				<?php 
            }
            ?>
			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<?php 
    if (bbp_has_replies($replies_query)) {
        ?>
			<?php 
        while (bbp_replies()) {
            bbp_the_reply();
            ?>

				<item>
					<guid><?php 
            bbp_reply_url();
            ?>
</guid>
					<title><![CDATA[<?php 
            bbp_reply_title();
            ?>
]]></title>
					<link><?php 
            bbp_reply_url();
            ?>
</link>
					<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
            ?>
</pubDate>
					<dc:creator><?php 
            the_author();
            ?>
</dc:creator>

					<description>
						<![CDATA[
						<?php 
            bbp_reply_content();
            ?>
						]]>
					</description>

					<?php 
            rss_enclosure();
            ?>

					<?php 
            do_action('bbp_feed_item');
            ?>

				</item>

			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<?php 
    do_action('bbp_feed_footer');
    ?>

	</channel>
	</rss>

<?php 
    // We're done here
    exit;
}
Exemple #5
0
function gwolle_gb_rss()
{
    // Only show the first page of entries.
    $entriesPerPage = (int) get_option('gwolle_gb-entriesPerPage', 20);
    /* Get the entries for the RSS Feed */
    $entries = gwolle_gb_get_entries(array('offset' => 0, 'num_entries' => $entriesPerPage, 'checked' => 'checked', 'trash' => 'notrash', 'spam' => 'nospam'));
    /* Get the time of the last entry, else of the last edited post */
    if (is_array($entries) && !empty($entries)) {
        $lastbuild = gmdate('D, d M Y H:i:s', $entries[0]->get_datetime());
    } else {
        $lastbuild = mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
    }
    $postid = gwolle_gb_get_postid();
    if ($postid) {
        $permalink = get_bloginfo('url') . '?p=' . $postid;
    } else {
        $permalink = get_bloginfo('url');
    }
    /* Get the Language setting */
    $WPLANG = get_option('WPLANG', false);
    if (!$WPLANG) {
        $WPLANG = WPLANG;
    }
    if (!$WPLANG) {
        $WPLANG = 'en-us';
    }
    $WPLANG = str_replace('_', '-', $WPLANG);
    $WPLANG = strtolower($WPLANG);
    /* Build the XML content */
    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>

	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"
		xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		<?php 
    do_action('rss2_ns');
    ?>
>

		<channel>
			<title><?php 
    bloginfo_rss('name');
    echo " - " . __('Guestbook Feed', GWOLLE_GB_TEXTDOMAIN);
    ?>
</title>
			<atom:link href="<?php 
    self_link();
    ?>
" rel="self" type="application/rss+xml" />
			<link><?php 
    echo $permalink;
    ?>
</link>
			<description><?php 
    bloginfo_rss('description');
    echo " - " . __('Guestbook Feed', GWOLLE_GB_TEXTDOMAIN);
    ?>
</description>
			<lastBuildDate><?php 
    echo $lastbuild;
    ?>
</lastBuildDate>
			<language><?php 
    echo $WPLANG;
    ?>
</language>
			<sy:updatePeriod><?php 
    echo apply_filters('rss_update_period', 'hourly');
    ?>
</sy:updatePeriod>
			<sy:updateFrequency><?php 
    echo apply_filters('rss_update_frequency', '1');
    ?>
</sy:updateFrequency>
			<?php 
    do_action('rss2_head');
    ?>

			<?php 
    if (is_array($entries) && !empty($entries)) {
        foreach ($entries as $entry) {
            ?>
					<item>
						<title><?php 
            _e('Guestbook Entry by', GWOLLE_GB_TEXTDOMAIN);
            echo " " . trim($entry->get_author_name());
            ?>
</title>
						<link><?php 
            echo $permalink;
            ?>
</link>
						<pubDate><?php 
            echo gmdate('D, d M Y H:i:s', $entry->get_datetime());
            ?>
</pubDate>
						<dc:creator><?php 
            echo trim($entry->get_author_name());
            ?>
</dc:creator>
						<guid isPermaLink="false"><?php 
            echo $permalink;
            ?>
</guid>
						<description><![CDATA[<?php 
            echo wp_trim_words($entry->get_content(), 12, '...');
            ?>
]]></description>
						<content:encoded><![CDATA[<?php 
            echo wp_trim_words($entry->get_content(), 25, '...');
            ?>
]]></content:encoded>
						<?php 
            rss_enclosure();
            ?>
						<?php 
            do_action('rss2_item');
            ?>
					</item>
					<?php 
        }
    }
    ?>
		</channel>
	</rss>
	<?php 
}
function draw_feed($posts)
{
    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>
    <rss version="2.0"
      xmlns:content="http://purl.org/rss/1.0/modules/content/"
      xmlns:wfw="http://wellformedweb.org/CommentAPI/"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:atom="http://www.w3.org/2005/Atom"
      xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
      xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
      <?php 
    do_action('rss2_ns');
    ?>
>
    <channel>
      <title><?php 
    bloginfo_rss('name');
    ?>
 - Feed</title>
      <atom:link href="<?php 
    self_link();
    ?>
" rel="self" type="application/rss+xml" />
      <link><?php 
    bloginfo_rss('url');
    ?>
</link>
      <description><?php 
    bloginfo_rss('description');
    ?>
</description>
      <lastBuildDate><?php 
    echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
    ?>
</lastBuildDate>
      <language><?php 
    echo get_option('rss_language');
    ?>
</language>
      <sy:updatePeriod><?php 
    echo apply_filters('rss_update_period', 'hourly');
    ?>
</sy:updatePeriod>
      <sy:updateFrequency><?php 
    echo apply_filters('rss_update_frequency', '1');
    ?>
</sy:updateFrequency>
      <?php 
    do_action('rss2_head');
    ?>
      <?php 
    foreach ($posts as $post) {
        ?>
        <item>
          <title><?php 
        echo $post->post_title;
        ?>
</title>
          <?php 
        $datetime = new DateTime($post->post_date);
        $permalink = site_url() . $datetime->format('/Y/m/') . $post->post_name;
        ?>
          <link><?php 
        echo $permalink;
        ?>
</link>
          <pubDate><?php 
        echo $post->post_date;
        ?>
</pubDate>
          <dc:creator><?php 
        echo get_the_author_meta('display_name', $post->post_author);
        ?>
</dc:creator>
          <guid isPermaLink="false"><?php 
        echo $post->guid;
        ?>
</guid>
          <description><![CDATA[<?php 
        echo trim(strip_tags($post->post_content));
        ?>
]]></description>
          <content:encoded><![CDATA[<?php 
        trim(strip_tags($post->post_content));
        ?>
]]></content:encoded>
          <?php 
        rss_enclosure($post);
        ?>
          <?php 
        $thumbnail_size = apply_filters('rss_enclosure_image_size', 'large');
        $thumbnail_id = get_post_thumbnail_id($post->ID);
        $thumbnail = wp_get_attachment_image_src($thumbnail_id, 'large');
        if ($thumbnail_id) {
            printf('<enclosure name="featured_image" url="%s" length="%s" type="%s" />', $thumbnail[0], filesize(path_join($upload_dir['basedir'], $thumbnail['path'])), get_post_mime_type($thumbnail_id));
        }
        ?>
        </item>
      <?php 
    }
    ?>
    </channel>
    </rss>
  <?php 
}
/**
 * Return XML for full feed.
 * 
 * @param   array $feed_items Array of objects. Required attributes: ID (=post id), blog_id
 * @return  string
 */
function get_feed_xml($feed_items)
{
    global $post;
    $rss_language = Settings\get_site_option('language_slug');
    if (empty($rss_language) && defined('WPLANG')) {
        $rss_language = substr(WPLANG, 0, 2);
    }
    ob_start();
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	<?php 
    do_action('rss2_ns');
    ?>
>

<channel>
	<title><?php 
    echo get_feed_title();
    ?>
</title>
	<atom:link href="<?php 
    echo get_feed_url();
    ?>
" rel="self" type="application/rss+xml" />
	<link><?php 
    echo get_feed_url();
    ?>
</link>
	<description><?php 
    echo get_feed_description();
    ?>
</description>
	<lastBuildDate><?php 
    echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), FALSE);
    ?>
</lastBuildDate>
	<language><?php 
    echo $rss_language;
    ?>
</language>
	<sy:updatePeriod><?php 
    echo apply_filters('rss_update_period', 'hourly');
    ?>
</sy:updatePeriod>
	<sy:updateFrequency><?php 
    echo apply_filters('rss_update_frequency', '1');
    ?>
</sy:updateFrequency>
	<?php 
    do_action('rss2_head');
    foreach ($feed_items as $feed_item) {
        switch_to_blog($feed_item->blog_id);
        $post = get_post($feed_item->ID);
        setup_postdata($post);
        ?>
		
		<item>
			<title><?php 
        the_title_rss();
        ?>
</title>
			<link><?php 
        the_permalink_rss();
        ?>
</link>
			<comments><?php 
        comments_link_feed();
        ?>
</comments>
			<pubDate><?php 
        echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', TRUE), FALSE);
        ?>
</pubDate>
			<dc:creator><?php 
        the_author();
        ?>
</dc:creator>
			<?php 
        the_category_rss('rss2');
        ?>
			
			<guid isPermaLink="false"><?php 
        the_guid();
        ?>
</guid>
	<?php 
        if (get_option('rss_use_excerpt')) {
            ?>
			<description><![CDATA[<?php 
            the_excerpt_rss();
            ?>
]]></description>
	<?php 
        } else {
            ?>
			<description><![CDATA[<?php 
            the_excerpt_rss();
            ?>
]]></description>
		<?php 
            $content = \Inpsyde\MultisiteFeed\get_the_content_feed('rss2');
            ?>
		<?php 
            if (strlen($content) > 0) {
                ?>
			<content:encoded><![CDATA[<?php 
                echo $content;
                ?>
]]></content:encoded>
		<?php 
            } else {
                ?>
			<content:encoded><![CDATA[<?php 
                the_excerpt_rss();
                ?>
]]></content:encoded>
		<?php 
            }
            ?>
	<?php 
        }
        ?>
			<wfw:commentRss><?php 
        echo esc_url(get_post_comments_feed_link(NULL, 'rss2'));
        ?>
</wfw:commentRss>
			<slash:comments><?php 
        echo get_comments_number();
        ?>
</slash:comments>
	<?php 
        rss_enclosure();
        do_action('rss2_item');
        ?>
		</item>
		
		<?php 
        restore_current_blog();
    }
    ?>
	
</channel>
</rss>
<?php 
    $xml = ob_get_contents();
    ob_end_clean();
    return $xml;
}
Exemple #8
0
    echo mp3_enclosure();
    ?>
</snippet>
                <description><![CDATA[<?php 
    echo the_content_feed();
    ?>
]]></description>
                <itunes:author><?php 
    the_author();
    ?>
</itunes:author>
                <itunes:subtitle><?php 
    the_excerpt_rss();
    ?>
</itunes:subtitle>
                <itunes:summary></itunes:summary>
                <itunes:image href="<?php 
    echo get_stylesheet_directory_uri();
    ?>
/images/show.jpg" />
            	
            	
            	<?php 
    echo rss_enclosure();
    ?>
            </item>
        <?php 
}
?>
    </channel>
</rss>