Plugin System

Here is the file layout of the plugin system:

mm/
    plugins/
        pluginX/
            Plugin.php
        pluginY/
        pluginX/

The "plugins/" folder is web server-writable so that in the future, a user interface will allow the user to install new plugins in one step.

The "plugins/" folder is included in the PHP include_path.

If a "init.php" file is found in a plugin folder, it is automatically included upon each request, unless the plugin is not active.

Controller Hooks

Now, you can add your own controller to Modern Merchant's URL space:
util_Hooks::registerController('paypalwpp', 'paypalwpp_ExpressCartController');

The above code registers the "paypalwpp_ExpressCartController" PHP class to the 'paypalwpp' URL space. Requests containing "action=paypalwpp.[actionname]" will dispatch that that class.

Menu Hooks

Now, adding menus and menu items to the administrator menu is really easy:
util_Hooks::addMenuItem('admin/product/list', array('label' => 'Manage Products', action => 'product.list'));