function createDifferenceObject($fromData, $toData)
 {
     $changes = new eZXMLTextDiff();
     $contentINI = eZINI::instance('content.ini');
     $useSimplifiedXML = $contentINI->variable('ContentVersionDiffSettings', 'UseSimplifiedXML');
     $diffSimplifiedXML = $useSimplifiedXML == 'enabled';
     $oldXMLTextObject = $fromData->content();
     $newXMLTextObject = $toData->content();
     $oldXML = $oldXMLTextObject->attribute('xml_data');
     $newXML = $newXMLTextObject->attribute('xml_data');
     $simplifiedXML = new eZSimplifiedXMLEditOutput();
     $domOld = new DOMDocument('1.0', 'utf-8');
     $domOld->preserveWhiteSpace = false;
     $domOld->loadXML($oldXML);
     $domNew = new DOMDocument('1.0', 'utf-8');
     $domNew->preserveWhiteSpace = false;
     $domNew->loadXML($newXML);
     $old = $simplifiedXML->performOutput($domOld);
     $new = $simplifiedXML->performOutput($domNew);
     if (!$diffSimplifiedXML) {
         $old = trim(strip_tags($old));
         $new = trim(strip_tags($new));
         $pattern = array('/[ ][ ]+/', '/ \\n( \\n)+/', '/^ /m', '/(\\n){3,}/');
         $replace = array(' ', "\n", '', "\n\n");
         $old = preg_replace($pattern, $replace, $old);
         $new = preg_replace($pattern, $replace, $new);
     }
     $oldArray = explode("\n", $old);
     $newArray = explode("\n", $new);
     $oldSums = array();
     foreach ($oldArray as $paragraph) {
         $oldSums[] = crc32($paragraph);
     }
     $newSums = array();
     foreach ($newArray as $paragraph) {
         $newSums[] = crc32($paragraph);
     }
     $textDiffer = new eZDiffTextEngine();
     $pre = $textDiffer->preProcess($oldSums, $newSums);
     $out = $textDiffer->createOutput($pre, $oldArray, $newArray);
     $changes->setChanges($out);
     return $changes;
 }
 function inputXML()
 {
     $contentObjectAttribute = $this->ContentObjectAttribute;
     $contentObjectAttributeID = $contentObjectAttribute->attribute('id');
     $originalInput = 'originalInput_' . $contentObjectAttributeID;
     $isInputValid = 'isInputValid_' . $contentObjectAttributeID;
     if (isset($GLOBALS[$isInputValid]) and $GLOBALS[$isInputValid] == false) {
         $output = $GLOBALS[$originalInput];
     } else {
         $dom = new DOMDocument('1.0', 'utf-8');
         $success = $dom->loadXML($this->XMLData);
         $editOutput = new eZSimplifiedXMLEditOutput();
         $dom->formatOutput = true;
         if (eZDebugSetting::isConditionTrue('kernel-datatype-ezxmltext', eZDebug::LEVEL_DEBUG)) {
             eZDebug::writeDebug($dom->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', __METHOD__ . ' xml string stored in database'));
         }
         $output = $editOutput->performOutput($dom);
     }
     return $output;
 }