JoshyPHP
Update
After a lot of testing, I finally got it working!
This is the FormatPosts.php
<?php
namespace MrPowerGamerBR\HelloWorld\Listener;
use Flarum\Event\ConfigureFormatter;
use Illuminate\Contracts\Events\Dispatcher;
class FormatPosts
{
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureFormatter::class, [$this, 'addEmoticons']);
}
/**
* @param ConfigureFormatter $event
*/
public function addEmoticons(ConfigureFormatter $event)
{
$event->configurator->Censor->add('apple*');
// echo "Hello!";
}
}
Yeah... "addEmoticons", I copied that class from the Emoticons extension.
bootstrap.php
<?php
use Flarum\Event\ScopePostVisibility;
use Illuminate\Contracts\Events\Dispatcher;
use MrPowerGamerBR\HelloWorld\Listener;
use Illuminate\Contracts\View\Factory;
error_reporting(-1);
ini_set('display_errors', 'On');
return function (Dispatcher $events) {
$events->subscribe(Listener\FormatPosts::class);
};
Thanks to @Davis (on Gitter for showing me the Censor extension plugin) and @JoshyPHP for helping me!