Această modificare permite și importarea unor module folosind limbajul XML. În acest fel modulul este un fișier XML care poate fi urcat pe server și transformat în fișier PHP. De asemenea se pot și exporta modulele.
Iată cum arată în format XML primul modul creat pentru această modificare și anume "Hello World" :
<?xml version="1.0" encoding="UTF-8"?>
<module author="MyBB România Team" name="helloworld" version="10">
<conditions>
<condition test="!defined(&quot;AIS_VERSION&quot;)"><![CDATA[
die("This file cannot be accessed directly.");
]]></condition>
</conditions>
<hooks>
<hook name="advinvsys_admin_menu"><![CDATA[ais_helloworld_menu]]></hook>
</hooks>
<functions>
<function name="info" params=""><![CDATA[
return array(
"name" => "Hello World",
"description" => "\"Hello World\" it is the first plugin maked in order to learn how to do other mods for \"Advanced Invitations System\".",
"website" => "http://mybb.ro",
"author" => "MyBB România Team",
"authorsite" => "http://mybb.ro",
"version" => "1.0",
"compatibility"=> "10*"
);
]]></function>
<function name="activate" params=""><![CDATA[
// Here you can add some tables or some settings
]]></function>
<function name="deactivate" params=""><![CDATA[
// Here you can remove some tables or some settings
]]></function>
<function name="menu" params="&$sub_menu"><![CDATA[
$sub_menu['helloworld'] = array(
"title" => "Hello World",
"link" => "index.php?module=config-advinvsys&section=plugins-helloworld",
"description" => "This page it is only for test."
);
]]></function>
<function name="admin" params=""><![CDATA[
global $lang, $page, $sub_tabs;
$page->add_breadcrumb_item($lang->advinvsys_modname);
$page->add_breadcrumb_item("Hello World!");
$page->output_header("Hello World!");
$page->output_nav_tabs($sub_tabs, 'helloworld');
echo '<center>Hello World!</center>';
$page->output_footer();
]]></function>
</functions>
</module>
După importarea acestui fișier XML se va genera următorul fișier PHP :
<?php/*
This file was generated with "Advanced Invitations System" modification.
*///BEGIN - SECURITY
if(!defined("IN_MYBB")){die("Direct initialization of this file is not allowed.");}//END - SECURITY
//BEGIN - CONDITIONS
if(!defined("AIS_VERSION")){die("This file cannot be accessed directly.");}//END - CONDITIONS
//BEGIN - HOOKS
$plugins->add_hook("advinvsys_admin_menu","ais_helloworld_menu");//END - HOOKS
//BEGIN - FUNCTIONS
function ais_helloworld_info(){returnarray("name"=>"Hello World","description"=>"\"Hello World\" it is the first plugin maked in order to learn how to do other mods for \"Advanced Invitations System\".","website"=>"http://mybb.ro","author"=>"MyBB România Team","authorsite"=>"http://mybb.ro","version"=>"1.0","compatibility"=>"10*");}function ais_helloworld_activate(){// Here you can add some tables or some settings
}function ais_helloworld_deactivate(){// Here you can remove some tables or some settings
}function ais_helloworld_menu(&$sub_menu){$sub_menu['helloworld']=array("title"=>"Hello World","link"=>"index.php?module=config-advinvsys&section=plugins-helloworld","description"=>"This page it is only for test.");}function ais_helloworld_admin(){global$lang,$page,$sub_tabs;$page->add_breadcrumb_item($lang->advinvsys_modname);$page->add_breadcrumb_item("Hello World!");$page->output_header("Hello World!");$page->output_nav_tabs($sub_tabs,'helloworld');echo'<center>Hello World!</center>';$page->output_footer();}//END - FUNCTIONS
?>
În concluzie în cadrul unui fișier XML se pot adăuga condiții (if-uri ce vor fi puse la începutul fișierului PHP al modulului), cârlige (ce ne permit interacționarea cu modificarea și sistemul MyBB) cât și funcții.
Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert. Novice users : people who are afraid that simply pressing a key might break their computer. Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it. Expert users : people who break other people`s computers.
(Acest mesaj a fost modificat ultima dată: 02-20-2012 02:16 AM de Mihu.)