[wp-hackers] Degrading gracefully with deactivated plugins?

David House dmhouse at gmail.com
Sun Mar 27 15:33:04 GMT 2005


If you wanted to do a bit more work, you could scan plugin files for
functions defined, then for each of them create a new function called
<funcname>_safe or (e.g., if a plugin defined 'foo_func', then this
new function would be foo_func_safe()), which would do the
function_exists() logic.

This would just involve looping over the code, quitting when the
regular expression no longer matches and defining a new function that
takes exactly the same arguments as the standard function using
variable variables. (I wrote something of the kind for the echo/return
thread [1]).

Of course, this procedure would have to be well documented so both
plugin authors and users know what's going on.

This has the advantage of bearing more resemblance to the actual
function than a _cpf() call; compare

<?php _cpf('wp_cc_output_metadata'); ?>

with

<?php wp_cc_output_metadata_safe(); ?>

[1]: http://textdrive.com/pipermail/hackers/2004-July/000872.html


More information about the wp-hackers mailing list