aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event/dispatcher.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/event/dispatcher.php')
-rw-r--r--phpBB/phpbb/event/dispatcher.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php
index 9a786022c2..1c4abeb108 100644
--- a/phpBB/phpbb/event/dispatcher.php
+++ b/phpBB/phpbb/event/dispatcher.php
@@ -14,6 +14,7 @@
namespace phpbb\event;
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
+use Symfony\Component\EventDispatcher\Event;
/**
* Extension of the Symfony2 EventDispatcher
@@ -32,6 +33,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface
{
/**
+ * @var bool
+ */
+ protected $disabled = false;
+
+ /**
* {@inheritdoc}
*/
public function trigger_event($eventName, $data = array())
@@ -40,4 +46,33 @@ class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_int
$this->dispatch($eventName, $event);
return $event->get_data_filtered(array_keys($data));
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function dispatch($eventName, Event $event = null)
+ {
+ if ($this->disabled)
+ {
+ return $event;
+ }
+
+ return parent::dispatch($eventName, $event);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function disable()
+ {
+ $this->disabled = true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function enable()
+ {
+ $this->disabled = false;
+ }
}