[wp-hackers] pluggable functions
lists at lobaugh.net
Mon Oct 29 00:24:25 UTC 2012
I am with Mike here. I do not understand your reasoning. The main issue
behind pluggable functions is that they can only be redefined once. You
say you could have a free/pro version, that is in itself not even a good
example. You could have a plugin order load conflict. If free loads
before pro then that function will take precedence over the pro version.
Or back to the wp_mail() example, I have a couple plugins I use for
clients that overload wp_mail(), however I cannot have all of those
plugins running at the same time. Only one wp_mail() can run at a time,
so the other plugins miss out and only the plugin that loaded first gets
to control wp_mail().
That is the reasoning behind using hooks instead of pluggable functions.
They just do not make sense in a plugin based architecture.
As far as the themes you are seeing making things "pluggable" this is
not truly the case I think. If you look closer what you will probably
notice is that all the themes by that author use the same function
names. They are more likely trying to prevent fatal errors from blowing
up the site if somehow the code from another theme gets fired off.
On 10/27/12 3:13 PM, Mike Schinkel wrote:
> Hi Peter,
> Thanks for answering.
> On Oct 27, 2012, at 5:48 PM, peter baylies <pbaylies at semperfiwebdesign.com> wrote:
>> Say you have a free and a pro version of the same plugin, and they share a
>> lot of code; and then someone upgrades to the pro version from the free
>> version, without first deactivating the free version.
> So are you just defining a "pluggable" here as a different named file of functions and/or classes that you can swap out for your require()?
>> say someone else forks your plugin without changing all the function names
>> / prefixes, and someone tries to install both your plugin and the forked
> Still not seeing this unless you are saying the pluggable loads one or the other but not both. I guess I need code example to fully understand.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers