Unify User-Agent strings

Description

In WordPress 2.3, there are either 10 or 11 places where User-Agent strings are created.

I would like to suggest adding a function, wp_user_agent() which would generate the base User-Agent including things like PHP version and bloginfo('url'). It could optionally take an array (in hash form) to append extra values, like Akismet version, etc.

Change History (22)

I have attached patch. I tried to follow the coding style as best as I could.

I changed the way the bloginfo('url') is appended to the user agent because id didn't follow RFC 2068. I put it in a comment (parenthesis) instead. I don't think that's an issue because according to photomatt, it isn't being used yet.

Also, my patch deliberately didn't change the Incutio and Snoopy UA strings, since they didn't seem to reflect anything. I don't actually understand when they are called, so I'm not sure what difference it makes.

I'm thinking a better method might be to wrap all outgoing http requests into a WP function. Currently theres a fair few fsockopen() scattered around the place, and theres Snoopy too, What would be better is a function such as:

Just makes more sense than changing the user agents in all these different locations to me, Why change the code in so many places when it could all just be consolidated in one swoop?, It would also help in adding Global Proxy support in.

(Probably new ticket material, infact, i swear there is one, i just cant find it).