Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add the generator element in feeds through the {rss2|atom|rdf|rss|opm…

…l}_head hooks. Fixes #6947 props sivel.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit d8490aeea2dd20ac55e007f13372a728f0d92cf7 1 parent df2a293
westi authored
View
1  wp-app.php
@@ -1096,7 +1096,6 @@ function get_feed($page = 1, $post_type = 'post') {
<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) ?>" />
<rights type="text">Copyright <?php echo date('Y'); ?></rights>
-<?php the_generator( 'atom' ); ?>
<?php do_action('app_head'); ?>
<?php if ( have_posts() ) {
while ( have_posts() ) {
View
5 wp-includes/default-filters.php
@@ -185,6 +185,11 @@
add_action( 'wp_head', 'rel_canonical' );
add_action( 'wp_footer', 'wp_print_footer_scripts' );
+// Feed Generator Tags
+foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
+ add_action( $action, 'the_generator' );
+}
+
// WP Cron
if ( !defined( 'DOING_CRON' ) )
add_action( 'sanitize_comment_cookies', 'wp_cron' );
View
1  wp-includes/feed-atom-comments.php
@@ -25,7 +25,6 @@
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
- <?php the_generator( 'atom' ); ?>
<?php if ( is_singular() ) { ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link(); ?>" />
View
1  wp-includes/feed-atom.php
@@ -20,7 +20,6 @@
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
- <?php the_generator( 'atom' ); ?>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('url') ?>" />
<id><?php bloginfo('atom_url'); ?></id>
View
1  wp-includes/feed-rdf.php
@@ -23,7 +23,6 @@
<link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description>
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
- <?php the_generator( 'rdf' ); ?>
<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
View
1  wp-includes/feed-rss.php
@@ -9,7 +9,6 @@
$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
-<?php the_generator( 'comment' ); ?>
<rss version="0.92">
<channel>
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
View
1  wp-includes/feed-rss2-comments.php
@@ -29,7 +29,6 @@
<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
<description><?php bloginfo_rss("description") ?></description>
<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
- <?php the_generator( 'rss2' ); ?>
<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('commentsrss2_head'); ?>
View
1  wp-includes/feed-rss2.php
@@ -26,7 +26,6 @@
<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>
- <?php the_generator( 'rss2' ); ?>
<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>
View
30 wp-includes/general-template.php
@@ -2130,8 +2130,34 @@ function the_generator( $type ) {
* @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
* @return string The HTML content for the generator.
*/
-function get_the_generator( $type ) {
- switch ($type) {
+function get_the_generator( $type = '' ) {
+ if ( empty( $type ) ) {
+
+ $current_filter = current_filter();
+ if ( empty( $current_filter ) )
+ return;
+
+ switch ( $current_filter ) {
+ case 'rss2_head' :
+ case 'commentsrss2_head' :
+ $type = 'rss2';
+ break;
+ case 'rss_head' :
+ case 'opml_head' :
+ $type = 'comment';
+ break;
+ case 'rdf_header' :
+ $type = 'rdf';
+ break;
+ case 'atom_head' :
+ case 'comments_atom_head' :
+ case 'app_head' :
+ $type = 'atom';
+ break;
+ }
+ }
+
+ switch ( $type ) {
case 'html':
$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
break;
View
2  wp-links-opml.php
@@ -26,11 +26,11 @@
$link_cat = intval($link_cat);
}
?><?php echo '<?xml version="1.0"?'.">\n"; ?>
-<?php the_generator( 'comment' ); ?>
<opml version="1.0">
<head>
<title>Links for <?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?></title>
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
+ <?php do_action('opml_head'); ?>
</head>
<body>
<?php
Please sign in to comment.
Something went wrong with that request. Please try again.