[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\event; 15 16 use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; 17 use Symfony\Component\EventDispatcher\Event; 18 19 /** 20 * Extension of the Symfony2 EventDispatcher 21 * 22 * It provides an additional `trigger_event` method, which 23 * gives some syntactic sugar for dispatching events. Instead 24 * of creating the event object, the method will do that for 25 * you. 26 * 27 * Example: 28 * 29 * $vars = array('page_title'); 30 * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); 31 * 32 */ 33 class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface 34 { 35 /** 36 * @var bool 37 */ 38 protected $disabled = false; 39 40 /** 41 * {@inheritdoc} 42 */ 43 public function trigger_event($eventName, $data = array()) 44 { 45 $event = new \phpbb\event\data($data); 46 $this->dispatch($eventName, $event); 47 return $event->get_data_filtered(array_keys($data)); 48 } 49 50 /** 51 * {@inheritdoc} 52 */ 53 public function dispatch($eventName, Event $event = null) 54 { 55 if ($this->disabled) 56 { 57 return $event; 58 } 59 60 return parent::dispatch($eventName, $event); 61 } 62 63 /** 64 * {@inheritdoc} 65 */ 66 public function disable() 67 { 68 $this->disabled = true; 69 } 70 71 /** 72 * {@inheritdoc} 73 */ 74 public function enable() 75 { 76 $this->disabled = false; 77 } 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |