event_add_patch.diff
| system/classes/event.php (working copy) | ||
|---|---|---|
| 24 | 24 |
* |
| 25 | 25 |
* @param string event name |
| 26 | 26 |
* @param array http://php.net/callback |
| 27 |
* @param boolean enforce unique callback |
|
| 27 | 28 |
* @return boolean |
| 28 | 29 |
*/ |
| 29 |
public static function add($name, $callback) |
|
| 30 |
public static function add($name, $callback, $unique = FALSE)
|
|
| 30 | 31 |
{
|
| 31 | 32 |
if ( ! isset(self::$events[$name])) |
| 32 | 33 |
{
|
| 33 | 34 |
// Create an empty event if it is not yet defined |
| 34 | 35 |
self::$events[$name] = array(); |
| 35 | 36 |
} |
| 36 |
elseif (in_array($callback, self::$events[$name], TRUE)) |
|
| 37 |
elseif ( $unique && in_array($callback, self::$events[$name], TRUE))
|
|
| 37 | 38 |
{
|
| 38 | 39 |
// The event already exists |
| 39 | 40 |
return FALSE; |