if ($SERVER == $ON_ARC) { $LANGDATA_PATH = "../langdata/"; } $xml_file_name = $LANGDATA_PATH . $lang_id . "_catalog.xml"; # Load XML document $pages = new DOMDocument(); $pages->validateOnParse = true; $pages->load($xml_file_name); $xpath = new DOMXPath($pages); # Get appropriate <entity> element # For each <term>, match by 'key' attrib and update the 'value' attribs $keys = $xpath->query("entity[@id='" . $page_id . "']/term/key"); $values = $xpath->query("entity[@id='" . $page_id . "']/term/value"); $term_count = 0; foreach ($keys as $key) { if (isset($_REQUEST[$key->nodeValue])) { $new_value = trim($_REQUEST[$key->nodeValue]); $old_value = $values->item($term_count)->nodeValue; //if($new_value != $old_value && $new_value != "") if ($new_value != "") { # If new value is not empty and not equal to existing value: Update $values->item($term_count)->nodeValue = $new_value; } } $term_count++; } # Store back updated XML into file $pages->save($LANGDATA_PATH . $lang_id . '_catalog.xml'); # Convert updated XML to updated PHP file catalog_xml2php($lang_id);
function update_measure_xml($measure_id, $measure_name) { catalog_db2xml(); catalog_xml2php("default"); # TODO: Extend to other languages }