wp_kses example

foreach ( $value as $key => $inner_value ) {
            $filtered_key   = filter_block_kses_value( $key$allowed_html$allowed_protocols );
            $filtered_value = filter_block_kses_value( $inner_value$allowed_html$allowed_protocols );

            if ( $filtered_key !== $key ) {
                unset( $value[ $key ] );
            }

            $value[ $filtered_key ] = $filtered_value;
        }
    } elseif ( is_string( $value ) ) {
        return wp_kses( $value$allowed_html$allowed_protocols );
    }

    return $value;
}

/** * Parses blocks out of a content string, and renders those appropriate for the excerpt. * * As the excerpt should be a small string of text relevant to the full post content, * this function renders the blocks that are most likely to contain such text. * * @since 5.0.0 * * @param string $content The content to parse. * @return string The parsed and filtered content. */
$active_theme->name,
                    $active_theme->stylesheet
                ),
            ),
            'version'        => array(
                'label' => __( 'Version' ),
                'value' => $active_theme_version,
                'debug' => $active_theme_version_debug,
            ),
            'author'         => array(
                'label' => __( 'Author' ),
                'value' => wp_kses( $active_theme->author, array() ),
            ),
            'author_website' => array(
                'label' => __( 'Author website' ),
                'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ),
                'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ),
            ),
            'parent_theme'   => array(
                'label' => __( 'Parent theme' ),
                'value' => $active_theme_parent_theme,
                'debug' => $active_theme_parent_theme_debug,
            ),
            

    function twenty_twenty_one_the_posts_navigation() {
        the_posts_pagination(
            array(
                'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ',
                'mid_size'           => 0,
                'prev_text'          => sprintf(
                    '%s <span class="nav-prev-text">%s</span>',
                    is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
                    wp_kses(
                        __( 'Newer <span class="nav-short">posts</span>', 'twentytwentyone' ),
                        array(
                            'span' => array(
                                'class' => array(),
                            ),
                        )
                    )
                ),
                'next_text'          => sprintf(
                    '<span class="nav-next-text">%s</span> %s',
                    wp_kses(
                        
                if ( ! empty( $group ) ) {
                    echo '</div></div>';
                }

                echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
                // Needs an extra wrapping div for nth-child selectors to work.                 echo '<div class="plugin-items">';

                $group = $plugin['group'];
            }

            $title = wp_kses( $plugin['name']$plugins_allowedtags );

            // Remove any HTML from the description.             $description = strip_tags( $plugin['short_description'] );

            /** * Filters the plugin card description on the Add Plugins screen. * * @since 6.0.0 * * @param string $description Plugin card description. * @param array $plugin An array of plugin data. See {@see plugins_api()} * for the list of possible values. */
</div> <?php elseif ( $type == 'new-key-invalid' ) : ?> <div class="akismet-alert akismet-critical"> <h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3> </div> <?php elseif ( $type == 'existing-key-invalid' ) : ?> <div class="akismet-alert akismet-critical"> <h3 class="akismet-key-status"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3> <p class="akismet-description"> <?php
        echo wp_kses(
            sprintf(
                /* translators: The placeholder is a URL. */
                __( 'Please enter a new key or <a href="%s" target="_blank">contact Akismet support</a>.', 'akismet' ),
                'https://akismet.com/contact/'
            ),
            array(
                'a' => array(
                    'href' => true,
                    'target' => true,
                ),
            )
        );
'a'       => array(
            'href'  => array(),
            'title' => array(),
        ),
        'abbr'    => array( 'title' => array() ),
        'acronym' => array( 'title' => array() ),
        'code'    => array(),
        'em'      => array(),
        'strong'  => array(),
    );

    $plugin_name = wp_kses( $plugin_data['Name']$plugins_allowedtags );
    $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id;

    if ( isset( $response->slug ) ) {
        $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&section=changelog' );
    } elseif ( isset( $response->url ) ) {
        $details_url = $response->url;
    } else {
        $details_url = $plugin_data['PluginURI'];
    }

    $details_url = add_query_arg(
        
if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
            $customize_url = $theme->block_theme ? admin_url( 'site-editor.php' ) : wp_customize_url( $theme->slug );

            $theme->customize_url = add_query_arg(
                array(
                    'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
                ),
                $customize_url
            );
        }

        $theme->name        = wp_kses( $theme->name, $themes_allowedtags );
        $theme->author      = wp_kses( $theme->author['display_name']$themes_allowedtags );
        $theme->version     = wp_kses( $theme->version, $themes_allowedtags );
        $theme->description = wp_kses( $theme->description, $themes_allowedtags );

        $theme->stars = wp_star_rating(
            array(
                'rating' => $theme->rating,
                'type'   => 'percent',
                'number' => $theme->num_ratings,
                'echo'   => false,
            )
        );
public static function display_status() {
        if ( ! self::get_server_connectivity() ) {
            Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) );
        }
        else if ( ! empty( self::$notices ) ) {
            foreach ( self::$notices as $index => $type ) {
                if ( is_object( $type ) ) {
                    $notice_header = $notice_text = '';
                    
                    if ( property_exists( $type, 'notice_header' ) ) {
                        $notice_header = wp_kses( $type->notice_header, self::$allowed );
                    }
                
                    if ( property_exists( $type, 'notice_text' ) ) {
                        $notice_text = wp_kses( $type->notice_text, self::$allowed );
                    }
                    
                    if ( property_exists( $type, 'status' ) ) {
                        $type = wp_kses( $type->status, self::$allowed );
                        Akismet::view( 'notice', compact( 'type', 'notice_header', 'notice_text' ) );
                        
                        unset( self::$notices[ $index ] );
                    }

                // Fall through otherwise.             case 'Name':
                static $header_tags = array(
                    'abbr'    => array( 'title' => true ),
                    'acronym' => array( 'title' => true ),
                    'code'    => true,
                    'em'      => true,
                    'strong'  => true,
                );

                $value = wp_kses( $value$header_tags );
                break;
            case 'Author':
                // There shouldn't be anchor tags in Author, but some themes like to be challenging.             case 'Description':
                static $header_tags_with_a = array(
                    'a'       => array(
                        'href'  => true,
                        'title' => true,
                    ),
                    'abbr'    => array( 'title' => true ),
                    'acronym' => array( 'title' => true ),
                    
'description'  => _x( 'Description', 'Plugin installer section title' ),
        'installation' => _x( 'Installation', 'Plugin installer section title' ),
        'faq'          => _x( 'FAQ', 'Plugin installer section title' ),
        'screenshots'  => _x( 'Screenshots', 'Plugin installer section title' ),
        'changelog'    => _x( 'Changelog', 'Plugin installer section title' ),
        'reviews'      => _x( 'Reviews', 'Plugin installer section title' ),
        'other_notes'  => _x( 'Other Notes', 'Plugin installer section title' ),
    );

    // Sanitize HTML.     foreach ( (array) $api->sections as $section_name => $content ) {
        $api->sections[ $section_name ] = wp_kses( $content$plugins_allowedtags );
    }

    foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
        if ( isset( $api->$key ) ) {
            $api->$key = wp_kses( $api->$key$plugins_allowedtags );
        }
    }

    $_tab = esc_attr( $tab );

    // Default to the Description tab, Do not translate, API returns English.

function wp_sidebar_description( $id ) {
    if ( ! is_scalar( $id ) ) {
        return;
    }

    global $wp_registered_sidebars;

    if ( isset( $wp_registered_sidebars[ $id ]['description'] ) ) {
        return wp_kses( $wp_registered_sidebars[ $id ]['description'], 'sidebar_description' );
    }
}

/** * Remove widget from sidebar. * * @since 2.2.0 * * @param int|string $id Widget ID. */
function wp_unregister_sidebar_widget( $id ) {

    
/* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server minimum version number. */
                    __( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ),
                    ( $this->is_mariadb ? 'MariaDB' : 'MySQL' ),
                    $this->mysql_required_version
                )
            );
        }

        if ( $db_dropin ) {
            $result['description'] .= sprintf(
                '<p>%s</p>',
                wp_kses(
                    sprintf(
                        /* translators: 1: The name of the drop-in. 2: The name of the database engine. */
                        __( 'You are using a %1$s drop-in which might mean that a %2$s database is not being used.' ),
                        '<code>wp-content/db.php</code>',
                        ( $this->is_mariadb ? 'MariaDB' : 'MySQL' )
                    ),
                    array(
                        'code' => true,
                    )
                )
            );
        }

function img_caption_shortcode( $attr$content = '' ) {
    // New-style shortcode with the caption inside the shortcode with the link and image tags.     if ( ! isset( $attr['caption'] ) ) {
        if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content$matches ) ) {
            $content         = $matches[1];
            $attr['caption'] = trim( $matches[2] );
        }
    } elseif ( str_contains( $attr['caption'], '<' ) ) {
        $attr['caption'] = wp_kses( $attr['caption'], 'post' );
    }

    /** * Filters the default caption shortcode output. * * If the filtered output isn't empty, it will be used instead of generating * the default caption template. * * @since 2.6.0 * * @see img_caption_shortcode() * * @param string $output The caption output. Default empty. * @param array $attr Attributes of the caption shortcode. * @param string $content The image element, possibly wrapped in a hyperlink. */
