diff --git a/bridges/GoAccessBridge.php b/bridges/GoAccessBridge.php new file mode 100644 index 00000000..94874496 --- /dev/null +++ b/bridges/GoAccessBridge.php @@ -0,0 +1,38 @@ +find('.container.content', 0); + foreach ($container->find('div') as $element) { + $titleEl = $element->find('h2', 0); + $dateEl = $titleEl->find('small', 0); + $date = trim($dateEl->plaintext); + $title = is_object($titleEl) ? str_replace($date, '', $titleEl->plaintext) : ''; + $linkEl = $titleEl->find('a', 0); + $link = is_object($linkEl) ? $linkEl->href : ''; + $postUrl = self::URI . $link; + + $contentEl = $element->find('.dl-horizontal', 0); + $content = '
' . $contentEl->xmltext() . '
'; + + $item = []; + $item['uri'] = $postUrl; + $item['timestamp'] = strtotime($date); + $item['title'] = $title; + $item['content'] = $content; + + $this->items[] = $item; + } + } +}