1
0
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:
Awilum
2022-05-04 22:01:18 +03:00
parent 07117c13a6
commit 9d6ef33012
2 changed files with 6 additions and 0 deletions

View File

@@ -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;

View File

@@ -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]'));
});