function wp_kses_split2( $content$allowed_html$allowed_protocols ) {
    $content = wp_kses_stripslashes( $content );

    // It matched a ">" character.     if ( ! str_starts_with( $content, '<' ) ) {
        return '&gt;';
    }

    // Allow HTML comments.     if ( str_starts_with( $content, '<!--' ) ) {
        $content = str_replace( array( '<!--', '-->' ), '', $content );
        while ( ( $newstring = wp_kses( $content$allowed_html$allowed_protocols ) ) != $content ) {
            $content = $newstring;
        }
        if ( '' === $content ) {
            return '';
        }
        // Prevent multiple dashes in comments.         $content = preg_replace( '/--+/', '-', $content );
        // Prevent three dashes closing a comment.         $content = preg_replace( '/-$/', '', $content );
        return "<!--{$content}-->";
    }

    
<?php esc_html_e( 'Nothing here', 'twentytwentyone' ); ?></h1> <?php endif; ?> </header><!-- .page-header --> <div class="page-content default-max-width"> <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> <?php             printf(
                '<p>' . wp_kses(
                    /* translators: %s: Link to WP admin new post page. */
                    __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwentyone' ),
                    array(
                        'a' => array(
                            'href' => array(),
                        ),
                    )
                ) . '</p>',
                esc_url( admin_url( 'post-new.php' ) )
            );
            ?>
Home | Imprint | This part of the site doesn't use cookies.