Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/interruptions #155

Merged
merged 2 commits into from Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -219,15 +219,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