array( 'name' => 'Release Channel', 'type' => 'list', 'defaultValue' => self::STABLE, 'values' => array( 'Stable' => self::STABLE, 'Beta' => self::BETA, 'Alpha' => self::ALPHA, ), ) ) ); private function getReleaseFeed($jsonUrl) { $json = getContents($jsonUrl) or returnServerError('Could not request Core OS Website.'); return json_decode($json, true); } public function getIcon() { return 'https://coreos.com/assets/ico/favicon.png'; } public function collectData() { $data = $this->getReleaseFeed($this->getJsonUri()); foreach ($data as $releaseVersion => $release) { $item = array(); $item['uri'] = "https://coreos.com/releases/#$releaseVersion"; $item['title'] = $releaseVersion; $content = $release['release_notes']; $content .= <<\1'; $item['content'] = preg_replace($regex, $replacement, $content); // Headings $regex = '/^(.*)\:\s?$/m'; $replacement = '

\1

'; $item['content'] = preg_replace($regex, $replacement, $item['content']); // Lists $regex = '/\n\s*[\*|\-](.*)/'; $item['content'] = preg_replace_callback ($regex, function($regs) { $item = $regs[1]; return sprintf ('', trim ($item)); }, $item['content']); $this->items[] = $item; } } private function getJsonUri() { $channel = $this->getInput('channel'); return "https://coreos.com/releases/releases-$channel.json"; } public function getURI() { return self::URI; } public function getName(){ if(!is_null($this->getInput('channel'))) { return 'Container Linux Releases: ' . $this->getInput('channel') . ' Channel'; } return parent::getName(); } }