forked from RSS-Bridge/rss-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExecuteProgramBridge.php
38 lines (31 loc) · 1.01 KB
/
ExecuteProgramBridge.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 ExecuteProgramBridge extends BridgeAbstract
{
const NAME = 'Execute Program Blog';
const URI = 'https://www.executeprogram.com/blog';
const DESCRIPTION = 'Unofficial feed for the www.executeprogram.com blog';
const MAINTAINER = 'dvikan';
public function collectData()
{
$data = json_decode(getContents('https://www.executeprogram.com/api/pages/blog'));
foreach ($data->posts as $post) {
$year = $post->date->year;
$month = $post->date->month;
$day = $post->date->day;
$item = array();
$item['uri'] = sprintf('https://www.executeprogram.com/blog/%s', $post->slug);
$item['title'] = $post->title;
$dateTime = \DateTime::createFromFormat('Y-m-d', $year . '-' . $month . '-' . $day);
$item['timestamp'] = $dateTime->format('U');
$item['content'] = $post->body;
$this->items[] = $item;
}
usort($this->items, function ($a, $b) {
return $a['timestamp'] < $b['timestamp'];
});
}
public function getIcon()
{
return 'https://www.executeprogram.com/favicon.ico';
}
}