WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2007 06:55:24 AM (12 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r6192 r6195  
    10761076}
    10771077
     1078/**
     1079 * Outputs the XHTML generator that is generated on the wp_head hook.
     1080 */
     1081function wp_generator()
     1082{
     1083    the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
     1084}
     1085
     1086/**
     1087 * Outputs the generator XML or Comment for RSS, ATOM, etc.
     1088 * @param {String} $type The type of generator to return.
     1089 */
     1090function the_generator ( $type ) {
     1091    echo apply_filters('the_generator',get_the_generator($type),$type) . "\n";
     1092}
     1093
     1094/**
     1095 * Creates the generator XML or Comment for RSS, ATOM, etc.
     1096 * @param {String} $type The type of generator to return.
     1097 */
     1098function get_the_generator ( $type ) {
     1099    switch ($type) {
     1100        case 'html':
     1101            $gen = '<meta name="generator" content="WordPress/' . get_bloginfo( 'version' ) . '">';
     1102            break;
     1103        case 'xhtml':
     1104            $gen = '<meta name="generator" content="WordPress/' . get_bloginfo( 'version' ) . '" />';
     1105            break;
     1106        case 'atom':
     1107            $gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
     1108            break;
     1109        case 'rss2':
     1110            $gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
     1111            break;
     1112        case 'rdf':
     1113            $gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
     1114            break;
     1115        case 'comment':
     1116            $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
     1117            break;
     1118        case 'export':
     1119            $gen = '<!-- generator="wordpress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '"-->';
     1120            break;
     1121    }
     1122    return apply_filters( "get_the_generator_{$type}", $gen, $type );
     1123}
    10781124?>
Note: See TracChangeset for help on using the changeset viewer.