mirror of
https://github.com/flarum/framework.git
synced 2025-03-10 04:05:30 +08:00
Remove deprecated formatting events
This commit is contained in:
parent
555c7767df
commit
2ee8358dbb
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* For detailed copyright and license information, please view the
|
|
||||||
* LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Formatter\Event;
|
|
||||||
|
|
||||||
use s9e\TextFormatter\Configurator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
|
|
||||||
*/
|
|
||||||
class Configuring
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var Configurator
|
|
||||||
*/
|
|
||||||
public $configurator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Configurator $configurator
|
|
||||||
*/
|
|
||||||
public function __construct(Configurator $configurator)
|
|
||||||
{
|
|
||||||
$this->configurator = $configurator;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* For detailed copyright and license information, please view the
|
|
||||||
* LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Formatter\Event;
|
|
||||||
|
|
||||||
use s9e\TextFormatter\Parser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* For detailed copyright and license information, please view the
|
|
||||||
* LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Formatter\Event;
|
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
use s9e\TextFormatter\Renderer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated beta 15, removed beta 16. Use the Formatter extender instead.
|
|
||||||
*/
|
|
||||||
class Rendering
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var Renderer
|
|
||||||
*/
|
|
||||||
public $renderer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var mixed
|
|
||||||
*/
|
|
||||||
public $context;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $xml;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ServerRequestInterface
|
|
||||||
*/
|
|
||||||
public $request;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Renderer $renderer
|
|
||||||
* @param mixed $context
|
|
||||||
* @param string $xml
|
|
||||||
* @param ServerRequestInterface|null $request
|
|
||||||
*/
|
|
||||||
public function __construct(Renderer $renderer, $context, &$xml, ServerRequestInterface $request = null)
|
|
||||||
{
|
|
||||||
$this->renderer = $renderer;
|
|
||||||
$this->context = $context;
|
|
||||||
$this->xml = &$xml;
|
|
||||||
$this->request = $request;
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,11 +9,7 @@
|
|||||||
|
|
||||||
namespace Flarum\Formatter;
|
namespace Flarum\Formatter;
|
||||||
|
|
||||||
use Flarum\Formatter\Event\Configuring;
|
|
||||||
use Flarum\Formatter\Event\Parsing;
|
|
||||||
use Flarum\Formatter\Event\Rendering;
|
|
||||||
use Illuminate\Contracts\Cache\Repository;
|
use Illuminate\Contracts\Cache\Repository;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use s9e\TextFormatter\Configurator;
|
use s9e\TextFormatter\Configurator;
|
||||||
use s9e\TextFormatter\Unparser;
|
use s9e\TextFormatter\Unparser;
|
||||||
@ -31,11 +27,6 @@ class Formatter
|
|||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Dispatcher
|
|
||||||
*/
|
|
||||||
protected $events;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -43,13 +34,11 @@ class Formatter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Repository $cache
|
* @param Repository $cache
|
||||||
* @param Dispatcher $events
|
|
||||||
* @param string $cacheDir
|
* @param string $cacheDir
|
||||||
*/
|
*/
|
||||||
public function __construct(Repository $cache, Dispatcher $events, $cacheDir)
|
public function __construct(Repository $cache, $cacheDir)
|
||||||
{
|
{
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->events = $events;
|
|
||||||
$this->cacheDir = $cacheDir;
|
$this->cacheDir = $cacheDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,9 +68,6 @@ class Formatter
|
|||||||
{
|
{
|
||||||
$parser = $this->getParser($context);
|
$parser = $this->getParser($context);
|
||||||
|
|
||||||
// Deprecated in beta 15, remove in beta 16
|
|
||||||
$this->events->dispatch(new Parsing($parser, $context, $text));
|
|
||||||
|
|
||||||
foreach ($this->parsingCallbacks as $callback) {
|
foreach ($this->parsingCallbacks as $callback) {
|
||||||
$text = $callback($parser, $context, $text);
|
$text = $callback($parser, $context, $text);
|
||||||
}
|
}
|
||||||
@ -101,9 +87,6 @@ class Formatter
|
|||||||
{
|
{
|
||||||
$renderer = $this->getRenderer();
|
$renderer = $this->getRenderer();
|
||||||
|
|
||||||
// Deprecated in beta 15, remove in beta 16
|
|
||||||
$this->events->dispatch(new Rendering($renderer, $context, $xml, $request));
|
|
||||||
|
|
||||||
foreach ($this->renderingCallbacks as $callback) {
|
foreach ($this->renderingCallbacks as $callback) {
|
||||||
$xml = $callback($renderer, $context, $xml, $request);
|
$xml = $callback($renderer, $context, $xml, $request);
|
||||||
}
|
}
|
||||||
@ -153,9 +136,6 @@ class Formatter
|
|||||||
$configurator->Autolink;
|
$configurator->Autolink;
|
||||||
$configurator->tags->onDuplicate('replace');
|
$configurator->tags->onDuplicate('replace');
|
||||||
|
|
||||||
// Deprecated in beta 15, remove in beta 16
|
|
||||||
$this->events->dispatch(new Configuring($configurator));
|
|
||||||
|
|
||||||
foreach ($this->configurationCallbacks as $callback) {
|
foreach ($this->configurationCallbacks as $callback) {
|
||||||
$callback($configurator);
|
$callback($configurator);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ class FormatterServiceProvider extends AbstractServiceProvider
|
|||||||
$this->app->singleton('flarum.formatter', function (Container $container) {
|
$this->app->singleton('flarum.formatter', function (Container $container) {
|
||||||
return new Formatter(
|
return new Formatter(
|
||||||
new Repository($container->make('cache.filestore')),
|
new Repository($container->make('cache.filestore')),
|
||||||
$container->make('events'),
|
|
||||||
$this->app[Paths::class]->storage.'/formatter'
|
$this->app[Paths::class]->storage.'/formatter'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user