Example #1
0
        $smarty->assign('user', $_USER = $dou_user->global_user_info());
    }
    // 通用信息调用
    $smarty->assign("lang", $_LANG);
    $smarty->assign("site", $_CFG);
    $_URL = $dou->dou_url();
    $_URL['catalog'] = $dou->rewrite_url('catalog');
    $smarty->assign("url", $_URL);
    // 模块URL
    $smarty->assign("open", $_OPEN = $_MODULE['open']);
    // 模块开启状态
    $_DISPLAY = unserialize($_CFG['mobile_display']);
    // 显示设置
    $_DEFINED = unserialize($_CFG['defined']);
    // 自定义属性
    // Smarty 过滤器
    function remove_html_comments($source, &$smarty)
    {
        global $_CFG;
        $theme_path = M_URL . 'theme';
        $source = preg_replace('/\\"\\.*\\/images\\//Ums', '"images/', $source);
        $source = preg_replace('/\\"images\\//Ums', "\"theme/{$_CFG['mobile_theme']}/images/", $source);
        $source = preg_replace('/link href\\=\\"([A-Za-z0-9_-]+)\\.css/Ums', "link href=\"theme/{$_CFG['mobile_theme']}/\$1.css", $source);
        $source = preg_replace('/theme\\//Ums', "{$theme_path}/", $source);
        $source = preg_replace('/^<meta\\shttp-equiv=["|\']Content-Type["|\']\\scontent=["|\']text\\/html;\\scharset=(?:.*?)["|\'][^>]*?>\\r?\\n?/i', '', $source);
        return $source = preg_replace('/<!--.*{(.*)}.*-->/U', '{$1}', $source);
    }
    $smarty->register_prefilter('remove_html_comments');
}
// 开启缓冲区
ob_start();