<?php
class WebBase_Module_Info
{
private $f_name;
private $f_author;
private $f_version;
private $f_language;
// 0 = Public Freeware
// 1 = Public Shareware
// 2 = Private Secured
// 3 = Personal WebBase-Core
// 4 = Personal WebBase-Enclosure
private $f_license;
function name() {
return $this->f_name;
}
function author() {
return $this->f_author;
}
function version() {
return $this->f_version;
}
function language() {
return $this->f_language;
}
function license() {
return $this->f_license;
}
function WebBase_Module_Info($name, $author, $version, $language, $license) {
$this->f_name = $name;
$this->f_author = $author;
$this->f_version = $version;
$this->f_language = $language;
$this->f_license = $license;
}
};
class WBModuleHandler {
private static
$cache_module_information = Array();
function get_module_information($modulename)
{
if (isset(self::$cache_module_information[$modulename])) {
return self::$cache_module_information[$modulename];
}
$xml = new xml();
if ((!strpos($modulename, '..')) && (file_exists('modules/'.$modulename.'/info.xml')))
{
$object = $xml->xml_file_to_object('modules/'.$modulename.'/info.xml');
if ($object->name == 'moduleinfo')
{
$v_expected_name = '';
$v_author = '';
$v_version = '';
$v_language = '';
$v_license = '';
foreach ($object->children as $m1 => $m2)
{
if ($object->children[$m1]->name == 'expected_name') $v_expected_name = $object->children[$m1]->content;
if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content;
if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content;
if ($object->children[$m1]->name == 'language') $v_language = $object->children[$m1]->content;
if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content;
}
$output = new WebBase_Module_Info($v_expected_name, $v_author, $v_version, $v_language, $v_license);
if ($output->caption == '') $output->caption = $modulename;
$ee = getmicrotime();
global $xml_time;
$xml_time += $ee-$ss;
global $xml_count;
$xml_count++;
}
self::$cache_module_information[$modulename] = $output;
return $output;
}
else
{
return NULL;
}
}
else
{
return NULL;
}
}
}
?>