$value ) { // TODO Instead should just fire actions which we hook into. // TODO should namespace api methods? switch( $action ) { // TODO should be dynamic case 'get_plugin_version' : $actions[$action] = '1.1'; break; case 'get_filesystem_method' : $actions[$action] = get_filesystem_method(); break; case 'get_wp_version' : global $wp_version; $actions[$action] = (string) $wp_version; break; case 'get_plugins' : $actions[$action] = _wprp_supports_plugin_upgrade() ? _wprp_get_plugins() : 'not-implemented'; break; case 'upgrade_plugin' : $actions[$action] = _wprp_upgrade_plugin( (string) $_GET['plugin'] ); break; case 'get_themes' : $actions[$action] = _wprp_supports_theme_upgrade() ? _wprp_get_themes() : 'not-implemented'; break; case 'upgrade_theme' : $actions[$action] = _wprp_upgrade_theme( (string) $_GET['theme'] ); break; case 'do_backup' : case 'delete_backup' : case 'supports_backups' : $actions[$action] = _wprp_backups_api_call( $action ); break; default : $actions[$action] = 'not-implemented'; break; } } echo json_encode( $actions ); exit;