/** * 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 from DOM node. * @param DOMElement $node */ public function parse(DOMElement $node) { parent::parse($node); $actualPpi = $node->hasAttribute(IdmlAttributes::ActualPpi) ? $node->getAttribute(IdmlAttributes::ActualPpi) : ''; $xy = explode(' ', $actualPpi); if (count($xy) == 2) { $this->ppiX = $xy[0]; $this->ppiY = $xy[1]; } // Get original width and height (in InDesign units of 72ppi) $graphicBoundNodes = $node->getElementsByTagName('GraphicBounds'); $graphicBoundNode = $graphicBoundNodes->item(0); if ($graphicBoundNode) { $top = $graphicBoundNode->getAttribute(IdmlAttributes::Top); $left = $graphicBoundNode->getAttribute(IdmlAttributes::Left); $bottom = $graphicBoundNode->getAttribute(IdmlAttributes::Bottom); $right = $graphicBoundNode->getAttribute(IdmlAttributes::Right); $this->boundary = new IdmlBoundary($top, $left, $bottom, $right); $this->width = $this->boundary->getWidth(); $this->height = $this->boundary->getHeight(); } // Load image content. $xpath = new DOMXPath($node->ownerDocument); $q = "./Properties/Contents"; $contentNodes = $xpath->query($q, $node); if ($contentNodes->length > 0) { $contentNode = $contentNodes->item(0); $this->imageContent = IdmlParserHelper::getCData($contentNode); $this->embeddedImage = true; } $this->idmlTag = "img"; $this->processImage(); }