代码复制自PC伪静态函数- function output_replace($content) {
- global $_G;
- if(defined('IN_MODCP') || defined('IN_ADMINCP')) return $content;
- if(!empty($_G['setting']['output']['str']['search'])) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['str']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['str']['replace']);
- }
- $content = str_replace($_G['setting']['output']['str']['search'], $_G['setting']['output']['str']['replace'], $content);
- }
- if(!empty($_G['setting']['output']['preg']['search']) && (empty($_G['setting']['rewriteguest']) || empty($_G['uid']))) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['preg']['search'] = str_replace('\{CURHOST\}', preg_quote($_G['siteurl'], '/'), $_G['setting']['output']['preg']['search']);
- $_G['setting']['output']['preg']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['preg']['replace']);
- }
- foreach($_G['setting']['output']['preg']['search'] as $key => $value) {
- $content = preg_replace_callback(
- $value,
- function ($matches) use ($_G, $key) {
- return eval('return ' . $_G['setting']['output']['preg']['replace'][$key] . ';');
- },
- $content
- );
- }
- }
- return $content;
- }
复制代码 |