wp_update_plugins

The timeline below displays how wordpress function wp_update_plugins has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
 *
 * Despite its name this function does not actually perform any updates, it only checks for available updates.
 *
 * A list of all plugins installed is sent to WP, along with the site locale.
 *
 * Checks against the WordPress server at api.wordpress.org. Will only check
 * if WordPress isn't installing.
 *
 * @since 2.3.0
 *
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $updates = new stdClass();
    $updates->last_checked = time();
    $updates->response = array();
    $updates->translations = array();
    $updates->no_update = array();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $updates->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || (string) $current->checked[$file] !== (string) $p['Version']) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param string[] $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
        // 30 seconds.
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 !== wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    if ($response && is_array($response)) {
        $updates->response = $response['plugins'];
        $updates->translations = $response['translations'];
        $updates->no_update = $response['no_update'];
    }
    // Support updates for any plugins using the `Update URI` header field.
    foreach ($plugins as $plugin_file => $plugin_data) {
        if (!$plugin_data['UpdateURI'] || isset($updates->response[$plugin_file])) {
            continue;
        }
        $hostname = wp_parse_url(sanitize_url($plugin_data['UpdateURI']), PHP_URL_HOST);
        /**
         * Filters the update response for a given plugin hostname.
         *
         * The dynamic portion of the hook name, `$hostname`, refers to the hostname
         * of the URI specified in the `Update URI` header field.
         *
         * @since 5.8.0
         *
         * @param array|false $update {
         *     The plugin update data with the latest details. Default false.
         *
         *     @type string $id           Optional. ID of the plugin for update purposes, should be a URI
         *                                specified in the `Update URI` header field.
         *     @type string $slug         Slug of the plugin.
         *     @type string $version      The version of the plugin.
         *     @type string $url          The URL for details of the plugin.
         *     @type string $package      Optional. The update ZIP for the plugin.
         *     @type string $tested       Optional. The version of WordPress the plugin is tested against.
         *     @type string $requires_php Optional. The version of PHP which the plugin requires.
         *     @type bool   $autoupdate   Optional. Whether the plugin should automatically update.
         *     @type array  $icons        Optional. Array of plugin icons.
         *     @type array  $banners      Optional. Array of plugin banners.
         *     @type array  $banners_rtl  Optional. Array of plugin RTL banners.
         *     @type array  $translations {
         *         Optional. List of translation updates for the plugin.
         *
         *         @type string $language   The language the translation update is for.
         *         @type string $version    The version of the plugin this translation is for.
         *                                  This is not the version of the language file.
         *         @type string $updated    The update timestamp of the translation file.
         *                                  Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
         *         @type string $package    The ZIP location containing the translation update.
         *         @type string $autoupdate Whether the translation should be automatically installed.
         *     }
         * }
         * @param array       $plugin_data      Plugin headers.
         * @param string      $plugin_file      Plugin filename.
         * @param string[]    $locales          Installed locales to look up translations for.
         */
        $update = apply_filters("update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales);
        if (!$update) {
            continue;
        }
        $update = (object) $update;
        // Is it valid? We require at least a version.
        if (!isset($update->version)) {
            continue;
        }
        // These should remain constant.
        $update->id = $plugin_data['UpdateURI'];
        $update->plugin = $plugin_file;
        // WordPress needs the version field specified as 'new_version'.
        if (!isset($update->new_version)) {
            $update->new_version = $update->version;
        }
        // Handle any translation updates.
        if (!empty($update->translations)) {
            foreach ($update->translations as $translation) {
                if (isset($translation['language'], $translation['package'])) {
                    $translation['type'] = 'plugin';
                    $translation['slug'] = isset($update->slug) ? $update->slug : $update->id;
                    $updates->translations[] = $translation;
                }
            }
        }
        unset($updates->no_update[$plugin_file], $updates->response[$plugin_file]);
        if (version_compare($update->new_version, $plugin_data['Version'], '>')) {
            $updates->response[$plugin_file] = $update;
        } else {
            $updates->no_update[$plugin_file] = $update;
        }
    }
    $sanitize_plugin_update_payload = static function (&$item) {
        $item = (object) $item;
        unset($item->translations, $item->compatibility);
        return $item;
    };
    array_walk($updates->response, $sanitize_plugin_update_payload);
    array_walk($updates->no_update, $sanitize_plugin_update_payload);
    set_site_transient('update_plugins', $updates);
}

