From c8ea6072febdb25e7459549d49a6e5fca06baa84 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Wed, 2 Dec 2009 06:56:58 +0000 Subject: [PATCH] + getDefaultCss() and getSysURL(). --- trunk/module/common/control.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/trunk/module/common/control.php b/trunk/module/common/control.php index 097258fe17..f2642323f7 100644 --- a/trunk/module/common/control.php +++ b/trunk/module/common/control.php @@ -206,4 +206,24 @@ EOT; ksort($diff); return implode("\n", $diff); } + + /* 获得系统URL地址。*/ + public function getSysURL() + { + global $config; + $httpType = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 'https' : 'http'; + $httpHost = $_SERVER['HTTP_HOST']; + return "$httpType://$httpHost"; + } + + /* 获得系统默认的样式表。*/ + public function getDefaultCss() + { + global $app; + $pathFix = $app->getPathFix(); + $cssFile = $app->getAppRoot() . "www{$pathFix}theme{$pathFix}default{$pathFix}style.css"; + $cssContent = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!','', file_get_contents($cssFile)); + $cssContent = str_replace(array(" {", "} ", ' ', "\r\n", "\r", "\n", "\t"), array("{", '}', ' ', ''), $cssContent); + return $cssContent; + } }