Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
76db66b2
Commit
76db66b2
authored
Oct 31, 2006
by
Penny Leach
Browse files
made handle_event make more sense
parent
fe8ca268
Changes
1
Show whitespace changes
Inline
Side-by-side
htdocs/lib/mahara.php
View file @
76db66b2
...
@@ -547,7 +547,15 @@ function redirect($location) {
...
@@ -547,7 +547,15 @@ function redirect($location) {
exit
;
exit
;
}
}
function
handle_event
(
$event
)
{
/**
* Handles an internal system event
*
* @param string event name of event
* @param mixed data data to pass to the handle function
* eg new user object etc.
*
*/
function
handle_event
(
$event
,
$data
)
{
if
(
!
$e
=
get_record
(
'event_type'
,
'name'
,
$event
))
{
if
(
!
$e
=
get_record
(
'event_type'
,
'name'
,
$event
))
{
throw
new
Exception
(
"Invalid event"
);
throw
new
Exception
(
"Invalid event"
);
}
}
...
@@ -557,7 +565,7 @@ function handle_event($event) {
...
@@ -557,7 +565,7 @@ function handle_event($event) {
foreach
(
$subs
as
$sub
)
{
foreach
(
$subs
as
$sub
)
{
$classname
=
'Plugin'
.
ucfirst
(
$name
)
.
ucfirst
(
$sub
->
plugin
);
$classname
=
'Plugin'
.
ucfirst
(
$name
)
.
ucfirst
(
$sub
->
plugin
);
try
{
try
{
call_static_method
(
$classname
,
$sub
->
callfunction
);
call_static_method
(
$classname
,
$sub
->
callfunction
,
$data
);
}
}
catch
(
Exception
$e
)
{
catch
(
Exception
$e
)
{
log_warn
(
"Event
$event
caused an exception from plugin
$classname
"
log_warn
(
"Event
$event
caused an exception from plugin
$classname
"
...
...
Write
Preview
Supports
Markdown
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