sanitize_html_class example


            $action_links = apply_filters( 'plugin_install_action_links', $action_links$plugin );

            $last_updated_timestamp = strtotime( $plugin['last_updated'] );
            ?> <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> <?php             if ( ! $compatible_php || ! $compatible_wp ) {
                echo '<div class="notice inline notice-error notice-alt"><p>';
                if ( ! $compatible_php && ! $compatible_wp ) {
                    _e( 'This plugin does not work with your versions of WordPress and PHP.' );
                    if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
                        printf(
                            /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
                            ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
                            self_admin_url( 'update-core.php' ),
                            esc_url( wp_get_update_php_url() )
                        );

        $fields = apply_filters( 'media_submitbox_misc_sections', $fields$post );

        foreach ( $fields as $key => $label ) {
            if ( empty( $meta[ $key ] ) ) {
                continue;
            }

            ?> <div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>"> <?php echo $label; ?> <strong> <?php
                switch ( $key ) {
                    case 'bitrate':
                        echo round( $meta['bitrate'] / 1000 ) . 'kb/s';
                        if ( ! empty( $meta['bitrate_mode'] ) ) {
                            echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
                        }
                        break;
                    
do_action( "admin_print_scripts-{$hook_suffix}); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    /** This action is documented in wp-admin/admin-header.php */
    do_action( 'admin_print_scripts' );

    /** This action is documented in wp-admin/admin-header.php */
    do_action( "admin_head-{$hook_suffix}); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    /** This action is documented in wp-admin/admin-header.php */
    do_action( 'admin_head' );

    $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );

    if ( is_rtl() ) {
        $admin_body_class .= ' rtl';
    }

    ?> </head> <?php     /** * @global string $body_id */
    
$atts['width'] = (int) $atts['width'];

    if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) {
        return $content;
    }

    $id          = '';
    $caption_id  = '';
    $describedby = '';

    if ( $atts['id'] ) {
        $atts['id'] = sanitize_html_class( $atts['id'] );
        $id         = 'id="' . esc_attr( $atts['id'] ) . '" ';
    }

    if ( $atts['caption_id'] ) {
        $atts['caption_id'] = sanitize_html_class( $atts['caption_id'] );
    } elseif ( $atts['id'] ) {
        $atts['caption_id'] = 'caption-' . str_replace( '_', '-', $atts['id'] );
    }

    if ( $atts['caption_id'] ) {
        $caption_id  = 'id="' . esc_attr( $atts['caption_id'] ) . '" ';
        

                $mce_buttons_4 = apply_filters( 'mce_buttons_4', array()$editor_id );
            }

            $body_class = $editor_id;

            $post = get_post();
            if ( $post ) {
                $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );

                if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
                    $post_format = get_post_format( $post );
                    if ( $post_format && ! is_wp_error( $post_format ) ) {
                        $body_class .= ' post-format-' . sanitize_html_class( $post_format );
                    } else {
                        $body_class .= ' post-format-standard';
                    }
                }

                $page_template = get_page_template_slug( $post );

                
$path_with_origin   = $preset_metadata['path'];
                $path_with_origin[] = $origin;
                $presets            = _wp_array_get( $input$path_with_origin, null );
                if ( null === $presets ) {
                    continue;
                }

                $escaped_preset = array();
                foreach ( $presets as $preset ) {
                    if (
                        esc_attr( esc_html( $preset['name'] ) ) === $preset['name'] &&
                        sanitize_html_class( $preset['slug'] ) === $preset['slug']
                    ) {
                        $value = null;
                        if ( isset( $preset_metadata['value_key']$preset[ $preset_metadata['value_key'] ] ) ) {
                            $value = $preset[ $preset_metadata['value_key'] ];
                        } elseif (
                            isset( $preset_metadata['value_func'] ) &&
                            is_callable( $preset_metadata['value_func'] )
                        ) {
                            $value = call_user_func( $preset_metadata['value_func']$preset );
                        }

                        
if ( $current_screen->post_type ) {
    $admin_body_class .= ' post-type-' . $current_screen->post_type;
}

if ( $current_screen->taxonomy ) {
    $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
}

$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );

if ( wp_is_mobile() ) {
    $admin_body_class .= ' mobile';
}

if ( is_multisite() ) {
    $admin_body_class .= ' multisite';
}

if ( is_network_admin() ) {
    
$link_end = '</a>';
        }

        $class = $thumb ? ' class="has-media-icon"' : '';
        ?> <strong<?php echo $class; ?>> <?php             echo $link_start;

            if ( $thumb ) :
                ?> <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span> <?php             endif;

            echo $title . $link_end;

            _media_states( $post );
            ?> </strong> <p class="filename"> <span class="screen-reader-text"> <?php
$body_class .= ' mobile';
    add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
endif;

if ( $wp_customize->is_ios() ) {
    $body_class .= ' ios';
}

if ( is_rtl() ) {
    $body_class .= ' rtl';
}
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );

if ( wp_use_widgets_block_editor() ) {
    $body_class .= ' wp-embed-responsive';
}

$admin_title = sprintf( $wp_customize->get_document_title_template()__( 'Loading&hellip;' ) );

?> <title><?php echo esc_html( $admin_title ); ?></title> <script type="text/javascript"> var ajaxurl =

    public function add_help_tab( $args ) {
        $defaults = array(
            'title'    => false,
            'id'       => false,
            'content'  => '',
            'callback' => false,
            'priority' => 10,
        );
        $args     = wp_parse_args( $args$defaults );

        $args['id'] = sanitize_html_class( $args['id'] );

        // Ensure we have an ID and title.         if ( ! $args['id'] || ! $args['title'] ) {
            return;
        }

        // Allows for overriding an existing tab with that ID.         $this->_help_tabs[ $args['id'] ] = $args;
    }

    /** * Removes a help tab from the contextual help for the screen. * * @since 3.3.0 * * @param string $id The help tab ID. */

    $template = apply_filters( 'navigation_markup_template', $template$css_class );

    return sprintf( $templatesanitize_html_class( $css_class )esc_html( $screen_reader_text )$linksesc_attr( $aria_label ) );
}

/** * Retrieves the comments page number link. * * @since 2.7.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param int $pagenum Optional. Page number. Default 1. * @param int $max_page Optional. The maximum number of comment pages. Default 0. * @return string The comments page number link URL. */
if ( ! $comment ) {
        return $classes;
    }

    // Get the comment type (comment, trackback).     $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;

    // Add classes for comment authors that are registered users.     $user = $comment->user_id ? get_userdata( $comment->user_id ) : false;
    if ( $user ) {
        $classes[] = 'byuser';
        $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
        // For comment authors who are the author of the post.         $_post = get_post( $post );
        if ( $_post ) {
            if ( $comment->user_id === $_post->post_author ) {
                $classes[] = 'bypostauthor';
            }
        }
    }

    if ( empty( $comment_alt ) ) {
        $comment_alt = 0;
    }
$img = '<img src="' . esc_url( $item[6] ) . '" alt="" />';

            if ( 'none' === $item[6] || 'div' === $item[6] ) {
                $img = '<br />';
            } elseif ( str_starts_with( $item[6], 'data:image/svg+xml;base64,' ) ) {
                $img = '<br />';
                // The value is base64-encoded data, so esc_attr() is used here instead of esc_url().                 $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
                $img_class = ' svg';
            } elseif ( str_starts_with( $item[6], 'dashicons-' ) ) {
                $img       = '<br />';
                $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] );
            }
        }
        $arrow = '<div class="wp-menu-arrow"><div></div></div>';

        $title = wptexturize( $item[0] );

        // Hide separators from screen readers.         if ( $is_separator ) {
            $aria_hidden = ' aria-hidden="true"';
        }

        
