forked from joomla/joomla-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.php
51 lines (47 loc) · 1.1 KB
/
event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* @version $Id$
* @package Joomla.Framework
* @subpackage Event
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
jimport('joomla.base.observer');
/**
* JEvent Class
*
* @abstract
* @package Joomla.Framework
* @subpackage Event
* @since 1.5
*/
abstract class JEvent extends JObserver
{
/**
* Method to trigger events.
*
* @access public
* @param array Arguments
* @return mixed Routine return value
* @since 1.5
*/
public function update(&$args)
{
/*
* First lets get the event from the argument array. Next we will unset the
* event argument as it has no bearing on the method to handle the event.
*/
$event = $args['event'];
unset($args['event']);
/*
* If the method to handle an event exists, call it and return its return
* value. If it does not exist, return null.
*/
if (method_exists($this, $event)) {
return call_user_func_array(array($this, $event), $args);
} else {
return null;
}
}
}