mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
TinyMCE, link check:
- Use `wp.a11y.speak()` to announce bad URLs. - Do not add a title to the link toolbar. - Better error message. Props afercia, azaozz. See #36638. git-svn-id: https://develop.svn.wordpress.org/trunk@38126 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3906,26 +3906,25 @@ function wp_ajax_test_url() {
|
||||
$href = get_bloginfo( 'url' ) . $href;
|
||||
}
|
||||
|
||||
// No redirects
|
||||
$response = wp_safe_remote_get( $href, array(
|
||||
'timeout' => 15,
|
||||
// Use an explicit user-agent
|
||||
'user-agent' => 'WordPress URL Test',
|
||||
) );
|
||||
|
||||
$message = null;
|
||||
$error = false;
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$error = $response->get_error_message();
|
||||
|
||||
if ( strpos( $message, 'resolve host' ) !== false ) {
|
||||
$message = array( 'error' => __( 'Invalid host name.' ) );
|
||||
if ( strpos( $response->get_error_message(), 'resolve host' ) !== false ) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
wp_send_json_error( $message );
|
||||
} elseif ( wp_remote_retrieve_response_code( $response ) === 404 ) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if ( wp_remote_retrieve_response_code( $response ) === 404 ) {
|
||||
wp_send_json_error( array( 'error' => __( 'Not found, HTTP error 404.' ) ) );
|
||||
if ( $error ) {
|
||||
wp_send_json_error( array( 'httpError' => true ) );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
|
||||
Reference in New Issue
Block a user