parent
59be6bded2
commit
04be85996d
1 changed files with 7 additions and 7 deletions
|
@ -8,12 +8,6 @@ class BastaBridge extends BridgeAbstract {
|
|||
const DESCRIPTION = 'Returns the newest articles.';
|
||||
|
||||
public function collectData(){
|
||||
// Replaces all relative image URLs by absolute URLs.
|
||||
// Relative URLs always start with 'local/'!
|
||||
function replaceImageUrl($content){
|
||||
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'' . self::URI . '$1\'', $content);
|
||||
}
|
||||
|
||||
$html = getSimpleHTMLDOM(self::URI . 'spip.php?page=backend')
|
||||
or returnServerError('Could not request Bastamag.');
|
||||
|
||||
|
@ -25,7 +19,13 @@ class BastaBridge extends BridgeAbstract {
|
|||
$item['title'] = $element->find('title', 0)->innertext;
|
||||
$item['uri'] = $element->find('guid', 0)->plaintext;
|
||||
$item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext);
|
||||
$item['content'] = replaceImageUrl(getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext);
|
||||
// Replaces all relative image URLs by absolute URLs.
|
||||
// Relative URLs always start with 'local/'!
|
||||
$item['content'] = preg_replace(
|
||||
'/src=["\']{1}([^"\']+)/ims',
|
||||
'src=\'' . self::URI . '$1\'',
|
||||
getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext
|
||||
);
|
||||
$this->items[] = $item;
|
||||
$limit++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue