Skip to content

Commit

Permalink
Merge pull request #155 from jncn/feature/interruptions
Browse files Browse the repository at this point in the history
Feature/interruptions
  • Loading branch information
Pieter Colpaert committed Jan 30, 2016
2 parents 86015f8 + bcc8ba0 commit 2bc3e15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/data/NMBS/connections.php
Expand Up @@ -207,8 +207,8 @@ public static function parseHafasXml($serverData, $lang, $fast, $showAlerts = fa
$alerts = [];
foreach ($conn->IList->I as $info) {
$alert = new Alert();
$alert->header = htmlentities(trim($info['header']));
$alert->description = htmlentities(trim($info['text']));
$alert->header = html_entity_decode(htmlentities(trim($info['header'])));
$alert->description = html_entity_decode(htmlentities(trim($info['text'])));
array_push($alerts, $alert);
}
$connection[$i]->alert = $alerts;
Expand Down
4 changes: 2 additions & 2 deletions api/data/NMBS/liveboard.php
Expand Up @@ -192,8 +192,8 @@ private static function parseData($xml, $time, $lang, $fast = false, $showAlerts
$himmessage = $journey->HIMMessage;
for ($a = 0; $a < count($himmessage); $a++) {
$alert = new Alert();
$alert->header = htmlentities(trim($himmessage[$a]['header']));
$alert->description = htmlentities(trim($himmessage[$a]['lead']));
$alert->header = html_entity_decode(htmlentities(trim($himmessage[$a]['header'])));
$alert->description = html_entity_decode(htmlentities(trim($himmessage[$a]['lead'])));
array_push($alerts, $alert);
}
$nodes[$i]->alert = $alerts;
Expand Down
6 changes: 3 additions & 3 deletions api/data/NMBS/vehicleinformation.php
Expand Up @@ -228,15 +228,15 @@ private static function getAlerts($html)

foreach ($nodes as $alertnode) {
$bodysplitter = "*#*";
$alertbody = strip_tags($alertnode, '<strong>, <br>');
$alertbody = strip_tags($alertnode, '<strong>, <br>, <a>');
$alertbody = str_replace('</strong>', $bodysplitter, $alertbody);
$alertbody = str_replace('<strong>', '', $alertbody);
$alertelements = explode($bodysplitter, $alertbody);
$header = preg_replace("/&nbsp;|\s*\(.*?\)\s*/i", '', $alertelements[0]);

$alert = new Alert();
$alert->header = htmlentities(trim($header));
$alert->description = htmlentities(trim($alertelements[1]));
$alert->header = html_entity_decode(htmlentities(trim($header)));
$alert->description = html_entity_decode(htmlentities(trim($alertelements[1])));

array_push($alerts, $alert);
}
Expand Down

0 comments on commit 2bc3e15

Please sign in to comment.