WordPress Version: 5.9

/**
 * Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
 *
 * Despite its name this function does not actually perform any updates, it only checks for available updates.
 *
 * A list of all plugins installed is sent to WP, along with the site locale.
 *
 * Checks against the WordPress server at api.wordpress.org. Will only check
 * if WordPress isn't installing.
 *
 * @since 2.3.0
 *
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $updates = new stdClass();
    $updates->last_checked = time();
    $updates->response = array();
    $updates->translations = array();
    $updates->no_update = array();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $updates->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || (string) $current->checked[$file] !== (string) $p['Version']) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 !== wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    if ($response && is_array($response)) {
        $updates->response = $response['plugins'];
        $updates->translations = $response['translations'];
        $updates->no_update = $response['no_update'];
    }
    // Support updates for any plugins using the `Update URI` header field.
    foreach ($plugins as $plugin_file => $plugin_data) {
        if (!$plugin_data['UpdateURI'] || isset($updates->response[$plugin_file])) {
            continue;
        }
        $hostname = wp_parse_url(esc_url_raw($plugin_data['UpdateURI']), PHP_URL_HOST);
        /**
         * Filters the update response for a given plugin hostname.
         *
         * The dynamic portion of the hook name, `$hostname`, refers to the hostname
         * of the URI specified in the `Update URI` header field.
         *
         * @since 5.8.0
         *
         * @param array|false $update {
         *     The plugin update data with the latest details. Default false.
         *
         *     @type string $id           Optional. ID of the plugin for update purposes, should be a URI
         *                                specified in the `Update URI` header field.
         *     @type string $slug         Slug of the plugin.
         *     @type string $version      The version of the plugin.
         *     @type string $url          The URL for details of the plugin.
         *     @type string $package      Optional. The update ZIP for the plugin.
         *     @type string $tested       Optional. The version of WordPress the plugin is tested against.
         *     @type string $requires_php Optional. The version of PHP which the plugin requires.
         *     @type bool   $autoupdate   Optional. Whether the plugin should automatically update.
         *     @type array  $icons        Optional. Array of plugin icons.
         *     @type array  $banners      Optional. Array of plugin banners.
         *     @type array  $banners_rtl  Optional. Array of plugin RTL banners.
         *     @type array  $translations {
         *         Optional. List of translation updates for the plugin.
         *
         *         @type string $language   The language the translation update is for.
         *         @type string $version    The version of the plugin this translation is for.
         *                                  This is not the version of the language file.
         *         @type string $updated    The update timestamp of the translation file.
         *                                  Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
         *         @type string $package    The ZIP location containing the translation update.
         *         @type string $autoupdate Whether the translation should be automatically installed.
         *     }
         * }
         * @param array       $plugin_data      Plugin headers.
         * @param string      $plugin_file      Plugin filename.
         * @param array       $locales          Installed locales to look translations for.
         */
        $update = apply_filters("update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales);
        if (!$update) {
            continue;
        }
        $update = (object) $update;
        // Is it valid? We require at least a version.
        if (!isset($update->version)) {
            continue;
        }
        // These should remain constant.
        $update->id = $plugin_data['UpdateURI'];
        $update->plugin = $plugin_file;
        // WordPress needs the version field specified as 'new_version'.
        if (!isset($update->new_version)) {
            $update->new_version = $update->version;
        }
        // Handle any translation updates.
        if (!empty($update->translations)) {
            foreach ($update->translations as $translation) {
                if (isset($translation['language'], $translation['package'])) {
                    $translation['type'] = 'plugin';
                    $translation['slug'] = isset($update->slug) ? $update->slug : $update->id;
                    $updates->translations[] = $translation;
                }
            }
        }
        unset($updates->no_update[$plugin_file], $updates->response[$plugin_file]);
        if (version_compare($update->new_version, $plugin_data['Version'], '>')) {
            $updates->response[$plugin_file] = $update;
        } else {
            $updates->no_update[$plugin_file] = $update;
        }
    }
    $sanitize_plugin_update_payload = static function (&$item) {
        $item = (object) $item;
        unset($item->translations, $item->compatibility);
        return $item;
    };
    array_walk($updates->response, $sanitize_plugin_update_payload);
    array_walk($updates->no_update, $sanitize_plugin_update_payload);
    set_site_transient('update_plugins', $updates);
}

