/** * Parse from DOM node. * * @param DOMElement $node */ public function parse(DOMElement $node) { $this->tag = 'audio'; parent::parse($node); $this->boundary = IdmlParserHelper::parseBoundary($node); $loopAttrib = $node->hasAttribute('SoundLoop') ? $node->getAttribute('SoundLoop') : 'false'; $autoplayAttrib = $node->hasAttribute('PlayOnPageTurn') ? $node->getAttribute('PlayOnPageTurn') : 'false'; $this->loop = $loopAttrib == 'true' ? true : false; $this->autoplay = $autoplayAttrib == 'true' ? true : false; }
/** * Parse from DOM node. *` * @param DOMElement $node */ public function parse(DOMElement $node) { $this->tag = 'video'; parent::parse($node); $this->boundary = IdmlParserHelper::parseBoundary($node); // Get all the IDML attributes needed for setting HTML attributes $controlsAttrib = $node->hasAttribute('ShowControls') ? $node->getAttribute('ShowControls') : 'true'; $loopAttrib = $node->hasAttribute('MovieLoop') ? $node->getAttribute('MovieLoop') : 'false'; $autoplayAttrib = $node->hasAttribute('PlayOnPageTurn') ? $node->getAttribute('PlayOnPageTurn') : 'false'; $playmodeAttrib = $node->hasAttribute('PlayMode') ? $node->getAttribute('PlayMode') : 'Once'; // Set the various HTML attributes $this->controls = $controlsAttrib == 'true' ? true : false; if ($playmodeAttrib == 'Once' || $autoplayAttrib == 'true') { $this->autoplay = true; } else { $this->autoplay = false; } if ($loopAttrib == 'true' || $playmodeAttrib == 'RepeatPlay') { $this->loop = true; } else { $this->loop = false; } }
/** * Parse the portion of a spread.xml file that contains a <TextFrame> * * @param DOMElement $node is a single <TextFrame> node within the IDML document */ public function parse(DOMElement $node) { parent::parse($node); $attributes = $node->attributes; $this->UID = $attributes->getNamedItem('Self')->value; // like 'uf9' $this->parentStoryUID = $attributes->getNamedItem('ParentStory')->value; // like 'ue5' $this->contentType = $attributes->getNamedItem('ContentType')->value; // like 'TextType' $this->visible = $attributes->getNamedItem('Visible')->value == 'false' ? false : true; // like 'true' $this->setTransform($node); $this->boundary = IdmlParserHelper::parseBoundary($node); $this->prevTextFrame = $attributes->getNamedItem(IdmlAttributes::PreviousTextFrame)->value == 'n' ? null : $attributes->getNamedItem(IdmlAttributes::PreviousTextFrame)->value; $this->nextTextFrame = $attributes->getNamedItem(IdmlAttributes::NextTextFrame)->value == 'n' ? null : $attributes->getNamedItem(IdmlAttributes::NextTextFrame)->value; $this->textColumnCount = isset($this->contextualStyle->idmlKeyValues['TextFramePreference->TextColumnCount']) ? (int) $this->contextualStyle->idmlKeyValues['TextFramePreference->TextColumnCount'] : null; $this->columnWidth = isset($this->contextualStyle->idmlKeyValues['TextFramePreference->TextColumnFixedWidth']) ? $this->contextualStyle->idmlKeyValues['TextFramePreference->TextColumnFixedWidth'] : null; // If we *do_not_have* a previous text frame then it is either a single text frame or the first of a series of // linked ones. In case of linked ones we output only the first one. if (!$this->prevTextFrame) { $this->loadParentStory(); } else { if (IdmlAssembler::getInstance()->isFixedLayout()) { CakeLog::debug("[IdmlTextFrame::parse] Encountered an InDesign threaded frame in a fixed layout book (story {$this->parentStoryUID}). Run Chaucer FixedLayoutPreflight.jsx script within InDesign and re-export the IDML."); } } }
/** * Parse from DOM node. * * @param DOMElement $node */ public function parse(DOMElement $node) { parent::parse($node); $this->UID = $node->hasAttribute(IdmlAttributes::Self) ? $node->getAttribute(IdmlAttributes::Self) : null; $this->setTransform($node); $visible = $node->hasAttribute(IdmlAttributes::Visible) ? $node->getAttribute(IdmlAttributes::Visible) : 'true'; $this->visible = strtolower($visible) == 'true' ? true : false; $this->boundary = IdmlParserHelper::parseBoundary($node); $ffiList = $node->getElementsByTagName('FrameFittingOption'); if ($ffiList->length > 0) { $ffiNode = $ffiList->item(0); $topCrop = $ffiNode->hasAttribute(IdmlAttributes::TopCrop) ? $ffiNode->getAttribute(IdmlAttributes::TopCrop) : 0; $leftCrop = $ffiNode->hasAttribute(IdmlAttributes::LeftCrop) ? $ffiNode->getAttribute(IdmlAttributes::LeftCrop) : 0; $bottomCrop = $ffiNode->hasAttribute(IdmlAttributes::BottomCrop) ? $ffiNode->getAttribute(IdmlAttributes::BottomCrop) : 0; $rightCrop = $ffiNode->hasAttribute(IdmlAttributes::RightCrop) ? $ffiNode->getAttribute(IdmlAttributes::RightCrop) : 0; $this->frameFittingOption = new IdmlFrameFitting($topCrop, $leftCrop, $bottomCrop, $rightCrop); } $this->parseChildren($node); }