Commit 968ea5cc by Scott Vivian

Rename qa_list_all_registered_modules_info() to qa_list_modules_info()

parent 39b13f70
......@@ -491,10 +491,9 @@
foreach ($modules as $module) {
$value = $module->option_default($name);
if (strlen($value)) {
if (strlen($value))
return $value;
}
}
$value='';
break;
......
......@@ -612,13 +612,12 @@
// Functions for listing, loading and getting info on modules
function qa_list_all_registered_modules_info()
function qa_list_modules_info()
/*
Return an array with all registered modules' information
*/
{
global $qa_modules;
return $qa_modules;
}
......@@ -627,38 +626,27 @@
Return an array of all the module types for which at least one module has been registered
*/
{
return array_keys(qa_list_all_registered_modules_info());
}
function qa_list_module_types()
/*
Return an array of all the module types for which at least one module has been registered
*/
{
return array_keys(qa_list_all_registered_modules_info());
return array_keys(qa_list_modules_info());
}
function qa_list_modules($type)
/*
Return a list of names of registered modules of $type
*/
{
$modules = qa_list_all_registered_modules_info();
$modules = qa_list_modules_info();
return is_array(@$modules[$type]) ? array_keys($modules[$type]) : array();
}
function qa_get_module_info($type, $name)
/*
Return an array containing information about the module of $type named $name
*/
{
$modules = qa_list_all_registered_modules_info();
$modules = qa_list_modules_info();
return @$modules[$type][$name];
}
function qa_load_module($type, $name)
/*
Return an instantiated class for module of $type named $name, whose functions can be called, or null if it doesn't exist
......@@ -666,7 +654,7 @@
{
global $qa_modules;
$module=@$qa_modules[$type][$name];
$module = @$qa_modules[$type][$name];
if (is_array($module)) {
if (isset($module['object']))
......@@ -676,12 +664,12 @@
require_once $module['directory'].$module['include'];
if (strlen(@$module['class'])) {
$object=new $module['class'];
$object = new $module['class'];
if (method_exists($object, 'load_module'))
$object->load_module($module['directory'], qa_path_to_root().$module['urltoroot'], $type, $name);
$qa_modules[$type][$name]['object']=$object;
$qa_modules[$type][$name]['object'] = $object;
return $object;
}
}
......@@ -697,9 +685,9 @@
{
$modules = array();
$registeredmodules = qa_list_all_registered_modules_info();
$regmodules = qa_list_modules_info();
foreach ($registeredmodules as $moduletype => $modulesinfo) {
foreach ($regmodules as $moduletype => $modulesinfo) {
foreach ($modulesinfo as $modulename => $moduleinfo) {
$module = qa_load_module($moduletype, $modulename);
......@@ -717,15 +705,15 @@
(other modules of that type are also loaded but not included in the returned array)
*/
{
$modules=array();
$modules = array();
$trynames=qa_list_modules($type);
$trynames = qa_list_modules($type);
foreach ($trynames as $tryname) {
$module=qa_load_module($type, $tryname);
$module = qa_load_module($type, $tryname);
if (method_exists($module, $method))
$modules[$tryname]=$module;
$modules[$tryname] = $module;
}
return $modules;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment