comparison inputParser.inc @ 26:d8c7b328899e

Removed globals, and introduced Options object for passing values around. Introduced <accepted_values> tag into master.xml
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Sun, 30 Sep 2012 00:16:58 +0200
parents 814296ea84a9
children 394b5df43d1a
comparison
equal deleted inserted replaced
25:da86ec2814e2 26:d8c7b328899e
27 } 27 }
28 } 28 }
29 return $param_value; 29 return $param_value;
30 } 30 }
31 31
32 function getInput($master, $param) 32 function getInput($master, $param, $options)
33 { 33 {
34 $out=''; 34 $out='';
35 35
36 $lang=$GLOBALS['lang']; 36 $lang = $options->getLang();
37 $name=$param->getAttribute("id"); 37 $name=$param->getAttribute("id");
38 $conf=$_GET[$name]; 38 $conf = $options->getName();
39 $GLOBALS[$name]=$conf;
40 if (!$conf) 39 if (!$conf)
41 $conf=$param->getAttribute("default"); 40 $conf = $param->getAttribute("default");
42 41
43 $fname = "${lang}/${conf}.xml"; 42 $fname = "${lang}/${conf}.xml";
44 cache_time($fname); 43 cache_time($fname);
45 $config = loadFile($fname); 44 $config = loadFile($fname);
46 45
63 $subdoc = new DOMDocument(); 62 $subdoc = new DOMDocument();
64 $subdoc->load("${lang}/${src}"); 63 $subdoc->load("${lang}/${src}");
65 $parent=$include->parentNode; 64 $parent=$include->parentNode;
66 $xml=getElementByTagName($subdoc,"xml"); 65 $xml=getElementByTagName($subdoc,"xml");
67 foreach($xml->childNodes as $child) { 66 foreach($xml->childNodes as $child) {
68 $text=$subdoc->saveXml($child); 67 $text=$subdoc->saveXml($child);
69 $clonedChild=$doc->importNode($child,true); 68 $clonedChild=$doc->importNode($child,true);
70 $parent->insertBefore($clonedChild,$include); 69 $parent->insertBefore($clonedChild,$include);
71 } 70 }
72 $parent->removeChild($include); 71 $parent->removeChild($include);
73 } 72 }
74 $includes=$doc->getElementsByTagName("include"); 73 $includes=$doc->getElementsByTagName("include");
75 } 74 }