Make WordPress Core


Ignore:
Timestamp:
07/21/2016 03:41:17 AM (9 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r38119 r38126  
    39073907    }
    39083908
     3909    // No redirects
    39093910    $response = wp_safe_remote_get( $href, array(
    39103911        'timeout' => 15,
     
    39133914    ) );
    39143915
    3915     $message = null;
     3916    $error = false;
    39163917
    39173918    if ( is_wp_error( $response ) ) {
    3918         $error = $response->get_error_message();
    3919 
    3920         if ( strpos( $message, 'resolve host' ) !== false ) {
    3921             $message = array( 'error' => __( 'Invalid host name.' ) );
    3922         }
    3923 
    3924         wp_send_json_error( $message );
    3925     }
    3926 
    3927     if ( wp_remote_retrieve_response_code( $response ) === 404 ) {
    3928         wp_send_json_error( array( 'error' => __( 'Not found, HTTP error 404.' ) ) );
     3919        if ( strpos( $response->get_error_message(), 'resolve host' ) !== false ) {
     3920            $error = true;
     3921        }
     3922    } elseif ( wp_remote_retrieve_response_code( $response ) === 404 ) {
     3923        $error = true;
     3924    }
     3925
     3926    if ( $error ) {
     3927        wp_send_json_error( array( 'httpError' => true ) );
    39293928    }
    39303929
Note: See TracChangeset for help on using the changeset viewer.