MASTER AUTOINDEX PLUGINS DOCUMENTATION
Home » Default Functions

In order for master autoindex to read the plugin he needs some guidelines. The basic info of the plugin is given by the default functions and the actual work is made by the hooks.
Now remember that in the last name we have set the name of the plugin to demo and we named the file demo_plugin.php. We will be also using that name in the default functions name.

Default function list: <name>_info(), <name>_install(), <name>_uninstall(), <name>_is_installed(), <name>_activate(), <name>_deactivate()

all this functions are optional a plugin can work just fine without any of this functions. BUT I RECOMMEND YOU USE THEM (if needed of course).

In our particular case because the name is demo our default functions would be demo_info(), demo_install(), demo_uninstall(), demo_is_installed(), demo_activate(), demo_deactivate()

Now lets see what they do:
demo_info() - is the function that returns some basic info about the plugin. It must return an array that looks like this
<?php
function demo_info(){
    
/**
    * Array containing info about your plugin
    * name - plugin name witch will be displayed in Manager
    * author - author name(s)
    * author_site - author site if you don't have keep it blank
    * description - a very small description about this plugin
    */
    
return    array(    
    
"name" => "Demo Plugin",
    
"author" => "ionutvmi",
    
"author_site" => "http://master-land.net",
    
"description" => "this is a demo plugin, it will show some text on some pages",
    );
}

?>
Now if you paste that in our file, save it and go to Admincp->Plugin Manages we should find something like this.

You can also activate the plugin but it won't do anything for now since we only set him to provide basic info.

demo_install() - this will be called when the Install link is clicked in the Plugin Manager. You can add it like this
<?php
function demo_install(){
    
// things that you want to be done when installing the plugin
    // edit/create files
    // adding settings etc..
}

?>

demo_uninstall() - this will be called when the UnInstall link is clicked in the Plugin Manager. You can add it like this
<?php
function demo_uninstall(){
    
// things that you want to be done when uninstalling the plugin
    // edit/delete files
    // removing settings etc..
}

?>

demo_is_installed() - this will be called in the Plugin Manager to check if the plugin is installed. If the function is missing from the file it will consider the return of it true. You can add it like this
<?php
function demo_is_installed(){
    
// check if the plugin is installed
    // if this is missing it will be considered true
}

?>

demo_activate() - this will be called in the Plugin Manager when the plugin is activated. You can add it like this
<?php
function demo_activate(){
    
// do something when the plugin is activated
    
}

?>

demo_deactivate() - this will be called in the Plugin Manager when the plugin is deactivated. You can add it like this
<?php
function demo_deactivate(){
    
// do something when the plugin is deactivated
    
}

?>


(!) There must NOT be any kind of output in the actual plugin file since it is included before any output on the page it may cause the header already set error. So try to avoid it.
« Back to Getting Started | Next to Hooks »
Mihai Ionut Vilcu ([email protected]) Feb - 2013