aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar dag <me@dvikan.no> 2022-03-22 20:46:59 +0100
committerGravatar GitHub <noreply@github.com> 2022-03-22 20:46:59 +0100
commitb646afffff4da83394e90790b1e776e668d03488 (patch)
tree649b946a1460b04101c7f3be0c815ba9eaffb2c2
parent05c31f49ce0c94240d4c091565728f8c0f4b18fa (diff)
downloadrss-bridge-b646afffff4da83394e90790b1e776e668d03488.tar.gz
rss-bridge-b646afffff4da83394e90790b1e776e668d03488.tar.zst
rss-bridge-b646afffff4da83394e90790b1e776e668d03488.zip
[ExecuteProgramBridge] Add new bridge for www.executeprogram.com (#2339)
-rwxr-xr-xbridges/ExecuteProgramBridge.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/bridges/ExecuteProgramBridge.php b/bridges/ExecuteProgramBridge.php
new file mode 100755
index 00000000..24342d1f
--- /dev/null
+++ b/bridges/ExecuteProgramBridge.php
@@ -0,0 +1,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';
+ }
+}