mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
use eval() for lang code when first install
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9053 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e239d46f1c
commit
d10698d7fb
2 changed files with 28 additions and 6 deletions
|
|
@ -468,7 +468,22 @@ class Context {
|
||||||
if(in_array($filename, $self->loaded_lang_files)) return;
|
if(in_array($filename, $self->loaded_lang_files)) return;
|
||||||
$self->loaded_lang_files[] = $filename;
|
$self->loaded_lang_files[] = $filename;
|
||||||
|
|
||||||
@include($filename);
|
if (is_readable($filename))
|
||||||
|
@include($filename);
|
||||||
|
else
|
||||||
|
$self->_evalxmlLang($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _evalxmlLang($path) {
|
||||||
|
global $lang;
|
||||||
|
|
||||||
|
if(substr($path,-1)!='/') $path .= '/';
|
||||||
|
$file = $path.'lang.xml';
|
||||||
|
|
||||||
|
$oXmlLangParser = new XmlLangParser($file, $this->lang_type);
|
||||||
|
$content = $oXmlLangParser->getCompileContent();
|
||||||
|
|
||||||
|
eval($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _loadXmlLang($path) {
|
function _loadXmlLang($path) {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
if(!file_exists($this->xml_file)) return false;
|
if(!file_exists($this->xml_file)) return false;
|
||||||
if(!file_exists($this->php_file)){
|
if(!file_exists($this->php_file)){
|
||||||
$this->_compile();
|
$this->_compile();
|
||||||
} else {
|
} else {
|
||||||
if(filemtime($this->xml_file)>filemtime($this->php_file)) $this->_compile();
|
if(filemtime($this->xml_file)>filemtime($this->php_file)) $this->_compile();
|
||||||
else return $this->php_file;
|
else return $this->php_file;
|
||||||
}
|
}
|
||||||
|
|
@ -39,6 +39,13 @@
|
||||||
return $this->_writefile() ? $this->php_file : false;
|
return $this->_writefile() ? $this->php_file : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCompileContent() {
|
||||||
|
if(!file_exists($this->xml_file)) return false;
|
||||||
|
$this->_compile();
|
||||||
|
|
||||||
|
return $this->code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief compile a xml_file
|
* @brief compile a xml_file
|
||||||
**/
|
**/
|
||||||
|
|
@ -81,21 +88,21 @@
|
||||||
$type = $item->attrs->type;
|
$type = $item->attrs->type;
|
||||||
|
|
||||||
if($type == 'array'){
|
if($type == 'array'){
|
||||||
$this->code .= $var."=array();\n";
|
$this->code .= $var."=array();\n";
|
||||||
$var .= '[\'%s\']';
|
$var .= '[\'%s\']';
|
||||||
}else{
|
}else{
|
||||||
$this->code .= $var."=new stdClass;\n";
|
$this->code .= $var."=new stdClass;\n";
|
||||||
$var .= '->%s';
|
$var .= '->%s';
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = $item->item;
|
$items = $item->item;
|
||||||
if(!is_array($items)) $item = array($items);
|
if(!is_array($items)) $items = array($items);
|
||||||
foreach($items as $item){
|
foreach($items as $item){
|
||||||
$this->_parseItem($item, $var);
|
$this->_parseItem($item, $var);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$code = $this->_parseValues($value, $var);
|
$code = $this->_parseValues($value, $var);
|
||||||
$this->code .= $code;
|
$this->code .= $code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue