* * @package WordPress */ header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true); $more = 1; echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; /** This action is documented in wp-includes/feed-rss2.php */ do_action('rss_tag_pre', 'atom'); ?> <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en" > <?php do_action('atom_ns'); ?> <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?> </title> <subtitle type="text"><?php bloginfo_rss("description"); ?> </subtitle> <updated><?php echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('GMT'), false); ?> </updated> <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?> " href="<?php bloginfo_rss('url'); ?> " /> <id><?php bloginfo_rss('url');
function create_my_customfeed() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); $more = 1; echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; $mfgigcal_options = get_option('mfgigcal_settings'); if (WPLANG == "") { $language = "en-us"; } else { $language = WPLANG; } ?> <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/" xmlns:mfgigcal="http://wordpress.org/extend/plugins/mf-gig-calendar/" <?php do_action('rss2_ns'); ?> > <channel> <title><?php bloginfo_rss('name'); wp_title_rss(); ?> </title> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <link><?php bloginfo_rss('url'); ?> </link> <description>MF Gig Cal Events</description> <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?> </lastBuildDate> <language><?php echo $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 //get events from db global $wpdb; $mfgigcal_table = $wpdb->prefix . "mfgigcal"; $mfgigcal_settings = get_option('mfgigcal_settings'); // get the dates $today = date("Y-m-d"); $sql = "SELECT * FROM {$mfgigcal_table} WHERE end_date >= '{$today}' ORDER BY start_date"; $mfgigcal_events = $wpdb->get_results($sql); if (!empty($mfgigcal_events)) { foreach ($mfgigcal_events as $mfgigcal_event) { ?> <item> <guid isPermaLink="false"><?php echo $mfgigcal_settings['calendar_url']; ?> ?event_id=<?php echo $mfgigcal_event->id; ?> </guid> <title><![CDATA[<?php echo $mfgigcal_event->title; ?> ]]></title> <link><?php echo $mfgigcal_settings['calendar_url']; ?> ?event_id=<?php echo $mfgigcal_event->id; ?> </link> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $mfgigcal_event->pub_date, false); ?> </pubDate> <description><![CDATA[<p><?php echo mfgigcal_feed_FormatDate($mfgigcal_event->start_date, $mfgigcal_event->end_date); ?> <?php echo $mfgigcal_event->time; ?> </p> <?php echo $mfgigcal_event->location; if ($mfgigcal_settings['rss_details']) { echo $mfgigcal_event->details; } ?> ]]></description> <mfgigcal:event-date><?php echo mfgigcal_feed_FormatDate($mfgigcal_event->start_date, $mfgigcal_event->end_date); ?> </mfgigcal:event-date> <mfgigcal:event-time><![CDATA[<?php echo $mfgigcal_event->time; ?> ]]></mfgigcal:event-time> <mfgigcal:location><![CDATA[<?php echo $mfgigcal_event->location; ?> ]]></mfgigcal:location> <mfgigcal:content><![CDATA[<?php echo $mfgigcal_event->details; ?> ]]></mfgigcal:content> </item> <?php } //end event loop } //end check for events ?> </channel> </rss> <?php }
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" --> <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/" <?php do_action('rss2_ns'); ?> > <channel> <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> <link><?php bloginfo_rss('url') ?></link> <description><?php bloginfo_rss("description") ?></description> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate> <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() ?>
function popular_rss() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); preg_match('{(\\d{1,2})/(\\d{1,2})/popular.xml}', $_SERVER['REQUEST_URI'], $match); $max_posts = (int) $match[1]; if ($max_posts < 1 || $max_posts > 25) { wp_die('Max popular posts should be between 1 and 25.'); } $days = (int) $match[2]; if ($days < 1 || $days > 90) { wp_die('The no. of days should be between 1 and 90.'); } if (function_exists('wpcom_vip_load_helper_stats')) { wpcom_vip_load_helper_stats(); } $feed_max_posts = $max_posts + 20; $popular_data = wpcom_vip_top_posts_array($days, $feed_max_posts); //print_r ($popular_data); foreach ($popular_data as $p) { if ($p["post_id"] != 0) { $popular_posts[] = $p["post_id"]; } } $the_query = new WP_Query(array('post__in' => $popular_posts, 'orderby' => 'post__in', 'posts_per_page' => $max_posts, 'ignore_sticky_posts' => 1)); echo '<?xml version="1.0"?>'; ?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title><?php bloginfo_rss('name'); wp_title_rss(); ?> </title> <link><?php bloginfo_rss('url'); ?> </link> <description><?php bloginfo_rss("description"); ?> </description> <image> <url><?php echo home_url(); ?> /wp-content/themes/vip/jptechcrunch/images/site-logo-small.png</url> <title><?php bloginfo_rss('name'); wp_title_rss(); ?> </title> <link><?php bloginfo_rss('url'); ?> </link> </image> <language><?php echo get_option('rss_language'); ?> </language> <copyright>Copyright <?php echo date('Y'); ?> TechCrunch The contents of this feed are available for non-commercial use only.</copyright> <?php global $post; while ($the_query->have_posts()) { $the_query->the_post(); ?> <item> <title><![CDATA[<?php the_title_rss(); ?> ]]></title> <link><![CDATA[<?php the_permalink_rss(); ?> ]]></link> <guid isPermaLink="true"><![CDATA[<?php the_permalink_rss(); ?> ]]></guid> <description><![CDATA[<?php if (is_single()) { if (get_post_meta($post->ID, '_tc_post_type', true) != 'simplepost' && has_post_thumbnail()) { the_post_thumbnail('full'); } the_content(); } else { echo strip_tags(get_the_excerpt()); } ?> ]]></description> <?php if ($thumb = tc_get_post_image($post, 'full')) { ?> <enclosure url="<?php echo esc_url($thumb); ?> " length="<?php echo strlen($thumb); ?> " type="<?php echo tc_get_image_type($thumb); ?> "></enclosure> <?php } else { ?> <enclosure url="" length="-1" ></enclosure> <?php } ?> <?php $byline = get_post_meta(get_the_ID(), 'byline', true); ?> <?php $co_authors = get_coauthors(); $author = get_the_author(); if (count($co_authors) > 0) { $co_author = $co_authors[0]; if ($co_author->last_name) { $author = $co_author->first_name . ' ' . $co_author->last_name; } else { $author = $co_author->display_name; } } ?> <dc:creator><![CDATA[<?php echo $byline ? esc_html($byline) : esc_html($author); ?> ]]></dc:creator> <pubDate><?php $gmt_timestamp = get_post_time('U', true); echo date('D, d M Y H:i:s O', intval($gmt_timestamp)); ?> </pubDate> <dc:identifier>0|19962129</dc:identifier> <?php foreach (wp_get_post_categories($post->ID) as $categoryId) { $category = get_category($categoryId); ?> <category domain="category:<?php echo esc_html($category->slug); ?> "><![CDATA[<?php echo esc_html($category->name); ?> ]]></category> <?php } ?> <?php foreach (wp_get_post_tags($post->ID) as $tag) { ?> <category domain="tag:<?php echo esc_html($tag->slug); ?> "><![CDATA[<?php echo esc_html($tag->name); ?> ]]></category> <?php } ?> <category domain="blogger:<?php echo esc_html(get_the_author()); ?> "><![CDATA[<?php echo esc_html(get_the_author()); ?> ]]></category> </item> <?php } ?> </channel> </rss> <?php }
<?php header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xml:lang="<?php echo get_option('rss_language'); ?>" xml:base="<?php bloginfo_rss('home') ?>/wp-atom.php" <?php do_action('atom_ns'); ?> > <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title> <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> <id><?php bloginfo('atom_url'); ?></id> <link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" /> <?php do_action('atom_head'); ?> <?php while (have_posts()) : the_post(); ?> <entry> <author> <name><?php the_author() ?></name> <uri><?php the_author_url()?></uri> </author> <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
function render_output($wgt_miss, $wgt_count, $wgt_format, $wgt_white) { global $switched; global $wpdb; $table_prefix = $wpdb->base_prefix; header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); if (!isset($wgt_miss) || $wgt_miss == '') { $wgt_miss = array(); } $white = 0; if (isset($wgt_white) && $wgt_white != '' && count($wgt_white) > 0 && $wgt_white[0] && $wgt_white[0] != '') { $white = 1; } 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/" > <channel> <title><?php bloginfo_rss('name'); wp_title_rss(); ?> </title> <link><?php self_link(); ?> </link> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <description><?php bloginfo_rss("description"); ?> </description> <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 $sqlstr = ''; $blog_list = get_blog_list(0, 'all'); if ($white == 0 && !in_array(1, $wgt_miss) || $white == 1 && in_array(1, $wgt_white)) { $sqlstr = "SELECT 1 as blog_id, id, post_date_gmt, post_type from " . $table_prefix . "posts where post_status = 'publish' and post_type = 'post' "; } $uni = ''; foreach ($blog_list as $blog) { if ($white == 0 && !in_array($blog['blog_id'], $wgt_miss) && $blog['blog_id'] != 1 || $white == 1 && $blog['blog_id'] != 1 && in_array($blog['blog_id'], $wgt_white)) { if ($sqlstr != '') { $uni = ' union '; } $sqlstr .= $uni . " SELECT " . $blog['blog_id'] . " as blog_id, id, post_date_gmt, post_type from " . $table_prefix . $blog['blog_id'] . "_posts where post_status = 'publish' and post_type = 'post' "; } } $limit = ''; if ((int) $wgt_count > 0) { $limit = ' LIMIT 0, ' . (int) $wgt_count; } else { $limit = ' LIMIT 0, 100'; } $sqlstr .= " ORDER BY post_date_gmt desc " . $limit; $post_list = $wpdb->get_results($sqlstr, ARRAY_A); foreach ($post_list as $post) { $txt = $wgt_format == '' ? '{excerpt}' : $wgt_format; $p = get_blog_post($post["blog_id"], $post["id"]); $ex = $p->post_excerpt; //if (!isset($ex) || trim($ex) == '') //$ex = substr(strip_tags($p->post_content), 0, 65) . '...'; echo "\r"; ?> <item> <title><![CDATA[<?php echo $p->post_title; ?> ]]></title> <link><?php echo get_blog_permalink($post["blog_id"], $post["id"]); ?> </link> <dc:creator><?php echo get_userdata($p->post_author)->nickname; ?> </dc:creator> <guid isPermaLink="false"><?php echo $p->guid; ?> </guid> <pubDate><?php echo date(DATE_RFC822, strtotime($p->post_date)); ?> </pubDate><?php // echo '<content:encoded><![CDATA[' . $p->post_content . ']]></content:encoded>'; $txt = str_replace('{content}', $p->post_content, $txt); $txt = str_replace('{excerpt}', $ex, $txt); $txt = str_replace('{blog}', get_blog_option($post["blog_id"], 'blogname'), $txt); echo "\r"; ?> <description><![CDATA[<?php echo $txt; ?> ]]></description> </item><?php } echo "\r"; ?> </channel> </rss><?php }