Mercurial > SimpleWebPresenter
comparison InputParser.inc @ 107:d5f3efba33e2
Support for common files between languages.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 07 Mar 2016 20:44:15 +0100 |
| parents | b6381903122e |
| children | adf7b11921f4 b9668126e52e |
comparison
equal
deleted
inserted
replaced
| 106:d0698ec07b0b | 107:d5f3efba33e2 |
|---|---|
| 221 chdir("${cwd}"); | 221 chdir("${cwd}"); |
| 222 } | 222 } |
| 223 else { | 223 else { |
| 224 $src = $file->getAttribute("src"); | 224 $src = $file->getAttribute("src"); |
| 225 $fname = $options->getBasePath() . "/${lang}/${src}"; | 225 $fname = $options->getBasePath() . "/${lang}/${src}"; |
| 226 if (!file_exists($fname) ) { | |
| 227 $fname = $options->getBasePath() . "/common/${src}"; | |
| 228 } | |
| 226 $file_content = $options->getCache()->loadFile($fname); | 229 $file_content = $options->getCache()->loadFile($fname); |
| 227 } | 230 } |
| 228 if(floatval($file_content)<0) { | 231 if(floatval($file_content)<0) { |
| 229 errorPage("Resource not found '${lang}/${src}'"); | 232 errorPage("Resource not found '${lang}/${src}'"); |
| 230 } | 233 } |
| 287 $conf = $options->getName(); | 290 $conf = $options->getName(); |
| 288 if (!$conf) | 291 if (!$conf) |
| 289 $conf = $param->getAttribute("default"); | 292 $conf = $param->getAttribute("default"); |
| 290 | 293 |
| 291 $confFile = $options->getBasePath() . "/${lang}/${conf}.xml"; | 294 $confFile = $options->getBasePath() . "/${lang}/${conf}.xml"; |
| 295 if (! file_exists($confFile) ) { | |
| 296 $confFile = $options->getBasePath() . "/common/${conf}.xml"; | |
| 297 } | |
| 298 | |
| 292 $options->getCache()->cache_time($confFile); | 299 $options->getCache()->cache_time($confFile); |
| 293 $doc = new DOMDocument(); | 300 $doc = new DOMDocument(); |
| 294 $doc->load($confFile); | 301 $doc->load($confFile); |
| 295 | 302 |
| 296 $toplevel = $doc->getElementsByTagName("toplevel"); | 303 $toplevel = $doc->getElementsByTagName("toplevel"); |
| 308 } | 315 } |
| 309 foreach ($includes as $include) { | 316 foreach ($includes as $include) { |
| 310 $src = $include->getAttribute("src"); | 317 $src = $include->getAttribute("src"); |
| 311 $subdoc = new DOMDocument(); | 318 $subdoc = new DOMDocument(); |
| 312 $subfile = $options->getBasePath() . "/${lang}/${src}"; | 319 $subfile = $options->getBasePath() . "/${lang}/${src}"; |
| 320 if (! file_exists($subfile) ) { | |
| 321 $subfile = $options->getBasePath() . "/common/${src}"; | |
| 322 } | |
| 313 $subdoc->load("$subfile"); | 323 $subdoc->load("$subfile"); |
| 314 $options->getCache()->cache_time($subfile); | 324 $options->getCache()->cache_time($subfile); |
| 315 $parent = $include->parentNode; | 325 $parent = $include->parentNode; |
| 316 $xml = getElementByTagName($subdoc,"xml"); | 326 $xml = getElementByTagName($subdoc,"xml"); |
| 317 foreach($xml->childNodes as $child) { | 327 foreach($xml->childNodes as $child) { |