'show_in_menu' => true,
    )
);
$builtin = array( 'post', 'page' );
foreach ( array_merge( $builtin$types ) as $ptype ) {
    $ptype_obj = get_post_type_object( $ptype );
    // Check if it should be a submenu.     if ( true !== $ptype_obj->show_in_menu ) {
        continue;
    }
    $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.     $ptype_for_id        = sanitize_html_class( $ptype );

    $menu_icon = 'dashicons-admin-post';
    if ( is_string( $ptype_obj->menu_icon ) ) {
        // Special handling for data:image/svg+xml and Dashicons.         if ( str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || str_starts_with( $ptype_obj->menu_icon, 'dashicons-' ) ) {
            $menu_icon = $ptype_obj->menu_icon;
        } else {
            $menu_icon = esc_url( $ptype_obj->menu_icon );
        }
    } elseif ( in_array( $ptype$builtin, true ) ) {
        $menu_icon = 'dashicons-admin-' . $ptype;
    }
if ( ! is_admin() ) {
        $classes[] = $post->post_type;
    }
    $classes[] = 'type-' . $post->post_type;
    $classes[] = 'status-' . $post->post_status;

    // Post Format.     if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
        $post_format = get_post_format( $post->ID );

        if ( $post_format && ! is_wp_error( $post_format ) ) {
            $classes[] = 'format-' . sanitize_html_class( $post_format );
        } else {
            $classes[] = 'format-standard';
        }
    }

    $post_password_required = post_password_required( $post->ID );

    // Post requires password.     if ( $post_password_required ) {
        $classes[] = 'post-password-required';
    } elseif ( ! empty( $post->post_password ) ) {
        
Home | Imprint | This part of the site doesn't use cookies.