forked from stank2010/php_function
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_function.php
More file actions
24 lines (21 loc) · 1.49 KB
/
html_function.php
File metadata and controls
24 lines (21 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$singleton = array("area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr");
$tags = array("a", "abbr", "address", "article", "aside", "audio", "b", "bdi", "bdo", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "html", "i", "iframe", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video");
function t_init($singleton, $tags){
foreach($singleton as $tag) t_start($tag);
foreach($tags as $tag){
t_start($tag);
t_stop($tag);
}
}
function t_start($tag){
eval('function h_'.$tag.'($param = null){ echo "<'.$tag.'"; if($param != null) echo " ".$param; echo ">"; }');
}
function t_stop($tag){
eval('function h_'.$tag.'_end(){ echo "</'.$tag.'>"; }');
}
function h_print($context){
echo $context;
}
t_init($singleton, $tags);
?>