mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
#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:
parent
586c6d9f70
commit
55c2a0d8de
4 changed files with 74 additions and 39 deletions
|
|
@ -714,18 +714,33 @@
|
|||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function addJsFile($file) {
|
||||
function addJsFile($file, $optimized = true) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addJsFile($file);
|
||||
return $oContext->_addJsFile($file, $optimized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function _addJsFile($file) {
|
||||
function _addJsFile($file, $optimized) {
|
||||
if(in_array($file, $this->js_files)) return;
|
||||
//if(!preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
|
||||
$this->js_files[] = $file;
|
||||
$this->js_files[] = array('file' => $file, 'optimized' => $optimized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함
|
||||
**/
|
||||
function _getUniqueFileList($files) {
|
||||
$filenames = array();
|
||||
$size = count($files);
|
||||
for($i = 0; $i < $size; ++ $i)
|
||||
{
|
||||
if(in_array($files[$i]['file'], $filenames))
|
||||
unset($files[$i]);
|
||||
$filenames[] = $files[$i]['file'];
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -742,25 +757,25 @@
|
|||
function _getJsFile() {
|
||||
require_once("./classes/optimizer/Optimizer.class.php");
|
||||
$oOptimizer = new Optimizer();
|
||||
return $oOptimizer->getOptimizedFiles(array_unique($this->js_files), "js");
|
||||
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->js_files), "js");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function addCSSFile($file) {
|
||||
function addCSSFile($file, $optimized = true, $media = 'all') {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_addCSSFile($file);
|
||||
return $oContext->_addCSSFile($file, $optimized, $media);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function _addCSSFile($file) {
|
||||
function _addCSSFile($file, $optimized, $media) {
|
||||
if(in_array($file, $this->css_files)) return;
|
||||
|
||||
//if(preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
|
||||
$this->css_files[] = $file;
|
||||
$this->css_files[] = array('file' => $file, 'optimized' => $optimized, 'media' => $media);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -777,7 +792,7 @@
|
|||
function _getCSSFile() {
|
||||
require_once("./classes/optimizer/Optimizer.class.php");
|
||||
$oOptimizer = new Optimizer();
|
||||
return $oOptimizer->getOptimizedFiles(array_unique($this->css_files), "css");
|
||||
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->css_files), "css");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue