diff --git a/framework/core/src/Core/CoreServiceProvider.php b/framework/core/src/Core/CoreServiceProvider.php index 572a8bf1c..6224f7d58 100644 --- a/framework/core/src/Core/CoreServiceProvider.php +++ b/framework/core/src/Core/CoreServiceProvider.php @@ -33,6 +33,8 @@ class CoreServiceProvider extends ServiceProvider $this->registerGambits(); $this->setupModels(); + $this->app['flarum.formatter']->add('linkify', 'Flarum\Core\Formatter\LinkifyFormatter'); + $bus->mapUsing(function ($command) { return Bus::simpleMapping( $command, 'Flarum\Core\Commands', 'Flarum\Core\Handlers\Commands' @@ -54,11 +56,7 @@ class CoreServiceProvider extends ServiceProvider // forum, registering, and starting discussions.) $this->app->singleton('flarum.forum', 'Flarum\Core\Models\Forum'); - $this->app->singleton('flarum.formatter', function () { - $formatter = new FormatterManager($this->app); - $formatter->add('basic', 'Flarum\Core\Formatter\BasicFormatter'); - return $formatter; - }); + $this->app->singleton('flarum.formatter', 'Flarum\Core\Formatter\FormatterManager'); $this->app->bind( 'Flarum\Core\Repositories\DiscussionRepositoryInterface', diff --git a/framework/core/src/Core/Formatter/BasicFormatter.php b/framework/core/src/Core/Formatter/BasicFormatter.php deleted file mode 100644 index 41316704f..000000000 --- a/framework/core/src/Core/Formatter/BasicFormatter.php +++ /dev/null @@ -1,25 +0,0 @@ -process($text, ['attr' => ['target' => '_blank']]); - - $text = preg_replace_callback('/(?:^ *[-*]\s*([^\n]*)(?:\n|$)){2,}/m', function ($matches) { - return '
'; - }, $text); - - $text = '
'.preg_replace(['/[\n]{2,}/', '/\n/'], ['
', '
'], trim($text)).'
\s*<\/p>/i", "/(?<=
)\s*(?:
)*/i", "/\s*(?:
)*\s*(?=<\/p>)/i"), "", $text);
- $text = str_replace("