本文整理汇总了PHP中get_lastpostmodified函数的典型用法代码示例。如果您正苦于以下问题:PHP get_lastpostmodified函数的具体用法?PHP get_lastpostmodified怎么用?PHP get_lastpostmodified使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_lastpostmodified函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_related
public function get_related($id = '', $filter = array(), $context = 'view')
{
$option = get_option('sirp_options');
$num = !empty($filter['num']) ? (int) $filter['num'] : (int) $option['display_num'];
$ids = sirp_get_related_posts_id_api($num, $id);
$posts_list = array();
foreach ($ids as $id) {
$posts_list[] = get_post($id['ID']);
}
$response = new WP_JSON_Response();
if (!$posts_list) {
$response->set_data(array());
return $response;
}
$struct = array();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT');
foreach ($posts_list as $post) {
$post = get_object_vars($post);
if (!$this->check_read_permission($post)) {
continue;
}
$response->link_header('item', json_url('/posts/' . $post['ID']), array('title' => $post['post_title']));
$post_data = $this->prepare_post($post, $context);
if (is_wp_error($post_data)) {
continue;
}
$struct[] = $post_data;
}
$response->set_data($struct);
return $response;
}
示例2: get_ranking
/**
* Retrieve ranking
*
* Overrides the $type to set to 'post', then passes through to the post
* endpoints.
*
* @see WP_JSON_Posts::get_posts()
*/
public function get_ranking($filter = array(), $context = 'view')
{
$ids = sga_ranking_get_date($filter);
$posts_list = array();
foreach ($ids as $id) {
$posts_list[] = get_post($id);
}
$response = new WP_JSON_Response();
if (!$posts_list) {
$response->set_data(array());
return $response;
}
// holds all the posts data
$struct = array();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT');
foreach ($posts_list as $post) {
$post = get_object_vars($post);
// Do we have permission to read this post?
if (!$this->check_read_permission($post)) {
continue;
}
$response->link_header('item', json_url('/posts/' . $post['ID']), array('title' => $post['post_title']));
$post_data = $this->prepare_post($post, $context);
if (is_wp_error($post_data)) {
continue;
}
$struct[] = $post_data;
}
$response->set_data($struct);
return $response;
}
示例3: test_feed_element
/**
* Test the <feed> element to make sure its present and populated
* with the expected child elements and attributes.
*/
function test_feed_element()
{
$this->go_to('/?feed=atom');
$feed = $this->do_atom();
$xml = xml_to_array($feed);
// Get the <feed> child element of <xml>.
$atom = xml_find($xml, 'feed');
// There should only be one <feed> child element.
$this->assertCount(1, $atom);
// Verify attributes.
$this->assertEquals('http://www.w3.org/2005/Atom', $atom[0]['attributes']['xmlns']);
$this->assertEquals('http://purl.org/syndication/thread/1.0', $atom[0]['attributes']['xmlns:thr']);
$this->assertEquals(site_url('/wp-atom.php'), $atom[0]['attributes']['xml:base']);
// Verify the <feed> element is present and contains a <title> child element.
$title = xml_find($xml, 'feed', 'title');
$this->assertEquals(get_option('blogname'), $title[0]['content']);
// Verify the <feed> element is present and contains a <updated> child element.
$updated = xml_find($xml, 'feed', 'updated');
$this->assertEquals(strtotime(get_lastpostmodified()), strtotime($updated[0]['content']));
// Verify the <feed> element is present and contains a <subtitle> child element.
$subtitle = xml_find($xml, 'feed', 'subtitle');
$this->assertEquals(get_option('blogdescription'), $subtitle[0]['content']);
// Verify the <feed> element is present and contains two <link> child elements.
$link = xml_find($xml, 'feed', 'link');
$this->assertCount(2, $link);
// Verify the <feed> element is present and contains a <link rel="alternate"> child element.
$this->assertEquals('alternate', $link[0]['attributes']['rel']);
$this->assertEquals(home_url(), $link[0]['attributes']['href']);
// Verify the <feed> element is present and contains a <link rel="href"> child element.
$this->assertEquals('self', $link[1]['attributes']['rel']);
$this->assertEquals(home_url('/?feed=atom'), $link[1]['attributes']['href']);
}
示例4: add_to_index
/**
* Add the XML News Sitemap to the Sitemap Index.
*
* @param string $str String with Index sitemap content.
* @return string
*/
function add_to_index($str)
{
$result = strtotime(get_lastpostmodified('gmt'));
$date = date('c', $result);
$str .= '<sitemap>' . "\n";
$str .= '<loc>' . home_url('news-sitemap.xml') . '</loc>' . "\n";
$str .= '<lastmod>' . $date . '</lastmod>' . "\n";
$str .= '</sitemap>' . "\n";
return $str;
}
示例5: google_sitemap
/**
* Google XML Sitemap
*
* @author Cor van Noorloos
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link https://github.com/corvannoorloos/google-xml-sitemap
*
* @wordpress
* HiddenPlugin Name: Google XML Sitemap
* Plugin URI: https://github.com/corvannoorloos/google-xml-sitemap
* Description: Sitemaps are a way to tell Google about pages on your site we might not otherwise discover. In its simplest terms, a XML Sitemap—usually called Sitemap, with a capital S—is a list of the pages on your website. Creating and submitting a Sitemap helps make sure that Google knows about all the pages on your site, including URLs that may not be discoverable by Google's normal crawling process.
* Author: Cor van Noorloos
* Version: 0.1.1
* Author URI: http://corvannoorloos.com/
* (Bookt) The original file has been modified to output specific entries from BAPI seo data
*/
function google_sitemap()
{
if (!preg_match('/sitemap\\.xml$/', $_SERVER['REQUEST_URI'])) {
return;
}
global $wpdb;
$posts = $wpdb->get_results("SELECT ID, post_title, post_modified_gmt\r\n\t\tFROM {$wpdb->posts}\r\n\t\tWHERE post_status = 'publish'\r\n\t\tAND post_type <> 'nav_menu_item'\r\n\t\tAND post_name <> 'hello-world'\r\n\t\tAND post_password = ''\r\n\t\tORDER BY post_type DESC, post_modified DESC\r\n\t\tLIMIT 50000");
header("HTTP/1.1 200 OK");
header('X-Robots-Tag: noindex, follow', true);
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
echo '<!-- generator="' . home_url('/') . '" -->' . "\n";
$xml = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 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">' . "\n";
$xml .= "\t<url>" . "\n";
$xml .= "\t\t<loc>" . home_url('/') . "</loc>\n";
$xml .= "\t\t<lastmod>" . mysql2date('Y-m-d\\TH:i:s+00:00', get_lastpostmodified('GMT'), false) . "</lastmod>\n";
$xml .= "\t\t<changefreq>" . 'daily' . "</changefreq>\n";
$xml .= "\t\t<priority>" . '1' . "</priority>\n";
$xml .= "\t</url>" . "\n";
foreach ($posts as $post) {
if ($post->ID == get_option('page_on_front')) {
continue;
}
if (!empty($post->post_title)) {
// prevent outputing detail screens which can be determined by seeing if the post has a meta bapikey
$bapikey = get_post_meta($post->ID, "bapikey", true);
if (empty($bapikey)) {
$xml .= "\t<url>\n";
$xml .= "\t\t<loc>" . get_permalink($post->ID) . "</loc>\n";
$xml .= "\t\t<lastmod>" . mysql2date('Y-m-d\\TH:i:s+00:00', $post->post_modified_gmt, false) . "</lastmod>\n";
$xml .= "\t\t<changefreq>" . 'weekly' . "</changefreq>\n";
$xml .= "\t\t<priority>" . '0.8' . "</priority>\n";
$xml .= "\t</url>\n";
}
}
}
// now output the pages from bapi seo data
global $bapisync;
global $bapi_all_options;
foreach ($bapisync->seodata as $seo) {
if (!empty($seo["entity"]) && !empty($seo["pkid"])) {
$turl = BAPISync::cleanurl($seo["DetailURL"]);
$xml .= "\t<url>\n";
$xml .= "\t\t<loc>" . $bapi_all_options['bapi_site_cdn_domain'] . $turl . "</loc>\n";
$xml .= "\t\t<lastmod>" . mysql2date('Y-m-d\\TH:i:s+00:00', $seo["ModifiedOn"]["LongDateTime"], false) . "</lastmod>\n";
$xml .= "\t\t<changefreq>" . 'weekly' . "</changefreq>\n";
$xml .= "\t\t<priority>" . '0.8' . "</priority>\n";
$xml .= "\t</url>\n";
}
}
$xml .= '</urlset>';
echo "{$xml}";
exit;
}
示例6: find
public static function find($app)
{
$found = 0;
$posts = array();
$request_args = $app->request()->get();
$args = self::convert_request($request_args);
if ($lastModified = apply_filters('thermal_get_lastpostmodified', get_lastpostmodified('gmt'))) {
$app->lastModified(strtotime($lastModified . ' GMT'));
}
$model = self::model();
$posts = $model->find($args, $found);
array_walk($posts, array(__CLASS__, 'format'), 'read');
return empty($args['no_found_rows']) ? compact('posts', 'found') : compact('posts');
}
示例7: seo_update_xmlsitemap
/**
* Xml site Map generator
* @param array $availables_post_types
* @return true if success, false otherwise
*/
function seo_update_xmlsitemap($availables_post_types)
{
$success = false;
// $xmlsitemappath = trailingslashit(get_home_path()) . "sitemap.xml"; makes error with woocommerce payplug/paypal purchase method
$xmlsitemappath = trailingslashit(ABSPATH) . "sitemap.xml";
if (($fp = @fopen($xmlsitemappath, 'w')) !== FALSE) {
$xml_sitemap = "";
$xml_sitemap .= '<?xml version="1.0" encoding="UTF-8"?>';
$xsl = locate_web_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . SEO_TOOL_NAME . '/xmlsitemap/xmlsitemap.xsl');
if (!empty($xsl)) {
$xml_sitemap .= "\n" . '<?xml-stylesheet type="text/xsl" href="' . $xsl . '"?>';
}
$xml_sitemap .= "\n" . '<urlset 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" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
// root
$lm = intval(get_timestamp_from_mysql(get_lastpostmodified('GMT')));
$date = date('Y-m-d\\TH:i:s+00:00', $lm);
$xml_sitemap .= "\n\t" . '<url>';
$xml_sitemap .= "\n\t\t" . '<loc>' . get_bloginfo('url') . '</loc>';
$xml_sitemap .= "\n\t\t" . '<lastmod>' . $date . '</lastmod>';
$xml_sitemap .= "\n\t\t" . '<changefreq>weekly</changefreq>';
$xml_sitemap .= "\n\t\t" . '<priority>1.0</priority>';
$xml_sitemap .= "\n\t" . '</url>';
if ($availables_post_types) {
// posts
$posts = get_posts(array('numberposts' => -1, 'orderby' => 'modified', 'order' => 'DESC', 'post_type' => $availables_post_types, 'suppress_filters' => true));
foreach ($posts as $post) {
$lm = intval(get_timestamp_from_mysql($post->post_modified_gmt));
$date = date('Y-m-d\\TH:i:s+00:00', $lm);
$xml_sitemap .= "\n\t" . '<url>';
$xml_sitemap .= "\n\t\t" . '<loc>' . get_permalink($post->ID) . '</loc>';
$xml_sitemap .= "\n\t\t" . '<lastmod>' . $date . '</lastmod>';
$xml_sitemap .= "\n\t\t" . '<changefreq>weekly</changefreq>';
$xml_sitemap .= "\n\t\t" . '<priority>0.6</priority>';
$xml_sitemap .= "\n\t" . '</url>';
}
}
$xml_sitemap .= "\n" . '</urlset>';
// ecriture du fichier
fwrite($fp, $xml_sitemap);
fclose($fp);
$success = true;
} else {
trace_err("Impossible d'écrire le fichier : " . trailingslashit(get_home_path()) . "sitemap.xml");
}
return $success;
}
示例8: test_channel
function test_channel()
{
$this->go_to('/?feed=rss2');
$feed = $this->do_rss2();
$xml = xml_to_array($feed);
// get the rss -> channel element
$channel = xml_find($xml, 'rss', 'channel');
$this->assertTrue(empty($channel[0]['attributes']));
$title = xml_find($xml, 'rss', 'channel', 'title');
$this->assertEquals(get_option('blogname'), $title[0]['content']);
$desc = xml_find($xml, 'rss', 'channel', 'description');
$this->assertEquals(get_option('blogdescription'), $desc[0]['content']);
$link = xml_find($xml, 'rss', 'channel', 'link');
$this->assertEquals(get_option('siteurl'), $link[0]['content']);
$pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
$this->assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
}
示例9: wpjam_headers
function wpjam_headers($headers, $wp)
{
if (!is_user_logged_in() && empty($wp->query_vars['feed'])) {
$headers['Cache-Control'] = 'max-age:600';
$headers['Expires'] = gmdate('D, d M Y H:i:s', time() + 600) . " GMT";
$wpjam_timestamp = get_lastpostmodified('GMT') > get_lastcommentmodified('GMT') ? get_lastpostmodified('GMT') : get_lastcommentmodified('GMT');
$wp_last_modified = mysql2date('D, d M Y H:i:s', $wpjam_timestamp, 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 = stripslashes(stripslashes($_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);
$exit_required = false;
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;
}
if ($exit_required) {
if (!empty($status)) {
status_header($status);
}
foreach ((array) $headers as $name => $field_value) {
@header("{$name}: {$field_value}");
}
if (isset($headers['Last-Modified']) && empty($headers['Last-Modified']) && function_exists('header_remove')) {
@header_remove('Last-Modified');
}
exit;
}
}
return $headers;
}
示例10: 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>';
}
示例11: post_notify
/**
* Handles publishing or updating a post
*
* @param string $post_id the post id
* @return bool whether the request worked
*/
public static function post_notify($post_id)
{
global $wpdb;
$post = get_post($post_id);
$url = get_permalink($post_id);
$tags = wp_get_post_tags($post_id, array('fields' => 'names'));
$categories = array_map(array('ShareaholicNotifier', 'post_notify_iterator'), get_the_category($post_id));
if (function_exists('has_post_thumbnail') && has_post_thumbnail($post_id)) {
$featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'large');
} else {
$featured_image = ShareaholicUtilities::post_first_image();
if (!$featured_image) {
$featured_image = '';
}
}
if ($post->post_author) {
$author_data = get_userdata($post->post_author);
$author_name = $author_data->display_name;
}
$notification = array('url' => $url, 'api_key' => ShareaholicUtilities::get_option('api_key'), 'content' => array('title' => $post->post_title, 'excerpt' => $post->post_excerpt, 'body' => $post->post_content, 'featured-image-url' => $featured_image), 'metadata' => array('author-id' => $post->post_author, 'author-name' => $author_name, 'post-type' => $post->post_type, 'post-id' => $post_id, 'post-tags' => $tags, 'post-categories' => $categories, 'post-language' => get_bloginfo('language'), 'published' => $post->post_date_gmt, 'updated' => get_lastpostmodified('GMT'), 'visibility' => $post->post_status), 'diagnostics' => array('platform' => 'wordpress', 'platform-version' => get_bloginfo('version'), 'shareaholic-version' => Shareaholic::VERSION, 'wp-multisite' => is_multisite(), 'wp-theme' => get_option('template'), 'wp-posts-total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts} where post_type = 'post' AND post_status = 'publish'"), 'wp-pages-total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts} where post_type = 'page' AND post_status = 'publish'"), 'wp-comments-total' => wp_count_comments()->approved, 'wp-users-total' => $wpdb->get_var("SELECT count(ID) FROM {$wpdb->users}")));
return self::send_notification($notification);
}
示例12: tax_query
public function tax_query($data)
{
$allowed = array('post_type', 'tax_query');
foreach ($data as $key => $value) {
if (!in_array($key, $allowed)) {
unset($data[$key]);
}
}
if (!is_array($data) || empty($data) || !isset($data['tax_query'])) {
return new WP_Error('jp_api_tax_query', __('Invalid tax query.'), array('status' => 500));
}
$post_query = new WP_Query();
$posts_list = $post_query->query($data);
$response = new WP_JSON_Response();
$response->query_navigation_headers($post_query);
if (!$posts_list) {
$response->set_data(array());
return $response;
}
// holds all the posts data
$struct = array();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT');
foreach ($posts_list as $post) {
$post = get_object_vars($post);
// Do we have permission to read this post?
if (json_check_post_permission($post, 'read')) {
continue;
}
$response->link_header('item', json_url('/posts/' . $post['ID']), array('title' => $post['post_title']));
$post_data = $this->prepare_post($post, 'view');
if (is_wp_error($post_data)) {
continue;
}
$struct[] = $post_data;
}
$response->set_data($struct);
return $response;
}
示例13: google_sitemap
/**
* Google XML Sitemap
*
* @since 0.1.1
*
* @global type $wpdb
*
* @return type
*/
function google_sitemap()
{
if (!preg_match('/sitemap\\.xml$/', $_SERVER['REQUEST_URI'])) {
return;
}
global $wpdb;
$posts = $wpdb->get_results("SELECT ID, post_title, post_modified_gmt\r\n FROM {$wpdb->posts}\r\n WHERE post_status = 'publish'\r\n AND post_password = ''\r\n ORDER BY post_type DESC, post_modified DESC\r\n LIMIT 50000");
header("HTTP/1.1 200 OK");
header('X-Robots-Tag: noindex, follow', true);
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>' . "\n";
echo '<!-- generator="' . home_url('/') . '" -->' . "\n";
$xml = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 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">' . "\n";
$xml .= "\t<url>" . "\n";
$xml .= "\t\t<loc>" . home_url('/') . "</loc>\n";
$xml .= "\t\t<lastmod>" . mysql2date('Y-m-d\\TH:i:s+00:00', get_lastpostmodified('GMT'), false) . "</lastmod>\n";
$xml .= "\t\t<changefreq>" . 'daily' . "</changefreq>\n";
$xml .= "\t\t<priority>" . '1' . "</priority>\n";
$xml .= "\t</url>" . "\n";
foreach ($posts as $post) {
if ($post->ID == get_option('page_on_front')) {
continue;
}
if (!empty($post->post_title)) {
$xml .= "\t<url>\n";
$xml .= "\t\t<loc>" . get_permalink($post->ID) . "</loc>\n";
$xml .= "\t\t<lastmod>" . mysql2date('Y-m-d\\TH:i:s+00:00', $post->post_modified_gmt, false) . "</lastmod>\n";
$xml .= "\t\t<changefreq>" . 'weekly' . "</changefreq>\n";
$xml .= "\t\t<priority>" . '0.8' . "</priority>\n";
$xml .= "\t</url>\n";
}
}
$xml .= '</urlset>';
echo "{$xml}";
exit;
}
示例14: feed
function feed()
{
$title = sprintf('%s log', $this->name);
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . ">\r\n";
?>
<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/">
<channel>
<title><?php
echo $title . ' - ';
bloginfo_rss('name');
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
<description><?php
bloginfo_rss("description");
?>
</description>
<pubDate><?php
echo htmlspecialchars(mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false));
?>
</pubDate>
<generator><?php
echo htmlspecialchars('http://wordpress.org/?v=');
bloginfo_rss('version');
?>
</generator>
<language><?php
echo get_option('rss_language');
?>
</language>
<?php
if (count($this->items) > 0) {
foreach ($this->items as $log) {
?>
<item>
<title><![CDATA[<?php
echo $log->url;
?>
]]></title>
<link><![CDATA[<?php
bloginfo('home');
echo $log->url;
?>
]]></link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', $log->created_at, false);
?>
</pubDate>
<guid isPermaLink="false"><?php
print $log->id;
?>
</guid>
<description><![CDATA[<?php
echo $log->url;
?>
]]></description>
<content:encoded><![CDATA[<?php
if ($log->referrer) {
echo 'Referred by ' . $log->referrer;
}
?>
]]></content:encoded>
</item>
<?php
}
}
?>
</channel>
</rss>
<?php
die;
}
示例15: send_headers
function send_headers()
{
@header('X-Pingback: ' . get_bloginfo('pingback_url'));
if (is_user_logged_in()) {
nocache_headers();
}
if (!empty($this->query_vars['error']) && '404' == $this->query_vars['error']) {
status_header(404);
if (!is_user_logged_in()) {
nocache_headers();
}
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
} else {
if (empty($this->query_vars['feed'])) {
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
} else {
// We're showing a feed, so WP is indeed the only thing that last changed
if (!empty($this->query_vars['withcomments']) || 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) . '"';
@header("Last-Modified: {$wp_last_modified}");
@header("ETag: {$wp_etag}");
// Support for Conditional GET
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$client_etag = stripslashes(stripslashes($_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_header(304);
exit;
}
}
}
do_action_ref_array('send_headers', array(&$this));
}