<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13113] trunk:
  Add the generator element in feeds through the {rss2|atom|rdf|rss|opml}_head hooks
 .</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13113">13113</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2010-02-13 16:45:16 +0000 (Sat, 13 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add the generator element in feeds through the {rss2|atom|rdf|rss|opml}_head hooks. Fixes <a href="http://trac.wordpress.org/ticket/6947">#6947</a> props sivel.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpappphp">trunk/wp-app.php</a></li>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesfeedatomcommentsphp">trunk/wp-includes/feed-atom-comments.php</a></li>
<li><a href="#trunkwpincludesfeedatomphp">trunk/wp-includes/feed-atom.php</a></li>
<li><a href="#trunkwpincludesfeedrdfphp">trunk/wp-includes/feed-rdf.php</a></li>
<li><a href="#trunkwpincludesfeedrssphp">trunk/wp-includes/feed-rss.php</a></li>
<li><a href="#trunkwpincludesfeedrss2commentsphp">trunk/wp-includes/feed-rss2-comments.php</a></li>
<li><a href="#trunkwpincludesfeedrss2php">trunk/wp-includes/feed-rss2.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
<li><a href="#trunkwplinksopmlphp">trunk/wp-links-opml.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpappphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-app.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-app.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-app.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -1096,7 +1096,6 @@
</span><span class="cx"> &lt;link rel=&quot;last&quot; type=&quot;&lt;?php echo $this-&gt;ATOM_CONTENT_TYPE ?&gt;&quot; href=&quot;&lt;?php $this-&gt;the_entries_url($last_page) ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;link rel=&quot;self&quot; type=&quot;&lt;?php echo $this-&gt;ATOM_CONTENT_TYPE ?&gt;&quot; href=&quot;&lt;?php $this-&gt;the_entries_url($self_page) ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;rights type=&quot;text&quot;&gt;Copyright &lt;?php echo date('Y'); ?&gt;&lt;/rights&gt;
</span><del>-&lt;?php the_generator( 'atom' ); ?&gt;
</del><span class="cx"> &lt;?php do_action('app_head'); ?&gt;
</span><span class="cx"> &lt;?php if ( have_posts() ) {
</span><span class="cx">                         while ( have_posts() ) {
</span></span></pre></div>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/default-filters.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -185,6 +185,11 @@
</span><span class="cx"> add_action( 'wp_head',             'rel_canonical'                        );
</span><span class="cx"> add_action( 'wp_footer',           'wp_print_footer_scripts'              );
</span><span class="cx"> 
</span><ins>+// 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' );
+}
+
</ins><span class="cx"> // WP Cron
</span><span class="cx"> if ( !defined( 'DOING_CRON' ) )
</span><span class="cx">         add_action( 'sanitize_comment_cookies', 'wp_cron' );
</span></span></pre></div>
<a id="trunkwpincludesfeedatomcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-atom-comments.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-atom-comments.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-atom-comments.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx">         &lt;subtitle type=&quot;text&quot;&gt;&lt;?php bloginfo_rss('description'); ?&gt;&lt;/subtitle&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;updated&gt;&lt;?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?&gt;&lt;/updated&gt;
</span><del>-        &lt;?php the_generator( 'atom' ); ?&gt;
</del><span class="cx"> 
</span><span class="cx"> &lt;?php if ( is_singular() ) { ?&gt;
</span><span class="cx">         &lt;link rel=&quot;alternate&quot; type=&quot;&lt;?php bloginfo_rss('html_type'); ?&gt;&quot; href=&quot;&lt;?php echo get_comments_link(); ?&gt;&quot; /&gt;
</span></span></pre></div>
<a id="trunkwpincludesfeedatomphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-atom.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-atom.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-atom.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -20,7 +20,6 @@
</span><span class="cx">         &lt;subtitle type=&quot;text&quot;&gt;&lt;?php bloginfo_rss(&quot;description&quot;) ?&gt;&lt;/subtitle&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;updated&gt;&lt;?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?&gt;&lt;/updated&gt;
</span><del>-        &lt;?php the_generator( 'atom' ); ?&gt;
</del><span class="cx"> 
</span><span class="cx">         &lt;link rel=&quot;alternate&quot; type=&quot;text/html&quot; href=&quot;&lt;?php bloginfo_rss('url') ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;id&gt;&lt;?php bloginfo('atom_url'); ?&gt;&lt;/id&gt;
</span></span></pre></div>
<a id="trunkwpincludesfeedrdfphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-rdf.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-rdf.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-rdf.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -23,7 +23,6 @@
</span><span class="cx">         &lt;link&gt;&lt;?php bloginfo_rss('url') ?&gt;&lt;/link&gt;
</span><span class="cx">         &lt;description&gt;&lt;?php bloginfo_rss('description') ?&gt;&lt;/description&gt;
</span><span class="cx">         &lt;dc:date&gt;&lt;?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?&gt;&lt;/dc:date&gt;
</span><del>-        &lt;?php the_generator( 'rdf' ); ?&gt;
</del><span class="cx">         &lt;sy:updatePeriod&gt;&lt;?php echo apply_filters( 'rss_update_period', 'hourly' ); ?&gt;&lt;/sy:updatePeriod&gt;
</span><span class="cx">         &lt;sy:updateFrequency&gt;&lt;?php echo apply_filters( 'rss_update_frequency', '1' ); ?&gt;&lt;/sy:updateFrequency&gt;
</span><span class="cx">         &lt;sy:updateBase&gt;2000-01-01T12:00+00:00&lt;/sy:updateBase&gt;
</span></span></pre></div>
<a id="trunkwpincludesfeedrssphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-rss.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-rss.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-rss.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> $more = 1;
</span><span class="cx"> 
</span><span class="cx"> echo '&lt;?xml version=&quot;1.0&quot; encoding=&quot;'.get_option('blog_charset').'&quot;?'.'&gt;'; ?&gt;
</span><del>-&lt;?php the_generator( 'comment' ); ?&gt;
</del><span class="cx"> &lt;rss version=&quot;0.92&quot;&gt;
</span><span class="cx"> &lt;channel&gt;
</span><span class="cx">         &lt;title&gt;&lt;?php bloginfo_rss('name'); wp_title_rss(); ?&gt;&lt;/title&gt;
</span></span></pre></div>
<a id="trunkwpincludesfeedrss2commentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-rss2-comments.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-rss2-comments.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-rss2-comments.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx">         &lt;link&gt;&lt;?php (is_single()) ? the_permalink_rss() : bloginfo_rss(&quot;url&quot;) ?&gt;&lt;/link&gt;
</span><span class="cx">         &lt;description&gt;&lt;?php bloginfo_rss(&quot;description&quot;) ?&gt;&lt;/description&gt;
</span><span class="cx">         &lt;lastBuildDate&gt;&lt;?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?&gt;&lt;/lastBuildDate&gt;
</span><del>-        &lt;?php the_generator( 'rss2' ); ?&gt;
</del><span class="cx">         &lt;sy:updatePeriod&gt;&lt;?php echo apply_filters( 'rss_update_period', 'hourly' ); ?&gt;&lt;/sy:updatePeriod&gt;
</span><span class="cx">         &lt;sy:updateFrequency&gt;&lt;?php echo apply_filters( 'rss_update_frequency', '1' ); ?&gt;&lt;/sy:updateFrequency&gt;
</span><span class="cx">         &lt;?php do_action('commentsrss2_head'); ?&gt;
</span></span></pre></div>
<a id="trunkwpincludesfeedrss2php"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/feed-rss2.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/feed-rss2.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/feed-rss2.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx">         &lt;link&gt;&lt;?php bloginfo_rss('url') ?&gt;&lt;/link&gt;
</span><span class="cx">         &lt;description&gt;&lt;?php bloginfo_rss(&quot;description&quot;) ?&gt;&lt;/description&gt;
</span><span class="cx">         &lt;lastBuildDate&gt;&lt;?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?&gt;&lt;/lastBuildDate&gt;
</span><del>-        &lt;?php the_generator( 'rss2' ); ?&gt;
</del><span class="cx">         &lt;language&gt;&lt;?php echo get_option('rss_language'); ?&gt;&lt;/language&gt;
</span><span class="cx">         &lt;sy:updatePeriod&gt;&lt;?php echo apply_filters( 'rss_update_period', 'hourly' ); ?&gt;&lt;/sy:updatePeriod&gt;
</span><span class="cx">         &lt;sy:updateFrequency&gt;&lt;?php echo apply_filters( 'rss_update_frequency', '1' ); ?&gt;&lt;/sy:updateFrequency&gt;
</span></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-includes/general-template.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -2130,8 +2130,34 @@
</span><span class="cx">  * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
</span><span class="cx">  * @return string The HTML content for the generator.
</span><span class="cx">  */
</span><del>-function get_the_generator( $type ) {
-        switch ($type) {
</del><ins>+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 ) {
</ins><span class="cx">                 case 'html':
</span><span class="cx">                         $gen = '&lt;meta name=&quot;generator&quot; content=&quot;WordPress ' . get_bloginfo( 'version' ) . '&quot;&gt;';
</span><span class="cx">                         break;
</span></span></pre></div>
<a id="trunkwplinksopmlphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-links-opml.php (13112 => 13113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-links-opml.php        2010-02-13 13:35:03 UTC (rev 13112)
+++ trunk/wp-links-opml.php        2010-02-13 16:45:16 UTC (rev 13113)
</span><span class="lines">@@ -26,11 +26,11 @@
</span><span class="cx">         $link_cat = intval($link_cat);
</span><span class="cx"> }
</span><span class="cx"> ?&gt;&lt;?php echo '&lt;?xml version=&quot;1.0&quot;?'.&quot;&gt;\n&quot;; ?&gt;
</span><del>-&lt;?php the_generator( 'comment' ); ?&gt;
</del><span class="cx"> &lt;opml version=&quot;1.0&quot;&gt;
</span><span class="cx">         &lt;head&gt;
</span><span class="cx">                 &lt;title&gt;Links for &lt;?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?&gt;&lt;/title&gt;
</span><span class="cx">                 &lt;dateCreated&gt;&lt;?php echo gmdate(&quot;D, d M Y H:i:s&quot;); ?&gt; GMT&lt;/dateCreated&gt;
</span><ins>+                &lt;?php do_action('opml_head'); ?&gt;
</ins><span class="cx">         &lt;/head&gt;
</span><span class="cx">         &lt;body&gt;
</span><span class="cx"> &lt;?php
</span></span></pre>
</div>
</div>

</body>
</html>