Skip to content

Commit

Permalink
fix trim(): Passing null to parameter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
siddik-web committed Dec 15, 2022
1 parent eb17dd4 commit 0cd17e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/mod_sp_weather/tmpl/flat.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@

if ( $getdataby == 'locaion_id' && $platform == 'openweathermap' ) {
$country = ( isset($data['current']->sys->country) && $data['current']->sys->country ) ? $data['current']->sys->country : '';
$location = ( trim($params->get('locationTranslated')) =='' ) ? $data['current']->name . ', ' . $country : $params->get('locationTranslated');
$location = ( trim((string)$params->get('locationTranslated')) =='' ) ? $data['current']->name . ', ' . $country : $params->get('locationTranslated');
} else {
if ($platform == 'weatherbit') {
$city = ( isset($data['current']->city_name) && $data['current']->city_name ) ? $data['current']->city_name : '';
$country = ( isset($data['current']->country_code) && $data['current']->country_code ) ? $data['current']->country_code : '';
$location = ( trim($params->get('locationTranslated'))=='' ) ? $city . ', ' . $country : $params->get('locationTranslated');
$location = ( trim((string)$params->get('locationTranslated'))=='' ) ? $city . ', ' . $country : $params->get('locationTranslated');
} elseif ($platform == 'darksky') {
$location = ( trim($params->get('locationTranslated'))=='' ) ? str_replace('_', ' ', $location) : $params->get('locationTranslated');
$location = ( trim((string)$params->get('locationTranslated'))=='' ) ? str_replace('_', ' ', $location) : $params->get('locationTranslated');
} elseif ($platform == 'yahoo') {
$city = ( isset($data['current']->sys->city) && $data['current']->sys->city ) ? $data['current']->sys->city : '';
$country = ( isset($data['current']->sys->country) && $data['current']->sys->country ) ? $data['current']->sys->country : '';
$location = ( trim($params->get('locationTranslated'))=='' ) ? $city . ', ' . $country : $params->get('locationTranslated');
$location = ( trim((string)$params->get('locationTranslated'))=='' ) ? $city . ', ' . $country : $params->get('locationTranslated');
} else {
$location = ( trim($params->get('locationTranslated'))=='' ) ? $params->get('location') : $params->get('locationTranslated');
$location = ( trim((string)$params->get('locationTranslated'))=='' ) ? $params->get('location') : $params->get('locationTranslated');
}
}

Expand Down

0 comments on commit 0cd17e5

Please sign in to comment.