/**
  * 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);
 }
 * @param  string $class Class name
 * @return null
 */
function euapi_autoloader($class)
{
    if (0 !== strpos($class, 'EUAPI')) {
        return;
    }
    $name = str_replace('EUAPI_', '', $class);
    $name = str_replace('_', '-', $name);
    $name = strtolower($name);
    $file = sprintf('%1$s/external-update-api/%2$s.php', dirname(__FILE__), $name);
    if (is_readable($file)) {
        include $file;
    }
}
/**
 * Flush the site's plugin and theme update transients. Fired on activation and deactivation.
 *
 * @author John Blackbourn
 */
function euapi_flush_transients()
{
    delete_site_transient('update_plugins');
    delete_site_transient('update_themes');
}
register_activation_hook(__FILE__, 'euapi_flush_transients');
register_deactivation_hook(__FILE__, 'euapi_flush_transients');
spl_autoload_register('euapi_autoloader');
EUAPI::init();