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:
flyskyko 2011-09-06 09:17:00 +00:00
parent e239d46f1c
commit d10698d7fb
2 changed files with 28 additions and 6 deletions

View file

@ -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) {

View 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
**/ **/
@ -89,7 +96,7 @@
} }
$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);
} }