[wp-hackers] Best Way
wp-hackers at striderweb.com
Thu Jun 25 03:36:16 GMT 2009
On Jun 24, 2009, at 10:24 PM, Mike Schinkel wrote:
> My plugin needs to use functions in /wp-admin/includes/bookmark.php
> which are not included by default. I have the following line at the
> top of the file but it feels like a hack:
> Is there a better way to do this vs. hardcoding?
That's pretty much what I do, but I first do a function_exists() on
the function I actually need from that file. If it doesn't exist
*then* I require_once(). (I'm told that require_once is "expensive"
> Also this plugin requires another plugin (I'm developing these
> plugins in part as real-world examples of the dependent plugin
> issues we were recently discussing on this list.) This is the code I
> have to include the other plugin's code to ensure they are loaded in
> the correct order, which also feels like a hack:
> if (!class_exists('WP_Options'))
> require_once(plugin_dir_path( __FILE__ ) . '../wp-options/wp-
> Any suggestions for either? Thanks in advance.
I don't claim it's the best system (yet... ;-) ) but you might take a
look at Strider Core: <http://code.google.com/p/strider-core/> --
perhaps it will give you some ideas.
More information about the wp-hackers