if ('enabled' == $mapSettings->variable('NewsletterAutomapping', 'autoMapping')) {
     $dataMap = $contentObject->attribute('data_map');
     $map = $mapSettings->variable('NewsletterAutomapping', $class->attribute('identifier'));
     foreach ($map as $objectAttribute => $typeSource) {
         // Check if attribute has content
         if (0 < strlen(trim($newsletterType->attribute($typeSource)))) {
             $attribute = $dataMap[$objectAttribute];
             if ('ezxmltext' === $attribute->DataTypeString) {
                 $inputData = '<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/" >';
                 $inputData .= '<paragraph>';
                 $inputData .= html_entity_decode($newsletterType->attribute($typeSource));
                 $inputData .= '</paragraph>';
                 $inputData .= '</section>';
                 try {
                     $parser = new eZSimplifiedXMLInputParser($attribute->ContentObjectID);
                     $parser->setParseLineBreaks(true);
                     $document = $parser->process($inputData);
                     $input = $document->saveXML();
                     if ($input === false) {
                         throw new Exception();
                     }
                 } catch (Exception $e) {
                     eZDebug::writeError("Invalid XML input data.", 'view_newslettertype');
                     $input = "";
                 }
             } else {
                 $input = $newsletterType->attribute($typeSource);
             }
             $attribute->setAttribute('data_text', $input);
             $attribute->store();
         }
Esempio n. 2
0
 /**
  * Convert input to XML format used by eZ for article ingress and body
  * @param String $content
  * @return String
  */
 protected function xmlConvert($content)
 {
     $parser = new eZSimplifiedXMLInputParser();
     $parser->setParseLineBreaks(true);
     $document = $parser->process($content);
     return eZXMLTextType::domString($document);
 }