mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Fixes #4079 - Corrected multiple event includes conflict.
This commit is contained in:
@@ -140,13 +140,15 @@ class e107_event
|
|||||||
*/
|
*/
|
||||||
function register($eventname, $function, $include='')
|
function register($eventname, $function, $include='')
|
||||||
{
|
{
|
||||||
$this->includes[$eventname] = array();
|
|
||||||
|
|
||||||
if(!isset($this->functions[$eventname]) || !in_array($function, $this->functions[$eventname]))
|
if(!isset($this->functions[$eventname]) || !in_array($function, $this->functions[$eventname]))
|
||||||
{
|
{
|
||||||
if (!empty($include))
|
if (!empty($include))
|
||||||
{
|
{
|
||||||
$this->includes[$eventname][] = $include;
|
$this->includes[$eventname][] = $include;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->functions[$eventname][] = $function;
|
$this->functions[$eventname][] = $function;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,11 +157,12 @@ class e107_event
|
|||||||
|
|
||||||
function debug()
|
function debug()
|
||||||
{
|
{
|
||||||
echo "<h3>Event Functions</h3>";
|
$text = "<h3>Event Functions</h3>";
|
||||||
print_a($this->functions);
|
$text .= print_a($this->functions,true);
|
||||||
echo "<h3>Event Includes</h3>";
|
$text .= "<h3>Event Includes</h3>";
|
||||||
print_a($this->includes);
|
$text .= print_a($this->includes,true);
|
||||||
|
|
||||||
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,6 +185,10 @@ class e107_event
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
// echo ($this->debug());
|
||||||
|
|
||||||
|
|
||||||
if (isset($this->functions[$eventname]))
|
if (isset($this->functions[$eventname]))
|
||||||
{
|
{
|
||||||
foreach($this->functions[$eventname] as $i => $evt_func)
|
foreach($this->functions[$eventname] as $i => $evt_func)
|
||||||
@@ -190,9 +197,12 @@ class e107_event
|
|||||||
if(isset($this->includes[$eventname][$i])) //no checks
|
if(isset($this->includes[$eventname][$i])) //no checks
|
||||||
{
|
{
|
||||||
$location = $this->includes[$eventname][$i];
|
$location = $this->includes[$eventname][$i];
|
||||||
|
|
||||||
e107_include_once($location);
|
e107_include_once($location);
|
||||||
unset($this->includes[$eventname][$i]);
|
unset($this->includes[$eventname][$i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_array($evt_func)) //class, method
|
if(is_array($evt_func)) //class, method
|
||||||
{
|
{
|
||||||
$class = $evt_func[0];
|
$class = $evt_func[0];
|
||||||
|
Reference in New Issue
Block a user