24,922
社区成员
发帖
与我相关
我的任务
分享
return preg_replace(array(
'/(^|_|-)+(.)/e', '/\.(.)/e'
), array(
"strtoupper('\\2')", "'_'.strtoupper('\\1')"
), $id);
$pattern = array(
'/<!--[^>|\n]*?({.+?})[^<|{|\n]*?-->/', // 替换smarty注释
'/<!--[^<|>|{|\n]*?-->/', // 替换不换行的html注释
'/(href=["|\'])\.\.\/(.*?)(["|\'])/i', // 替换相对链接
'/((?:background|src)\s*=\s*["|\'])(?:\.\/|\.\.\/)?(images\/.*?["|\'])/is', // 在images前加上 $tmp_dir
'/((?:background|background-image):\s*?url\()(?:\.\/|\.\.\/)?(images\/)/is', // 在images前加上 $tmp_dir
//'/{nocache}(.+?){\/nocache}/ise', //无缓存模块
'/{nocache}(.+?){\/nocache}/', //无缓存模块
);
$replace = array(
'\1',
'',
'\1\2\3',
'\1' . $tmp_dir . '\2',
'\1' . $tmp_dir . '\2',
"'{insert name=\"nocache\" ' . '" . $this->_echash . "' . base64_encode('\\1') . '}'",
);
$source = preg_replace_callback($pattern[0], function($match){return $match[1];}, $source);
$source = preg_replace_callback($pattern[1], function($match){return '';}, $source);
$source = preg_replace_callback($pattern[2], function($match){return $match[1].$match[2].$match[3];}, $source);
$source = preg_replace_callback($pattern[3], function($match){return $match[1]. $tmp_dir .$match[2];}, $source);
$source = preg_replace_callback($pattern[4], function($match){return $match[1]. $tmp_dir .$match[2];}, $source);
$source = preg_replace_callback($pattern[5], function($match){return "'{insert name=\"nocache\" ' . '" . $this->_echash . "' . base64_encode($match[1]) . '}'";}, $source);
return $source ;
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
如果还有其他的地方报这样的错,就参照这个改