Tracking deprecated functions

This evening I have added some changes for the upcoming WordPress v2.4 release which will help theme, plugin and site developers track down when they are using deprecated WordPress functions. This new functionality relies, in part, on the new WP_DEBUG flag being enabled before anything interesting happens. With the new flag enabled a USER_NOTICE php error will be raised for each call to a deprecated function and if a deprecated file is included by a plugin. The error messages include the replacement function name and the version in which the function was deprecated.

The changes also introduce a pair of new hooks, deprecated_function_run and deprecated_file_included, which could be used by a plugin to create a log of all the functions used and provide the developer with information of what files need updating to use the replacement functions. These new hooks will fire whenever a deprecated function/file is used even if WP_DEBUG is disabled to allow for a simple plugin to log the errors without triggering the actual error on a live site.

Props to docwhat and darkdragon/santosj for their work on this change.