function convertCustomAlign($doc, $xmlString, $customAlignAttribute, &$customAlignTagList, &$modificationList) { $attribute = 'custom:' . $customAlignAttribute; // return if xml doesn't contain custom tag if (strpos($xmlString, $attribute) === false) { return false; } $schema = eZXMLSchema::instance(); foreach ($schema->Schema as $customAlignTag => $customAlignTagSchema) { // continue if current tag does not contain align attribute if (!isset($customAlignTagSchema['attributes']) or !is_array($customAlignTagSchema['attributes']) or !in_array('align', $customAlignTagSchema['attributes'])) { continue; } $customNodes = $doc->getElementsByTagName($customAlignTag); foreach ($customNodes as $customNode) { // MAke sure this is a tag that supports align if ($customNode->hasAttribute($attribute)) { $customNode->setAttribute('align', $customNode->getAttribute($attribute)); $customNode->removeAttribute($attribute); $modificationList[] = 'Converting ' . $attribute . ' to align on <' . $customNode->nodeName . '> tag.'; if ($customNode->nodeName === 'custom') { $customAlignTagList[] = $customNode->getAttribute('name') . '(custom)'; } else { $customAlignTagList[] = $customNode->nodeName; } } } } }
function performOutput($dom) { $this->XMLSchema = eZXMLSchema::instance(); $this->NestingLevel = 0; $this->Output = ''; $sectionLevel = -1; $this->createLinksArray($dom); $this->outputTag($dom->documentElement, $sectionLevel); return $this->Output; }
function eZXMLInputParser($validateErrorLevel = self::ERROR_NONE, $detectErrorLevel = self::ERROR_NONE, $parseLineBreaks = false, $removeDefaultAttrs = false) { // Back-compatibility fixes: if ($detectErrorLevel === self::SHOW_SCHEMA_ERRORS) { $detectErrorLevel = self::ERROR_SCHEMA; } elseif ($detectErrorLevel === self::SHOW_ALL_ERRORS) { $detectErrorLevel = self::ERROR_ALL; } if ($validateErrorLevel === false) { $validateErrorLevel = self::ERROR_NONE; } elseif ($validateErrorLevel === true) { $validateErrorLevel = $detectErrorLevel; } $this->ValidateErrorLevel = $validateErrorLevel; $this->DetectErrorLevel = $detectErrorLevel; $this->RemoveDefaultAttrs = $removeDefaultAttrs; $this->ParseLineBreaks = $parseLineBreaks; $this->XMLSchema = eZXMLSchema::instance(); $this->eZPublishVersion = eZPublishSDK::majorVersion() + eZPublishSDK::minorVersion() * 0.1; $ini = eZINI::instance('ezxml.ini'); if ($ini->hasVariable('InputSettings', 'TrimSpaces')) { $trimSpaces = $ini->variable('InputSettings', 'TrimSpaces'); $this->TrimSpaces = $trimSpaces == 'true' ? true : false; } if ($ini->hasVariable('InputSettings', 'AllowMultipleSpaces')) { $allowMultipleSpaces = $ini->variable('InputSettings', 'AllowMultipleSpaces'); $this->AllowMultipleSpaces = $allowMultipleSpaces == 'true' ? true : false; } if ($ini->hasVariable('InputSettings', 'AllowNumericEntities')) { $allowNumericEntities = $ini->variable('InputSettings', 'AllowNumericEntities'); $this->AllowNumericEntities = $allowNumericEntities == 'true' ? true : false; } $contentIni = eZINI::instance('content.ini'); $useStrictHeaderRule = $contentIni->variable('header', 'UseStrictHeaderRule'); $this->StrictHeaders = $useStrictHeaderRule == 'true' ? true : false; }
function &outputText() { if (!$this->XMLData) { $output = ''; return $output; } $this->Tpl = eZTemplate::factory(); $this->Res = eZTemplateDesignResource::instance(); if ($this->ContentObjectAttribute) { $this->Res->setKeys(array(array('attribute_identifier', $this->ContentObjectAttribute->attribute('contentclass_attribute_identifier')))); } $this->Document = new DOMDocument('1.0', 'utf-8'); $success = $this->Document->loadXML($this->XMLData); if (!$success) { $this->Output = ''; return $this->Output; } $this->prefetch(); $this->XMLSchema = eZXMLSchema::instance(); // Add missing elements to the OutputTags array foreach ($this->XMLSchema->availableElements() as $element) { if (!isset($this->OutputTags[$element])) { $this->OutputTags[$element] = array(); } } $this->NestingLevel = 0; $params = array(); $output = $this->outputTag($this->Document->documentElement, $params); $this->Output = $output[1]; unset($this->Document); $this->Res->removeKey('attribute_identifier'); return $this->Output; }