<script />, <style />에 대해 IE conditional comment를 적용할 수 있도록 %import 구문에 targetie 인자 추가.

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4087 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
wdlee91 2008-04-09 04:39:22 +00:00
parent c7b12d80b0
commit 12d606ef13
3 changed files with 51 additions and 21 deletions

View file

@ -714,18 +714,18 @@
/**
* @brief js file을 추가
**/
function addJsFile($file, $optimized = true) {
function addJsFile($file, $optimized = true, $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_addJsFile($file, $optimized);
return $oContext->_addJsFile($file, $optimized, $targetie);
}
/**
* @brief js file을 추가
**/
function _addJsFile($file, $optimized) {
function _addJsFile($file, $optimized, $targetie) {
if(in_array($file, $this->js_files)) return;
//if(!preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
$this->js_files[] = array('file' => $file, 'optimized' => $optimized);
$this->js_files[] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
}
/**
@ -763,19 +763,19 @@
/**
* @brief CSS file 추가
**/
function addCSSFile($file, $optimized = true, $media = 'all') {
function addCSSFile($file, $optimized = true, $media = 'all', $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_addCSSFile($file, $optimized, $media);
return $oContext->_addCSSFile($file, $optimized, $media, $targetie);
}
/**
* @brief CSS file 추가
**/
function _addCSSFile($file, $optimized, $media) {
function _addCSSFile($file, $optimized, $media, $targetie) {
if(in_array($file, $this->css_files)) return;
//if(preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
$this->css_files[] = array('file' => $file, 'optimized' => $optimized, 'media' => $media);
$this->css_files[] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
}
/**

View file

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