Make WordPress Core

Changeset 54181


Ignore:
Timestamp:
09/15/2022 01:27:38 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Docs: Clarify the $allowed_protocols default value in various KSES functions.

Add a note that the parameter is optional and defaults to the result of wp_allowed_protocols().

This affects:

  • wp_kses()
  • filter_block_content()
  • filter_block_kses()
  • filter_block_kses_value()

Includes synchronizing the $allowed_html parameter description for consistency.

Follow-up to [649], [6630], [18826], [32603], [43016], [46896], [48478].

Props armondal, SergeyBiryukov.
Fixes #56580.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r54175 r54181  
    718718
    719719/**
    720  * Returns a joined string of the aggregate serialization of the given parsed
    721  * blocks.
     720 * Returns a joined string of the aggregate serialization of the given
     721 * parsed blocks.
    722722 *
    723723 * @since 5.3.1
     
    731731
    732732/**
    733  * Filters and sanitizes block content to remove non-allowable HTML from
    734  * parsed block attribute values.
     733 * Filters and sanitizes block content to remove non-allowable HTML
     734 * from parsed block attribute values.
    735735 *
    736736 * @since 5.3.1
    737737 *
    738738 * @param string         $text              Text that may contain block content.
    739  * @param array[]|string $allowed_html      An array of allowed HTML elements
    740  *                                          and attributes, or a context name
    741  *                                          such as 'post'.
    742  * @param string[]       $allowed_protocols Array of allowed URL protocols.
     739 * @param array[]|string $allowed_html      An array of allowed HTML elements and attributes,
     740 *                                          or a context name such as 'post'. See wp_kses_allowed_html()
     741 *                                          for the list of accepted context names.
     742 * @param string[]       $allowed_protocols Optional. Array of allowed URL protocols.
     743 *                                          Defaults to the result of wp_allowed_protocols().
    743744 * @return string The filtered and sanitized content result.
    744745 */
     
    756757
    757758/**
    758  * Filters and sanitizes a parsed block to remove non-allowable HTML from block
    759  * attribute values.
     759 * Filters and sanitizes a parsed block to remove non-allowable HTML
     760 * from block attribute values.
    760761 *
    761762 * @since 5.3.1
    762763 *
    763764 * @param WP_Block_Parser_Block $block             The parsed block object.
    764  * @param array[]|string        $allowed_html      An array of allowed HTML
    765  *                                                 elements and attributes, or a
    766  *                                                 context name such as 'post'.
    767  * @param string[]              $allowed_protocols Allowed URL protocols.
     765 * @param array[]|string        $allowed_html      An array of allowed HTML elements and attributes,
     766 *                                                 or a context name such as 'post'. See wp_kses_allowed_html()
     767 *                                                 for the list of accepted context names.
     768 * @param string[]              $allowed_protocols Optional. Array of allowed URL protocols.
     769 *                                                 Defaults to the result of wp_allowed_protocols().
    768770 * @return array The filtered and sanitized block object result.
    769771 */
     
    781783
    782784/**
    783  * Filters and sanitizes a parsed block attribute value to remove non-allowable
    784  * HTML.
     785 * Filters and sanitizes a parsed block attribute value to remove
     786 * non-allowable HTML.
    785787 *
    786788 * @since 5.3.1
    787789 *
    788790 * @param string[]|string $value             The attribute value to filter.
    789  * @param array[]|string  $allowed_html      An array of allowed HTML elements
    790  *                                           and attributes, or a context name
    791  *                                           such as 'post'.
    792  * @param string[]        $allowed_protocols Array of allowed URL protocols.
     791 * @param array[]|string  $allowed_html      An array of allowed HTML elements and attributes,
     792 *                                           or a context name such as 'post'. See wp_kses_allowed_html()
     793 *                                           for the list of accepted context names.
     794 * @param string[]        $allowed_protocols Optional. Array of allowed URL protocols.
     795 *                                           Defaults to the result of wp_allowed_protocols().
    793796 * @return string[]|string The filtered and sanitized result.
    794797 */
  • trunk/src/wp-includes/kses.php

    r54117 r54181  
    707707 *                                          or a context name such as 'post'. See wp_kses_allowed_html()
    708708 *                                          for the list of accepted context names.
    709  * @param string[]       $allowed_protocols Array of allowed URL protocols.
     709 * @param string[]       $allowed_protocols Optional. Array of allowed URL protocols.
     710 *                                          Defaults to the result of wp_allowed_protocols().
    710711 * @return string Filtered content containing only the allowed HTML.
    711712 */
Note: See TracChangeset for help on using the changeset viewer.