nabeghe/wp-shortcodes

WordPress短码系统的一个独立版本,用于WordPress之外的使用。

1.0.0 2024-09-22 07:39 UTC

This package is auto-updated.

Last update: 2024-09-22 07:41:43 UTC


README

WordPress短码系统(源代码)的独立版本,用于WordPress之外的使用。

注意:从短码系统中移除了与kses相关的部分,目前不支持。

🫡 使用方法

🚀 安装

您可以通过composer安装此包

composer require nabeghe/wp-shortcodes

📁 本地化目录

示例

use Nabeghe\WPShortcodes\Shortcodes;

$shortcodes = new Shortcodes();
$shortcodes->add('hash', function ($atts, $content = null) {
    $atts['algo'] ??= 'md5';
    return hash($atts['algo'], $content);
});

$result = $shortcodes->do('
MD5 = [hash algo="md5"]https://github.com/nabeghe/wp-shortcodes[/hash]
SJA256 = [hash algo="sha256"]https://github.com/nabeghe/wp-shortcodes[/hash]
');
echo $result;

📖 许可证

版权所有 (c) 2024 Hadi Akbarzadeh

许可协议:GPL-2.0+,详细信息请参阅LICENSE.md