Make WordPress Core

Ticket #47357: 47357.diff

File 47357.diff, 1.4 KB (added by SergeyBiryukov, 4 years ago)
  • src/wp-includes/kses.php

     
    3636 * Using `CUSTOM_TAGS` is not recommended and should be considered deprecated. The
    3737 * {@see 'wp_kses_allowed_html'} filter is more powerful and supplies context.
    3838 *
     39 * When using this constant, make sure to set all of these globals to arrays:
     40 *
     41 *  - `$allowedposttags`
     42 *  - `$allowedtags`
     43 *  - `$allowedentitynames`
     44 *  - `$allowedxmlentitynames`
     45 *
    3946 * @see wp_kses_allowed_html()
    4047 * @since 1.2.0
    4148 *
     
    685692
    686693        $allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags );
    687694} else {
     695        $kses_globals = array(
     696                'allowedposttags',
     697                'allowedtags',
     698                'allowedentitynames',
     699                'allowedxmlentitynames',
     700        );
     701
     702        foreach ( $kses_globals as $global_name ) {
     703                if ( ! isset( $GLOBALS[ $global_name ] ) || ! is_array( $GLOBALS[ $global_name ] ) ) {
     704                        _doing_it_wrong(
     705                                'wp_kses_allowed_html',
     706                                sprintf(
     707                                        /* translators: 1: CUSTOM_TAGS, 2: Global variable name. */
     708                                        __( 'When using the %1$s constant, make sure to set the %2$s global to an array.' ),
     709                                        '<code>CUSTOM_TAGS</code>',
     710                                        '<code>$' . $global_name . '</code>'
     711                                ),
     712                                '6.1.0'
     713                        );
     714                }
     715        }
     716
    688717        $allowedtags     = wp_kses_array_lc( $allowedtags );
    689718        $allowedposttags = wp_kses_array_lc( $allowedposttags );
    690719}