mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 20:44:28 +09:00
r7861 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7862 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
298a0465e5
commit
4f279059c7
6 changed files with 47 additions and 15 deletions
|
|
@ -1158,15 +1158,15 @@
|
||||||
/**
|
/**
|
||||||
* @brief js file을 추가
|
* @brief js file을 추가
|
||||||
**/
|
**/
|
||||||
function addJsFile($file, $optimized = false, $targetie = '',$index=null) {
|
function addJsFile($file, $optimized = false, $targetie = '',$index=null, $type="head") {
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
return $oContext->_addJsFile($file, $targetie,$index);
|
return $oContext->_addJsFile($file, $targetie,$index,$type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief js file을 추가
|
* @brief js file을 추가
|
||||||
**/
|
**/
|
||||||
function _addJsFile($file, $targetie = '',$index=null) {
|
function _addJsFile($file, $targetie = '',$index=null,$type="head") {
|
||||||
if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file;
|
if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file;
|
||||||
$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
|
$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
|
||||||
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
|
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
|
||||||
|
|
@ -1175,7 +1175,7 @@
|
||||||
|
|
||||||
if(is_null($index)) $index=count($this->js_files);
|
if(is_null($index)) $index=count($this->js_files);
|
||||||
for($i=$index;array_key_exists($i,$this->js_files);$i++);
|
for($i=$index;array_key_exists($i,$this->js_files);$i++);
|
||||||
$this->js_files[$i] = array('file' => $file, 'targetie' => $targetie);
|
$this->js_files[$i] = array('file' => $file, 'targetie' => $targetie, 'type'=> $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1230,6 +1230,7 @@
|
||||||
{
|
{
|
||||||
if(in_array($files[$i]['file'], $filenames))
|
if(in_array($files[$i]['file'], $filenames))
|
||||||
unset($files[$i]);
|
unset($files[$i]);
|
||||||
|
|
||||||
$filenames[] = $files[$i]['file'];
|
$filenames[] = $files[$i]['file'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1239,17 +1240,23 @@
|
||||||
/**
|
/**
|
||||||
* @brief js file 목록을 return
|
* @brief js file 목록을 return
|
||||||
**/
|
**/
|
||||||
function getJsFile() {
|
function getJsFile($type='head') {
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
return $oContext->_getJsFile();
|
return $oContext->_getJsFile($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief js file 목록을 return
|
* @brief js file 목록을 return
|
||||||
**/
|
**/
|
||||||
function _getJsFile() {
|
function _getJsFile($type) {
|
||||||
|
$_files = array();
|
||||||
$files = $this->_getUniqueFileList($this->js_files);
|
$files = $this->_getUniqueFileList($this->js_files);
|
||||||
return $files;
|
foreach($files as $k => $v)
|
||||||
|
{
|
||||||
|
if($v['type'] == $type) $_files[] = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,11 @@ class HTMLDisplayHandler {
|
||||||
$oContext =& Context::getInstance();
|
$oContext =& Context::getInstance();
|
||||||
// add common JS/CSS files
|
// add common JS/CSS files
|
||||||
$oContext->_addJsFile("./common/js/jquery.js", '', -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", '', -100000);
|
$oContext->_addJsFile("./common/js/x.js", '', -100000);
|
||||||
$oContext->_addJsFile("./common/js/common.js", '', -100000);
|
$oContext->_addJsFile("./common/js/common.js", '', -100000);
|
||||||
$oContext->_addJsFile("./common/js/js_app.js", '', -100000);
|
$oContext->_addJsFile("./common/js/js_app.js", '', -100000);
|
||||||
$oContext->_addJsFile("./common/js/xml_handler.js", '', -100000);
|
$oContext->_addJsFile("./common/js/xml_handler.js", '', -100000);
|
||||||
$oContext->_addJsFile("./common/js/xml_js_filter.js", '', -100000);
|
$oContext->_addJsFile("./common/js/xml_js_filter.js", '', -100000, 'body');
|
||||||
$oContext->_addCSSFile("./common/css/default.css", 'all', '', -100000);
|
$oContext->_addCSSFile("./common/css/default.css", 'all', '', -100000);
|
||||||
$oContext->_addCSSFile("./common/css/button.css", 'all', '', -100000);
|
$oContext->_addCSSFile("./common/css/button.css", 'all', '', -100000);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@
|
||||||
$buff = preg_replace('!(\n?)( *?)<\!--//(.*?)-->!is', '', $buff);
|
$buff = preg_replace('!(\n?)( *?)<\!--//(.*?)-->!is', '', $buff);
|
||||||
|
|
||||||
// import xml filter/ css/ js/ files <!--%import("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
|
// import xml filter/ css/ js/ files <!--%import("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
|
||||||
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileImportCode'), $buff);
|
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?(,index=\"([^\"]*)\")?(,type=\"([^\"]*)\")?\)-->!is', array($this, '_compileImportCode'), $buff);
|
||||||
|
|
||||||
// unload css/ js <!--%unload("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
|
// unload css/ js <!--%unload("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
|
||||||
$buff = preg_replace_callback('!<\!--%unload\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileUnloadCode'), $buff);
|
$buff = preg_replace_callback('!<\!--%unload\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileUnloadCode'), $buff);
|
||||||
|
|
@ -725,6 +725,11 @@
|
||||||
if(!$targetie) $targetie = '';
|
if(!$targetie) $targetie = '';
|
||||||
else $optimized = 'false';
|
else $optimized = 'false';
|
||||||
|
|
||||||
|
if(isset($matches[9])) $index = intval($matches[9]);
|
||||||
|
if(!$index) $index = null;
|
||||||
|
if(isset($matches[11])) $type = strtolower(trim($matches[11]));
|
||||||
|
if($type!='body') $type = 'head';
|
||||||
|
|
||||||
// if given_file ends with lang, load language pack
|
// if given_file ends with lang, load language pack
|
||||||
if(substr($given_file, -4)=='lang') {
|
if(substr($given_file, -4)=='lang') {
|
||||||
if(substr($given_file,0,2)=='./') $given_file = substr($given_file, 2);
|
if(substr($given_file,0,2)=='./') $given_file = substr($given_file, 2);
|
||||||
|
|
@ -778,10 +783,10 @@
|
||||||
// js file
|
// js file
|
||||||
case 'js' :
|
case 'js' :
|
||||||
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
||||||
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie);
|
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie, $index, $type);
|
||||||
} else {
|
} else {
|
||||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||||
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
|
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie, $index, $type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
if(!file_exists($this->xml_file)) return;
|
if(!file_exists($this->xml_file)) return;
|
||||||
if(!file_exists($this->js_file)) $this->_compile();
|
if(!file_exists($this->js_file)) $this->_compile();
|
||||||
else if(filemtime($this->xml_file)>filemtime($this->js_file)) $this->_compile();
|
else if(filemtime($this->xml_file)>filemtime($this->js_file)) $this->_compile();
|
||||||
Context::addJsFile($this->js_file);
|
Context::addJsFile($this->js_file, false, '',null,'body');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -75,5 +75,15 @@
|
||||||
|
|
||||||
<div id="waitingforserverresponse"></div>
|
<div id="waitingforserverresponse"></div>
|
||||||
|
|
||||||
|
{@ $js_body_files = Context::getJsFile('body') }
|
||||||
|
<!--@foreach($js_body_files as $key => $js_file)-->
|
||||||
|
<!--@if($js_file['targetie'])-->
|
||||||
|
<!--[if {$js_file['targetie']}]>
|
||||||
|
<!--@end-->
|
||||||
|
<script type="text/javascript" src="{$js_file['file']}"></script>
|
||||||
|
<!--@if($js_file['targetie'])-->
|
||||||
|
<![endif]-->
|
||||||
|
<!--@end-->
|
||||||
|
<!--@end-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -53,5 +53,16 @@
|
||||||
{$content}
|
{$content}
|
||||||
|
|
||||||
{Context::getHtmlFooter()}
|
{Context::getHtmlFooter()}
|
||||||
|
|
||||||
|
{@ $js_body_files = Context::getJsFile('body') }
|
||||||
|
<!--@foreach($js_body_files as $key => $js_file)-->
|
||||||
|
<!--@if($js_file['targetie'])-->
|
||||||
|
<!--[if {$js_file['targetie']}]>
|
||||||
|
<!--@end-->
|
||||||
|
<script type="text/javascript" src="{$js_file['file']}"></script>
|
||||||
|
<!--@if($js_file['targetie'])-->
|
||||||
|
<![endif]-->
|
||||||
|
<!--@end-->
|
||||||
|
<!--@end-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue