function upcoming_events() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); $xml = new DomDocument(); $xml->loadXML($this->get_upcoming_events()); echo $xml->saveXML(); }
/** * Deliver the Memberful Private User Feed. * This Function should be used only within the "init" wordpress hook. */ function memberful_private_user_feed_deliver() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); memberful_private_user_feed_disable_caching(); require MEMBERFUL_DIR . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'private_user_feed_content.php'; exit; }
public function rss_feed() { global $CP_Smarty; header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); echo $CP_Smarty->smarty->fetch('rss.html'); exit; }
/** * * @since 3.1.0 */ public function replyToLoadRSS2Feed() { $_aArguments = $_GET; $_aArguments['template_path'] = AmazonAutoLinks_Registry::$sDirPath . '/template/rss2/template.php'; $_aArguments['credit_link'] = false; header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); AmazonAutoLinks($_aArguments, true); exit; }
/** * Print the feed link tag. */ public function feed_link() { $post_title = self::feed_title(); $feed_link = LivePress_Updater::instance()->get_current_post_feed_link(); if (count($feed_link) > 0) { $tag = '<link rel="alternate" type="' . esc_attr(feed_content_type('rss2')) . '" '; $tag .= 'title="' . esc_attr(get_bloginfo('name')) . ' » ' . esc_attr($post_title) . '" '; $tag .= 'href="' . esc_url($feed_link[0]) . '" />' . "\n"; echo $tag; } }
function link_library_generate_rss_feed() { require_once plugin_dir_path(__FILE__) . 'rss.genesis.php'; global $wpdb; if (isset($_GET['settingsset']) && !empty($_GET['settingsset'])) { $settingsetid = intval($_GET['settingsset']); } else { $settingsetid = 1; } $settingsname = 'LinkLibraryPP' . $settingsetid; $options = get_option($settingsname); $rss = new rssGenesis(); $feedtitle = $options['rssfeedtitle'] == "" ? "Link Library Generated Feed" : $options['rssfeedtitle']; $feeddescription = $options['rssfeeddescription'] == "" ? "Link Library Generated Feed Description" : $options['rssfeeddescription']; // CHANNEL $rss->setChannel($feedtitle, home_url() . '/feed/linklibraryfeed?settingsset=' . $settingsetid, $feeddescription, null, null, null, null, null, "auto", "auto", "Link Library Links", null, null, null, null); $linkquery = "SELECT distinct *, UNIX_TIMESTAMP(l.link_updated) as link_date "; $linkquery .= "FROM " . $wpdb->prefix . "terms t "; $linkquery .= "LEFT JOIN " . $wpdb->prefix . "term_taxonomy tt ON (t.term_id = tt.term_id) "; $linkquery .= "LEFT JOIN " . $wpdb->prefix . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) "; $linkquery .= "LEFT JOIN " . $wpdb->prefix . "links l ON (tr.object_id = l.link_id) "; $linkquery .= "WHERE tt.taxonomy = 'link_category' "; if ($options['hide_if_empty']) { $linkquery .= "AND l.link_id is not NULL AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' "; } if ($options['categorylist'] != "") { $linkquery .= " AND t.term_id in (" . $options['categorylist'] . ")"; } if ($options['excludecategorylist'] != "") { $linkquery .= " AND t.term_id not in (" . $options['excludecategorylist'] . ")"; } if ($options['showinvisible'] == false) { $linkquery .= " AND l.link_visible != 'N'"; } $linkquery .= " ORDER by link_date DESC"; $linkquery .= " LIMIT 0, " . $options['numberofrssitems']; $linkitems = $wpdb->get_results($linkquery); if ($linkitems) { foreach ($linkitems as $linkitem) { if ($linkitem->link_url != '') { // ITEM $rss->addItem($linkitem->link_name, $linkitem->link_url, $linkitem->link_description, $linkitem->link_updated, $linkitem->name); } } } header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset')); print $rss->getFeed(); exit; }
function generate_edition_atom_feed($edition_id, $include_hidden = false, $search_term = null) { // Check it exists $edition = get_post($edition_id); if (empty($edition)) { header('HTTP/1.1 404 Not Found'); exit; } pugpig_remove_wordpress_headers(); $modified = pugpig_get_page_modified($edition); if ($search_term) { $modified = time(); } if ($edition->post_status != 'publish') { if (FALSE && !pugpig_is_internal_user()) { header('HTTP/1.1 403 Forbidden'); exit; } header('X-Pugpig-Status: unpublished'); pugpig_set_cache_headers($modified, 0); } else { header('X-Pugpig-Status: published'); pugpig_set_cache_headers($modified, pugpig_get_feed_ttl()); } $x_entitlement = pugpig_get_edition_entitlement_header($edition); if (!empty($x_entitlement)) { header('X-Pugpig-Entitlement: ' . $x_entitlement); } $links = pugpig_get_edition_atom_links($edition, true); header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true); header('Content-Disposition: inline'); global $wp_query; $filter = ""; $regions = pugpig_get_available_region_array(); foreach (array_keys($regions) as $region) { if (isset($wp_query->query_vars[$region . "_pugpig_atom_contents_manifest"])) { $filter = $region; } } $region = ""; $d = pugpig_get_atom_container($edition_id, $include_hidden, $search_term, $links, $filter); $d->formatOutput = true; echo $d->saveXML(); }
public function print_eventlist_feed() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); $events = $this->db->get_events($this->options->get('el_feed_upcoming_only') ? 'upcoming' : null); // Print feeds 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>' . get_bloginfo_rss('name') . '</title> <atom:link href="' . apply_filters('self_link', get_bloginfo()) . '" rel="self" type="application/rss+xml" /> <link>' . get_bloginfo_rss('url') . '</link> <description>' . __('Eventlist') . '</description> <lastBuildDate>' . mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false) . '</lastBuildDate> <language>' . get_option('rss_language') . '</language> <sy:updatePeriod>' . apply_filters('rss_update_period', 'hourly') . '</sy:updatePeriod> <sy:updateFrequency>' . apply_filters('rss_update_frequency', '1') . '</sy:updateFrequency> '; do_action('rss2_head'); if (!empty($events)) { foreach ($events as $event) { echo ' <item> <title>' . esc_attr($this->format_date($event->start_date, $event->end_date) . ' - ' . $event->title) . '</title> <pubDate>' . mysql2date('D, d M Y H:i:s +0000', $event->start_date, false) . '</pubDate> <description>' . esc_attr($this->format_date($event->start_date, $event->end_date) . ' ' . ('' != $event->time ? $event->time : '') . ('' != $event->location ? ' - ' . $event->location : '')) . '</description> ' . ('' != $event->details ? '<content:encoded><![CDATA[' . esc_attr($this->format_date($event->start_date, $event->end_date) . ' ' . ('' != $event->time ? $event->time : '') . ('' != $event->location ? ' - ' . $event->location : '')) . $event->details . ']]></content:encoded>' : '') . ' </item>'; } } echo ' </channel> </rss>'; }
/** * 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(' » ')); } elseif (!bbp_show_lead_topic()) { $title = ' » ' . __('All Posts', 'bbpress'); } else { $title = ' » ' . __('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; }
/** * Sends additional HTTP headers for caching, content type, etc. * * Sets the Content-Type header. Sets the 'error' status (if passed) and optionally exits. * If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed. * * @since 2.0.0 * @since 4.4.0 `X-Pingback` header is added conditionally after posts have been queried in handle_404(). * @access public */ public function send_headers() { $headers = array(); $status = null; $exit_required = false; if (is_user_logged_in()) { $headers = array_merge($headers, wp_get_nocache_headers()); } if (!empty($this->query_vars['error'])) { $status = (int) $this->query_vars['error']; if (404 === $status) { if (!is_user_logged_in()) { $headers = array_merge($headers, wp_get_nocache_headers()); } $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); } elseif (in_array($status, array(403, 500, 502, 503))) { $exit_required = true; } } elseif (empty($this->query_vars['feed'])) { $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); } else { // Set the correct content type for feeds $type = $this->query_vars['feed']; if ('feed' == $this->query_vars['feed']) { $type = get_default_feed(); } $headers['Content-Type'] = feed_content_type($type) . '; charset=' . get_option('blog_charset'); // We're showing a feed, so WP is indeed the only thing that last changed if (!empty($this->query_vars['withcomments']) || false !== strpos($this->query_vars['feed'], 'comments-') || empty($this->query_vars['withoutcomments']) && (!empty($this->query_vars['p']) || !empty($this->query_vars['name']) || !empty($this->query_vars['page_id']) || !empty($this->query_vars['pagename']) || !empty($this->query_vars['attachment']) || !empty($this->query_vars['attachment_id']))) { $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0) . ' GMT'; } else { $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT'; } $wp_etag = '"' . md5($wp_last_modified) . '"'; $headers['Last-Modified'] = $wp_last_modified; $headers['ETag'] = $wp_etag; // Support for Conditional GET if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $client_etag = wp_unslash($_SERVER['HTTP_IF_NONE_MATCH']); } else { $client_etag = false; } $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']); // If string is empty, return 0. If not, attempt to parse into a timestamp $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; // Make a timestamp for our most recent modification... $wp_modified_timestamp = strtotime($wp_last_modified); if ($client_last_modified && $client_etag ? $client_modified_timestamp >= $wp_modified_timestamp && $client_etag == $wp_etag : $client_modified_timestamp >= $wp_modified_timestamp || $client_etag == $wp_etag) { $status = 304; $exit_required = true; } } /** * Filter the HTTP headers before they're sent to the browser. * * @since 2.8.0 * * @param array $headers The list of headers to be sent. * @param WP $this Current WordPress environment instance. */ $headers = apply_filters('wp_headers', $headers, $this); if (!empty($status)) { status_header($status); } // If Last-Modified is set to false, it should not be sent (no-cache situation). if (isset($headers['Last-Modified']) && false === $headers['Last-Modified']) { unset($headers['Last-Modified']); // In PHP 5.3+, make sure we are not sending a Last-Modified header. if (function_exists('header_remove')) { @header_remove('Last-Modified'); } else { // In PHP 5.2, send an empty Last-Modified header, but only as a // last resort to override a header already sent. #WP23021 foreach (headers_list() as $header) { if (0 === stripos($header, 'Last-Modified')) { $headers['Last-Modified'] = ''; break; } } } } foreach ((array) $headers as $name => $field_value) { @header("{$name}: {$field_value}"); } if ($exit_required) { exit; } /** * Fires once the requested HTTP headers for caching, content type, etc. have been sent. * * @since 2.1.0 * * @param WP &$this Current WordPress environment instance (passed by reference). */ do_action_ref_array('send_headers', array(&$this)); }
function wp_rss_multi_importer_feed() { header("Content-type: text/xml"); $catArray = array(0); if (!function_exists("wprssmi_hourly_feed")) { function wprssmi_hourly_feed() { return 0; } // no caching of RSS feed } $options = get_option('rss_import_options', 'option not found'); $option_items = get_option('rss_import_items', 'option not found'); $feed_options = get_option('rss_feed_options', 'option not found'); if ($option_items == false) { return "You need to set up the WP RSS Multi Importer Plugin before any results will show here. Just go into the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin'>settings panel</a> and put in some RSS feeds"; } $cat_array = preg_grep("^feed_cat_^", array_keys($option_items)); if (count($cat_array) == 0) { // for backward compatibility $noExistCat = 1; } else { $noExistCat = 0; } if (!empty($option_items)) { //GET PARAMETERS $size = count($option_items); $sortDir = $options['sortbydate']; // 1 is ascending $stripAll = $options['stripAll']; $todaybefore = $options['todaybefore']; $adjustImageSize = $options['adjustImageSize']; $showDesc = $options['showdesc']; // 1 is show $descNum = $options['descnum']; $maxperPage = $options['maxperPage']; $cacheMin = $options['cacheMin']; $maxposts = $options['maxfeed']; if ($thisfeed != '') { $maxposts = $thisfeed; } $targetWindow = $options['targetWindow']; // 0=LB, 1=same, 2=new $floatType = $options['floatType']; $noFollow = $options['noFollow']; $showmore = $options['showmore']; $cb = $options['cb']; // 1 if colorbox should not be loaded $pag = $options['pag']; // 1 if pagination $perPage = $options['perPage']; if (empty($options['sourcename'])) { $attribution = ''; } else { $attribution = $options['sourcename'] . ': '; } if ($floatType == '1') { $float = "left"; } else { $float = "none"; } if ($parmfloat != '') { $float = $parmfloat; } $cacheMin = 0; if ($cacheMin == '') { $cacheMin = 0; //set caching minutes } if (!is_null($cachetime)) { $cacheMin = $cachetime; } //override caching minutes with shortcode parameter $myarray = get_transient($cachename); // added for transient cache if ($cacheMin == 0) { delete_transient($cachename); } if (false === $myarray) { // added for transient cache - only get feeds and put into array if the array isn't cached (for a given category set) for ($i = 1; $i <= $size; $i = $i + 1) { $key = key($option_items); if (!strpos($key, '_') > 0) { continue; } //this makes sure only feeds are included here...everything else are options $rssName = $option_items[$key]; next($option_items); $key = key($option_items); $rssURL = $option_items[$key]; next($option_items); $key = key($option_items); // $rssCatID=$option_items[$key]; ///this should be the category ID if (!in_array(0, $catArray) && in_array($option_items[$key], $catArray) || in_array(0, $catArray) || $noExistCat == 1) { $myfeeds[] = array("FeedName" => $rssName, "FeedURL" => $rssURL); } $cat_array = preg_grep("^feed_cat_^", array_keys($option_items)); // for backward compatibility if (count($cat_array) > 0) { next($option_items); //skip feed category } } if ($maxposts == "") { return "One more step...go into the the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin&tab=setting_options'>Settings Panel and choose Options.</a>"; } // check to confirm they set options if (empty($myfeeds)) { return "You've either entered a category ID that doesn't exist or have no feeds configured for this category. Edit the shortcode on this page with a category ID that exists, or <a href=" . $cat_options_url . ">go here and and get an ID</a> that does exist in your admin panel."; exit; } foreach ($myfeeds as $feeditem) { $url = (string) $feeditem["FeedURL"]; while (stristr($url, 'http') != $url) { $url = substr($url, 1); } $feed = fetch_feed($url); if (is_wp_error($feed)) { if ($size < 4) { return "You have one feed and it's not valid. This is likely a problem with the source of the RSS feed. Contact our support forum for help."; exit; } else { //echo $feed->get_error_message(); continue; } } $maxfeed = $feed->get_item_quantity(0); //SORT DEPENDING ON SETTINGS if ($sortDir == 1) { for ($i = $maxfeed - 1; $i >= $maxfeed - $maxposts; $i--) { $item = $feed->get_item($i); if (empty($item)) { continue; } $myarray[] = array("mystrdate" => strtotime($item->get_date()), "mytitle" => $item->get_title(), "mylink" => $item->get_link(), "myGroup" => $feeditem["FeedName"], "mydesc" => $item->get_description()); } } else { for ($i = 0; $i <= $maxposts - 1; $i++) { $item = $feed->get_item($i); if (empty($item)) { continue; } $myarray[] = array("mystrdate" => strtotime($item->get_date()), "mytitle" => $item->get_title(), "mylink" => $item->get_link(), "myGroup" => $feeditem["FeedName"], "mydesc" => $item->get_description()); } } } if ($cacheMin !== 0) { set_transient($cachename, $myarray, 60 * $cacheMin); // added for transient cache } } // added for transient cache if ($timerstop == 1) { timer_stop(1); echo ' seconds<br>'; //TIMER END for testing purposes } // CHECK $myarray BEFORE DOING ANYTHING ELSE // if ($dumpthis == 1) { var_dump($myarray); } if (!isset($myarray) || empty($myarray)) { return "There is a problem with the feeds you entered. Go to our <a href='http://www.allenweiss.com/wp_plugin'>support page</a> and we'll help you diagnose the problem."; exit; } //$myarrary sorted by mystrdate foreach ($myarray as $key => $row) { $dates[$key] = $row["mystrdate"]; } //SORT, DEPENDING ON SETTINGS if ($sortDir == 1) { array_multisort($dates, SORT_ASC, $myarray); } else { array_multisort($dates, SORT_DESC, $myarray); } header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); ?> <rss version="2.0"> <channel> <title><?php echo $feed_options['feedtitle']; ?> </title> <link></link> <description><?php echo $feed_options['feeddesc']; ?> </description> <language>en-us</language> <?php $total = 0; foreach ($myarray as $items) { $total = $total + 1; if ($total > 20) { break; } ?> <item> <title><?php echo $items["mytitle"]; ?> </title> <link><?php echo $items["mylink"]; ?> </link> <description><?php echo '<![CDATA[' . rss_text_limit($feed_options['striptags'], $items["mydesc"], 500) . '<br/><br/>Keep on reading: <a href="' . $items["mylink"] . '">' . $items["mytitle"] . '</a>' . ']]>'; ?> </description> <pubdate><?php echo date_i18n("D, M d, Y", $items["mystrdate"]); ?> </pubdate> <guid><?php echo $items["mylink"]; ?> </guid> </item> <?php } ?> </channel></rss> <?php } }
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 }
/** * Provide a public-facing view for the plugin * * This file is used to markup the public-facing aspects of the plugin. * * @link http://www.jonathandavidharris.co.uk * @since 1.0.0 * * @package Simple_Google_News_Sitemap * @subpackage Simple_Google_News_Sitemap/public/partials */ $wp_lang = get_bloginfo('language'); $lang_array = explode("-", $wp_lang); $lang = $lang_array[0]; $site_name = get_bloginfo('name'); header('Content-Type: ' . feed_content_type($this->plugin_name) . '; charset=' . get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; ?> <!-- generator="simple-google-news-sitemap" datetime="<?php echo date("Y-m-d H:i:s"); ?> " --> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-news/0.9 http://www.google.com/schemas/sitemap-news/0.9/sitemap-news.xsd" >
/** * Display the links to the extra feeds such as category feeds. * * @since 2.8.0 * * @param array $args Optional arguments. */ function feed_links_extra($args = array()) { $defaults = array('separator' => _x('»', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), 'posttypetitle' => __('%1$s %2$s %3$s Feed')); $args = wp_parse_args($args, $defaults); if (is_singular()) { $id = 0; $post = get_post($id); if (comments_open() || pings_open() || $post->comment_count > 0) { $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false))); $href = get_post_comments_feed_link($post->ID); } } elseif (is_post_type_archive()) { $post_type = get_query_var('post_type'); if (is_array($post_type)) { $post_type = reset($post_type); } $post_type_obj = get_post_type_object($post_type); $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name); $href = get_post_type_archive_feed_link($post_type_obj->name); } elseif (is_category()) { $term = get_queried_object(); if ($term) { $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name); $href = get_category_feed_link($term->term_id); } } elseif (is_tag()) { $term = get_queried_object(); if ($term) { $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name); $href = get_tag_feed_link($term->term_id); } } elseif (is_author()) { $author_id = intval(get_query_var('author')); $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id)); $href = get_author_feed_link($author_id); } elseif (is_search()) { $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false)); $href = get_search_feed_link(); } elseif (is_post_type_archive()) { $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false)); $post_type_obj = get_queried_object(); if ($post_type_obj) { $href = get_post_type_archive_feed_link($post_type_obj->name); } } if (isset($title) && isset($href)) { echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n"; } }
public function wpproads_rss($adzone_id = 0) { global $pro_ads_main, $pro_ads_adzones, $pro_ads_shortcodes; if (!empty($adzone_id) || isset($_GET['wpproads-rss']) && !empty($_GET['wpproads-rss'])) { $html = ''; $adzoneID = !empty($adzone_id) ? $adzone_id : $_GET['wpproads-rss']; $atts = $pro_ads_shortcodes->default_atts($adzoneID); // http://kb.mailchimp.com/merge-tags/rss-blog/rss-item-tags // Mailchimp RSS code // *|RSSITEMS:|* *|RSSITEM:CONTENT_FULL|* *|END:RSSITEMS|* header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); $html .= '<?xml version="1.0" encoding="UTF-8"?>'; $html .= '<rss 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/" version="2.0">'; $html .= '<channel>'; $html .= '<title>' . get_bloginfo('name') . '</title>'; $html .= '<atom:link href="' . get_bloginfo('url') . '/?wpproads-rss=' . $adzoneID . '" rel="self" type="application/rss+xml" />'; $html .= '<link>' . get_bloginfo('url') . '</link>'; $html .= '<description><![CDATA[' . get_bloginfo('description') . ']]></description>'; $html .= '<lastBuildDate>' . date('r', $pro_ads_main->time_by_timezone()) . '</lastBuildDate>'; $html .= '<language>' . get_bloginfo('language') . '</language>'; $html .= '<generator>http://wordpress-advertising.com/?v=' . WP_ADS_VERSION . '</generator>'; $html .= '<item>'; $html .= '<title>Adzone</title>'; $html .= '<link>' . get_bloginfo('url') . '</link>'; $html .= '<guid isPermaLink="false">' . get_bloginfo('url') . '/?wpproads-rss=' . $adzoneID . '</guid>'; $html .= '<description><![CDATA[ ' . get_the_title($adzoneID) . ' ]]></description>'; $html .= '<content:encoded><![CDATA[' . $pro_ads_adzones->display_adzone($adzoneID, $atts) . ']]></content:encoded>'; $html .= '<pubDate>' . date('r', $pro_ads_main->time_by_timezone()) . '</pubDate>'; $html .= '</item>'; $html .= '</channel>'; $html .= '</rss>'; echo $html; exit; } }
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 }
/** * Output for Stream Records as a feed. * * @return xml */ public static function feed_template() { $die_title = esc_html__('Access Denied', 'stream'); $die_message = '<h1>' . $die_title . '</h1><p>' . esc_html__('You don\'t have permission to view this feed, please contact your site Administrator.', 'stream') . '</p>'; if (!isset($_GET[self::FEED_QUERY_VAR]) || empty($_GET[self::FEED_QUERY_VAR])) { wp_die($die_message, $die_title); } $args = array('meta_key' => self::USER_FEED_KEY, 'meta_value' => $_GET[self::FEED_QUERY_VAR], 'number' => 1); $user = get_users($args); if (!is_super_admin($user[0]->ID)) { $roles = isset($user[0]->roles) ? (array) $user[0]->roles : array(); if (self::$is_network_feed) { wp_die($die_message, $die_title); } if (!$roles || !array_intersect($roles, WP_Stream_Settings::$options['general_role_access'])) { wp_die($die_message, $die_title); } } $blog_id = self::$is_network_feed ? null : get_current_blog_id(); $args = array('blog_id' => $blog_id, 'records_per_page' => wp_stream_filter_input(INPUT_GET, 'records_per_page', FILTER_SANITIZE_NUMBER_INT, array('options' => array('default' => get_option('posts_per_rss')))), 'search' => wp_stream_filter_input(INPUT_GET, 'search'), 'object_id' => wp_stream_filter_input(INPUT_GET, 'object_id', FILTER_SANITIZE_NUMBER_INT), 'ip' => wp_stream_filter_input(INPUT_GET, 'ip', FILTER_VALIDATE_IP), 'author' => wp_stream_filter_input(INPUT_GET, 'author', FILTER_SANITIZE_NUMBER_INT), 'author_role' => wp_stream_filter_input(INPUT_GET, 'author_role'), 'date' => wp_stream_filter_input(INPUT_GET, 'date'), 'date_from' => wp_stream_filter_input(INPUT_GET, 'date_from'), 'date_to' => wp_stream_filter_input(INPUT_GET, 'date_to'), 'record__in' => wp_stream_filter_input(INPUT_GET, 'record__in', FILTER_SANITIZE_NUMBER_INT), 'record_parent' => wp_stream_filter_input(INPUT_GET, 'record_parent', FILTER_SANITIZE_NUMBER_INT), 'order' => wp_stream_filter_input(INPUT_GET, 'order', FILTER_DEFAULT, array('options' => array('default' => 'desc'))), 'orderby' => wp_stream_filter_input(INPUT_GET, 'orderby', FILTER_DEFAULT, array('options' => array('default' => 'ID'))), 'fields' => wp_stream_filter_input(INPUT_GET, 'fields', FILTER_DEFAULT, array('options' => array('default' => 'with-meta')))); $records = wp_stream_query($args); $latest_record = isset($records[0]->created) ? $records[0]->created : null; $records_admin_url = add_query_arg(array('page' => WP_Stream_Admin::RECORDS_PAGE_SLUG), admin_url(WP_Stream_Admin::ADMIN_PARENT_PAGE)); if ('json' === wp_stream_filter_input(INPUT_GET, self::FEED_TYPE_QUERY_VAR)) { if (version_compare(PHP_VERSION, '5.4', '>=')) { echo json_encode($records, JSON_PRETTY_PRINT); } else { echo json_encode($records); } } else { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); printf('<?xml version="1.0" encoding="%s"?>', esc_attr(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 /** * Action fires during RSS xmls printing */ ?> <?php do_action('rss2_ns'); ?> > <channel> <title><?php bloginfo_rss('name'); ?> - <?php esc_html_e('Stream Feed', 'stream'); ?> </title> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <link><?php echo esc_url($records_admin_url); ?> </link> <description><?php bloginfo_rss('description'); ?> </description> <lastBuildDate><?php echo esc_html(mysql2date('r', $latest_record, false)); ?> </lastBuildDate> <language><?php bloginfo_rss('language'); ?> </language> <sy:updatePeriod><?php echo esc_html('hourly'); ?> </sy:updatePeriod> <sy:updateFrequency><?php echo absint(1); ?> </sy:updateFrequency> <?php /** * Action fires during RSS head */ ?> <?php do_action('rss2_head'); ?> <?php foreach ($records as $record) { ?> <?php $record_link = add_query_arg(array('record__in' => (int) $record->ID), $records_admin_url); $author = get_userdata($record->author); $display_name = isset($author->display_name) ? $author->display_name : 'N/A'; ?> <item> <title><![CDATA[ <?php echo trim($record->summary); ?> ]]></title> <pubDate><?php echo esc_html(mysql2date('r', $record->created, false)); ?> </pubDate> <dc:creator><?php echo esc_html($display_name); ?> </dc:creator> <category domain="connector"><![CDATA[ <?php echo esc_html($record->connector); ?> ]]></category> <category domain="context"><![CDATA[ <?php echo esc_html($record->context); ?> ]]></category> <category domain="action"><![CDATA[ <?php echo esc_html($record->action); ?> ]]></category> <category domain="ip"><?php echo esc_html($record->ip); ?> </category> <guid isPermaLink="false"><?php echo esc_url($record_link); ?> </guid> <link><?php echo esc_url($record_link); ?> </link> <?php /** * Action fires during RSS item */ ?> <?php do_action('rss2_item'); ?> </item> <?php } ?> </channel> </rss> <?php exit; } }
/** * Print out feed XML. Use cache if available. * * @return void */ function display_feed() { global $wpdb; $cache_key = 'inpsyde_multisite_feed_cache'; $out = get_site_transient($cache_key); // Deactivate Caching for Debugging if (defined('WP_DEBUG') && WP_DEBUG || 0 === Settings\get_site_option('cache_expiry_minutes')) { $out = FALSE; } if (FALSE === $out) { $max_entries_per_site = Settings\get_site_option('max_entries_per_site'); $max_entries = Settings\get_site_option('max_entries'); $excluded_blogs = Settings\get_site_option('excluded_blogs'); $only_podcasts = Settings\get_site_option('only_podcasts'); $use_excerpt = Settings\get_site_option('use_excerpt'); if ($excluded_blogs) { $excluded_blogs_sql = "AND blog.`blog_id` NOT IN (" . $excluded_blogs . ")"; } else { $excluded_blogs_sql = ''; } $blogs = $wpdb->get_col("\n\t\t\tSELECT\n\t\t\t\tblog.`blog_id`\n\t\t\tFROM\n\t\t\t\t" . $wpdb->base_prefix . "blogs AS blog \n\t\t\tWHERE\n\t\t\t\tblog.`public` = '1'\n\t\t\t\tAND blog.`archived` = '0'\n\t\t\t\tAND blog.`spam` = '0'\n\t\t\t\t{$excluded_blogs_sql}\n\t\t\t\tAND blog.`deleted` ='0' \n\t\t\t\tAND blog.`last_updated` != '0000-00-00 00:00:00'\n\t\t"); if (!is_array($blogs)) { wp_die("There are no blogs."); } $feed_items = array(); foreach ($blogs as $blog_id) { if ($only_podcasts) { $only_podcasts_sql_from = ", `" . $wpdb->get_blog_prefix($blog_id) . "postmeta` AS postmeta"; $only_podcasts_sql_where = "AND posts.`ID` = postmeta.`post_id`"; $only_podcasts_sql = "AND (postmeta.`meta_key` = 'enclosure' OR postmeta.`meta_key` = '_podPressMedia')"; } else { $only_podcasts_sql_from = ''; $only_podcasts_sql_where = ''; $only_podcasts_sql = ''; } // $wpdb::get_blog_prefix( $blog_id ) // $wpdb->base_prefix . ($blog_id > 1 ? $blog_id . '_' : '') $results = $wpdb->get_results("\n\t\t\t\tSELECT\n\t\t\t\t\tposts.`ID`, posts.`post_date_gmt` AS date\n\t\t\t\tFROM\n\t\t\t\t\t`" . $wpdb->get_blog_prefix($blog_id) . "posts` AS posts\n\t\t\t\t\t{$only_podcasts_sql_from}\n\t\t\t\tWHERE\n\t\t\t\t\tposts.`post_type` = 'post'\n\t\t\t\t\t{$only_podcasts_sql_where}\n\t\t\t\t\tAND posts.`post_status` = 'publish'\n\t\t\t\t\tAND posts.`post_password` = ''\n\t\t\t\t\tAND posts.`post_date_gmt` < '" . gmdate("Y-m-d H:i:s") . "'\n\t\t\t\t\t{$only_podcasts_sql}\n\t\t\t\tORDER BY\n\t\t\t\t\tposts.post_date_gmt DESC\n\t\t\t\tLIMIT 0," . (int) $max_entries_per_site); if (!is_array($results) || empty($results)) { continue; } // add blog id to post data $results = array_map(function ($row) use($blog_id) { $row->blog_id = $blog_id; return $row; }, $results); // add blog items to final array $feed_items = array_merge($feed_items, $results); } // sort by date uasort($feed_items, function ($a, $b) { if ($a->date == $b->date) { return 0; } return $a->date > $b->date ? -1 : 1; }); if ($max_entries) { $feed_items = array_slice($feed_items, 0, $max_entries); } $out = get_feed_xml($feed_items); set_site_transient($cache_key, $out, 60 * Settings\get_site_option('cache_expiry_minutes', 60)); } header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), TRUE); echo $out; }
/** * Action wp_head * * Clean up the header * * @since 5.0.0 * * @return void */ function action_wp_head() { printf('<link rel="alternate" type="%s" title="%s" href="%s" />%s', esc_attr(feed_content_type()), esc_html(get_bloginfo('name')) . ' | ' . esc_attr__('Tech Posts Only', 'chriswiegman'), 'http://feeds.chriswiegman.com/', esc_attr(PHP_EOL)); printf('<link rel="alternate" type="%s" title="%s" href="%s" />%s', esc_attr(feed_content_type()), esc_html(get_bloginfo('name')) . ' | ' . esc_attr__('All Posts', 'chriswiegman'), 'http://feeds.chriswiegman.com/all', esc_attr(PHP_EOL)); printf('<link rel="alternate" type="%s" title="%s" href="%s" />%s', esc_attr(feed_content_type()), esc_html(get_bloginfo('name')) . ' | ' . esc_attr__('All Comments', 'chriswiegman'), 'http://feeds.chriswiegman.com/comments', esc_attr(PHP_EOL)); }
function wp_rss_multi_importer_feed() { header("Content-type: text/xml"); $catArray = array(0); if (!function_exists("wprssmi_hourly_feed")) { function wprssmi_hourly_feed() { return 0; } // no caching of RSS feed } // add_filter( 'wp_feed_cache_transient_lifetime', 'wprssmi_hourly_feed' ); $options = get_option('rss_import_options', 'option not found'); $option_items = get_option('rss_import_items', 'option not found'); $feed_options = get_option('rss_feed_options', 'option not found'); if ($option_items == false) { return "You need to set up the WP RSS Multi Importer Plugin before any results will show here. Just go into the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin'>settings panel</a> and put in some RSS feeds"; } if (!empty($option_items)) { //GET PARAMETERS $size = count($option_items); $sortDir = $options['sortbydate']; // 1 is ascending $stripAll = $options['stripAll']; $todaybefore = $options['todaybefore']; $adjustImageSize = $options['adjustImageSize']; $showDesc = $options['showdesc']; // 1 is show $descNum = $options['descnum']; $maxperPage = $options['maxperPage']; $cacheMin = $options['cacheMin']; $maxposts = $options['maxfeed']; if ($thisfeed != '') { $maxposts = $thisfeed; } $targetWindow = $options['targetWindow']; // 0=LB, 1=same, 2=new $floatType = $options['floatType']; $noFollow = $options['noFollow']; $showmore = $options['showmore']; $cb = $options['cb']; // 1 if colorbox should not be loaded $pag = $options['pag']; // 1 if pagination $perPage = $options['perPage']; if (empty($options['sourcename'])) { $attribution = ''; } else { $attribution = $options['sourcename'] . ' '; } if ($floatType == '1') { $float = "left"; } else { $float = "none"; } if ($parmfloat != '') { $float = $parmfloat; } $cacheMin = 0; if ($cacheMin == '') { $cacheMin = 0; //set caching minutes } global $wpdb; $myarray = array(); $feed_array = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type ='rssmi_feed' AND post_status='publish'"); if (empty($feed_array) || is_null($feed_array)) { return 'No feed urls entered'; } foreach ($feed_array as $feed) { $feedlimit = 0; $rssmi_cat = get_post_meta($feed->ID, 'rssmi_cat', true); $rssmi_url = get_post_meta($feed->ID, 'rssmi_url', true); $rssmi_user = get_post_meta($feed->ID, 'rssmi_user', true); $rssmi_title = get_the_title($feed->ID); $catSourceArray = array("myGroup" => $rssmi_source, "mycatid" => $rssmi_cat); /* if (((!in_array(0, $catArray ) && in_array(intval($rssmi_cat), $catArray ))) || in_array(0, $catArray )) { $myfeeds[] = array("FeedName"=>$rssmi_title,"FeedURL"=>$rssmi_url,"FeedCatID"=>$rssmi_cat, "FeedUser"=>$rssmi_user); } } if(!$maxposts) { $maxposts=20;} $myarray=get_my_array($myfeeds,$sortDir,$maxposts, $dumpthis); */ $rssmi_sql = "SELECT a.post_id,b.meta_key,b.meta_value FROM {$wpdb->postmeta} as a inner join {$wpdb->postmeta} as b on a.post_id=b.post_id WHERE a.meta_value ={$feed->ID} and b.meta_key='rssmi_item_date' order by b.meta_value desc"; $desc_array = $wpdb->get_results($rssmi_sql); foreach ($desc_array as $arrayItem) { $feedlimit = $feedlimit + 1; if ($feedlimit > $maxposts) { continue; } $post_ID = $arrayItem->post_id; $desc = get_post_meta($post_ID, 'rssmi_item_description', true); $arrayItem = array_merge((array) $desc[0], $catSourceArray); // add the source and category ID if (include_post($rssmi_cat, $arrayItem['mydesc'], $arrayItem['mytitle']) == 0) { continue; } // FILTER array_push($myarray, $arrayItem); //combine into final array } } if (!isset($myarray) || empty($myarray)) { return "There is a problem with the feeds you entered. Go to our <a href='http://www.wprssimporter.com/faqs'>support page</a> and we'll help you diagnose the problem."; exit; } //$myarrary sorted by mystrdate //print_r($myarray); foreach ($myarray as $key => $row) { $dates[$key] = $row["mystrdate"]; } //var_dump($myarray); // UNCOMMMENT THIS LINE TO PRINT OUT THE ARRAY, WHICH SHOWS IT EXISTS// //SORT, DEPENDING ON SETTINGS if ($sortDir == 1) { array_multisort($dates, SORT_ASC, $myarray); } else { array_multisort($dates, SORT_DESC, $myarray); } if (!$maxposts) { $maxposts = 20; } // print_r($myarray); header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); // echo get_option('blog_charset'); // die; // echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <rss version="2.0"> <channel> <title><?php echo $feed_options['feedtitle']; ?> </title> <link>some link</link> <description><?php echo $feed_options['feeddesc']; ?> </description> <language>en-us</language> <?php $total = 0; foreach ($myarray as $items) { $total = $total + 1; if ($total > 20) { break; } ?> <item> <title><?php echo $items["mytitle"]; ?> </title> <link><?php echo $items["mylink"]; ?> </link> <description><?php echo '<![CDATA[' . rss_text_limit($feed_options['striptags'], $items["mydesc"], 500) . '<br/><br/>Keep on reading: <a href="' . $items["mylink"] . '">' . $items["mytitle"] . '</a>' . ']]>'; ?> </description> <pubdate><?php echo date_i18n("D, M d, Y", $items["mystrdate"]); ?> </pubdate> <guid><?php echo $items["mylink"]; ?> </guid> </item> <?php } ?> </channel> </rss> <?php } }
/** * Renders RSS feed link tags for category product feeds * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function feedlinks() { if (empty(ShoppCollection()->name)) { return; } $title = apply_filters('shopp_collection_feed_title', sprintf('%s %s %s', get_bloginfo('name'), ShoppCollection()->name, __('Feed', 'Shopp'))); echo '<link rel="alternate" type="' . feed_content_type('rss') . '" title="' . esc_attr($title) . '" href="' . esc_attr(shopp('collection.get-feed-url')) . '" />' . "\n"; }
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 }
/** * Display the links to the extra feeds such as category feeds. * * @since 2.8.0 * * @param array $args Optional arguments. */ function feed_links_extra($args) { $defaults = array('separator' => _x('»', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed')); $args = wp_parse_args($args, $defaults); if (is_single() || is_page()) { $post =& get_post($id = 0); if (comments_open() || pings_open() || $post->comment_count > 0) { $title = esc_attr(sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html(get_the_title()))); $href = get_post_comments_feed_link($post->ID); } } elseif (is_category()) { $cat_id = intval(get_query_var('cat')); $title = esc_attr(sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name($cat_id))); $href = get_category_feed_link($cat_id); } elseif (is_tag()) { $tag_id = intval(get_query_var('tag_id')); $tag = get_tag($tag_id); $title = esc_attr(sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name)); $href = get_tag_feed_link($tag_id); } elseif (is_author()) { $author_id = intval(get_query_var('author')); $title = esc_attr(sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id))); $href = get_author_feed_link($author_id); } elseif (is_search()) { $title = esc_attr(sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query())); $href = get_search_feed_link(); } if (isset($title) && isset($href)) { echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . $title . '" href="' . $href . '" />' . "\n"; } }
<?php /** * RSS2 Feed Template for displaying RSS2 Posts feed. * * @package WordPress */ header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . Ai1ec_Meta::get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="', Ai1ec_Meta::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'); wp_title_rss(); ?> </title> <atom:link href="<?php self_link();
]" value="1" <?php echo $Checked; ?> /> <?php _e('Hide'); ?> </label> <p class="description"><?php _e('Extra feed', $this->ltd); ?> </p> <p class="description"><?php _e('Tag to be output', $this->ltd); ?> : <code><?php echo esc_html('<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf(__('%1$s %2$s Comments Feed'), get_bloginfo('name'), '&raquo;')) . '" href="' . get_feed_link(get_default_feed() . '&p=***') . ' />'); ?> </code></p> </td> </tr> </tbody> </table> </div> </div> </div> </div> <div id="postbox-container-2" class="postbox-container">
<?php header("Content-Type: " . feed_content_type("rdf") . "; charset=" . get_option("blog_charset"), true); $posts = new WP_Query("post_type=meet&meta_key=meet_start_time&orderby=meta_value_num&order=DESC"); echo '<?xml version="1.0" encoding="' . get_option("blog_charset") . '"?>'; ?> <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/"> <?php do_action("rdf_ns"); ?> <channel rdf:about="<?php bloginfo_rss("url"); ?> "> <title><?php wp_title_rss(); ?> </title> <link><?php bloginfo_rss("url"); ?> </link> <description><?php bloginfo_rss("description");
/** * 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'); ?> » <?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; }
/** * replaces feed_links function, WP 4.1.1 * * @since 0.0.2 * @access public * @link https://github.com/solarissmoke/disable-comments-mu * @uses current_theme_supports() * @uses wp_parse_args * @uses feed_content_type() * @uses esc_attr() * @uses get_bloginfo() * @uses get_feed_link() */ public static function feedLinks($args = []) { if (!current_theme_supports('automatic-feed-links')) { return; } $defaults = ['separator' => _x('»', 'feed link'), 'feedtitle' => __('%1$s %2$s Feed')]; $args = wp_parse_args($args, $defaults); echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf($args['feedtitle'], get_bloginfo('name'), $args['separator'])) . '" href="' . esc_url(get_feed_link()) . "\" />\n"; }
<?php /** * Atom Feed Template for displaying Atom Posts feed. * * @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
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 }