Beispiel #1
0
 public function handle(Document $document)
 {
     $this->theme = $this->codex->theme;
     $this->addBaseAssets();
     foreach ($this->config['plugins'] as $plugin) {
         $this->addPlugin($plugin);
     }
     return;
     $dom = $document->getDom();
     $dom->find('//pre/code')->each(function (Element $el) {
         $cls = $el->getAttribute('class');
         $a = 'a';
     });
 }
Beispiel #2
0
 public function handle(Document $document)
 {
     if (false === $this->hasContent()) {
         return;
         // prevents ErrorException in Html.php line 42: DOMDocument::loadHTMLFile(): Empty string supplied as input
     }
     $d = $document->getDom();
     $d->find('//a')->each(function (Element $element) {
         $url = $element->getAttribute('href');
         try {
             if ($this->isAction($url)) {
                 $this->callAction($element);
             } elseif ($this->isDocument($url) && $this->isRelative($url)) {
                 // replaces links that reference other documents to the right url
                 $element->setAttribute('href', $this->getDocumentUrl($url));
             }
         } catch (InvalidArgumentException $e) {
             $this->codex->log('debug', static::class . " throws exception: {$e->getMessage()} | file: {$e->getFile()} | line: {$e->getLine()} | trace: {$e->getTraceAsString()}");
         }
     });
     $document->setDom($d);
 }