DansTonChatBridge: test before accessing plaintext
This commit is contained in:
parent
2390fb58b3
commit
4b7fbe4188
1 changed files with 6 additions and 1 deletions
|
@ -15,7 +15,12 @@ class DansTonChatBridge extends BridgeAbstract {
|
||||||
foreach($html->find('div.item') as $element) {
|
foreach($html->find('div.item') as $element) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = $element->find('a', 0)->href;
|
$item['uri'] = $element->find('a', 0)->href;
|
||||||
$item['title'] = 'DansTonChat ' . html_entity_decode($element->find('h3 a', 0)->plaintext, ENT_QUOTES);
|
$titleContent = $element->find('h3 a', 0);
|
||||||
|
if($titleContent) {
|
||||||
|
$item['title'] = 'DansTonChat ' . html_entity_decode($titleContent->plaintext, ENT_QUOTES);
|
||||||
|
} else {
|
||||||
|
$item['title'] = 'DansTonChat';
|
||||||
|
}
|
||||||
$item['content'] = $element->find('div.item-content a', 0)->innertext;
|
$item['content'] = $element->find('div.item-content a', 0)->innertext;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue