本文整理汇总了PHP中feed_content_type函数的典型用法代码示例。如果您正苦于以下问题:PHP feed_content_type函数的具体用法?PHP feed_content_type怎么用?PHP feed_content_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feed_content_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upcoming_events
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();
}
开发者ID:henk23,项目名称:wp-theatre,代码行数:7,代码来源:wpt_feeds.php
示例2: memberful_private_user_feed_deliver
/**
* 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;
}
开发者ID:andrewkhunn,项目名称:lancero,代码行数:11,代码来源:private_user_feed.php
示例3: rss_feed
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;
}
开发者ID:psoluch,项目名称:rowerblog.pl,代码行数:7,代码来源:class-rss.php
示例4: replyToLoadRSS2Feed
/**
*
* @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;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:13,代码来源:AmazonAutoLinks_Event_Feed.php
示例5: feed_link
/**
* 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;
}
}
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:14,代码来源:livepress-feed.php
示例6: link_library_generate_rss_feed
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;
}
开发者ID:wenhao87,项目名称:WPPlugins,代码行数:49,代码来源:rssfeed.php
示例7: generate_edition_atom_feed
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();
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:44,代码来源:pugpig_manifests_wordpress.php
示例8: print_eventlist_feed
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>';
}
开发者ID:geekpondering,项目名称:wtg,代码行数:40,代码来源:feed.php
示例9: bbp_display_replies_feed_rss2
/**
* 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()) {
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:functions.php
示例10: send_headers
/**
* 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.
*
//.........这里部分代码省略.........
开发者ID:qaryas,项目名称:qaryas_site,代码行数:101,代码来源:class-wp.php
示例11: wp_rss_multi_importer_feed
//.........这里部分代码省略.........
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
}
}
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:101,代码来源:rss_feed.php
示例12: gwolle_gb_rss
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());
//.........这里部分代码省略.........
开发者ID:kovacsa91,项目名称:gwolle-gb,代码行数:101,代码来源:rss.php
示例13: get_bloginfo
/**
* 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"
>
开发者ID:spacedmonkey,项目名称:simple-google-news-sitemap,代码行数:29,代码来源:simple-google-news-sitemap-public-display.php
示例14: feed_links_extra
/**
* 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";
}
}
开发者ID:jenoya,项目名称:final,代码行数:56,代码来源:general-template.php
示例15: wpproads_rss
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;
}
}
开发者ID:bunnywong,项目名称:freshlinker,代码行数:35,代码来源:Pro_Ads_Main.php
示例16: popular_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
//.........这里部分代码省略.........
开发者ID:AarishMannan,项目名称:First,代码行数:101,代码来源:functions-japan-popularfeed.php
示例17: feed_template
/**
* 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
//.........这里部分代码
|
请发表评论