mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 19:51:42 +09:00
latest version applied
git-svn-id: http://xe-core.googlecode.com/svn/trunk@8247 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3f7330fde7
commit
674499a39c
1 changed files with 41 additions and 27 deletions
|
|
@ -750,7 +750,7 @@ class Context {
|
|||
if(is_array($args_list) && $args_list[0]=='') array_shift($args_list);
|
||||
} else {
|
||||
// Otherwise, make GET variables into array
|
||||
$get_vars = $_GET;
|
||||
$get_vars = get_object_vars($self->get_vars);
|
||||
}
|
||||
|
||||
// arrange args_list
|
||||
|
|
@ -909,11 +909,12 @@ class Context {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief key/val로 context vars 세팅
|
||||
* @brief set a context value with a key
|
||||
**/
|
||||
function set($key, $val, $set_to_get_vars = false) {
|
||||
function set($key, $val, $set_to_get_vars=0) {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
$self->context->{$key} = $val;
|
||||
if($set_to_get_vars === false) return;
|
||||
if($set_to_get_vars || $self->get_vars->{$key}) $self->get_vars->{$key} = $val;
|
||||
}
|
||||
|
||||
|
|
@ -993,14 +994,15 @@ class Context {
|
|||
/**
|
||||
* @brief js file을 추가
|
||||
**/
|
||||
function addJsFile($file, $optimized = false, $targetie = '',$index=null, $type='head') {
|
||||
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
|
||||
$avail_types = array('head', 'body');
|
||||
if(!in_array($type, $avail_types)) $type = $avail_types[0];
|
||||
|
||||
$file = $self->normalizeFilePath($file);
|
||||
|
||||
$key = $self->normalizeFilePath($file)."\t".$targetie;
|
||||
$map = &$self->js_files_map;
|
||||
|
||||
// Is this file already registered?
|
||||
if (!is_array($map[$type])) $map[$type] = array();
|
||||
if (!isset($map[$type][$key]) || (int)$map[$type][$key] > (int)$index) $map[$type][$key] = (int)$index+count($map[$type])/1000-1;
|
||||
|
|
@ -1014,10 +1016,10 @@ class Context {
|
|||
|
||||
$realfile = realpath($file);
|
||||
|
||||
foreach($self->js_files as $key=>$val) {
|
||||
if(realpath($val['file'])==$realfile && $val['targetie'] == $targetie) {
|
||||
unset($self->js_files[$key]);
|
||||
unset($self->js_files_map[$val['file']]);
|
||||
foreach($self->js_files_map as $key=>$val) {
|
||||
list($_file, $_targetie) = explode("\t", $key);
|
||||
if(realpath($_file)==$realfile && $_targetie == $targetie) {
|
||||
unset($self->js_files_map[$key]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1028,7 +1030,6 @@ class Context {
|
|||
**/
|
||||
function unloadAllJsFiles() {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
$self->js_files = array();
|
||||
$self->js_files_map = array();
|
||||
}
|
||||
|
||||
|
|
@ -1063,11 +1064,16 @@ class Context {
|
|||
function getJsFile($type='head') {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
|
||||
ksort($self->js_files);
|
||||
if(!is_array($self->js_files_map[$type])) $self->js_files_map[$type] = array();
|
||||
|
||||
$ret = array();
|
||||
foreach($self->js_files as $key=>$val) {
|
||||
if($val['type'] == $type) $ret[] = $val;
|
||||
$ret = array();
|
||||
$map = &$self->js_files_map[$type];
|
||||
|
||||
asort($self->js_files_map[$type]);
|
||||
|
||||
foreach($map as $key=>$val) {
|
||||
list($file, $targetie) = explode("\t", $key);
|
||||
$ret[] = array('file'=>$file, 'targetie'=>$targetie);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
|
@ -1076,10 +1082,11 @@ class Context {
|
|||
/**
|
||||
* @brief CSS file 추가
|
||||
**/
|
||||
function addCSSFile($file, $optimized = false, $media = 'all', $targetie = '',$index = null) {
|
||||
function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
|
||||
$file = $self->normalizeFilePath($file);
|
||||
$key = $self->normalizeFilePath($file)."\t".$targetie."\t".$media;
|
||||
$map = &$self->css_files_map;
|
||||
|
||||
if (!isset($map[$key]) || (int)$map[$key] > (int)$index) $map[$key] = (int)$index+count($map)/100-1;
|
||||
}
|
||||
|
|
@ -1092,10 +1099,10 @@ class Context {
|
|||
|
||||
$realfile = realpath($file);
|
||||
|
||||
foreach($self->css_files as $key => $val) {
|
||||
if(realpath($val['file'])==$realfile && $val['media'] == $media && $val['targetie'] == $targetie) {
|
||||
unset($self->css_files[$key]);
|
||||
unset($self->css_files_map[$val['file']]);
|
||||
foreach($self->css_files_map as $key => $val) {
|
||||
list($_file, $_targetie, $_media) = explode("\t", $key);
|
||||
if(realpath($_file)==$realfile && $_media==$media && $_targetie==$targetie) {
|
||||
unset($self->css_files_map[$key]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1106,7 +1113,6 @@ class Context {
|
|||
**/
|
||||
function unloadAllCSSFiles() {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
$self->css_files = array();
|
||||
$self->css_files_map = array();
|
||||
}
|
||||
|
||||
|
|
@ -1115,8 +1121,16 @@ class Context {
|
|||
**/
|
||||
function getCSSFile() {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
ksort($self->css_files);
|
||||
return array_values($self->css_files);
|
||||
|
||||
asort($self->css_files_map);
|
||||
$ret = array();
|
||||
|
||||
foreach($self->css_files_map as $key=>$val) {
|
||||
list($_file, $_targetie, $_media) = explode("\t", $key);
|
||||
$ret[] = array('file'=>$_file, 'media'=>$_media, 'targetie'=>$_targetie);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1141,8 +1155,8 @@ class Context {
|
|||
if(!$filename) continue;
|
||||
|
||||
if(substr($filename,0,2)=='./') $filename = substr($filename,2);
|
||||
if(preg_match('/\.js$/i', $filename)) $self->addJsFile($plugin_path.$filename, false, '', null, 'body');
|
||||
elseif(preg_match('/\.css$/i', $filename)) $self->addCSSFile($plugin_path.$filename, false, 'all', '', null);
|
||||
if(preg_match('/\.js$/i', $filename)) $self->addJsFile($plugin_path.$filename, false, '', 0, 'body');
|
||||
elseif(preg_match('/\.css$/i', $filename)) $self->addCSSFile($plugin_path.$filename, false, 'all', '', 0);
|
||||
}
|
||||
|
||||
if(is_dir($plugin_path.'lang')) $self->loadLang($plugin_path.'lang');
|
||||
|
|
@ -1287,4 +1301,4 @@ class Context {
|
|||
return $path;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue