Commit edd68cae authored by User expired's avatar User expired
Browse files

new html object tags enabled

parent 3cf3124c
......@@ -62,6 +62,9 @@ function F_decode_tcecode($text_to_decode) {
// [mathml]MathML_code[/mathml]
$newtext = preg_replace_callback("#\[mathml\](.*?)\[/mathml\]#si", 'F_mathml_callback', $newtext);
// [html]html_code[/html]
$newtext = preg_replace_callback("#\[html\](.*?)\[/html\]#si", 'F_html_callback', $newtext);
// [object]object_url[/object:width:height:alt]
$newtext = preg_replace_callback("#\[object\](.*?)\.(.*?)\[/object\:(.*?)\:(.*?)\:(.*?)\]#si", 'F_objects_callback', $newtext);
// [object]object_url[/object:width:height]
......@@ -302,6 +305,26 @@ function F_mathml_callback($matches) {
return $mathml;
}
/**
* Callback function for preg_replace_callback (html replacement).
* Returns replacement code for html code.
* @param $matches (string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' (the html code)
* @return string html code.
*/
function F_html_callback($matches) {
//list of valid tags
$html_tags = '<em><h1><h2><h3><h4><h5><img><p><strong><table><thead><tbody><td><th><tr>';
$html_tags .= "<audio><video>";
$html = unhtmlentities($matches[1]);
$html = str_replace("&gt;", '>', $html);
$html = str_replace("&lt;", '<', $html);
// remove all non-html tags
$html = strip_tags($html, $html_tags);
$html = preg_replace("/[\n\r\s]+/", ' ', $html);
$html = trim($html);
return $html;
}
/**
* Callback function for preg_replace_callback.
* Returns replacement code by MIME type.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment