$settings) { if (!is_array($settings)) continue; //preserve any existing cache data into the new transient so the widget doesn't blank out post-upgrade if (isset($settings['cache']) && !AdvancedSteamWidget_get_cache($id)) { AdvancedSteamWidget_set_cache( $id, $settings['cache'], $settings['last_cached'] ?? time() ); } //drop the old cache fields from the widget options. caches are moved to transients if (isset($settings['cache']) || isset($settings['last_cached'])) { unset($widget_settings[$id]['cache'], $widget_settings[$id]['last_cached']); $modified = true; } //migrate old preset/game_template/template to the new template slug field //custom-preset widgets reset to "games" template (their HTML/CSS content is discarded) if (isset($settings['preset'])) { $slug = ($settings['preset'] === 'custom') ? 'games' : $settings['preset']; $widget_settings[$id]['template'] = $slug; unset($widget_settings[$id]['preset'], $widget_settings[$id]['game_template']); $modified = true; } //rename legacy 'steam_id' key to 'profile_url' and normalize its value //old field held bare ids or vanity slugs if (isset($settings['steam_id'])) { $widget_settings[$id]['profile_url'] = AdvancedSteamWidget_normalize_profile_input($settings['steam_id']); unset($widget_settings[$id]['steam_id']); $modified = true; } } if ($modified) update_option("widget_advancedsteamwidget", $widget_settings); } register_activation_hook("advanced-steam-widget/advanced-steam-widget.php", "AdvancedSteamWidget_activate");