1
|
|
|
<?php namespace EvolutionCMS; |
2
|
|
|
|
3
|
|
|
class Event implements Interfaces\EventInterface |
|
|
|
|
4
|
|
|
{ |
5
|
|
|
public $name = ''; |
6
|
|
|
public $_propagate = true; |
7
|
|
|
/** |
8
|
|
|
* @deprecated use setOutput(), getOutput() |
9
|
|
|
* @var string |
10
|
|
|
*/ |
11
|
|
|
public $_output; |
12
|
|
|
public $activated = false; |
13
|
|
|
public $activePlugin = ''; |
14
|
|
|
public $params = array(); |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @param string $name Name of the event |
18
|
|
|
*/ |
19
|
|
|
public function __construct($name = "") |
20
|
|
|
{ |
21
|
|
|
$this->_resetEventObject(); |
22
|
|
|
$this->name = $name; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Display a message to the user |
27
|
|
|
* |
28
|
|
|
* @global array $SystemAlertMsgQueque |
29
|
|
|
* @param string $msg The message |
30
|
|
|
*/ |
31
|
|
|
public function alert($msg) |
32
|
|
|
{ |
33
|
|
|
global $SystemAlertMsgQueque; |
|
|
|
|
34
|
|
|
if ($msg == "") { |
35
|
|
|
return; |
36
|
|
|
} |
37
|
|
|
if (is_array($SystemAlertMsgQueque)) { |
38
|
|
|
$title = ''; |
39
|
|
|
if ($this->name && $this->activePlugin) { |
40
|
|
|
$title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
41
|
|
|
} |
42
|
|
|
$SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Output |
48
|
|
|
* |
49
|
|
|
* @param string $msg |
50
|
|
|
* @deprecated see addOutput |
51
|
|
|
*/ |
52
|
|
|
public function output($msg) |
53
|
|
|
{ |
54
|
|
|
$this->_output .= $msg; |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param mixed $data |
59
|
|
|
*/ |
60
|
|
|
public function setOutput($data) |
61
|
|
|
{ |
62
|
|
|
$this->_output = $data; |
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return mixed |
|
|
|
|
67
|
|
|
*/ |
68
|
|
|
public function getOutput() |
69
|
|
|
{ |
70
|
|
|
return $this->_output; |
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Stop event propogation |
75
|
|
|
*/ |
76
|
|
|
public function stopPropagation() |
77
|
|
|
{ |
78
|
|
|
$this->_propagate = false; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function _resetEventObject() |
82
|
|
|
{ |
83
|
|
|
unset ($this->returnedValues); |
84
|
|
|
$this->name = ""; |
85
|
|
|
$this->setOutput(null); |
86
|
|
|
$this->_propagate = true; |
87
|
|
|
$this->activated = false; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.