[wp-hackers] Overriding Cor Functions (Was: IIS Problem)

Robert Deaton false.hopes at gmail.com
Sun Apr 3 21:30:07 GMT 2005


How about splitting some of the bare necessities out of functions.php and 
into another file, so that we would have access to some of the functions 
that nobody should be changing anyways and that plugins would need 
(get_option, add_action, add_filter, etc.). This way, we don't lose some of 
the features that plugins can provide and still have the option to override 
most core functions. This could become a whole new major feature for 
whatever the next release is (dare I say 1.6, 1.7, or 1.8, who knows?). It 
could be called more of a "module" or "addon" instead of plugins, because it 
offers greater power over what happens everywhere.

On Apr 3, 2005 1:40 PM, Ryan Boren <ryan at boren.nu> wrote:
> 
> On Sun, 2005-04-03 at 03:32 -0500, Scott Reilly wrote:
> > Since you mentioned it, WP doesn't currently support plugins
> > overriding core functions even if those core functions are wrapped in
> > function_exists(), correct? I know the intent is for plugins to be
> > able to do that, but how? Plugins aren't sourced until after all core
> > files have been sourced, which is too late. Or am I missing
> > something?
> 
> Here's an approach I've been mulling over.
> 
> Add a preload_file action to be called from plugin files. This allows
> plugin files to specify a file to be loaded before the core WP
> includes. In the plugin:
> 
> function test_plugin_preload_file() {
> preload_file(dirname(__FILE__). '/test_preload.php');
> }
> 
> add_action('preload_file', 'test_plugin_preload_file');
> 
> preload_file() runs plugin_basename() on the supplied file and adds it
> to a 'preload' array in the options DB.
> 
> In plugins.php, we call the preload_file action whenever a plugin is
> activated. This is a bit tricky. First we'll have to unset all
> existing preload actions and then include the just activated plugin.
> Then we call the preload_file action. This is the only situation where
> the preload_file action is called.
> 
> In wp-settings.php, we loop through the list of preloaded files after
> wp-db.php is included but before functions.php is included. Since
> functions.php is not yet included, we have to be careful not to call
> get_option() to retrieve the preload array etc. Only wpdb may be used.
> 
> Thoughts?
> 
> Ryan
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 



-- 
--Robert Deaton
http://somethingunpredictable.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050403/334a3000/attachment-0001.html


More information about the wp-hackers mailing list