diff options
Diffstat (limited to 'phpBB/phpbb/event')
| -rw-r--r-- | phpBB/phpbb/event/dispatcher.php | 35 | ||||
| -rw-r--r-- | phpBB/phpbb/event/dispatcher_interface.php | 10 | ||||
| -rw-r--r-- | phpBB/phpbb/event/kernel_request_subscriber.php | 82 | ||||
| -rw-r--r-- | phpBB/phpbb/event/md_exporter.php | 11 | 
4 files changed, 48 insertions, 90 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; +	}  } diff --git a/phpBB/phpbb/event/dispatcher_interface.php b/phpBB/phpbb/event/dispatcher_interface.php index 50a3ef9101..c66aa98260 100644 --- a/phpBB/phpbb/event/dispatcher_interface.php +++ b/phpBB/phpbb/event/dispatcher_interface.php @@ -37,4 +37,14 @@ interface dispatcher_interface extends \Symfony\Component\EventDispatcher\EventD  	* @return mixed  	*/  	public function trigger_event($eventName, $data = array()); + +	/** +	 * Disable the event dispatcher. +	 */ +	public function disable(); + +	/** +	 * Enable the event dispatcher. +	 */ +	public function enable();  } diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php deleted file mode 100644 index ee9f29a59d..0000000000 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace phpbb\event; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\EventListener\RouterListener; -use Symfony\Component\Routing\RequestContext; - -class kernel_request_subscriber implements EventSubscriberInterface -{ -	/** -	* Extension manager object -	* @var \phpbb\extension\manager -	*/ -	protected $manager; - -	/** -	* PHP file extension -	* @var string -	*/ -	protected $php_ext; - -	/** -	* Root path -	* @var string -	*/ -	protected $root_path; - -	/** -	* Construct method -	* -	* @param \phpbb\extension\manager $manager Extension manager object -	* @param string $root_path Root path -	* @param string $php_ext PHP file extension -	*/ -	public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext) -	{ -		$this->root_path = $root_path; -		$this->php_ext = $php_ext; -		$this->manager = $manager; -	} - -	/** -	* This listener is run when the KernelEvents::REQUEST event is triggered -	* -	* This is responsible for setting up the routing information -	* -	* @param GetResponseEvent $event -	* @throws \BadMethodCallException -	* @return null -	*/ -	public function on_kernel_request(GetResponseEvent $event) -	{ -		$request = $event->getRequest(); -		$context = new RequestContext(); -		$context->fromRequest($request); - -		$matcher = phpbb_get_url_matcher($this->manager, $context, $this->root_path, $this->php_ext); -		$router_listener = new RouterListener($matcher, $context); -		$router_listener->onKernelRequest($event); -	} - -	public static function getSubscribedEvents() -	{ -		return array( -			KernelEvents::REQUEST		=> 'on_kernel_request', -		); -	} -} diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index f7021875f3..84b10e79c1 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -89,7 +89,7 @@ class md_exporter  	{  		$this->crawl_eventsmd($md_file, 'styles'); -		$styles = array('prosilver', 'subsilver2'); +		$styles = array('prosilver');  		foreach ($styles as $style)  		{  			$file_list = $this->get_recursive_file_list( @@ -179,7 +179,7 @@ class md_exporter  		{  			$wiki_page = '= Template Events =' . "\n";  			$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; -			$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Subsilver Placement (If applicable) !! Added in Release !! Explanation' . "\n"; +			$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n";  		}  		foreach ($this->events as $event_name => $event) @@ -193,7 +193,7 @@ class md_exporter  			}  			else  			{ -				$wiki_page .= implode(', ', $event['files']['prosilver']) . ' || ' . implode(', ', $event['files']['subsilver2']); +				$wiki_page .= implode(', ', $event['files']['prosilver']);  			}  			$wiki_page .= " || {$event['since']} || " . str_replace("\n", ' ', $event['description']) . "\n"; @@ -246,7 +246,6 @@ class md_exporter  	{  		$files_list = array(  			'prosilver'		=> array(), -			'subsilver2'	=> array(),  			'adm'			=> array(),  		); @@ -266,10 +265,6 @@ class md_exporter  				{  					$files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/'));  				} -				else if (($this->filter !== 'adm') && strpos($file, 'styles/subsilver2/template/') === 0) -				{ -					$files_list['subsilver2'][] = substr($file, strlen('styles/subsilver2/template/')); -				}  				else if (($this->filter === 'adm') && strpos($file, 'adm/style/') === 0)  				{  					$files_list['adm'][] = substr($file, strlen('adm/style/')); | 
