func('file'); Util::mkDirs($path); } $content = self::wl_template_parse(file_get_contents($from), $inmodule); if (defined('IN_APP')) { if (!empty($_W['wlsetting']['halfcard']['text']['halfcardtext'])) { $content = str_replace('一卡通', $_W['wlsetting']['halfcard']['text']['halfcardtext'], $content); } if (!empty($_W['wlsetting']['halfcard']['text']['privilege'])) { $content = str_replace('特权', $_W['wlsetting']['halfcard']['text']['privilege'], $content); } if (!empty($_W['wlsetting']['trade']['credittext'])) { $content = str_replace('积分', $_W['wlsetting']['trade']['credittext'], $content); } if (!empty($_W['wlsetting']['trade']['moneytext'])) { $content = str_replace('余额', $_W['wlsetting']['trade']['moneytext'], $content); } } file_put_contents($to, $content); } /** * 转译模板 * * @access static public * @name wl_template_parse */ static function wl_template_parse($str, $inmodule = false) { $str = preg_replace('//s', '{$1}', $str); $str = preg_replace('/{template\s+(.+?)}/', '', $str); $str = preg_replace('/{php\s+(.+?)}/', '', $str); $str = preg_replace('/{if\s+(.+?)}/', '', $str); $str = preg_replace('/{else}/', '', $str); $str = preg_replace('/{else ?if\s+(.+?)}/', '', $str); $str = preg_replace('/{\/if}/', '', $str); $str = preg_replace('/{loop\s+(\S+)\s+(\S+)}/', '', $str); $str = preg_replace('/{loop\s+(\S+)\s+(\S+)\s+(\S+)}/', ' $3) { ?>', $str); $str = preg_replace('/{\/loop}/', '', $str); $str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)}/', '', $str); $str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\[\]\'\"\$]*)}/', '', $str); $str = preg_replace('/{url\s+(\S+)}/', '', $str); $str = preg_replace('/{url\s+(\S+)\s+(array\(.+?\))}/', '', $str); $str = @preg_replace_callback('/<\?php([^\?]+)\?>/s', "template_addquote", $str); $str = preg_replace('/{([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)}/s', '', $str); $str = str_replace('{##', '{', $str); $str = str_replace('##}', '}', $str); $str = "" . $str; return $str; } }