Example of a plugin.config.xml

From PHPDevShell

Jump to: navigation, search

Please make sure you read the plugin Configuring the plugin config file before looking at the example. This is just an example of how a typical plugin.config.xml file will look. For better formatting download this file at the bottom of this document. Please see http://phpdevshell.org/project/dummyplugin for a plugin example.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Please see http://phpdevshell.org for documentation on plugin config xml files. -->
<!-- Download DummyPlugin from http://phpdevshell.org for a detailed example plugin. -->
<!--  This plugin does not contain all the values needed for a normal plugin. -->
<config type="plugin">
 
	<!-- Use a proper plugin name without using special characters. -->
	<name>SimplePhonebook</name>
 
	<!-- Human readable version number of your plugin. -->
	<version>2.0.1-Stable</version>
 
	<!-- a Short description of your plugin. -->
	<description>Simple Phonebook allows you to enter phone numbers in a phonebook database for registered users.</description>
 
	<!-- If the plugin/script is modification by you, place the original authors names here. -->
	<founder>Jason Schoeman</founder>
 
	<!-- Name of the developer for this plugin. -->
	<author>Jason Schoeman</author>
 
	<!-- Email address of the developer for this plugin. -->
	<email>titan@phpdevshell.org</email>
 
	<!-- Plugin developers email address. -->
	<homepage>http://www.phpdevshell.org</homepage>
 
	<!-- Date the plugin was developed, modified etc, this is up to you. -->
	<date>02 March 2008</date>
 
	<!-- Copyright notice you would like to amend to your plugin. -->
	<copyright>Copyright 2009 PHPDevShell.org All rights reserved.</copyright>
 
	<!-- License this plugin is released under. -->
	<license>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU/LGPL</license>
 
	<!-- Detailed information and help for this plugin. -->
	<info>
		<![CDATA[
			<p>
				This plugin was created as an example for the developer on how to create plugins for PHPDevShell. 
                                It is very simple, but that is the idea.
				For advanced examples view the PHPDevShell plugin scripts, 
                                it contains everything you might encounter during your development.
				Also view the API directory found on http://www.phpdevshell.org, or visit the forums to ask for help.
			</p>
			<p>
				This plugin also offers a good example on how the hook system works.
			</p>
		]]>
	</info>
	<install version="2001">
		<!--
		[contains][All query, menu, hooks, settings installation tags.]
	        [param][version][int][mandatory][The latest database version in numbers only.]
	        [note][This is how the plugin manager will know to what version upgrade scripts should be executed.]
	        [note][Always keep install maintained to the latest menu, query, hooks and setting versions.]     
		-->
		<queries>
			<!-- [contains][All install queries to create the tables for your plugin.] --> 
			<!-- [note][If there is a SQL query error, the plugin will not install.] --> 
			<query>
				<!-- 
                                [string][This is a single actual sql query that will be executed]
                                [note][SQL query be placed in <![CDATA[ ]]> tags.] 
				-->
				<![CDATA[
					CREATE TABLE `pds_simple_phonebook` (
					  `user_id` int(20) unsigned NOT NULL auto_increment,
					  `cell_number` varchar(255) default NULL,
					  `home_number` varchar(255) default NULL,
					  `work_number` varchar(255) default NULL,
					  `fax_number` varchar(255) default NULL,
					  PRIMARY KEY  (`user_id`)
					) ENGINE=InnoDB DEFAULT CHARSET=latin1;
				]]>
			</query>
			<!-- [note][SQL queries can be repeated.] -->
		</queries>
	<menus>
        <!--
        [contains][All types of menu items that needs to be installed.]
      	[note][Tags inside menus can be nested and repeated.]  
		-->
		<menu name="" type="2" link="list_entries.link" hide="" rank="last" newwindow="" 
                plugin="PHPDevShell" parentlink="" symlink="user/control_panel.php" 
                template="" height="" noautopermission="">
             	<!-- 
                [contains][Menu items can be contained in itself, this will create a menu tree.]
                [param][name][string][not-mandatory][The name of the menu item, if empty the pluginName.menu.lang.php will be used.]
                [param][type][int][not-mandatory][There are 8 menu types, 1 is the default if left empty.]
                        [1][Plugin script] normal plugin menu item in your plugin folder.
                        [2][Link existing menu] item while staying in its own menu group when clicked.
                        [3][Link existing menu] item while jumping to original scripts menu group when clicked.
                        [4][External file] Include external PHP web applications into PHPDevShell.
                        [5][HTTP URL] Normal url to outside web.
                        [6][Empty Place Holder] This item will only serve as a unclickable menu place holder.
                        [7][iFrame] Link url to both external url or onsite url.
                        [8][Cronjob Menu Type] The same as a plugin script but is set as cronjob.
                [param][link][string][mandatory][The url, script location or symlink holder will be entered here depending on type.]
                [param][hide][int][not-mandatory][There are 4 hide types, 0 is the default if left empty.]
                        [0] Do not hide menu item.
                        [1] Hide menu item from both Menu System and Control Panel.
                        [2] Hide menu item from Control Panel only.
                        [3] Hide menu item from Menu System only.
                [param][rank][string][not-mandatory][If you want to ensure ranking positions, will auto rank if left empty.]
                        [int] Can be ranked with integer.
                        [last] Will be ranked last in a menu group.
                        [first] Will be ranked first in a menu group.
                [param][newwindow][int][not-mandatory][To make item open in new window set to 1, will not open in new if left empty.]
                [param][plugin][string][not-mandatory][Plugin name, use to install menu item to a different plugins menu structure.]
                [param][alias][string][not-mandatory][When switching on friendly urls in the settings and r
                enaming rename.htaccess in the root, sef url will use this alias.]
                [param][parentlink][string][not-mandatory][Use with [param][plugin] or without to install in different structure.]
                [param][symlink][string][not-mandatory][Url or location with [param][plugin] or without to link to another menu item 
                duplicating its use.]
                        [note][Symlink is mandatory for menu types 1,2,6]
                [param][template][string][not-mandatory][Set template to use with plugin, if template is unavailable it will be installed.]
                [param][template][string][not-mandatory][Set the height of an iframe menu type.]
                        [note][Height is mandatory for menu types 7]   
                [param][noautopermission][int][not-mandatory][Set to 1 to not add the installer of the plugin to permit menu item access.]
                -->
			<menu link="ajax/login_count.ajax.php" type="1" rank="1" hide="1" template="empty" />
			<menu link="list_entries.php" type="1" rank="2" alias="pb-list" />
			<menu link="manage_entry.php" type="1" rank="3" hide="1" alias="pb-manage" />
		</menu>
        </menus>
	<hooks>
		<!-- [contains][Contains hook scripts to be installed inside other scripts and plugins.] -->
		<!-- [note]I will be using a file in DummyPlugin/hooks/dummy.config.php hence I call hookprefix="dummy". -->
		<!-- [note]on_submit, on_edit and on_update points are available in PHPDevShell/user/register.php -->
		<hook plugin="PHPDevShell" hookinlink="user/register.php" hookpoint="on_submit" hookprefix="register"/>
		<hook plugin="PHPDevShell" hookinlink="user/register.php" hookpoint="on_update" hookprefix="register"/>
		<hook plugin="PHPDevShell" hookinlink="user/register.php" hookpoint="bottom_html" hookprefix="register"/>
		<hook plugin="PHPDevShell" hookinlink="user/edit_preferences.php" hookpoint="on_edit" hookprefix="preferences"/>
		<hook plugin="PHPDevShell" hookinlink="user/edit_preferences.php" hookpoint="on_submit" hookprefix="preferences"/>
		<hook plugin="PHPDevShell" hookinlink="user/edit_preferences.php" hookpoint="on_update" hookprefix="preferences"/>
		<hook plugin="PHPDevShell" hookinlink="user/edit_preferences.php" hookpoint="bottom_html" hookprefix="preferences"/>
		<hook plugin="PHPDevShell" hookinlink="user_admin/user_admin_list.php" hookpoint="on_delete" hookprefix="delete_user">
		<!--
		[contains][Nothing, works from parameters only.]
		[param][plugin][string][mandatory][Name of plugin where script is located to hook.]
		[param][hookinlink][string][mandatory][File location from [param][plugin] where script to be hooked is located.]
		[param][hookinlink][string][mandatory][What hook point should the script be hooked in.]
				       [note][Please see hook documentation to gain access and see what hooks point are available in scripts.]
		[param][hookprefix][string][mandatory][Your plugin hooks script to be called when hook location is reached.]
				       [note][To call sample.hooks.php name hookprefix="sample", it will then load pluginName/hooks/sample.hook.php]
				       [note][In your sample.hooks.php you will set on what hook point will what piece of code run.]
		[note][Please see the hooks manual for more information on hooks.]
		[note][Hooks changes on upgrades should be done here, this will always be the model on upgrades.]
		-->
		</hook>
	</hooks>
	</install>
	<uninstall>
		<!--
		[contains][All actions that will be executed on uninstalling a plugin.]
		[note][Menus, settings and hooks will be uninstalled automatically for this plugin.]
		-->
		<queries>
			<!-- [contains][All uninstall queries that will be executed when requested.] -->
			<query>
				<!--
				[string][This is a single actual sql query that will be executed on uninstalling plugin.]
				[note][SQL uninstall query be placed in <![CDATA[ ]]> tags.]
				-->	
				<![CDATA[
					DROP TABLE IF EXISTS pds_simple_phonebook;
				]]>
			</query>
		</queries>
	</uninstall>
</config>