forked from VerifiedJoseph/rss-bridge-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VirtualBoxNewsBridge.php
38 lines (27 loc) · 910 Bytes
/
VirtualBoxNewsBridge.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
class VirtualBoxNewsBridge extends BridgeAbstract {
const NAME = 'VirtualBox News Bridge';
const URI = 'https://www.virtualbox.org';
const DESCRIPTION = 'Returns project news';
const MAINTAINER = 'VerifiedJoseph';
const PARAMETERS = array();
const CACHE_TIMEOUT = 3600;
public function collectData() {
$html = getSimpleHTMLDOM($this->getURI() . '/wiki/News')
or returnServerError('Could not request: ' . $this->getURI() . '/wiki/News');
$html = defaultLinkTo($html, $this->getURI());
$wikipage = $html->find('div[id=wikipage]', 0);
foreach($wikipage->find('p') as $index => $p) {
$item = array();
$date = $p->find('strong', 0)->plaintext;
$item['title'] = $date;
$item['timestamp'] = $date;
$p->find('strong', 0)->innertext = '';
$item['content'] = $p->innertext;
$this->items[] = $item;
if (count($this->items) >= 10) {
break;
}
}
}
}