WordPress.org

Make WordPress Core

Ticket #25459: 25459.3.diff

File 25459.3.diff, 1.2 KB (added by GrahamArmfield, 7 years ago)

New patch which combines Neil Pie's functionality with a more concise function name.

  • src/wp-includes/functions.php

     
    41914191function reset_mbstring_encoding() {
    41924192        mbstring_binary_safe_encoding( true );
    41934193}
     4194
     4195/**
     4196 * Wrap two text strings in appropriate HTML to display one on screen and present the other to a screen reader.
     4197 *
     4198 * @since
     4199 *
     4200 * @param string $display_text The text to display on screen
     4201 * @param string $screen_reader_alternative_text The text to present to screen readers
     4202 * @return string
     4203 */
     4204function get_aria_text_combination( $display_text, $screen_reader_alternative_text ) {
     4205        /**
     4206         * Filter the HTML class attribute of the screen reader element.
     4207         *
     4208         * @since
     4209         *
     4210         * @param string The HTML class attribute to add to the screen reader element
     4211         */
     4212        $screen_reader_element_class = apply_filters( 'screen_reader_alternative_text_classname', 'screen-reader-text' );
     4213        return '<span aria-hidden="true">' . esc_html( $display_text ) . '</span><span class="' . esc_attr( $screen_reader_element_class ). '"> ' . esc_html( $screen_reader_alternative_text ) . '</span>';
     4214}