maintainer = 'ORelio';
$this->name = 'We Live Security';
$this->uri = 'http://www.welivesecurity.com/';
$this->description = 'Returns the newest articles.';
$this->update = '2016-08-06';
}
public function collectData(array $param) {
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {
$section_to_remove = substr($string, strpos($string, $start));
$section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
$string = str_replace($section_to_remove, '', $string);
} return $string;
}
$feed = $this->getURI().'feed/';
$html = $this->file_get_html($feed) or $this->returnError('Could not request '.$this->getName().': '.$feed, 500);
$limit = 0;
foreach ($html->find('item') as $element) {
if ($limit < 5) {
$article_image = $element->find('image', 0)->plaintext;
$article_url = ExtractFromDelimiters($element->innertext, '', '');
$article_summary = ExtractFromDelimiters($element->innertext, '