#210 JS/CSS import의 optimizer의 부분 적용 문법과 media 적용 문법 추가(getJSFile, getCSSFile의 함수 용법 변화)

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3926 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
wdlee91 2008-03-11 02:20:35 +00:00
parent 586c6d9f70
commit 55c2a0d8de
4 changed files with 74 additions and 39 deletions

View file

@ -115,8 +115,8 @@
// <!--@, --> 의 변경
$buff = preg_replace_callback('!<\!--@(.*?)-->!is', array($this, '_compileFuncToCode'), $buff);
// import xml filter/ css/ js/ 언어파일 <!--%filename-->
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"\)-->!is', array($this, '_compileImportCode'), $buff);
// import xml filter/ css/ js/ 언어파일 <!--%import("filename"[,optimized=true|false[,media="media"]]--> (media는 css에만 적용)
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"(,optimized\=(true|false)(,media\=\"([^\"]*)\")?)?\)-->!is', array($this, '_compileImportCode'), $buff);
// 파일에 쓰기 전에 직접 호출되는 것을 방지
$buff = sprintf('%s%s%s','<?php if(!defined("__ZBXE__")) exit();?>',"\n",$buff);
@ -259,6 +259,10 @@
$base_path = $this->tpl_path;
$given_file = trim($matches[1]);
if(!$given_file) return;
$optimized = strtolower(trim(@$matches[3]));
if(!$optimized) $optimized = 'true';
$media = trim(@$matches[5]);
if(!$media) $media = 'all';
// given_file이 lang으로 끝나게 되면 언어팩을 읽도록 함
if(substr($given_file, -4)=='lang') {
@ -303,12 +307,12 @@
// css file
case 'css' :
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::addCSSFile("%s%s"); ?>', $base_path, $filename);
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $media);
break;
// js file
case 'js' :
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::addJsFile("%s%s"); ?>', $base_path, $filename);
$output = sprintf('<?php Context::addJsFile("%s%s", %s); ?>', $base_path, $filename, $optimized);
break;
}
}