)/",$input,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $output = ""; while ($block = array_shift($splits)) { if ($block == "") die("phpProtect : parse error"); $output .= "{PHP:".base64_encode($code).":PHP}"; } else { $output .= $block; } } return $output; } /** Unprotect PHP code. */ function phpUnprotect($input) { $splits = preg_split("/({PHP:.+:PHP})/",$input,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $output = ""; foreach ($splits as $block) { if (preg_match("/{PHP:(.+):PHP}/",$block,$match)) { $output .= ""; } else { $output .= $block; } } return $output; } /** Convert XHTML-compliant tags to plain HTML. */ function xhtmlToHtml($input) { return html_accent(preg_replace("/<(br|img|input|p)( [^\/]*)?\/>/","<\$1\$2>",$input)); } /** Restore XHTML-compliant tags. */ function htmlToXhtml($input) { return preg_replace("/<(br|img|input)( [^>]+)?>/","<\$1\$2/>",$input); } ?>