/** * Fetch info about the latest version of the item. * * @author John Blackbourn * @return EUAPI_Info|WP_Error An EUAPI_Info object, or a WP_Error object on failure. */ public final function fetch_info() { $fields = array('author' => 'Author', 'description' => 'Description'); switch ($this->get_type()) { case 'plugin': $file = $this->get_file_url(); $fields['plugin_name'] = 'Plugin Name'; break; case 'theme': $file = $this->get_file_url('style.css'); $fields['theme_name'] = 'Theme Name'; break; } $response = EUAPI::fetch($file, $this->config['http']); if (is_wp_error($response)) { return $response; } $data = EUAPI::get_content_data($response, $fields); $info = array_merge($data, array('slug' => $this->get_file(), 'version' => $this->get_new_version(), 'homepage' => $this->get_homepage_url(), 'download_link' => $this->get_package_url(), 'downloaded' => 0, 'sections' => array('description' => $data['description']))); return new EUAPI_Info($info); }