Added Zalgo bbcode
This commit is contained in:
parent
177700c652
commit
a5b4af743a
2 changed files with 19 additions and 0 deletions
|
@ -35,6 +35,7 @@ class BBCodeParser implements ParserInterface
|
|||
new Tags\UnderlineTag,
|
||||
new Tags\StrikeTag,
|
||||
new Tags\ImageTag,
|
||||
new Tags\ZalgoTag,
|
||||
|
||||
// Links
|
||||
new Tags\NamedUrlTag,
|
||||
|
|
18
src/Parsers/BBCode/Tags/ZalgoTag.php
Normal file
18
src/Parsers/BBCode/Tags/ZalgoTag.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeTag;
|
||||
|
||||
final class ZalgoTag extends BBCodeTag
|
||||
{
|
||||
public function parseText(string $text): string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
'#\[zalgo\](.+?)\[\/zalgo\]#s',
|
||||
function ($matches) {
|
||||
return zalgo_run($matches[1]);
|
||||
},
|
||||
$text
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue