1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

Added e107::getEvent()->triggered() for manually checking if an event has already been triggered.

This commit is contained in:
Cameron
2022-06-07 12:33:50 -07:00
parent 08eb2a37d9
commit 8bf3481eaf
3 changed files with 103 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ class e107_event
var $includes = array();
protected $coreEvents;
private $triggered = array();
protected $oldCoreEvents = array(
@@ -181,13 +182,13 @@ class e107_event
/**
* Trigger event
* Triggers an event
*
* @param string $eventname
* @param mixed $data
* @return mixed
*/
function trigger($eventname, $data='')
function trigger($eventname, $data=null)
{
/*if (isset($this->includes[$eventname]))
{
@@ -201,10 +202,12 @@ class e107_event
}*/
// echo ($this->debug());
$this->triggered[$eventname] = true;
if (isset($this->functions[$eventname]))
{
foreach($this->functions[$eventname] as $i => $evt_func)
{
$location = '';
@@ -257,7 +260,15 @@ class e107_event
return (isset($ret) ? $ret : false);
}
/**
* Returns true if an event has been triggered.
* @param $eventname
* @return bool
*/
public function triggered($eventname)
{
return !empty($this->triggered[$eventname]);
}
/**