PluginSDK
Line 69: | Line 69: | ||
Again much the same as the installer this just help with loading the plugins | Again much the same as the installer this just help with loading the plugins | ||
− | =Calling Tables= | + | ==Calling Tables== |
Calling tables in your plugin has 1 extra value that has to be set | Calling tables in your plugin has 1 extra value that has to be set | ||
<php>$roster->db->table($tablename,$pluginname,$type)</php> | <php>$roster->db->table($tablename,$pluginname,$type)</php> |
Latest revision as of 00:18, 8 June 2012
Important note: When you edit this page, you agree to release your contribution into the public domain. |
Contents |
Plugin SDK
Most of the Plugin install system is like the Addon system see the AddOn SDK for more info some changes are as such
- Each AddOn has its own Plugin Function settings each addon that uses Plugin "Should" Include a example Blank Plugin
- Plugins only function in addons that use plugin with the exception of Global Plugins which can be called in any function
Each install.def.php for each plugin has to have these vars at the top after the class is started
class eventsInstall { /* * These Vars are used with the new Plugin installer * @var name - unique name for the plugin * @var parent - the intended addon to use this plugin */ var $active = true; var $name = 'events'; var $filename = 'events.php'; var $parent = 'main'; var $scope = 'guild'; var $icon = 'achievement_worldevent_childrensweek'; var $version = '1.0'; var $oldversion = ''; var $wrnet_id = ''; var $fullname = 'WoW Events'; var $description = 'Creates a display of the current ingame event.'; var $credits = array( array( "name"=> "Ulminia <Ulminia@gmail.com>", "info"=> "WoW Events (Alpha Release)"), );
- $filename
- this is the filename that has the output functions must be the same name as the folder
- $parent
- the addon that the plugin is for this is the addon basename
- $scope
- this is the scope the plugin functions in ex guild, user multiple scopes are set as guild|char|user global can only be defined alone
Install Class
function install()
All the same functions you can use in addon install class work here BUT you cannot create menu buttons this is the only limitation
Plugin Class
Plugins are loaded as class objects for addons so using the events plugin as an example we declare our class in the php file names the same as the folder of the plugin events.php
class events { var $output; /* * These Vars are used with the new Plugin installer * @var name - unique name for the plugin * @var parent - the intended addon to use this plugin * */ var $active = true; var $name = 'events'; var $parent = 'main'; var $icon = 'achievement_worldevent_childrensweek'; var $version = '1.0'; var $oldversion = ''; var $wrnet_id = '';
Again much the same as the installer this just help with loading the plugins
Calling Tables
Calling tables in your plugin has 1 extra value that has to be set
$roster->db->table($tablename,$pluginname,$type)
- $tablename
- this value has not changes
- $pluginname
- the name of the plugin of addon you want to get sql info from
- $type
- NEW this is set to ither addons or plugins if you are using addon tables you may leave this blank
Addon Plugin Init
This function is customized for each addon and is included in the functions or main file for the addon to get plugin data
This is the Function used in the new WoWRoster Portal
function _initPlugins() { global $roster, $addon; $plugins = $roster->plugin_data; if( !empty($plugins) ) { foreach( $plugins as $plugin_name => $plugin ) { if ($plugin['parent'] == $addon['basename']) { if ($roster->plugin_data[$plugin_name]['active'] == '1') { $xplugin = getplugin($plugin_name); foreach( $roster->multilanguages as $lang ) { $roster->locale->add_locale_file($xplugin['locale_dir'] . $lang . '.php', $lang); } $plugin['scope'] = explode('|',$plugin['scope']); if (in_array( $roster->scope, $plugin['scope'] ) ) { $classfile = ROSTER_PLUGINS . $plugin_name . DIR_SEP . $plugin_name . '.php'; require($classfile); $pluginstuff = new $plugin_name($xplugin); $this->block[] = array( 'name' => $roster->locale->act[$plugin_name]['title'],//$pluginstuff->fullname, 'output' => $pluginstuff->output, 'icon' => $pluginstuff->icon ); unset($pluginstuff); } } } } } return true; }
after $pluginstuff = new $plugin_name($xplugin); is where custom variables are declared for each addon these do change from addon to addon $this->block is passed to the index.php and looped to output the custom blocks for this plugin.