Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
968ea5cc
Commit
968ea5cc
authored
Feb 17, 2014
by
Scott Vivian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename qa_list_all_registered_modules_info() to qa_list_modules_info()
parent
39b13f70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
33 deletions
+20
-33
qa-app-options.php
qa-include/qa-app-options.php
+1
-2
qa-base.php
qa-include/qa-base.php
+19
-31
No files found.
qa-include/qa-app-options.php
View file @
968ea5cc
...
@@ -491,9 +491,8 @@
...
@@ -491,9 +491,8 @@
foreach
(
$modules
as
$module
)
{
foreach
(
$modules
as
$module
)
{
$value
=
$module
->
option_default
(
$name
);
$value
=
$module
->
option_default
(
$name
);
if
(
strlen
(
$value
))
{
if
(
strlen
(
$value
))
return
$value
;
return
$value
;
}
}
}
$value
=
''
;
$value
=
''
;
...
...
qa-include/qa-base.php
View file @
968ea5cc
...
@@ -612,53 +612,41 @@
...
@@ -612,53 +612,41 @@
// Functions for listing, loading and getting info on modules
// 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
Return an array with all registered modules' information
*/
*/
{
{
global
$qa_modules
;
global
$qa_modules
;
return
$qa_modules
;
return
$qa_modules
;
}
}
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
());
}
function
qa_list_module_types
()
function
qa_list_module_types
()
/*
/*
Return an array of all the module types for which at least one module has been registered
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
)
function
qa_list_modules
(
$type
)
/*
/*
Return a list of names of registered modules of $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
();
return
is_array
(
@
$modules
[
$type
])
?
array_keys
(
$modules
[
$type
])
:
array
();
}
}
function
qa_get_module_info
(
$type
,
$name
)
function
qa_get_module_info
(
$type
,
$name
)
/*
/*
Return an array containing information about the module of $type named $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
];
return
@
$modules
[
$type
][
$name
];
}
}
function
qa_load_module
(
$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
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 @@
...
@@ -666,7 +654,7 @@
{
{
global
$qa_modules
;
global
$qa_modules
;
$module
=
@
$qa_modules
[
$type
][
$name
];
$module
=
@
$qa_modules
[
$type
][
$name
];
if
(
is_array
(
$module
))
{
if
(
is_array
(
$module
))
{
if
(
isset
(
$module
[
'object'
]))
if
(
isset
(
$module
[
'object'
]))
...
@@ -676,19 +664,19 @@
...
@@ -676,19 +664,19 @@
require_once
$module
[
'directory'
]
.
$module
[
'include'
];
require_once
$module
[
'directory'
]
.
$module
[
'include'
];
if
(
strlen
(
@
$module
[
'class'
]))
{
if
(
strlen
(
@
$module
[
'class'
]))
{
$object
=
new
$module
[
'class'
];
$object
=
new
$module
[
'class'
];
if
(
method_exists
(
$object
,
'load_module'
))
if
(
method_exists
(
$object
,
'load_module'
))
$object
->
load_module
(
$module
[
'directory'
],
qa_path_to_root
()
.
$module
[
'urltoroot'
],
$type
,
$name
);
$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
;
return
$object
;
}
}
}
}
return
null
;
return
null
;
}
}
function
qa_load_all_modules_with
(
$method
)
function
qa_load_all_modules_with
(
$method
)
/*
/*
Return an array of instantiated clases for modules which have defined $method
Return an array of instantiated clases for modules which have defined $method
...
@@ -696,10 +684,10 @@
...
@@ -696,10 +684,10 @@
*/
*/
{
{
$modules
=
array
();
$modules
=
array
();
$reg
isteredmodules
=
qa_list_all_registered
_modules_info
();
$reg
modules
=
qa_list
_modules_info
();
foreach
(
$reg
istered
modules
as
$moduletype
=>
$modulesinfo
)
{
foreach
(
$regmodules
as
$moduletype
=>
$modulesinfo
)
{
foreach
(
$modulesinfo
as
$modulename
=>
$moduleinfo
)
{
foreach
(
$modulesinfo
as
$modulename
=>
$moduleinfo
)
{
$module
=
qa_load_module
(
$moduletype
,
$modulename
);
$module
=
qa_load_module
(
$moduletype
,
$modulename
);
...
@@ -707,25 +695,25 @@
...
@@ -707,25 +695,25 @@
$modules
[
$moduletype
]
=
$module
;
$modules
[
$moduletype
]
=
$module
;
}
}
}
}
return
$modules
;
return
$modules
;
}
}
function
qa_load_modules_with
(
$type
,
$method
)
function
qa_load_modules_with
(
$type
,
$method
)
/*
/*
Return an array of instantiated clases for modules of $type which have defined $method
Return an array of instantiated clases for modules of $type which have defined $method
(other modules of that type are also loaded but not included in the returned array)
(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
)
{
foreach
(
$trynames
as
$tryname
)
{
$module
=
qa_load_module
(
$type
,
$tryname
);
$module
=
qa_load_module
(
$type
,
$tryname
);
if
(
method_exists
(
$module
,
$method
))
if
(
method_exists
(
$module
,
$method
))
$modules
[
$tryname
]
=
$module
;
$modules
[
$tryname
]
=
$module
;
}
}
return
$modules
;
return
$modules
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment