mirror of
https://github.com/flextype/flextype.git
synced 2025-08-06 21:26:48 +02:00
feat(shortcodes): [strings]
shortcode - add base64Encode
modifier
This commit is contained in:
@@ -89,6 +89,9 @@ parsers()->shortcodes()->addHandler('strings', static function (ShortcodeInterfa
|
||||
$content = strings($content)->{'base64Decode'}()->toString();
|
||||
}
|
||||
|
||||
if ($key == 'base64Encode') {
|
||||
$content = strings($content)->{'base64Encode'}()->toString();
|
||||
}
|
||||
}
|
||||
|
||||
return (string) $content;
|
||||
|
@@ -42,4 +42,7 @@ test('[strings] shortcode', function () {
|
||||
|
||||
// base64Decode
|
||||
$this->assertEquals("test", parsers()->shortcodes()->parse('[strings base64Decode]dGVzdA==[/strings]'));
|
||||
|
||||
// base64Encode
|
||||
$this->assertEquals("dGVzdA==", parsers()->shortcodes()->parse('[strings base64Encode]test[/strings]'));
|
||||
});
|
Reference in New Issue
Block a user