WordPress.org

Make WordPress Core

Ticket #40245: 40245_update.diff

File 40245_update.diff, 3.1 KB (added by TomHarrigan, 2 years ago)

patch refresh

  • wp-includes/default-filters.php

     
    554554add_filter( 'the_excerpt_embed', 'shortcode_unautop' );
    555555add_filter( 'the_excerpt_embed', 'wp_embed_excerpt_attachment' );
    556556
     557add_filter( 'oembed_dataparse', 'wp_filter_oembed_title', 9, 3 );
    557558add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 );
    558559add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );
    559560add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 );
  • wp-includes/embed.php

     
    709709}
    710710
    711711/**
     712 * + * Filters the given oEmbed HTML to make sure it has a title.
     713 *
     714 * @since x.x.x
     715 *
     716 * @param string $result The oEmbed HTML result.
     717 * @param object $data   A data object result from an oEmbed provider.
     718 * @param string $url    The URL of the content to be embedded.
     719 * @return string The filtered oEmbed result.
     720 */
     721function wp_filter_oembed_title( $result, $data, $url ) {
     722
     723        // Get title from oEmbed data to start.
     724        $title = ! empty( $data->title ) ? $data->title : '';
     725
     726        // If no oEmbed title, search the return markup for a title attribute.
     727        $preg_match     = '/title\=[\"|\\\']{1}([^\"\\\']*)[\"|\\\']{1}/i';
     728        $has_title_attr = preg_match( $preg_match, $result, $matches );
     729        if ( $has_title_attr && ! empty( $matches[1] ) ) {
     730                $title = $matches[1];
     731        }
     732
     733        $title = apply_filters( 'oembed_title', $title, $result, $data, $url );
     734
     735        /*
     736         * If the title attribute already
     737         * exists, replace with new value.
     738         *
     739         * Otherwise, add the title attribute.
     740         */
     741        if ( $has_title_attr ) {
     742                $result = preg_replace( $preg_match, 'title="' . esc_attr( $title ) . '"', $result );
     743        } else {
     744                $result = preg_replace( '/^\<iframe/i', '<iframe title="' . esc_attr( $title ) . '"', $result );
     745        }
     746
     747        return $result;
     748}
     749
     750/**
    712751 * Filters the given oEmbed HTML.
    713752 *
    714753 * If the `$url` isn't on the trusted providers list,
  • wp-login.php

     
    334334        } elseif ( strpos( $_POST['user_login'], '@' ) ) {
    335335                $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
    336336                if ( empty( $user_data ) ) {
    337                         $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There is no user registered with that email address.' ) );
     337                        $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There are no user accounts using that username or email address.' ) );
    338338                }
    339339        } else {
    340340                $login     = trim( $_POST['user_login'] );
     
    357357        }
    358358
    359359        if ( ! $user_data ) {
    360                 $errors->add( 'invalidcombo', __( '<strong>ERROR</strong>: Invalid username or email.' ) );
     360                $errors->add( 'invalidcombo', __( '<strong>ERROR</strong>: There are no user accounts using that username or email address.' ) );
    361361                return $errors;
    362362        }
    363363