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