wp_kses_allowed_html example

<?php esc_html_e( 'Content:' ); ?></label> <textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea> </p> <?php if ( ! current_user_can( 'unfiltered_html' ) ) : ?> <?php                 $probably_unsafe_html = array( 'script', 'iframe', 'form', 'input', 'style' );
                $allowed_html         = wp_kses_allowed_html( 'post' );
                $disallowed_html      = array_diff( $probably_unsafe_htmlarray_keys( $allowed_html ) );
                ?> <?php if ( ! empty( $disallowed_html ) ) : ?> <# if ( data.codeEditorDisabled ) { #> <p> <?php _e( 'Some HTML tags are not permitted, including:' ); ?> <code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code> </p> <# } #> <?php endif; ?> <?php endif; ?>
'mode'              => 'htmlmixed',
                'lint'              => true,
                'autoCloseBrackets' => true,
                'autoCloseTags'     => true,
                'matchTags'         => array(
                    'bothTags' => true,
                ),
            )
        );

        if ( ! current_user_can( 'unfiltered_html' ) ) {
            $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' );
        }
    } elseif ( 'text/x-gfm' === $type ) {
        $settings['codemirror'] = array_merge(
            $settings['codemirror'],
            array(
                'mode'                => 'gfm',
                'highlightFormatting' => true,
            )
        );
    } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) {
        $settings['codemirror'] = array_merge(
            
 else {
                $output .= wp_get_attachment_link( $att_id$atts['size'], true );
            }
            $output .= "\n";
        }
        return $output;
    }

    $itemtag    = tag_escape( $atts['itemtag'] );
    $captiontag = tag_escape( $atts['captiontag'] );
    $icontag    = tag_escape( $atts['icontag'] );
    $valid_tags = wp_kses_allowed_html( 'post' );
    if ( ! isset( $valid_tags[ $itemtag ] ) ) {
        $itemtag = 'dl';
    }
    if ( ! isset( $valid_tags[ $captiontag ] ) ) {
        $captiontag = 'dd';
    }
    if ( ! isset( $valid_tags[ $icontag ] ) ) {
        $icontag = 'dt';
    }

    $columns   = (int) $atts['columns'];
    

function wp_kses_one_attr( $attr$element ) {
    $uris              = wp_kses_uri_attributes();
    $allowed_html      = wp_kses_allowed_html( 'post' );
    $allowed_protocols = wp_allowed_protocols();
    $attr              = wp_kses_no_null( $attr, array( 'slash_zero' => 'keep' ) );

    // Preserve leading and trailing whitespace.     $matches = array();
    preg_match( '/^\s*/', $attr$matches );
    $lead = $matches[0];
    preg_match( '/\s*$/', $attr$matches );
    $trail = $matches[0];
    if ( empty( $trail ) ) {
        $attr = substr( $attrstrlen( $lead ) );
    }
Home | Imprint | This part of the site doesn't use cookies.