current; $weather_data['forecast'] = $weather_apixu->forecast; } else { // NOW $weather_apixu = apixuWeather::get_current_weather($key, $location); $weather_data['now'] = $weather_apixu->current; } $weather_data['location'] = $weather_apixu->location; if ($weather_data['now'] OR $weather_data['forecast']) { set_transient($weather_transient_name, $weather_data, apply_filters('apixu_weather_cache', 1800)); } } // NO WEATHER if (!$weather_data OR !isset($weather_data['now'])) return apixu_weather_error(); // TODAYS TEMPS $today = $weather_data['now']; $today_temp = ($units == "imperial") ? (int)$today->temp_f : (int)$today->temp_c; $location = $weather_data['location']; // BACKGROUND DATA, CLASSES AND OR IMAGES $background_classes = array(); $background_classes[] = "apixu-weather-wrap"; $background_classes[] = "awecf"; $background_classes[] = "awe_" . $size; // DATA //$header_title = $override_title ? $override_title : $today->name; // WIND $wind_direction = false; if (isset($today->wind_dir)) $wind_direction = apply_filters('apixu_weather_wind_direction', __($today->wind_dir, 'apixu-weather')); $background_classes[] = ($show_stats) ? "awe_with_stats" : "awe_without_stats"; // ADD WEATHER CONDITIONS CLASSES TO WRAP if (isset($today->condition)) { $weather_code = $today->condition->code; $weather_descr = explode(' ', strtolower(trim($today->condition->text))); $weather_description_slug = sanitize_title($weather_descr[ count($weather_descr) - 1 ]); $background_classes[] = "awe-code-" . $weather_code; $background_classes[] = "awe-desc-" . $weather_description_slug; } // EXTRA STYLES $background_class_string = @implode(" ", apply_filters('apixu_weather_background_classes', $background_classes)); $today_sign = ($today_temp > 0) ? '+' : ''; if (in_array($widget_scheme, [41, 42, 43, 44, 45])) { $widget_scheme_group = 'shm_4'; } elseif (in_array($widget_scheme, [71, 72, 73])) { $widget_scheme_group = 'shm_7'; } elseif (in_array($widget_scheme, [81, 82, 83])) { $widget_scheme_group = 'shm_8'; } elseif (in_array($widget_scheme, [91])) { $widget_scheme_group = 'shm_9'; } if (in_array($widget_scheme, array(1,81))){ $inline_style = "color:{$text_color};background:{$custom_bg_color}"; } if ($inline_style){ $inline_style = "style='{$inline_style}'"; } $background_class_string .= ' ' . $widget_scheme_group; // DISPLAY WIDGET $rtn .= "