[wp-hackers] function_exists - user woes

Stephen O'Connor steve at stevarino.com
Fri Jul 30 07:46:25 UTC 2004


What about a new template-tag function for plugins? To call 
xyz_photos(), the user would add this line to their template:

<?php wp_tag('xyz_photos'); ?>

The wp_tag would take care of function-exists checks as well as anything 
else that comes up. If an error occurs such as the function being 
non-existent, it could create a log entry to be viewed in a wp-admin log.

Also if the function needs to be given parameters, you could use the 
URI-style as a second parameter.

<?php wp_tag('xyz_photos', 'foo=bar&x=3'); ?>

Just a little thought I had.

- Stephen

Carthik Sharma wrote:

>Note for Plugin Authors :
>from http://sweth.com/index.php?p=65  :
>
>Earlier today, for example, the entire site was crippled apparently
>because I deactivated a plugin and didn't remove some corresponding
>code from one of the pages; if you have to hack things in order to
>make the plugin work (which it seems like almost every plugin I've
>tried requires), then it ain't a plugin, it's a hack. (Especially
>since I just, Googling quickly and having never written a line of
>original PHP code, found the function_exists php function, which would
>seem to make it trivial for plugin authors to at least make their page
>hacks modular enough that turning off the corresponding plugin doesn't
>break anything, if only those authors would spend ten minutes making
>their hacks self-aware. (Laziness is a virtue in programmers, but not
>Foolish Laziness.))
>
>Important points : 
>"if you have to hack things in order to make the plugin work (which it
>seems like almost every plugin I've tried requires), then it ain't a
>plugin, it's a hack."
>"function_exists"
>
>:)
>Carthik.
>  
>




More information about the hackers mailing list