mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
new module creation
This commit is contained in:
55
e107_handlers/event_class.php
Normal file
55
e107_handlers/event_class.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/event_class.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:33:44 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class e107_event {
|
||||
var $functions = array();
|
||||
var $includes = array();
|
||||
|
||||
function register($eventname, $function, $include='') {
|
||||
if ($include!='') {
|
||||
$this->includes[$eventname][] = $include;
|
||||
}
|
||||
$this->functions[$eventname][] = $function;
|
||||
}
|
||||
|
||||
function trigger($eventname, &$data) {
|
||||
if (isset($this -> includes[$eventname])) {
|
||||
foreach($this->includes[$eventname] as $evt_inc) {
|
||||
if (file_exists($evt_inc)) {
|
||||
include_once($evt_inc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this -> functions[$eventname])) {
|
||||
foreach($this->functions[$eventname] as $evt_func) {
|
||||
if (function_exists($evt_func)) {
|
||||
$ret = $evt_func($data);
|
||||
if ($ret!='') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (isset($ret) ? $ret : false);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user