Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are multiple issues to consider. As you noted a plugin system depends on registering extensions with the application, and the extension itselfs need a way to hook into the main application.</p> <p>For all its faults, Wordpress has a quite workable approach to this. It <a href="https://stackoverflow.com/questions/5127424/how-does-plugin-system-work-wordpress-mybb/5127470#5127470">uses "hooks"</a> for interfacing to plugins. That's basically a callback-system which more or less can amount to "event-driven" too. Fundamentally the main application does something like:</p> <pre><code>foreach ($callback["need_to_render_sidebar"] as $fn) { $fn(); } </code></pre> <p>But you can make it more flexible with passing extra parameters, returning data, and more importantly: using objects rather than procedural callbacks for more complex features. (I'd avise to mix and match. There's not one approach that suits <em>all</em> applications or extensions.)</p> <p>Likewise a plugin system often enables the extensions itself to call back the main application, feed data into it, or modify settings.</p> <p>The second part you need to consider for a plugin system is how you make it manageable. There basically each WebCMS/DMS has its own approach. Many use zip files to be manually extracted, or module directories. For starters a WP-like approach of meta-data augmented script files is the most suitable. I made a similar system which can be used independently of WP, though it's pretty rough: <a href="http://milki.include-once.org/genericplugins/" rel="nofollow noreferrer">http://milki.include-once.org/genericplugins/</a> (the nice part is actually the manageability of settings.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload