public function pre_set_site_transient_update_plugins($data) { // // Only run after other plugins are checked. // if (empty($data->checked)) { return $data; } // // Create Batch of plugins to update. // $plugins = $this->get_plugin_meta(); $batch = array(); foreach ($plugins as $slug => $plugin) { $batch[] = $plugin->product_slug; } if (!empty($batch)) { // // Request update information from the remote API. // $request = X_Update_API::get_products($batch); $remote_plugins = isset($request['products']) ? $request['products'] : array(); // // Set update info for each plugin. // foreach ($plugins as $slug => $plugin) { // // Continue if there was a response from the server for this plugin. // if (isset($remote_plugins[$plugin->product_slug])) { $remote = $remote_plugins[$plugin->product_slug]; } else { continue; } $update = array('upgrade_notice' => $remote['download_url'] == null ? X_Update_API::get_validation_html_plugin_updates() : '', 'plugin' => $slug, 'slug' => dirname($slug), 'new_version' => $remote['latest_version'], 'url' => 'http://theme.co/changelog/?iframe=true', 'package' => $remote['download_url']); $remote_is_newer = 1 === version_compare($remote['latest_version'], $plugin->local_version); if ($remote_is_newer) { $data->response[$slug] = (object) $update; } } } // Clear addon list cache delete_site_option('x_addon_list_cache'); return $data; }