Пример #1
0
 public function render(DOMRenderer $renderer, DOMElement $element)
 {
     $generator = $renderer->getGenerator();
     $src = $element->getAttribute('src');
     $inputDir = $generator->getInputDirectory();
     $path = $renderer->getRenderer()->getBaseUrl() . '/' . $src;
     $assetManager = $generator->getAssetManager();
     $assetManager->addAsset($src, $inputDir . '/' . $src);
     return '<img src="' . $path . '" alt="image" width=300 />';
 }
 protected function parseLink(DOMRenderer $renderer, $href)
 {
     $result = array();
     $urlInfo = parse_url($href);
     if (!array_key_exists('scheme', $urlInfo)) {
         $renderer->getGenerator()->getPageManager()->getQueue()->enqueue($href);
         $result['href'] = $renderer->getRenderer()->getLink($href);
         $result['path'] = $href;
     } else {
         $result['href'] = $href;
         $result['path'] = null;
     }
     return $result;
 }
Пример #3
0
 public function render(DOMRenderer $iterator, DOMElement $element)
 {
     $sourceFile = $iterator->getGenerator()->getPageManager()->getSourceFile($element->nodeValue);
     return $iterator->renderContentElement($sourceFile->getContent());
 }