WordPress Version: 5.8

/**
 * Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
 *
 * Despite its name this function does not actually perform any updates, it only checks for available updates.
 *
 * A list of all plugins installed is sent to WP, along with the site locale.
 *
 * Checks against the WordPress server at api.wordpress.org. Will only check
 * if WordPress isn't installing.
 *
 * @since 2.3.0
 *
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $updates = new stdClass();
    $updates->last_checked = time();
    $updates->response = array();
    $updates->translations = array();
    $updates->no_update = array();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $updates->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || (string) $current->checked[$file] !== (string) $p['Version']) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 !== wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    if ($response && is_array($response)) {
        $updates->response = $response['plugins'];
        $updates->translations = $response['translations'];
        $updates->no_update = $response['no_update'];
    }
    // Support updates for any plugins using the `Update URI` header field.
    foreach ($plugins as $plugin_file => $plugin_data) {
        if (!$plugin_data['UpdateURI'] || isset($updates->response[$plugin_file])) {
            continue;
        }
        $hostname = wp_parse_url(esc_url_raw($plugin_data['UpdateURI']), PHP_URL_HOST);
        /**
         * Filters the update response for a given plugin hostname.
         *
         * The dynamic portion of the hook name, `$hostname`, refers to the hostname
         * of the URI specified in the `Update URI` header field.
         *
         * @since 5.8.0
         *
         * @param array|false $update {
         *     The plugin update data with the latest details. Default false.
         *
         *     @type string $id           Optional. ID of the plugin for update purposes, should be a URI
         *                                specified in the `Update URI` header field.
         *     @type string $slug         Slug of the plugin.
         *     @type string $version      The version of the plugin.
         *     @type string $url          The URL for details of the plugin.
         *     @type string $package      Optional. The update ZIP for the plugin.
         *     @type string $tested       Optional. The version of WordPress the plugin is tested against.
         *     @type string $requires_php Optional. The version of PHP which the plugin requires.
         *     @type bool   $autoupdate   Optional. Whether the plugin should automatically update.
         *     @type array  $icons        Optional. Array of plugin icons.
         *     @type array  $banners      Optional. Array of plugin banners.
         *     @type array  $banners_rtl  Optional. Array of plugin RTL banners.
         *     @type array  $translations {
         *         Optional. List of translation updates for the plugin.
         *
         *         @type string $language   The language the translation update is for.
         *         @type string $version    The version of the plugin this translation is for.
         *                                  This is not the version of the language file.
         *         @type string $updated    The update timestamp of the translation file.
         *                                  Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
         *         @type string $package    The ZIP location containing the translation update.
         *         @type string $autoupdate Whether the translation should be automatically installed.
         *     }
         * }
         * @param array       $plugin_data      Plugin headers.
         * @param string      $plugin_file      Plugin filename.
         * @param array       $locales          Installed locales to look translations for.
         */
        $update = apply_filters("update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales);
        if (!$update) {
            continue;
        }
        $update = (object) $update;
        // Is it valid? We require at least a version.
        if (!isset($update->version)) {
            continue;
        }
        // These should remain constant.
        $update->id = $plugin_data['UpdateURI'];
        $update->plugin = $plugin_file;
        // WordPress needs the version field specified as 'new_version'.
        if (!isset($update->new_version)) {
            $update->new_version = $update->version;
        }
        // Handle any translation updates.
        if (!empty($update->translations)) {
            foreach ($update->translations as $translation) {
                if (isset($translation['language'], $translation['package'])) {
                    $translation['type'] = 'plugin';
                    $translation['slug'] = isset($update->slug) ? $update->slug : $update->id;
                    $updates->translations[] = $translation;
                }
            }
        }
        unset($updates->no_update[$plugin_file], $updates->response[$plugin_file]);
        if (version_compare($update->new_version, $plugin_data['Version'], '>')) {
            $updates->response[$plugin_file] = $update;
        } else {
            $updates->no_update[$plugin_file] = $update;
        }
    }
    $sanitize_plugin_update_payload = function (&$item) {
        $item = (object) $item;
        unset($item->translations, $item->compatibility);
        return $item;
    };
    array_walk($updates->response, $sanitize_plugin_update_payload);
    array_walk($updates->no_update, $sanitize_plugin_update_payload);
    set_site_transient('update_plugins', $updates);
}

