There are plenty of articles which explain how to create a wordpress plugin. I’m not looking for that, I’m looking for a schema of the core architecture of a wordpress plugin (an UML class diagram and sequence for example).
Has somebody seen anything like that somewhere ?
Update: I know plugin can be as simple as a function. It’s not my question. My question is about the architecture of the CALLER that calls the plugin, that is the architecture of the SYSTEM pertaining to the call of the plugin.
At least in which PHP module(s) is it implemented by the WordPress Core System files ?
There is not much to it, really.
During the loading of WordPress engine
wp-settings.php
file is processed.Among other things this files calls
wp_get_active_and_valid_plugins()
function, that gets list of activated (through admin interface) plugins fromactive_plugins
option (stored in database).include
d and from there it is up to plugin how it uses Plugins API (more commonly known as hooks) to integrate with WordPress.Basically it is only a thin layer of active/inactive controls on top of straight PHP
include
.The WP plugin architecture is event based and is very simple:
Events are attached using
add_action()
andadd_filter()
.Events are triggered using
do_action()
andapply_filters()
.All these functions are found in
wp-includes/plugin.php
More information can be found here: http://codex.wordpress.org/Plugin_API
For a “flow diagram” of sorts, see this site: http://wp-roadmap.com/demo/