mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
#19278316 remove optimizer
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7861 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4e4f9a9943
commit
298a0465e5
8 changed files with 33 additions and 443 deletions
|
|
@ -218,8 +218,6 @@
|
|||
if(file_exists($db_config_file)) @include($db_config_file);
|
||||
|
||||
if(!$db_info->time_zone) $db_info->time_zone = date("O");
|
||||
if(!$db_info->use_optimizer || $db_info->use_optimizer != 'N') $db_info->use_optimizer = 'Y';
|
||||
else $db_info->use_optimizer = 'N';
|
||||
if(!$db_info->qmail_compatibility || $db_info->qmail_compatibility != 'Y') $db_info->qmail_compatibility = 'N';
|
||||
else $db_info->qmail_compatibility = 'Y';
|
||||
if(!$db_info->use_ssl) $db_info->use_ssl = 'none';
|
||||
|
|
@ -1160,15 +1158,15 @@
|
|||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function addJsFile($file, $optimized = true, $targetie = '',$index=null) {
|
||||
function addJsFile($file, $optimized = false, $targetie = '',$index=null) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addJsFile($file, $optimized, $targetie,$index);
|
||||
return $oContext->_addJsFile($file, $targetie,$index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function _addJsFile($file, $optimized = true, $targetie = '',$index=null) {
|
||||
function _addJsFile($file, $targetie = '',$index=null) {
|
||||
if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file;
|
||||
$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
|
||||
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
|
||||
|
|
@ -1177,23 +1175,23 @@
|
|||
|
||||
if(is_null($index)) $index=count($this->js_files);
|
||||
for($i=$index;array_key_exists($i,$this->js_files);$i++);
|
||||
$this->js_files[$i] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
|
||||
$this->js_files[$i] = array('file' => $file, 'targetie' => $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 제거
|
||||
**/
|
||||
function unloadJsFile($file, $optimized = true, $targetie = '') {
|
||||
function unloadJsFile($file, $optimized = false, $targetie = '') {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_unloadJsFile($file, $optimized, $targetie);
|
||||
return $oContext->_unloadJsFile($file, $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 제거
|
||||
**/
|
||||
function _unloadJsFile($file, $optimized, $targetie) {
|
||||
function _unloadJsFile($file, $targetie) {
|
||||
foreach($this->js_files as $key => $val) {
|
||||
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['targetie'] == $targetie) {
|
||||
if(realpath($val['file'])==realpath($file) && $val['targetie'] == $targetie) {
|
||||
unset($this->js_files[$key]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1250,23 +1248,22 @@
|
|||
* @brief js file 목록을 return
|
||||
**/
|
||||
function _getJsFile() {
|
||||
require_once(_XE_PATH_."classes/optimizer/Optimizer.class.php");
|
||||
$oOptimizer = new Optimizer();
|
||||
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->js_files), "js");
|
||||
$files = $this->_getUniqueFileList($this->js_files);
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function addCSSFile($file, $optimized = true, $media = 'all', $targetie = '',$index = null) {
|
||||
function addCSSFile($file, $optimized = false, $media = 'all', $targetie = '',$index = null) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addCSSFile($file, $optimized, $media, $targetie,$index);
|
||||
return $oContext->_addCSSFile($file, $media, $targetie,$index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function _addCSSFile($file, $optimized = true, $media = 'all', $targetie = '', $index = null) {
|
||||
function _addCSSFile($file, $media = 'all', $targetie = '', $index = null) {
|
||||
if(strpos($file,'://')===false && substr($file,0,1)!='/' && substr($file,0,1)!='.') $file = './'.$file;
|
||||
$file = str_replace(array('/./','//'),'/',$file);
|
||||
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
|
||||
|
|
@ -1277,23 +1274,23 @@
|
|||
for($i=$index;array_key_exists($i,$this->css_files);$i++);
|
||||
|
||||
//if(preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
|
||||
$this->css_files[$i] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
|
||||
$this->css_files[$i] = array('file' => $file, 'media' => $media, 'targetie' => $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief css file을 제거
|
||||
**/
|
||||
function unloadCSSFile($file, $optimized = true, $media = 'all', $targetie = '') {
|
||||
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_unloadCSSFile($file, $optimized, $media, $targetie);
|
||||
return $oContext->_unloadCSSFile($file, $media, $targetie);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief css file을 제거
|
||||
**/
|
||||
function _unloadCSSFile($file, $optimized, $media, $targetie) {
|
||||
function _unloadCSSFile($file, $media, $targetie) {
|
||||
foreach($this->css_files as $key => $val) {
|
||||
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['media'] == $media && $val['targetie'] == $targetie) {
|
||||
if(realpath($val['file'])==realpath($file) && $val['media'] == $media && $val['targetie'] == $targetie) {
|
||||
unset($this->css_files[$key]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1324,9 +1321,8 @@
|
|||
* @brief CSS file 목록 return
|
||||
**/
|
||||
function _getCSSFile() {
|
||||
require_once(_XE_PATH_."classes/optimizer/Optimizer.class.php");
|
||||
$oOptimizer = new Optimizer();
|
||||
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->css_files), "css");
|
||||
$files = $this->_getUniqueFileList($this->css_files);
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1354,8 +1350,8 @@
|
|||
$filename = trim($list[$i]);
|
||||
if(!$filename) continue;
|
||||
if(substr($filename,0,2)=='./') $filename = substr($filename,2);
|
||||
if(preg_match('/\.js$/i',$filename)) $this->_addJsFile($plugin_path.$filename, true, '', null);
|
||||
elseif(preg_match('/\.css$/i',$filename)) $this->_addCSSFile($plugin_path.$filename, true, 'all','', null);
|
||||
if(preg_match('/\.js$/i',$filename)) $this->_addJsFile($plugin_path.$filename, '', null);
|
||||
elseif(preg_match('/\.css$/i',$filename)) $this->_addCSSFile($plugin_path.$filename, 'all','', null);
|
||||
}
|
||||
|
||||
if(is_dir($plugin_path.'lang')) $this->_loadLang($plugin_path.'lang');
|
||||
|
|
|
|||
|
|
@ -136,21 +136,21 @@ class HTMLDisplayHandler {
|
|||
{
|
||||
$oContext =& Context::getInstance();
|
||||
// add common JS/CSS files
|
||||
$oContext->_addJsFile("./common/js/jquery.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/jquery.js", '', -100000);
|
||||
//$oContext->_addJsFile("./common/js/jquery-1.4.2-full.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/x.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/common.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/js_app.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/xml_handler.js", true, '', -100000);
|
||||
$oContext->_addJsFile("./common/js/xml_js_filter.js", true, '', -100000);
|
||||
$oContext->_addCSSFile("./common/css/default.css", true, 'all', '', -100000);
|
||||
$oContext->_addCSSFile("./common/css/button.css", true, 'all', '', -100000);
|
||||
$oContext->_addJsFile("./common/js/x.js", '', -100000);
|
||||
$oContext->_addJsFile("./common/js/common.js", '', -100000);
|
||||
$oContext->_addJsFile("./common/js/js_app.js", '', -100000);
|
||||
$oContext->_addJsFile("./common/js/xml_handler.js", '', -100000);
|
||||
$oContext->_addJsFile("./common/js/xml_js_filter.js", '', -100000);
|
||||
$oContext->_addCSSFile("./common/css/default.css", 'all', '', -100000);
|
||||
$oContext->_addCSSFile("./common/css/button.css", 'all', '', -100000);
|
||||
|
||||
// for admin page, add admin css
|
||||
if(Context::get('module')=='admin' || strpos(Context::get('act'),'Admin')>0){
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/font.css", true, 'all', '',10000);
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/pagination.css", true, 'all', '', 100001);
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/admin.css", true, 'all', '', 100002);
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/font.css", 'all', '',10000);
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/pagination.css", 'all', '', 100001);
|
||||
$oContext->_addCSSFile("./modules/admin/tpl/css/admin.css", 'all', '', 100002);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @class Optimizer
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief class designed to be used to merge mutiple JS/CSS files into one file to shorten time taken for transmission.
|
||||
*
|
||||
**/
|
||||
|
||||
class Optimizer {
|
||||
|
||||
var $cache_path = "./files/cache/optimized/";
|
||||
var $script_file = "./common/script.php?l=%s&t=.%s";
|
||||
|
||||
/**
|
||||
* @brief Constructor which check if a directory, 'optimized' exists in designated path. If not create a new one
|
||||
**/
|
||||
function Optimizer() {
|
||||
if(!is_dir($this->cache_path)) {
|
||||
FileHandler::makeDir($this->cache_path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief file that removes 'optimized' in a given array
|
||||
* @param[in] $files an array to be modified
|
||||
**/
|
||||
function _getOptimizedRemoved($files) {
|
||||
foreach($files as $key => $val) unset($files[$key]['optimized']);
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief method that optimizes a given file and returns a resultant file
|
||||
* @param[in] source_files an array of source files to be optimized
|
||||
* @param[in] type a type of source file, either js or css.
|
||||
* @return Returns a optimized file
|
||||
**/
|
||||
function getOptimizedFiles($source_files, $type = "js") {
|
||||
if(!is_array($source_files) || !count($source_files)) return;
|
||||
|
||||
// 관리자 설정시 설정이 되어 있지 않으면 패스
|
||||
// 캐시 디렉토리가 없으면 실행하지 않음
|
||||
$db_info = Context::getDBInfo();
|
||||
if($db_info->use_optimizer == 'N' || !is_dir($this->cache_path)) return $this->_getOptimizedRemoved($source_files);
|
||||
|
||||
if(!count($source_files)) return;
|
||||
|
||||
$files = array();
|
||||
$hash = "";
|
||||
foreach($source_files as $key => $file) {
|
||||
if($file['file'][0] == '/'){
|
||||
if(!file_exists($file['file'])){
|
||||
if(file_exists($_SERVER['DOCUMENT_ROOT'] . $file['file'])){
|
||||
if($file['optimized']) $source_files[$key]['file'] = $file['file'] = $_SERVER['DOCUMENT_ROOT'].$file['file'];
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if(!$file || !$file['file'] || !file_exists($file['file'])) continue;
|
||||
$file['file'] = $source_files[$key]['file'] = str_replace("\\","/",$file['file']);
|
||||
if(empty($file['optimized']) || preg_match('/^https?:\/\//i', $file['file']) ) $files[] = $file;
|
||||
else{
|
||||
$targets[] = $file;
|
||||
$hash .= $file['file'];
|
||||
}
|
||||
}
|
||||
if(!count($targets)) return $this->_getOptimizedRemoved($files);
|
||||
$list_file_hash = md5($hash);
|
||||
$oCacheHandler = &CacheHandler::getInstance('template');
|
||||
if($oCacheHandler->isSupport()){
|
||||
if(!$oCacheHandler->isValid($list_file_hash)){
|
||||
$buff = array();
|
||||
foreach($targets as $file) $buff[] = $file['file'];
|
||||
$oCacheHandler->put($list_file_hash, $buff);
|
||||
}
|
||||
}else{
|
||||
$list_file = FileHandler::getRealPath($this->cache_path . $list_file_hash . '.info.php');
|
||||
|
||||
if(!file_exists($list_file)){
|
||||
$str = '<?php $f=array();';
|
||||
foreach($targets as $file) $str .= '$f[]="'. $file['file'] . '";';
|
||||
$str .= ' return $f; ?>';
|
||||
|
||||
FileHandler::writeFile($list_file, $str);
|
||||
}
|
||||
}
|
||||
|
||||
array_unshift($files, array('file' => sprintf($this->script_file, $list_file_hash, $type) , 'media' => 'all'));
|
||||
$files = $this->_getOptimizedRemoved($files);
|
||||
if(!count($files)) return $files;
|
||||
|
||||
$url_info = parse_url(Context::getRequestUri());
|
||||
$abpath = $url_info['path'];
|
||||
foreach($files as $key => $val) {
|
||||
$file = $val['file'];
|
||||
|
||||
if($file{0} == '/' || strpos($file,'://')!==false) continue;
|
||||
if(substr($file,0,2)=='./') $file = substr($file,2);
|
||||
$file = $abpath.$file;
|
||||
while(strpos($file,'/../')!==false) {
|
||||
$file = preg_replace('/\/([^\/]+)\/\.\.\//','/',$file);
|
||||
}
|
||||
$files[$key]['file'] = $file;
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @author NHN (developer@xpressengine.com)
|
||||
* @brief css 및 js Optimizer 처리 gateway
|
||||
*
|
||||
**/
|
||||
|
||||
if(!$_GET['t'] || !$_GET['l']) exit;
|
||||
|
||||
// set env
|
||||
$XE_PATH = substr(dirname(__FILE__),0,strlen('common')*-1);
|
||||
define('_XE_PATH_', $XE_PATH);
|
||||
define('__ZBXE__', true);
|
||||
define('__XE_LOADED_CLASS__', true);
|
||||
include _XE_PATH_ . 'config/config.inc.php';
|
||||
|
||||
$dbconfig_file =_XE_PATH_ . 'files/config/db.config.php';
|
||||
if(file_exists($dbconfig_file)){
|
||||
include $dbconfig_file;
|
||||
if($db_info && $db_info->use_template_cache){
|
||||
include _XE_PATH_ . 'classes/handler/Handler.class.php';
|
||||
include _XE_PATH_ . 'classes/cache/CacheHandler.class.php';
|
||||
$oCacheHandler = new CacheHandler('template', $db_info);
|
||||
$cache_support = $oCacheHandler->isSupport();
|
||||
}else{
|
||||
$cache_support = false;
|
||||
}
|
||||
}else{
|
||||
$cache_support = false;
|
||||
}
|
||||
|
||||
//$XE_WEB_PATH = substr($XE_PATH,strlen($_SERVER['DOCUMENT_ROOT']));
|
||||
$XE_WEB_PATH_arr = explode("/", $_SERVER['REQUEST_URI']);
|
||||
array_pop($XE_WEB_PATH_arr);
|
||||
array_pop($XE_WEB_PATH_arr);
|
||||
$XE_WEB_PATH = implode("/", $XE_WEB_PATH_arr);
|
||||
if(substr($XE_WEB_PATH,-1) != "/") $XE_WEB_PATH .= "/";
|
||||
$cache_path = $XE_PATH . 'files/cache/optimized/';
|
||||
$type = $_GET['t'];
|
||||
$list_file = $cache_path . $_GET['l'] .'.info.php';
|
||||
|
||||
|
||||
function getRealPath($file){
|
||||
if($file{0}=='.' && $file{1} =='/') $file = _XE_PATH_.substr($file, 2);
|
||||
return $file;
|
||||
}
|
||||
|
||||
function getMtime($file){
|
||||
$file = getRealPath($file);
|
||||
if(file_exists($file)) return filemtime($file);
|
||||
}
|
||||
|
||||
function getMaxMtime($list){
|
||||
$mtime = array();
|
||||
foreach($list as $file) $mtime[] = getMtime($file);
|
||||
return count($mtime)?max($mtime):0;
|
||||
}
|
||||
|
||||
// check
|
||||
if($cache_support){
|
||||
$list = $oCacheHandler->get($_GET['l']);
|
||||
$mtime = getMaxMtime($list);
|
||||
}else{
|
||||
if(!file_exists($list_file)) exit;
|
||||
$list = include($list_file);
|
||||
$mtime = getMaxMtime(array_merge($list,array($list_file)));
|
||||
}
|
||||
if(!is_array($list)) exit;
|
||||
|
||||
// set content-type
|
||||
if($type == '.css'){
|
||||
$content_type = 'text/css';
|
||||
} else if($type == '.js') {
|
||||
$content_type = 'text/javascript';
|
||||
}
|
||||
|
||||
header("Content-Type: ".$content_type."; charset=UTF-8");
|
||||
|
||||
// return 304
|
||||
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
$modifiedSince = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||
if ($modifiedSince && ($modifiedSince == $mtime)) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
header("Connection: close");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
function useContentEncoding(){
|
||||
if( (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1)
|
||||
&& strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false
|
||||
&& function_exists('ob_gzhandler')
|
||||
&& extension_loaded('zlib')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCacheKey($list){
|
||||
$key = 'optimized:' . join('',$list);
|
||||
return md5($key);
|
||||
}
|
||||
|
||||
function printFileList($list){
|
||||
global $mtime, $cache_support, $oCacheHandler;
|
||||
|
||||
$content_encoding = useContentEncoding();
|
||||
$output = null;
|
||||
|
||||
if($cache_support){
|
||||
$cache_key = getCacheKey($list);
|
||||
$output = $oCacheHandler->get($cache_key, $mtime);
|
||||
}
|
||||
|
||||
if(!$output || trim($output)==''){
|
||||
for($i=0,$c=count($list);$i<$c;$i++){
|
||||
$file = getRealPath($list[$i]);
|
||||
if(file_exists($file)){
|
||||
$output .= '/* file: ' . str_replace(_XE_PATH_,'./',$file) . " */\n";
|
||||
$output .= file_get_contents($file);
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($cache_support) $oCacheHandler->put($cache_key, $output);
|
||||
|
||||
if($content_encoding) $output = ob_gzhandler($output, 5);
|
||||
$size = strlen($output);
|
||||
|
||||
if($size > 0){
|
||||
header("Cache-Control: private");
|
||||
header("Pragma: cache");
|
||||
header("Connection: close");
|
||||
header("Last-Modified: " . substr(gmdate('r', $mtime), 0, -5). "GMT");
|
||||
header("ETag: \"". md5(join(' ', $list)) .'-'. dechex($mtime) .'-'.dechex($size)."\"");
|
||||
}
|
||||
|
||||
// Fix : 서버에서 gzip 압축을 제공하는 경우 콘텐츠의 길이가 실제와 일치하지 않아 문제가 발생하여
|
||||
// Content-Length 헤더를 생략함. Core #19159958 이슈 참고.
|
||||
// header("Content-Length: ". $size);
|
||||
|
||||
if($content_encoding) header("Content-Encoding: gzip");
|
||||
|
||||
echo($output);
|
||||
}
|
||||
|
||||
function write($file_name, $buff, $mode='w'){
|
||||
$file_name = getRealPath($file_name);
|
||||
if(@!$fp = fopen($file_name,$mode)) return false;
|
||||
fwrite($fp, $buff);
|
||||
fclose($fp);
|
||||
@chmod($file_name, 0644);
|
||||
}
|
||||
|
||||
function read($file_name) {
|
||||
$file_name = getRealPath($file_name);
|
||||
|
||||
if(!file_exists($file_name)) return;
|
||||
$filesize = filesize($file_name);
|
||||
if($filesize<1) return;
|
||||
|
||||
if(function_exists('file_get_contents')) return file_get_contents($file_name);
|
||||
|
||||
$fp = fopen($file_name, "r");
|
||||
$buff = '';
|
||||
if($fp) {
|
||||
while(!feof($fp) && strlen($buff)<=$filesize) {
|
||||
$str = fgets($fp, 1024);
|
||||
$buff .= $str;
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
return $buff;
|
||||
}
|
||||
|
||||
function makeCacheFileCSS($css_file, $cache_file, $return=false){
|
||||
$str = read($css_file);
|
||||
$str = replaceCssPath($css_file, trim(convertEncodingStr($str)));
|
||||
|
||||
if($return){
|
||||
return $str;
|
||||
}else{
|
||||
write($cache_file, $str."\n");
|
||||
unset($str);
|
||||
}
|
||||
}
|
||||
|
||||
function replaceCssPath($file, $str) {
|
||||
global $tmp_css_path;
|
||||
|
||||
// css 파일의 위치를 구함
|
||||
$tmp_css_path = preg_replace("/^\.\//is","",dirname($file))."/";
|
||||
// url() 로 되어 있는 css 파일의 경로를 변경
|
||||
$str = preg_replace_callback('/url\(([^\)]*)\)/is', '_replaceCssPath', $str);
|
||||
|
||||
// charset 지정 문구를 제거
|
||||
$str = preg_replace('!@charset([^;]*?);!is','',$str);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function _replaceCssPath($matches) {
|
||||
global $tmp_css_path, $XE_WEB_PATH;
|
||||
|
||||
$path = str_replace(array('"',"'"),'',$matches[1]);
|
||||
if(substr($path,0,1)=='/' || strpos($path,'://')!==false || strpos($path,'.htc')!==false) return 'url('.$path.')';
|
||||
if(substr($path,0,2)=='./') $path = substr($path,2);
|
||||
$target = $XE_WEB_PATH.$tmp_css_path.$path;
|
||||
while(strpos($target,'/../')!==false) {
|
||||
$target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target);
|
||||
}
|
||||
|
||||
return 'url('.$target.')';
|
||||
}
|
||||
|
||||
function convertEncodingStr($str) {
|
||||
if(!$str) return '';
|
||||
|
||||
$charset_list = array(
|
||||
'UTF-8', 'EUC-KR', 'CP949', 'ISO8859-1', 'EUC-JP', 'SHIFT_JIS', 'CP932',
|
||||
'EUC-CN', 'HZ', 'GBK', 'GB18030', 'EUC-TW', 'BIG5', 'CP950', 'BIG5-HKSCS',
|
||||
'ISO2022-CN', 'ISO2022-CN-EXT', 'ISO2022-JP', 'ISO2022-JP-2', 'ISO2022-JP-1',
|
||||
'ISO8859-6', 'ISO8859-8', 'JOHAB', 'ISO2022-KR', 'CP1255', 'CP1256', 'CP862',
|
||||
'ASCII', 'ISO8859-1', 'ISO8850-2', 'ISO8850-3', 'ISO8850-4', 'ISO8850-5',
|
||||
'ISO8850-7', 'ISO8850-9', 'ISO8850-10', 'ISO8850-13', 'ISO8850-14',
|
||||
'ISO8850-15', 'ISO8850-16', 'CP1250', 'CP1251', 'CP1252', 'CP1253', 'CP1254',
|
||||
'CP1257', 'CP850', 'CP866',
|
||||
);
|
||||
|
||||
for($i=0,$c=count($charset_list);$i<$c;$i++) {
|
||||
$charset = $charset_list[$i];
|
||||
if($str == iconv($charset, $charset.'//IGNORE',$str)){
|
||||
if($charset == 'UTF-8') return $str;
|
||||
return iconv($charset, 'UTF-8//IGNORE', $str);
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
if($type == '.js'){
|
||||
printFileList($list);
|
||||
}else if($type == '.css'){
|
||||
$css = array();
|
||||
|
||||
if($cache_support){
|
||||
foreach($list as $file){
|
||||
$cache_file = $cache_path . md5($file). '.cache.php';
|
||||
$css[] = getRealPath($cache_file);
|
||||
}
|
||||
|
||||
$cache_key = getCacheKey($css);
|
||||
|
||||
$buff = $oCacheHandler->get($cache_key, $mtime);
|
||||
if(!$buff){
|
||||
$buff = '';
|
||||
foreach($list as $file){
|
||||
$buff .= makeCacheFileCSS($file, '', true);
|
||||
}
|
||||
|
||||
$oCacheHandler->put($cache_key, $buff);
|
||||
}
|
||||
|
||||
}else{
|
||||
foreach($list as $file){
|
||||
$cache_file = $cache_path . md5($file). '.cache.php';
|
||||
$cache_mtime = getMtime($cache_file);
|
||||
$css_mtime = getMtime($file);
|
||||
|
||||
// check modified
|
||||
if($css_mtime > $cache_mtime){
|
||||
makeCacheFileCSS($file, getRealPath($cache_file));
|
||||
}
|
||||
$css[] = getRealPath($cache_file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
printFileList($css);
|
||||
}
|
||||
?>
|
||||
|
|
@ -33,7 +33,6 @@
|
|||
Context::set('time_zone', $GLOBALS['_time_zone']);
|
||||
Context::set('use_rewrite', $db_info->use_rewrite=='Y'?'Y':'N');
|
||||
Context::set('use_sso', $db_info->use_sso=='Y'?'Y':'N');
|
||||
Context::set('use_optimizer', $db_info->use_optimizer!='N'?'Y':'N');
|
||||
Context::set('use_spaceremover', $db_info->use_spaceremover?$db_info->use_spaceremover:'Y');
|
||||
Context::set('qmail_compatibility', $db_info->qmail_compatibility=='Y'?'Y':'N');
|
||||
Context::set('use_db_session', $db_info->use_db_session=='N'?'N':'Y');
|
||||
|
|
|
|||
|
|
@ -52,14 +52,6 @@
|
|||
<input type="text" name="_target_module" id="_target_module" class="inputTypeText w300" value="{$start_module->mid} ({htmlspecialchars($start_module->browser_title)})" readonly="readonly" /><a href="{getUrl('','module','module','act','dispModuleSelectList','id','target_module','type','single')}" onclick="popopen(this.href,'ModuleSelect');return false;" class="button green"><span>{$lang->cmd_select}</span></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><div>{$lang->use_optimizer}</div></th>
|
||||
<td>
|
||||
<input type="checkbox" name="use_optimizer" value="Y" <!--@if($use_optimizer!='N')-->checked="checked"<!--@end--> />
|
||||
<p>{$lang->about_optimizer}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><div>Language</div></th>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -190,10 +190,6 @@
|
|||
<tr>
|
||||
<th><div>{$lang->use_sso}</div></th>
|
||||
<td><!--@if($use_sso=='Y')-->{$lang->use}<!--@else-->{$lang->notuse}<!--@end--></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><div>{$lang->use_optimizer}</div></th>
|
||||
<td><!--@if($use_optimizer=='Y')-->{$lang->use}<!--@else-->{$lang->notuse}<!--@end--></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><div>{$lang->mobile_view}</div></th>
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@
|
|||
$use_sso = Context::get('use_sso');
|
||||
if($use_sso !='Y') $use_sso = 'N';
|
||||
|
||||
$use_optimizer = Context::get('use_optimizer');
|
||||
if($use_optimizer!='Y') $use_optimizer = 'N';
|
||||
|
||||
$time_zone = Context::get('time_zone');
|
||||
|
||||
$qmail_compatibility = Context::get('qmail_compatibility');
|
||||
|
|
@ -79,7 +76,6 @@
|
|||
$db_info->use_db_session = $use_db_session;
|
||||
$db_info->use_rewrite = $use_rewrite;
|
||||
$db_info->use_sso = $use_sso;
|
||||
$db_info->use_optimizer = $use_optimizer;
|
||||
$db_info->use_ssl = $use_ssl;
|
||||
$db_info->use_mobile_view = $use_mobile_view;
|
||||
if($http_port) $db_info->http_port = (int) $http_port;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue