test
function daimasj($html){ $html=preg_replace_callback("/(?:\s*<p>\s*)?\s*(?:\<([^\s<>]*)[^<>]*\>|\ \;)(\={3,}[^\r\n\=]+\={3,})<\/\\1>(?:\s*<\/p>)?/isx",function($em){ $em[2]=strip_tags($em[2]); return "\r\n<p>{$em[2]}</p>"; },$html); $html=preg_replace_callback("/(<div\sclass=\"codeText\">(?:(?<!codeText).)*)(?:<\/ol[^<>]*>\s*<\/div>\s*<\/div>|<\/ol[^<>]*>\s*<\/div>|<\/ol[^<>]*>\s*|(?=<p>\=\=\=))/Uisx",function($em){ return "{$em[1]}</ol></div></div>"; },$html); $html=preg_replace_callback("/\s*?<li(?:\s+class=\"alt\")?>(\ \;|\s|<\/?span>)*<\/li>\s*?/Uisx",function($em){ return ""; },$html); $html=preg_replace_callback("/(<code[^<>]*>)(.*)(<\/code>)/Uisx",function($em){ $em[2]=preg_replace("/<br>/i","",$em[2]); return $em[1].$em[2].$em[3]; },$html); $html=preg_replace_callback("/(<div\s*class=\"codeText\">).*<ol[^<>]*>(.*)(<\/ol>\s*<\/div>\s*<\/div>)/Uisx",function($em){ $em[2]=preg_replace("/<li[^<>]*>(.*)<\/li>/Uimx","\r\n\\1",$em[2]); return "[code=\"\"]{$em[2]}[/code]"; },$html); $html=preg_replace_callback("/\[code\=\"?([a-zA-Z\.]*)\"?\](.*)\[\/code\]/Uisx",function($em){ $em[2]=preg_replace("/^(\s*|\r\s*\n|\n\s*\r)$/m","",$em[2]); $em[2]=preg_replace("/(\r|\n){3,}/is","\r\n",$em[2]); $em[2]=preg_replace("/<p><\/p>/Uisx","",$em[2]); $tmplate="<pre class=\" language-{$em[1]}\" data-language=\"{$em[1]}\"> <code class=\" language-{$em[1]}\"> {$em[2]} </code></pre>"; return $tmplate; },$html); $html=preg_replace_callback("/\s*?<li(?:\s+class=\"alt\")?>(\ \;|\s|<\/?span>)*<\/li>\s*?/Uisx",function($em){ return ""; },$html); $html=preg_replace_callback("/<(span|h[0-9]+)\s([^<>]*)>/Uisx",function($em){ return "<$em[1]>"; },$html); return $html; }