Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API: Introduce Plugins and Block Directory endpoint #359

Closed
wants to merge 9 commits into from
2 changes: 2 additions & 0 deletions src/wp-admin/edit-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,14 @@
);
wp_tinymce_inline_scripts();
wp_enqueue_editor();
wp_enqueue_script( 'wp-block-directory' );

/**
* Styles
*/
wp_enqueue_style( 'wp-edit-post' );
wp_enqueue_style( 'wp-format-library' );
wp_enqueue_style( 'wp-block-directory' );

/**
* Fires after block assets have been enqueued for the editing interface.
Expand Down
19 changes: 11 additions & 8 deletions src/wp-admin/includes/plugin-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,17 @@ function plugins_api( $action, $args = array() ) {
$request = wp_remote_get( $url, $http_args );

if ( $ssl && is_wp_error( $request ) ) {
trigger_error(
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
);
if ( ! wp_is_json_request() ) {
trigger_error(
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
);
}

$request = wp_remote_get( $http_url, $http_args );
}

Expand Down
8 changes: 8 additions & 0 deletions src/wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ function create_initial_rest_routes() {
$controller = new WP_REST_Themes_Controller;
$controller->register_routes();

// Plugins.
$controller = new WP_REST_Plugins_Controller();
$controller->register_routes();

// Block Directory.
$controller = new WP_REST_Block_Directory_Controller();
$controller->register_routes();

}

/**
Expand Down
Loading