[wp-trac] Re: [WordPress Trac] #5085: Unify generator strings
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 26 22:02:14 GMT 2007
#5085: Unify generator strings
---------------------+------------------------------------------------------
Reporter: docwhat | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version:
Severity: normal | Resolution:
Keywords: |
---------------------+------------------------------------------------------
Comment (by Otto42):
Most of the feeds and such have their own syntax for expressing the
generator. So there's no one universal way.
I'd suggest something like this:
{{{
function get_generator($type='comment')
{
switch ($type) {
case 'meta':
$gen = '<meta name="generator" content="WordPress/'.
bloginfo('version') .'" />';
break;
case 'atom':
$gen = '<generator uri="http://wordpress.org/"
version="'.bloginfo_rss('version').'">WordPress</generator>';
break;
case 'rss2':
$gen =
'<generator>http://wordpress.org/?v='.bloginfo_rss('version').'</generator>';
break;
case 'rdf':
$gen = '<admin:generatorAgent
rdf:resource="http://wordpress.org/?v='.bloginfo_rss('version').'" />';
break;
default: // case 'comment':
$gen = '<!-- generator="WordPress/'.bloginfo('version').'"
-->";
break;
}
return apply_filters('get_generator',$gen);
}
}}}
Then call the appropriate one with <?php echo get_generator('whatever');
?> at the right point in the code.
--
Ticket URL: <http://trac.wordpress.org/ticket/5085#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list