[wp-hackers] Less than Core, More than Plugins/Themes: Proposing Optional Modules.

Ryan McCue ryanmccue at cubegames.net
Tue Feb 3 07:53:38 GMT 2009

Here's my $2e-2 on the issue:

I think we should have a set of standard API *classes* (important, I'll
explain later) included with WordPress but not actually used until they
are called. Including them with WordPress is imperative to their use: if
they are not included with WordPress by default, they won't be used,
even if they are promoted, as authors would have to write fallbacks for
their code anyway.

Now, the use of classes. Using PHP's built in autoloader, these modules
could sit, unused, until they are actually needed, when they would be
dynamically loaded. Additionally, one would be able to hook into these
and create their own modules, which would overrride the built in ones
(if they so desire, somewhat pointless though, in my humble opinion).
Ideally, the real classes would be named something like _ExampleAPI,
with an ExampleAPI alias, so that one could override the ExampleAPI
class, but still get all the real functionality by "extend"ing _ExampleAPI.

There is, however, a catch: __autoload() is only available in PHP5+.
And, I don't believe there is any way at all to replicate the
functionality (being that the code that calls it is built into the
Zend/PHP engine). This is most likely not a problem though, because I
doubt the APIs would be ubiquitously used, even by about 3.2. Until
then, we could have it as a progressive enhancement for developers who
develop for PHP5+.

So, for those of you who skipped to the end (I'm talking to you, tl;dr
fans): standard API classes; must be included with the core; should be
autoloaded; needs PHP5+; maybe progressive enhancement.

Ryan McCue

More information about the wp-hackers mailing list