Skip to content

Commit

Permalink
Merge branch 'release/1.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwsmith committed Jun 27, 2020
2 parents 64f8bbc + fd47ae9 commit 0fa55e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 55 deletions.
54 changes: 1 addition & 53 deletions front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
use Rarst\WordPress\DateTime\WpDateTime;
use Rarst\WordPress\DateTime\WpDateTimeZone;

//$data = json_decode(file_get_contents(WP_CONTENT_DIR . '/uploads/KCHS.json'), true);

$data = array();

$data['current_observation'] = chswx_normalize_observation_data(chswx_get_observation_data());
Expand Down Expand Up @@ -79,15 +77,6 @@
}
?>
<?php get_header(); ?>
<?php /*<script>
jQuery(document).ready(function($) {
$('.alert').click(function(event) {
var toggleID = '#' + event.currentTarget.id.toString();
$(toggleID + ' ul').toggle();
});
});
</script>
*/?>
<div id="currentwx">
<h2>CURRENTLY</h2>
<?php
Expand All @@ -109,48 +98,7 @@
<div class="fail">Temporarily Unavailable</div>
<?php } ?>
</div>
<?php if (!empty($data['alerts']))
{
?>
<div id="advisories">
<h2>Alerts</h2>
<ul>
<?php foreach($data['alerts'] as $alert)
{
// try to filter out bad advisories
$current_time = time();

if($alert['phenomena'] == "TO")
{
$advisory_class = "tor";
}
else if($alert['phenomena'] == "SV")
{
$advisory_class = "svr";
}
else if($alert['phenomena'] == 'FL' || $alert['phenomena'] == 'FF')
{
$advisory_class = "ffw";
}
else
{
$advisory_class = "normal";
}

$alert_timing_text = '';

if($alert['date_epoch'] > time()) {
$alert_timing_text = "from {$alert['date']} ";
}

$alert_timing_text .= " until {$alert['expires']}";

echo "<li class=\"alert vtec-phen-{$alert['phenomena']} vtec-sig-{$alert['significance']}\" id=\"{$alert['phenomena']}-{$alert['significance']}-{$alert['date_epoch']}\"><span class=\"alert-name\">" . $alert['description'] . "</span> <span class=\"alert-timing\">$alert_timing_text</span>";
echo "<ul><li>" . str_replace("\n",'<br />',trim($alert['message'])) . "</li></ul></li>";
}
?>
</div>
<?php } ?>
<?php do_action('wx_alerts'); ?>
<?php if (isset($data['forecast'])) :
$fcstdate = new WpDateTime();
if (isset($data['forecast']['updated'])) {
Expand Down
4 changes: 2 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ function chswx_normalize_observation_data($ob)
}

if (!is_null($windSpd)) {
$c_wind = new Convertor($windSpd, 'm s**-1');
$c_wind = new Convertor($windSpd, 'km h**-1');
$n_ob['wind_mph'] = round($c_wind->to('mi h**-1')) . " mph";
} else {
$n_ob['wind_mph'] = "Not Available";
}

if (!is_null($windGust)) {
$c_gust = new Convertor($windGust, 'm s**-1');
$c_gust = new Convertor($windGust, 'km h**-1');
$n_ob['wind_gust_mph'] = round($c_gust->to('mi h**-1')) . " mph";
}

Expand Down

0 comments on commit 0fa55e4

Please sign in to comment.