From e9cfb43133610ee771d5599401b704952413c095 Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 6 Oct 2007 06:55:24 +0000 Subject: [PATCH] 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 --- wp-admin/export.php | 2 +- wp-app.php | 2 +- wp-content/themes/classic/header.php | 2 -- wp-content/themes/default/header.php | 2 -- wp-includes/default-filters.php | 1 + wp-includes/feed-atom-comments.php | 2 +- wp-includes/feed-atom.php | 2 +- wp-includes/feed-rdf.php | 3 +- wp-includes/feed-rss.php | 2 +- wp-includes/feed-rss2-comments.php | 3 +- wp-includes/feed-rss2.php | 3 +- wp-includes/general-template.php | 46 ++++++++++++++++++++++++++++ wp-links-opml.php | 2 +- 13 files changed, 56 insertions(+), 16 deletions(-) diff --git a/wp-admin/export.php b/wp-admin/export.php index eab8044d4b..45f1774ce8 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -181,7 +181,7 @@ echo '\n"; - + Copyright -WordPress.com Atom API + - - diff --git a/wp-content/themes/default/header.php b/wp-content/themes/default/header.php index 99d3962067..ec70a6af42 100644 --- a/wp-content/themes/default/header.php +++ b/wp-content/themes/default/header.php @@ -6,8 +6,6 @@ <?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?> - - diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 3fc94e8777..15fab157cf 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -141,6 +141,7 @@ add_action('wp_head', 'locale_stylesheet'); add_action('publish_future_post', 'wp_publish_post', 10, 1); add_action('wp_head', 'noindex', 1); add_action('wp_head', 'wp_print_scripts'); +add_action('wp_head', 'wp_generator'); if(!defined('DOING_CRON')) add_action('init', 'wp_cron'); add_action('do_feed_rdf', 'do_feed_rdf', 10, 1); diff --git a/wp-includes/feed-atom-comments.php b/wp-includes/feed-atom-comments.php index ee9a73b401..72897bbc6b 100644 --- a/wp-includes/feed-atom-comments.php +++ b/wp-includes/feed-atom-comments.php @@ -18,7 +18,7 @@ echo '' - WordPress + diff --git a/wp-includes/feed-atom.php b/wp-includes/feed-atom.php index f80f48f9d8..0bb3c5e181 100644 --- a/wp-includes/feed-atom.php +++ b/wp-includes/feed-atom.php @@ -15,7 +15,7 @@ $more = 1; - WordPress + diff --git a/wp-includes/feed-rdf.php b/wp-includes/feed-rdf.php index 1f92b23930..dd0b785571 100644 --- a/wp-includes/feed-rdf.php +++ b/wp-includes/feed-rdf.php @@ -4,7 +4,6 @@ $more = 1; ?> '; ?> - - + hourly 1 2000-01-01T12:00+00:00 diff --git a/wp-includes/feed-rss.php b/wp-includes/feed-rss.php index 469e4bc8c9..900dcec8c5 100644 --- a/wp-includes/feed-rss.php +++ b/wp-includes/feed-rss.php @@ -4,7 +4,7 @@ $more = 1; ?> '; ?> - + <?php bloginfo_rss('name'); wp_title_rss(); ?> diff --git a/wp-includes/feed-rss2-comments.php b/wp-includes/feed-rss2-comments.php index 7bd5ae2954..f077a16d85 100644 --- a/wp-includes/feed-rss2-comments.php +++ b/wp-includes/feed-rss2-comments.php @@ -3,7 +3,6 @@ header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true); echo ''; ?> - '; - http://wordpress.org/?v= + '; ?> - - http://wordpress.org/?v= + diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 2d13616e78..6ae8796543 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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 = ''; + break; + case 'xhtml': + $gen = ''; + break; + case 'atom': + $gen = 'WordPress'; + break; + case 'rss2': + $gen = 'http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . ''; + break; + case 'rdf': + $gen = ''; + break; + case 'comment': + $gen = ''; + break; + case 'export': + $gen = ''; + break; + } + return apply_filters( "get_the_generator_{$type}", $gen, $type ); +} ?> diff --git a/wp-links-opml.php b/wp-links-opml.php index 2ee7751684..3adaba9743 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -14,7 +14,7 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { $link_cat = intval($link_cat); } ?>\n"; ?> - + Links for <?php echo attribute_escape(get_bloginfo('name', 'display').$cat_name); ?>