[wp-hackers] Degrading gracefully with deactivated plugins?

Firas D. fd at firasd.org
Sun Mar 27 08:51:41 GMT 2005


Morgan Doocy wrote:

>
>
> call_plugin_function($function_name, $arg1, $arg2, ..., $argn);
>
> This would be a cinch to implement, and is appreciably cleaner than 
> if() wrappers -- but on the other hand it would require a lot of 
> education to get folks to use the go-between, and require a lot of 
> plugin authors to update their documentation in solidarity with the 
> "best practice."
>
> Seems to me that if we did add something like this, it would only 
> serve to benefit users, even if only a small percentage knew about it 
> or used it: If they don't use it, they see no change from the status 
> quo; if they do, they see a benefit in graceful degradation.

Yes! Especially if call_plugin_function is shortened to _cpf or something.

1) I'd loathe to put if_function_exists in my documentation because it 
makes things look really scary and complex:

Compare

<?php if(function_exists('wp_cc_output_metadata') { 
wp_cc_output_metadata() } ?>

<?php _cpf('wp_cc_output_metadata') ?>

2) It makes templates easy to 'clean' if there is a standard way of 
calling plugin functions: any function foreign to wp or php is is easy 
to spot.

3) Standardizing on a way to call plugin functions is probably a good 
idea for other reasons that don't occur to me right now.


More information about the wp-hackers mailing list