mirror of
https://github.com/flarum/core.git
synced 2025-08-16 21:34:08 +02:00
Move events to Flarum\Formatter\Event namespace
This commit is contained in:
30
src/Formatter/Event/Configuring.php
Normal file
30
src/Formatter/Event/Configuring.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Formatter\Event;
|
||||
|
||||
use s9e\TextFormatter\Configurator;
|
||||
|
||||
class Configuring
|
||||
{
|
||||
/**
|
||||
* @var Configurator
|
||||
*/
|
||||
public $configurator;
|
||||
|
||||
/**
|
||||
* @param Configurator $configurator
|
||||
*/
|
||||
public function __construct(Configurator $configurator)
|
||||
{
|
||||
$this->configurator = $configurator;
|
||||
}
|
||||
}
|
44
src/Formatter/Event/Parsing.php
Normal file
44
src/Formatter/Event/Parsing.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Formatter\Event;
|
||||
|
||||
use s9e\TextFormatter\Parser;
|
||||
|
||||
class Parsing
|
||||
{
|
||||
/**
|
||||
* @var Parser
|
||||
*/
|
||||
public $parser;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $context;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $text;
|
||||
|
||||
/**
|
||||
* @param Parser $parser
|
||||
* @param mixed $context
|
||||
* @param string $text
|
||||
*/
|
||||
public function __construct(Parser $parser, $context, &$text)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
$this->context = $context;
|
||||
$this->text = &$text;
|
||||
}
|
||||
}
|
44
src/Formatter/Event/Rendering.php
Normal file
44
src/Formatter/Event/Rendering.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Formatter\Event;
|
||||
|
||||
use s9e\TextFormatter\Renderer;
|
||||
|
||||
class Rendering
|
||||
{
|
||||
/**
|
||||
* @var Renderer
|
||||
*/
|
||||
public $renderer;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $context;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $xml;
|
||||
|
||||
/**
|
||||
* @param Renderer $renderer
|
||||
* @param mixed $context
|
||||
* @param string $xml
|
||||
*/
|
||||
public function __construct(Renderer $renderer, $context, &$xml)
|
||||
{
|
||||
$this->renderer = $renderer;
|
||||
$this->context = $context;
|
||||
$this->xml = &$xml;
|
||||
}
|
||||
}
|
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Flarum\Formatter;
|
||||
|
||||
use Flarum\Event\ConfigureFormatter;
|
||||
use Flarum\Event\ConfigureFormatterParser;
|
||||
use Flarum\Event\ConfigureFormatterRenderer;
|
||||
use Flarum\Formatter\Event\Configuring;
|
||||
use Flarum\Formatter\Event\Parsing;
|
||||
use Flarum\Formatter\Event\Rendering;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use s9e\TextFormatter\Configurator;
|
||||
@@ -59,7 +59,7 @@ class Formatter
|
||||
{
|
||||
$parser = $this->getParser($context);
|
||||
|
||||
$this->events->fire(new ConfigureFormatterParser($parser, $context, $text));
|
||||
$this->events->fire(new Parsing($parser, $context, $text));
|
||||
|
||||
return $parser->parse($text);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class Formatter
|
||||
{
|
||||
$renderer = $this->getRenderer($context);
|
||||
|
||||
$this->events->fire(new ConfigureFormatterRenderer($renderer, $context, $xml));
|
||||
$this->events->fire(new Rendering($renderer, $context, $xml));
|
||||
|
||||
return $renderer->render($xml);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class Formatter
|
||||
$configurator->Autolink;
|
||||
$configurator->tags->onDuplicate('replace');
|
||||
|
||||
$this->events->fire(new ConfigureFormatter($configurator));
|
||||
$this->events->fire(new Configuring($configurator));
|
||||
|
||||
$this->configureExternalLinks($configurator);
|
||||
|
||||
|
Reference in New Issue
Block a user