Plugin install manifest
(→Custom icon image) |
(→Options button) |
||
Line 22: | Line 22: | ||
===Options button=== | ===Options button=== | ||
− | If you're plugin includes its own configuration/management module, you can display an "Options" button in Plugin Manager that links to it. | + | If you're plugin includes its own configuration/management module, you can display an "Options" button in Plugin Manager that links to it. Path is relative to your plugin folder. |
+ | |||
$plugin_options_link = "management_module.php"; | $plugin_options_link = "management_module.php"; | ||
+ | |||
+ | '''Alternative Use Example''' &mdash You can also use this option to link to a standard feature module (as in, the ones that come built-in to Soholaunch Pro). For example, if you're plugin adds a payment gateway to the shopping cart, you could link this options button to Payment Options like so... | ||
+ | $plugin_options_link = "../../program/modules/mods_full/shopping_cart/payment_options.php"; | ||
===Custom icon image=== | ===Custom icon image=== |
Revision as of 16:53, 29 November 2006
Each plugin must include in it's folder a file named install_manifest.php. Pro Edition reads this file to know what to do when it attempts to install your plugin. All plugins must have a valid install_manifest.php in their folder.
Contents |
Overview of file contents
There are two types of content in any given install_manifest.php:
- Information - Plugin title, author, etc
- Instructions - Overwrite this file with my modified version, replace these lines of source code with my custom code, include my custom file at this point in this source file, etc.
Include basic info about your plugin
# PLUGIN INFO $plugin_folder = "HELLO_WORLD"; $plugin_title = "Hello World"; $plugin_version = "1.0"; $plugin_author = "John Smith"; $plugin_homepage = "http://example.com"; # Description text $plugin_description = "Adds '- Hello World!' next to the 'Basic Features Group' on the main menu.";
Optional instructions
Options button
If you're plugin includes its own configuration/management module, you can display an "Options" button in Plugin Manager that links to it. Path is relative to your plugin folder.
$plugin_options_link = "management_module.php";
Alternative Use Example &mdash You can also use this option to link to a standard feature module (as in, the ones that come built-in to Soholaunch Pro). For example, if you're plugin adds a payment gateway to the shopping cart, you could link this options button to Payment Options like so...
$plugin_options_link = "../../program/modules/mods_full/shopping_cart/payment_options.php";
Custom icon image
If you'd like your plugin to have it's own icon displayed next to it's name in the Plugin Manager (instead of the default puzzle piece graphic), include the image file in your plugin folder, and add a line like this to your install_manifest.php...
$plugin_icon = "my_plugin_icon.gif"
Create db tables on install
The idea here is to include a file in your plugin folder that creates the database table(s) your plugin uses. This file will be included/processed when your plugin is installed.
Add a line like this to your install_manifest.php...
$file_that_creates_plugin_dbtables = "install-create_dbtables.php";
Drop db tables on uninstall
If your plugin creates any database tables list them here so that Pro Edition knows to drop them during the un-installation process.
Example usage in install_manifest.php...
$drop_tables[] = "myplugin_userdata"; $drop_tables[] = "myplugin_prefs"; $drop_tables[] = "myplugin_whatever";
Custom install script
Allows you to halt the installation of your plugin, run a script, then resume the install process.
Example usage in install_manifest.php...
$plugin_install_form = "install_form.inc.php";
Just make sure to redirect back to install_plugin.php when your script is done doing what it needs to do (note the todo= and plugin= variables in the example below).
Example contents of install_form.inc.php...
<? #========================================================= # Example plugin install form #========================================================= session_start(); include_once($_SESSION['product_gui']); if ( $_POST['todo'] == "write_vital_info" ) { # Do what you need to do here # Normal path from your setup script back to plugin manager $redirect_path = "../../program/webmaster/plugin_manager/install_plugin.php?"; # This is key (replace hello_world_advanced) with your plugin folder name $redirect_path .= "todo=finish_install&plugin=hello_world_advanced"; # Go now header("location: ".$redirect_path); exit; } ?> <form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="todo" value="write_vital_info"/> User-defined data: <input type="text" name="vital_info" value="<? echo $_POST['vital_info']; ?>"/> <input type="submit" name="submit" value="Next >>"/> </form>
Tell Pro Edition how to plug-in your plugin
This is the part where you tell Pro Edition how and where to plug-in your plugin (heh). So our specific task at the moment is to tell Pro Edition (through our install manifest) to add our "- Hello World" change to the main menu.
Add this line to your install_manifest.php file...
hook_overwrite("sohoadmin/program/main_menu.php", "main_menu-helloworld.php");
The hook_overwrite function tells Pro Edition to use your version of main_menu.php (main_menu-helloworld.php) instead of the regular one.
Completed install manifest
Here's what your completed install_manifest.php file should look like...
<? # PLUGIN INFO $plugin_folder = "HELLO_WORLD"; $plugin_title = "Hello World"; $plugin_version = "1.0"; $plugin_author = "John Smith"; $plugin_homepage = "http://example.com"; # Description text $plugin_description = "Adds '- Hello World!' next to the 'Basic Features Group' on the main menu."; # Replace main_menu.php with my custom-modified version hook_overwrite("sohoadmin/program/main_menu.php", "main_menu-helloworld.php"); ?>