static function xmlReplaceTextNode($oNode, $oNodeForReplace) { //ensure it's a text node if (!self::xmlIsTextNode($oNode)) { throw new AnwUnexpectedException("ReplaceTextNode on non text node"); } $oNode = AnwXml::xmlReplaceTextNodeValue($oNode, $oNodeForReplace->nodeValue); return $oNode; }
function saveTranslation_onTextValue($oRootNode, $sFieldInput) { //escape < and > $sTranslatedValue = $this->getTranslatedValueFromPost($sFieldInput); $bTranslated = (int) AnwEnv::_POST("done-" . $sFieldInput) == 1 ? true : false; //deny empty values to avoid unsync if (trim($sTranslatedValue) == "") { $sTranslatedValue = self::EMPTY_VALUE; } AnwDebug::log(" --> {$sFieldInput} : " . ($bTranslated ? "TRANSLATED" : "UNTRANSLATED") . " : " . $sTranslatedValue . " ( was " . $oRootNode->nodeValue . ")"); //$oRootNode->nodeValue = $sTranslatedValue; $oRootNode = AnwXml::xmlReplaceTextNodeValue($oRootNode, $sTranslatedValue); $oRootNode = AnwXml::xmlSetTextUntranslated($oRootNode, !$bTranslated); //xml structure is now modified }