diff --git a/lib/zin/core/htm.class.php b/lib/zin/core/htm.class.php index e36aed5ecb..eb3e4a6b20 100644 --- a/lib/zin/core/htm.class.php +++ b/lib/zin/core/htm.class.php @@ -45,7 +45,13 @@ function hookContent(): htm return h::comment('{{HOOK_CONTENT}}'); } -function rParse($rawContent) +/** + * 解析 rawContent 中的 rStart 和 rBottom 标记,提取内容块。 + * + * @param string $rawContent 原始内容字符串 + * @return array 包含所有内容块的数组,键为块名,值为块内容 + */ +function rParse($rawContent): array { $rawContents = []; /* 解析所有的 rStart 标记,提取内容块。 */ @@ -63,17 +69,35 @@ function rParse($rawContent) return $rawContents; } -function rTop($name) +/** + * 生成 rStart 标记。 + * + * @param string $name 标记名称 + * @return htm 包含 rStart 标记的 htm 对象 + */ +function rTop($name): htm { return h::comment('{RTOP:' . $name . '}'); } -function rBottom($name) +/** + * 生成 rBottom 标记。 + * + * @param string $name 标记名称 + * @return htm 包含 rBottom 标记的 htm 对象 + */ +function rBottom($name): htm { return h::comment('{RBOTTOM:' . $name . '}'); } -function rHolder($name) +/** + * 生成 rContent 标记。 + * + * @param string $name 标记名称 + * @return string 包含 rContent 标记的字符串 + */ +function rHolder($name): string { context()->rawContentCalled = true; $name = strtoupper($name);