[wp-hackers] Facebook API and WordPress Plugin Development - Insight / Best Practice

John Blackbourn johnbillion+wp at gmail.com
Thu Nov 15 03:42:13 UTC 2012


On 15 November 2012 01:19, Mike Schinkel <mike at newclarity.net> wrote:
> I think this can easily be addressed for the 20% use-case, and here is how:
>
> Add a "register_library()" function to WordPress that accepts the following parameters, to be called by a plugin or theme within an 'init' hook:
>
>         Library Name
>         Version of this library
>         Filepath of the file to require()
>         Rules: Load Latest or Load this Version.
>
> Then call a 'load_libraries()' function after the 'after_setup_theme' hook to load the latest version of each library. If there is a conflict don't load the library and display an error message inside the admin for the administrator to see and take appropriate action about while plugins are in conflict.

Surely all this can be avoided by simply using namespaces in PHP. If I
bundle API X in my plugin and namespace it, then another plugin can
include the same or a different version of API X and there will be no
conflict.

Am I missing something?

John


More information about the wp-hackers mailing list