checked)) return $checked_data; $request_args = array( 'slug' => $plugin_slug, 'version' => $checked_data->checked[$plugin_slug .'/'. $plugin_slug .'.php'], ); $request_string = prepare_request('basic_check', $request_args); // Start checking for an update $raw_response = wp_remote_post($api_url, $request_string); if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200)) $response = unserialize($raw_response['body']); if (is_object($response) && !empty($response)) // Feed the update data into WP updater $checked_data->response[$plugin_slug .'/'. $plugin_slug .'.php'] = $response; return $checked_data; } // Take over the Plugin info screen add_filter('plugins_api', 'my_plugin_api_call', 10, 3); function my_plugin_api_call($def, $action, $args) { global $plugin_slug, $api_url; if ($args->slug != $plugin_slug) return false; // Get the current version $plugin_info = get_site_transient('update_plugins'); $current_version = $plugin_info->checked[$plugin_slug .'/'. $plugin_slug .'.php']; $args->version = $current_version; $request_string = prepare_request($action, $args); $request = wp_remote_post($api_url, $request_string); if (is_wp_error($request)) { $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.

Try again'), $request->get_error_message()); } else { $res = unserialize($request['body']); if ($res === false) $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']); } return $res; } function prepare_request($action, $args) { global $wp_version; return array( 'body' => array( 'action' => $action, 'request' => serialize($args), 'api-key' => md5(get_bloginfo('url')) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url') ); } ?>