69 if(!file_exists($this->xml_file))
73 if(!file_exists($this->php_file))
79 if(filemtime($this->xml_file) > filemtime($this->php_file))
89 return $this->
_writeFile() ? $this->php_file : FALSE;
98 if(!file_exists($this->xml_file))
114 $this->lang_types = array_keys($lang_selected);
118 $buff = str_replace(
'xml:lang',
'xml_lang', $buff);
121 $xml_obj = parent::parse($buff);
123 $item = $xml_obj->lang->item;
126 $item = array($item);
156 $name = $item->attrs->name;
157 $value = $item->value;
158 $var = sprintf($var, $name);
162 $type = $item->attrs->type;
163 $mode = $item->attrs->mode;
167 $this->code .=
"if(!is_array({$var})){\n";
168 $this->code .=
" {$var} = array();\n";
169 $this->code .=
"}\n";
174 $this->code .=
"if(!is_object({$var})){\n";
175 $this->code .=
" {$var} = new stdClass();\n";
176 $this->code .=
"}\n";
180 $items = $item->item;
181 if(!is_array($items))
183 $items = array($items);
185 foreach($items as $item)
193 $this->code .=
$code;
205 if(!is_array($nodes))
207 $nodes = array($nodes);
211 foreach($nodes as $node)
214 if($return && is_array($return))
216 $value = array_merge($value, $return);
220 if($value[$this->lang_type])
224 else if($value[
'en'])
228 else if($value[
'ko'])
235 if($lang_type ==
'en' || $lang_type ==
'ko' || $lang_type == $this->lang_type)
239 if($value[$lang_type])
257 $value = $node->body;
263 $var .=
'=\'' . str_replace(
"'",
"\'", $value) .
"';\n";
275 return sprintf(
'%s%s.%s.php', $this->compiled_path, md5($this->xml_file),
$lang_type);
__construct($xml_file, $lang_type)
writeFile($filename, $buff, $mode="w")
_getCompiledFileName($lang_type, $type= 'php')
_parseValues($nodes, $var)