-
Notifications
You must be signed in to change notification settings - Fork 6
/
SMTP_Server_API.php
46 lines (38 loc) · 959 Bytes
/
SMTP_Server_API.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
<?php
/**
* SMTP_Server_API
*
* @author Jason Johnson <jason@php-smtp.org>
* @copyright Copyright (c) 2008, Jason Johnson
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version 1.0
* @package php-smtp
*/
class SMTP_Server_API {
var $events = array();
var $hooks = array();
function register_event($event, $function) {
$this->events[$event][] = $function;
}
function register_hook($hook, $function) {
$this->hooks[$hook][] = $function;
}
function event() {
$args = func_get_args();
$event = array_shift($args);
for($i = 0; $i < count($this->events[$event]); $i++) {
call_user_func_array($this->events[$event][$i], $args);
}
}
function hook() {
$args = func_get_args();
$hook = array_shift($args);
for($i = 0; $i < count($this->hooks[$hook]); $i++) {
if(call_user_func_array($this->hooks[$hook][$i], $args) == false) {
return false;
}
}
return true;
}
}
?>