模板函数文件
<?php /** * 模板替换中需要用到的函数 * * @package functions * @copyright Copyright (c) 2007-2008 () * @author Akon(番茄红了) <aultoale@gmail.com> * @license PHP Version 3.0 {@link } */ function transamp($template) { $template = str_replace('&', '&', $template); $template = str_replace('&amp;', '&', $template); $template = str_replace('\"', '"', $template); return $template; } function stripvtags($expr, $statement) { $expr = str_replace("\\\"", "http://enenba.com/\"", preg_replace("/\<\?\=(\\\$.+?)\?\>/s", "\\1", $expr)); $statement = str_replace("\\\"", "http://enenba.com/\"", $statement); return $expr . $statement; } function addquote($var) { return str_replace("\\\"", "http://enenba.com/\"", preg_replace("/\[([a-zA-Z0-9_\-\.\x7f-\xff]+)\]/s", "['\\1']", $var)); } function stripscriptamp($s) { $s = str_replace('&', '&', $s); return "<script src=http://enenba.com/\"$s\" type=http://enenba.com/\"text/javascript\"></script>"; } function stripblock($var, $s) { $s = str_replace('\\"', '"', $s); $s = preg_replace("/<\?=http://enenba.com/\\\$(.+?)\?>/", "{\$\\1}", $s); preg_match_all("/<\?=(.+?)\?>/e", $s, $constary); $constadd = ''; $constary[1] = array_unique($constary[1]); foreach($constary[1] as $const) { $constadd .= '$__' . $const .' = ' . $const . ';'; } $s = preg_replace("/<\?=(.+?)\?>/", "{\$__\\1}", $s); $s = str_replace('?>', "\n\$$var .= <<<EOF\n", $s); $s = str_replace('<?', "\nEOF;\n", $s); return "<?\n$constadd\$$var = <<<EOF\n" . $s . "\nEOF;\n?>"; } ?>end