Fragen\GitHub_Updater\Rest_Update::show_updates PHP Method

show_updates() public method

Return listing of available updates.
public show_updates ( $response ) : mixed
$response
return mixed
    public function show_updates($response)
    {
        $themes = get_site_transient('update_themes');
        $plugins = get_site_transient('update_plugins');
        $show_plugins = null;
        $show_themes = null;
        /*
         * Ensure update data is up to date.
         */
        $this->forced_meta_update_remote_management();
        $themes = Theme::instance()->pre_set_site_transient_update_themes($themes);
        $plugins = Plugin::instance()->pre_set_site_transient_update_plugins($plugins);
        foreach ($plugins->response as $plugin) {
            $plugin->plugin = $plugin->slug;
            unset($plugin->slug);
            unset($plugin->url);
            unset($plugin->package);
            if (isset($plugin->id, $plugin->tested, $plugin->compatibility)) {
                unset($plugin->id);
                unset($plugin->tested);
                unset($plugin->compatibility);
            }
            $show_plugins[] = $plugin;
        }
        foreach ($themes->response as $theme) {
            unset($theme['url']);
            unset($theme['package']);
            $show_themes[] = $theme;
        }
        $response['messages'] = 'Available Updates';
        $response['plugins'] = $show_plugins;
        $response['themes'] = $show_themes;
        return $response;
    }