From ca52ce3cb5d67ba85e5ee48992df2dae6dc3efcd Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 19 Apr 2024 11:15:17 +0800 Subject: [PATCH] * zin: support to create h5 node with createWg. --- lib/zin/core/h.class.php | 2 ++ lib/zin/core/h.func.php | 1 + lib/zin/core/loader.func.php | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/lib/zin/core/h.class.php b/lib/zin/core/h.class.php index 8aaef9640b..a95a77cac0 100644 --- a/lib/zin/core/h.class.php +++ b/lib/zin/core/h.class.php @@ -18,6 +18,8 @@ require_once __DIR__ . DS . 'directive.class.php'; class h extends node { + public static array $h5Tags = array('div', 'span', 'strong', 'small', 'code', 'canvas', 'br', 'a', 'p', 'img', 'button', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'li', 'template', 'fieldset', 'legend'); + public static array $defineProps = array ( 'tagName' => 'string', diff --git a/lib/zin/core/h.func.php b/lib/zin/core/h.func.php index 6630311fd6..8066bd85a5 100644 --- a/lib/zin/core/h.func.php +++ b/lib/zin/core/h.func.php @@ -32,6 +32,7 @@ function h3(mixed ...$args): h {return h::h3(...$args);} function h4(mixed ...$args): h {return h::h4(...$args);} function h5(mixed ...$args): h {return h::h5(...$args);} function h6(mixed ...$args): h {return h::h6(...$args);} +function ol(mixed ...$args): h {return h::ol(...$args);} function ul(mixed ...$args): h {return h::ul(...$args);} function li(mixed ...$args): h {return h::li(...$args);} function template(mixed ...$args): h {return h::template(...$args);} diff --git a/lib/zin/core/loader.func.php b/lib/zin/core/loader.func.php index 9bcfe42598..18f0e6191e 100644 --- a/lib/zin/core/loader.func.php +++ b/lib/zin/core/loader.func.php @@ -42,6 +42,11 @@ function createWg($name, $args, ?string $fallbackWgName = null): node $wgVer = getWgVer($name); $wgName = "\\zin\\$name"; + if(in_array($name, h::$h5Tags)) + { + return h::$name($args); + } + if(!class_exists($wgName)) { include_once dirname(__DIR__) . DS . 'wg' . DS . $name . DS . "v$wgVer.php";