* @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();