Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 ?

share|improve this question
    
Now I might be mistaken, but the majority of Wordpress plugins are not very object-structured. So UML diagrams could be difficult to find. -- Btw, you could consider flagging your question for moderator attention to have it moved to wordpress.stackexchange.com –  mario Mar 20 '11 at 10:01
    
OK you're right I'll flag to request the move. –  user310291 Mar 20 '11 at 11:26
    
You are not looking for architecture but for designs. Architect <> Designer. Architecture is on meta level e.g. togaf.info/togaf9/togafSlides9/TOGAF-V9-M7-Metamodel.pdf designing is e.g. uml / logical data models /operational models. –  edelwater Mar 20 '11 at 23:31
add comment

migrated from stackoverflow.com Mar 20 '11 at 13:15

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 6 down vote accepted

There is not much to it, really.

  1. During the loading of WordPress engine wp-settings.php file is processed.

  2. Among other things this files calls wp_get_active_and_valid_plugins() function, that gets list of activated (through admin interface) plugins from active_plugins option (stored in database).

  3. For each active plugin its main file (the one holding plugin header) is included 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.

share|improve this answer
    
OK thanks it's a good start for me to look for in the right place :) –  user310291 Mar 20 '11 at 14:37
    
    
@user310291 only be careful that third party xrefs can be of outdated WP versions. It's not cross-referenced but you can explore code in official subversion repository via trac core.trac.wordpress.org/browser/tags/3.1 –  Rarst Mar 20 '11 at 15:34
    
the official site doesn't seem as practical: how can I get all "Functions defined on the site" like on phpxref ? –  user310291 Oct 30 '11 at 15:53
    
@user310291 in which context and for which purpose? You can always generate your own xref. Or retrieve this via PHP code. Or use IDE with such functionality. Also see my Codex Generator plugin that gives you interface to explore active functions. –  Rarst Oct 30 '11 at 16:46
add comment

The WP plugin architecture is event based and is very simple:

Events are attached using add_action() and add_filter().

Events are triggered using do_action() and apply_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/

share|improve this answer
    
Once again I'm not looking for How to create a plugin, I'm looking for the architecture of the ENGINE. Like I'm not asking about how to assemble a PC, I'm asking about the architecture of the Processor. –  user310291 Mar 20 '11 at 13:38
    
OOP can be and mostly is Event Based since it's non-linear programming. But that is not the problem, architecture schema can be done OOP or not OOP. –  user310291 Mar 20 '11 at 13:40
    
Updated answer. –  scribu Mar 20 '11 at 14:47
    
Related answer: wordpress.stackexchange.com/questions/12576/… –  scribu Mar 21 '11 at 0:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.