WordPress Version: 5.6

/**
 * Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
 *
 * Despite its name this function does not actually perform any updates, it only checks for available updates.
 *
 * A list of all plugins installed is sent to WP, along with the site locale.
 *
 * Checks against the WordPress server at api.wordpress.org. Will only check
 * if WordPress isn't installing.
 *
 * @since 2.3.0
 *
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || (string) $current->checked[$file] !== (string) $p['Version']) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 !== wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 5.5

/**
 * Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
 *
 * Despite its name this function does not actually perform any updates, it only checks for available updates.
 *
 * A list of all plugins installed is sent to WP, along with the site locale.
 *
 * Checks against the WordPress server at api.wordpress.org. Will only check
 * if WordPress isn't installing.
 *
 * @since 2.3.0
 *
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 !== wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 5.4

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version The WordPress version string.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // Include an unmodified $wp_version.
    require ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours.
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed.
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs.
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins.
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 5.3

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    $http_url = $url;
    $ssl = wp_http_supports(array('ssl'));
    if ($ssl) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: Support forums URL. */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/forums/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .20

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 9.2

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .10

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 2 * HOUR_IN_SECONDS;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.9

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url('/'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.8

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    $doing_cron = wp_doing_cron();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if ($doing_cron) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if ($doing_cron) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.7

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(sprintf(
            /* translators: %s: support forums URL */
            __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
            __('https://wordpress.org/support/')
        ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.6

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filters the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.5

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array_values(get_available_languages());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
     *
     * @param array $locales Plugin locales. Default is all available locales of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $locales = array_unique($locales);
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
        if (isset($plugin->compatibility)) {
            $plugin->compatibility = (object) $plugin->compatibility;
            foreach ($plugin->compatibility as &$data) {
                $data = (object) $data;
            }
        }
    }
    unset($plugin, $data);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.4

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (wp_installing()) {
        return;
    }
    global $wp_version;
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', array(get_locale()));
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.3

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @global string $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 */
function wp_update_plugins($extra_stats = array())
{
    if (defined('WP_INSTALLING')) {
        return;
    }
    global $wp_version;
    // include an unmodified $wp_version
    include ABSPATH . WPINC . '/version.php';
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', array(get_locale()));
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.1

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return false|null Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => wp_json_encode($to_send), 'translations' => wp_json_encode($translations), 'locale' => wp_json_encode($locales), 'all' => wp_json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = wp_json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 4.0

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    if (defined('DOING_CRON') && DOING_CRON) {
        $timeout = 30;
    } else {
        // Three seconds, plus one extra second for every 10 plugins
        $timeout = 3 + (int) (count($plugins) / 10);
    }
    $options = array('timeout' => $timeout, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales), 'all' => json_encode(true)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    foreach ($response['no_update'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
        // TODO: Perhaps better to store no_update in a separate transient with an expiry?
        $new_option->no_update = $response['no_update'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
        $new_option->no_update = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 3.9

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.') . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 8.4

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .30

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 8.3

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .20

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 8.2

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .12

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .10

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 3.8

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 7.5

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .40

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 7.4

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .30

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 7.3

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .20

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 7.2

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .12

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            if (defined('DOING_CRON') && DOING_CRON) {
                $timeout = 0;
            } else {
                $timeout = 12 * HOUR_IN_SECONDS;
            }
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: .10

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins($extra_stats = array())
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed && !$extra_stats) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    if ($extra_stats) {
        $options['body']['update_stats'] = json_encode($extra_stats);
    }
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 7.1

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if ($ssl = wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if ($ssl && is_wp_error($raw_response)) {
        trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.') . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', (headers_sent() || WP_DEBUG) ? E_USER_WARNING : E_USER_NOTICE);
        $raw_response = wp_remote_post($http_url, $options);
    }
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}

WordPress Version: 3.7

/**
 * Check plugin versions against the latest versions hosted on WordPress.org.
 *
 * The WordPress version, PHP version, and Locale is sent along with a list of
 * all plugins installed. Checks against the WordPress server at
 * api.wordpress.org. Will only check if WordPress isn't installing.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_version Used to notify the WordPress version.
 *
 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 */
function wp_update_plugins()
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (defined('WP_INSTALLING')) {
        return false;
    }
    // If running blog-side, bail unless we've not checked in the last 12 hours
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $plugins = get_plugins();
    $translations = wp_get_installed_translations('plugins');
    $active = get_option('active_plugins', array());
    $current = get_site_transient('update_plugins');
    if (!is_object($current)) {
        $current = new stdClass();
    }
    $new_option = new stdClass();
    $new_option->last_checked = time();
    // Check for update on a different schedule, depending on the page.
    switch (current_filter()) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            $timeout = 12 * HOUR_IN_SECONDS;
    }
    $time_not_changed = isset($current->last_checked) && $timeout > time() - $current->last_checked;
    if ($time_not_changed) {
        $plugin_changed = false;
        foreach ($plugins as $file => $p) {
            $new_option->checked[$file] = $p['Version'];
            if (!isset($current->checked[$file]) || strval($current->checked[$file]) !== strval($p['Version'])) {
                $plugin_changed = true;
            }
        }
        if (isset($current->response) && is_array($current->response)) {
            foreach ($current->response as $plugin_file => $update_details) {
                if (!isset($plugins[$plugin_file])) {
                    $plugin_changed = true;
                    break;
                }
            }
        }
        // Bail if we've checked recently and if nothing has changed
        if (!$plugin_changed) {
            return false;
        }
    }
    // Update last_checked for current to prevent multiple blocking requests if request hangs
    $current->last_checked = time();
    set_site_transient('update_plugins', $current);
    $to_send = compact('plugins', 'active');
    $locales = array(get_locale());
    /**
     * Filter the locales requested for plugin translations.
     *
     * @since 3.7.0
     *
     * @param array $locales Plugin locale. Default is current locale of the site.
     */
    $locales = apply_filters('plugins_update_check_locales', $locales);
    $options = array('timeout' => (defined('DOING_CRON') && DOING_CRON) ? 30 : 3, 'body' => array('plugins' => json_encode($to_send), 'translations' => json_encode($translations), 'locale' => json_encode($locales)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    $url = 'http://api.wordpress.org/plugins/update-check/1.1/';
    if (wp_http_supports(array('ssl'))) {
        $url = set_url_scheme($url, 'https');
    }
    $raw_response = wp_remote_post($url, $options);
    if (is_wp_error($raw_response) || 200 != wp_remote_retrieve_response_code($raw_response)) {
        return false;
    }
    $response = json_decode(wp_remote_retrieve_body($raw_response), true);
    foreach ($response['plugins'] as &$plugin) {
        $plugin = (object) $plugin;
    }
    unset($plugin);
    if (is_array($response)) {
        $new_option->response = $response['plugins'];
        $new_option->translations = $response['translations'];
    } else {
        $new_option->response = array();
        $new_option->translations = array();
    }
    set_site_transient('update_plugins', $new_option);
}