1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

feat(shortcodes): add [php] shortcode

This commit is contained in:
Awilum
2022-04-12 12:04:43 +03:00
parent 1f713f1aaa
commit b5d3678f4c
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
/**
* Flextype - Hybrid Content Management System with the freedom of a headless CMS
* and with the full functionality of a traditional CMS!
*
* Copyright (c) Sergey Romanenko (https://awilum.github.io)
*
* Licensed under The MIT License.
*
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*/
namespace Flextype\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
// Shortcode: [php] php code here [/php]
parsers()->shortcodes()->addHandler('php', static function (ShortcodeInterface $s) {
ob_start();
eval($s->getContent());
return ob_get_clean();
});

View File

@@ -516,6 +516,9 @@ parsers:
entries:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/EntriesShortcode.php"
php:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/PhpShortcode.php"
raw:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/RawShortcode.php"