Hi folks!!

i've added the main code for adding plugin in aiki. There a lot of work to
do, but it works.

Now, everbody can write plugin.
To install a plugin is necesary:
- copy plugin file(s) in aiki_root/plugins directory.
- make available the plugin (tells aiki that there is a plugin available for
site/view/languages)
- activate the plugin for a site/view/language.

You can:
- activate a plugin like google analytic in frontend (is a site) but not in
backend.
- activate a plugin like google analytic with a different configuration in
each site (different key)
- etc.

For testing purpose i attached two files: a first plugin (ga.php), and a
rude setup_plugin.php that search, install all activate all plugins.

Writing plugins is so easy as:
<?php
/*
 * This is a aiki plugin:
 * Name: google analitycs
 * Version: 0.001
 * Description: First plugin for aiki
 * Author: Roger Martin
 */

class ga extends plugin {

    function set_actions(){
        return array ("output_html", "output_body"=>10) ;
    }

    function action( $action, &$text){
        switch ($action){
            case "output_html":
                $text .= $this->"a plugin in action....";
        }
        return true;
    }

}
?>

the first /* */ block is required: contains meta info of  plugin, and the
markup "This is a aiki plugin:" that use aiki to check if a file is a
plugin.

TODO
- we must define and add the action point, when aiki activate plugins. It's
easy. For example, output.php contains a action point:
public function footer()
    {   global $aiki;
        $footer = "\n</body>\n</html>";
        $aiki->plugins->do_action("output_html", &$footer); //--> you must
put this in code
        return $footer;
    }
- admin
The library has three method for installing and activating plugin, but there
is no included in admin.

- some features :
* plugins need create tables and upgraded it. This feature can be used in
web installer too, and upgrade system.
* plugins need edit his variables configuration.

- doc in aiki (i'm working on if).

<<attachment: ga.php>>

<<attachment: set_plugin.php>>

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to