[HaveIBeenPwnedBridge] Display breach type (#1203)

* Extract breach types for each data breach
* Add paragraph tag
This commit is contained in:
Joseph 2019-07-06 09:55:31 +00:00 committed by LogMANOriginal
parent a31e518a07
commit 7e6c58b67a

View file

@ -58,8 +58,9 @@ class HaveIBeenPwnedBridge extends BridgeAbstract {
$item['breachDate'] = strtotime($breachDate[1]);
$item['uri'] = self::URI . '/PwnedWebsites' . $permalink;
$item['content'] = '<p>' . $breach->find('p', 0)->innertext . '<p>';
$item['content'] .= '<p>' . $breach->find('p', 1)->innertext . '<p>';
$item['content'] = '<p>' . $breach->find('p', 0)->innertext . '</p>';
$item['content'] .= '<p>' . $this->breachType($breach) . '</p>';
$item['content'] .= '<p>' . $breach->find('p', 1)->innertext . '</p>';
$this->breaches[] = $item;
}
@ -68,6 +69,25 @@ class HaveIBeenPwnedBridge extends BridgeAbstract {
$this->createItems();
}
/**
* Extract data breach type(s)
*/
private function breachType($breach) {
$content = '';
if ($breach->find('h3 > i', 0)) {
foreach ($breach->find('h3 > i') as $i) {
$content .= $i->title . '.<br>';
}
}
return $content;
}
/**
* Order Breaches by date added or date breached
*/