Centralise generator generation, move theme generator generation to wp-head hook. Fixes #5085, #4803. props docwhat, Viper007Bond.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2007-10-06 06:55:24 +00:00
parent 410b858509
commit e9cfb43133
13 changed files with 56 additions and 16 deletions

View File

@ -181,7 +181,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
<!-- 6. WordPress will then import each of the posts, comments, and categories --> <!-- 6. WordPress will then import each of the posts, comments, and categories -->
<!-- contained in this file into your blog --> <!-- contained in this file into your blog -->
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"--> <?php the_generator('export');?>
<rss version="2.0" <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"

View File

@ -739,7 +739,7 @@ EOD;
<link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" /> <link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
<link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" /> <link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" />
<rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights> <rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights>
<generator uri="http://wordpress.com/" version="1.0.5-dc">WordPress.com Atom API</generator> <?php the_generator( 'atom' ); ?>
<?php if ( have_posts() ) { <?php if ( have_posts() ) {
while ( have_posts() ) { while ( have_posts() ) {
the_post(); the_post();

View File

@ -6,8 +6,6 @@
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title> <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import url( <?php bloginfo('stylesheet_url'); ?> ); @import url( <?php bloginfo('stylesheet_url'); ?> );
</style> </style>

View File

@ -6,8 +6,6 @@
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title> <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

View File

@ -141,6 +141,7 @@ add_action('wp_head', 'locale_stylesheet');
add_action('publish_future_post', 'wp_publish_post', 10, 1); add_action('publish_future_post', 'wp_publish_post', 10, 1);
add_action('wp_head', 'noindex', 1); add_action('wp_head', 'noindex', 1);
add_action('wp_head', 'wp_print_scripts'); add_action('wp_head', 'wp_print_scripts');
add_action('wp_head', 'wp_generator');
if(!defined('DOING_CRON')) if(!defined('DOING_CRON'))
add_action('init', 'wp_cron'); add_action('init', 'wp_cron');
add_action('do_feed_rdf', 'do_feed_rdf', 10, 1); add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);

View File

@ -18,7 +18,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator> <?php the_generator( 'atom' ); ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" /> <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" />
<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" /> <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />

View File

@ -15,7 +15,7 @@ $more = 1;
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> <?php the_generator( 'atom' ); ?>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
<id><?php bloginfo('atom_url'); ?></id> <id><?php bloginfo('atom_url'); ?></id>

View File

@ -4,7 +4,6 @@ $more = 1;
?> ?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php echo $wp_version ?>" -->
<rdf:RDF <rdf:RDF
xmlns="http://purl.org/rss/1.0/" xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -19,7 +18,7 @@ $more = 1;
<link><?php bloginfo_rss('url') ?></link> <link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description> <description><?php bloginfo_rss('description') ?></description>
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date> <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/> <?php the_generator( 'rdf' ); ?>
<sy:updatePeriod>hourly</sy:updatePeriod> <sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency> <sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>

View File

@ -4,7 +4,7 @@ $more = 1;
?> ?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php echo $wp_version ?>" --> <?php the_generator( 'comment' ); ?>
<rss version="0.92"> <rss version="0.92">
<channel> <channel>
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>

View File

@ -3,7 +3,6 @@ header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?> ?>
<!-- generator="wordpress/<?php echo $wp_version ?>" -->
<rss version="2.0" <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
@ -20,7 +19,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link> <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
<description><?php bloginfo_rss("description") ?></description> <description><?php bloginfo_rss("description") ?></description>
<pubDate><?php echo gmdate('r'); ?></pubDate> <pubDate><?php echo gmdate('r'); ?></pubDate>
<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator> <?php the_generator( 'rss2' ); ?>
<?php do_action('commentsrss2_head'); ?> <?php do_action('commentsrss2_head'); ?>
<?php <?php
if ( have_comments() ) : while ( have_comments() ) : the_comment(); if ( have_comments() ) : while ( have_comments() ) : the_comment();

View File

@ -5,7 +5,6 @@ $more = 1;
?> ?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
<rss version="2.0" <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"
@ -18,7 +17,7 @@ $more = 1;
<link><?php bloginfo_rss('url') ?></link> <link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss("description") ?></description> <description><?php bloginfo_rss("description") ?></description>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> <?php the_generator( 'rss2' ); ?>
<language><?php echo get_option('rss_language'); ?></language> <language><?php echo get_option('rss_language'); ?></language>
<?php do_action('rss2_head'); ?> <?php do_action('rss2_head'); ?>
<?php while( have_posts()) : the_post(); ?> <?php while( have_posts()) : the_post(); ?>

View File

@ -1075,4 +1075,50 @@ function wp_admin_css( $file = 'wp-admin' ) {
} }
} }
/**
* Outputs the XHTML generator that is generated on the wp_head hook.
*/
function wp_generator()
{
the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
}
/**
* Outputs the generator XML or Comment for RSS, ATOM, etc.
* @param {String} $type The type of generator to return.
*/
function the_generator ( $type ) {
echo apply_filters('the_generator',get_the_generator($type),$type) . "\n";
}
/**
* Creates the generator XML or Comment for RSS, ATOM, etc.
* @param {String} $type The type of generator to return.
*/
function get_the_generator ( $type ) {
switch ($type) {
case 'html':
$gen = '<meta name="generator" content="WordPress/' . get_bloginfo( 'version' ) . '">';
break;
case 'xhtml':
$gen = '<meta name="generator" content="WordPress/' . get_bloginfo( 'version' ) . '" />';
break;
case 'atom':
$gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
break;
case 'rss2':
$gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
break;
case 'rdf':
$gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
break;
case 'comment':
$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
break;
case 'export':
$gen = '<!-- generator="wordpress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '"-->';
break;
}
return apply_filters( "get_the_generator_{$type}", $gen, $type );
}
?> ?>

View File

@ -14,7 +14,7 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
$link_cat = intval($link_cat); $link_cat = intval($link_cat);
} }
?><?php echo '<?xml version="1.0"?'.">\n"; ?> ?><?php echo '<?xml version="1.0"?'.">\n"; ?>
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" --> <?php the_generator( 'comment' ); ?>
<opml version="1.0"> <opml version="1.0">
<head> <head>
<title>Links for <?php echo attribute_escape(get_bloginfo('name', 'display').$cat_name); ?></title> <title>Links for <?php echo attribute_escape(get_bloginfo('name', 'display').$cat_name); ?></title>