Make WordPress Core


Ignore:
Timestamp:
04/14/2023 01:25:36 AM (14 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename the $myHTML parameter to $text in htmlentities2().

This resolves a WPCS warning:

Variable "$myHTML" is not in valid snake_case format, try "$my_h_t_m_l"

It also matches other formatting functions with the $text parameter, e.g. esc_html(), ent2ncr(), etc.

Follow-up to [1727], [3717], [8662], [8743], [54927].

Props victoranto, audrasjb, jrf.
Fixes #58129.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r55642 r55651  
    45254525 * @since 1.2.2
    45264526 *
    4527  * @param string $myHTML The text to be converted.
     4527 * @param string $text The text to be converted.
    45284528 * @return string Converted text.
    45294529 */
    4530 function htmlentities2( $myHTML ) {
    4531     $translation_table              = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
     4530function htmlentities2( $text ) {
     4531    $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
     4532
    45324533    $translation_table[ chr( 38 ) ] = '&';
    4533     return preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', strtr( $myHTML, $translation_table ) );
     4534
     4535    return preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', strtr( $text, $translation_table ) );
    45344536}
    45354537
Note: See TracChangeset for help on using the changeset viewer.