Skip to content

Commit

Permalink
[ExecuteProgramBridge] Add new bridge for www.executeprogram.com (#2339)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvikan authored Mar 22, 2022
1 parent 05c31f4 commit b646aff
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions bridges/ExecuteProgramBridge.php
Original file line number Diff line number Diff line change
@@ -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';
}
}

0 comments on commit b646aff

Please sign in to comment.