Mass escaping and singular placeholder fix according to the CS check.

This commit is contained in:
Frank419 2024-08-29 15:48:42 +08:00
parent 45e080cfba
commit 3cf6389db6
11 changed files with 65 additions and 66 deletions

View File

@ -39,7 +39,7 @@ if ( !defined( 'WPINC' ) ) {
<?php $mf_meta = get_the_author_meta( $mf_metas[$mf_i] ); ?>
<?php if ( strlen( $mf_meta ) && get_theme_mod( 'minimalistflex_layout_author_elements_' . $mf_metas[$mf_i], 'yes' ) === 'yes' ): ?>
<div class="author-detail">
<h2><?php echo $mf_titles[$mf_i] ?></h2>
<h2><?php echo $mf_titles[$mf_i] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h2>
<?php echo esc_html( $mf_meta ) ?>
</div>
<?php endif; ?>
@ -51,7 +51,7 @@ if ( !defined( 'WPINC' ) ) {
printf(
/* translators: %s: The author display name. */
esc_html__( 'All posts by %s', 'minimalistflex' ),
get_the_author_meta( 'display_name' )
esc_html( get_the_author_meta( 'display_name' ) )
)
?>
</h2>

View File

@ -17,14 +17,14 @@ if ( post_password_required() ) {
printf(
/* translators: %1$s: Number of comments. %2$s: Post title. */
esc_html( _nx(
'One comment on "%2$s"',
'%1$s comment on "%2$s"',
'%1$s comments on "%2$s"',
get_comments_number(),
'comments title',
'minimalistflex'
) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
esc_html( number_format_i18n( get_comments_number() ) ),
'<span>' . esc_html( get_the_title() ) . '</span>'
);
?>
</h2>

View File

@ -9,24 +9,24 @@ if ( !defined( 'WPINC' ) ) {
<?php
if( is_home() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' );
} elseif ( is_front_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' );
} elseif ( is_search() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' );
} elseif ( is_archive() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' );
} elseif( is_author() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' );
} elseif( is_single() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' );
} elseif( is_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' );
}
?>
<?php if ( $sidebar <> 'no' ): ?>
<?php if ( $mf_sidebar <> 'no' ): ?>
<aside class="minimalistflex-sidebar">
<?php get_sidebar(); ?>
</aside>
@ -42,13 +42,13 @@ if( is_home() ) {
<footer class="minimalistflex-footer">
<div class="minimalistflex-footer-widgets-container">
<?php $sidebars = get_theme_mod( 'minimalistflex_footer_widget_layout', 'one' ); ?>
<?php $mf_sidebars = get_theme_mod( 'minimalistflex_footer_widget_layout', 'one' ); ?>
<?php
get_sidebar( 'footer' );
if ( $sidebars === 'two' || $sidebars === 'three' ) {
if ( $mf_sidebars === 'two' || $mf_sidebars === 'three' ) {
get_sidebar( 'footer-2' );
}
if ( $sidebars === 'three' ) {
if ( $mf_sidebars === 'three' ) {
get_sidebar( 'footer-3' );
}
?>
@ -67,11 +67,11 @@ if( is_home() ) {
</div>
<?php endif; ?>
<div class="footer-credits">
<?php $footer_type = get_theme_mod( 'minimalistflex_footer_type', 'both' ); ?>
<?php if ( $footer_type === 'both' || $footer_type === 'custom' ): ?>
<?php $mf_footer_type = get_theme_mod( 'minimalistflex_footer_type', 'both' ); ?>
<?php if ( $mf_footer_type === 'both' || $mf_footer_type === 'custom' ): ?>
<?php echo wp_kses_data( get_theme_mod( 'minimalistflex_footer_text' ) ) ?>
<?php endif; ?>
<?php if ( $footer_type === 'both' || $footer_type === 'minimalistflex' ): ?>
<?php if ( $mf_footer_type === 'both' || $mf_footer_type === 'minimalistflex' ): ?>
<?php
printf(
/* translators: %s: Link to theme author website. */

View File

@ -22,58 +22,58 @@ if ( function_exists( 'wp_body_open' ) ) {
<?php
if( is_home() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_home_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_home_header', 'yes' );
} elseif ( is_front_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_front_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_front_header', 'yes' );
} elseif ( is_search() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_search_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_search_header', 'yes' );
} elseif ( is_author() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_author_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_author_header', 'yes' );
} elseif ( is_archive() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_archive_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_archive_header', 'yes' );
} elseif ( is_single() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_singular_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_singular_header', 'yes' );
} elseif ( is_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_page_header', 'yes' );
$mf_sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' );
$mf_header = get_theme_mod( 'minimalistflex_layout_page_header', 'yes' );
}
$link = get_theme_mod( 'minimalistflex_header_link' );
$label = get_theme_mod( 'minimalistflex_header_label' );
$mf_link = get_theme_mod( 'minimalistflex_header_link' );
$mf_label = get_theme_mod( 'minimalistflex_header_label' );
?>
<a class="screen-reader-text" href="#main-content"><?php esc_html_e( 'Skip to main content', 'minimalistflex' ) ?></a>
<?php if( get_header_image() && $header === 'yes' ): ?>
<?php if( get_header_image() && $mf_header === 'yes' ): ?>
<header class="minimalistflex-header-image">
<?php if ( strlen( $link ) ): ?>
<a href="<?php echo esc_url( $link ) ?>" aria-label="<?php
if ( strlen( $label ) ) {
echo esc_attr( $label );
<?php if ( strlen( $mf_link ) ): ?>
<a href="<?php echo esc_url( $mf_link ) ?>" aria-label="<?php
if ( strlen( $mf_label ) ) {
echo esc_attr( $mf_label );
} else {
esc_attr_e( 'The header image link.', 'minimalistflex' );
}
?>">
<?php endif; ?>
<img src="<?php header_image(); ?>" aria-label="<?php
if ( strlen( $label ) ) {
if ( strlen( $mf_label ) ) {
printf(
/* translators: %s: The label of the header image link. */
esc_attr__( 'The image of the header image link to "%s".', 'minimalistflex' ),
esc_attr( $label )
esc_attr( $mf_label )
);
} else {
esc_attr_e( 'The header image.', 'minimalistflex' );
}
?>">
<?php if ( strlen( $link ) ): ?>
<?php if ( strlen( $mf_link ) ): ?>
</a>
<?php endif; ?>
</header>
@ -81,11 +81,11 @@ $label = get_theme_mod( 'minimalistflex_header_label' );
<header class="minimalistflex-header">
<?php if ( has_custom_logo() ): ?>
<?php echo get_custom_logo(); ?>
<?php echo get_custom_logo() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?>
<?php if ( display_header_text() ): ?>
<h1 class="blog-title">
<a href="<?php echo esc_url( home_url() ); ?>" class="blog-title-link"><?php echo get_bloginfo( 'name' ) ?></a>
<a href="<?php echo esc_url( home_url() ); ?>" class="blog-title-link"><?php echo wp_kses_data( get_bloginfo( 'name' ) ) ?></a>
</h1>
<?php endif; ?>
<div class="spacer"></div>
@ -105,7 +105,7 @@ $label = get_theme_mod( 'minimalistflex_header_label' );
<?php endif; ?>
</header>
<main class="minimalistflex-master <?php echo 'minimalistflex-sidebar-layout-' . $sidebar ?>">
<main class="minimalistflex-master <?php echo 'minimalistflex-sidebar-layout-' . esc_attr( $mf_sidebar ) ?>">
<article class="minimalistflex-content" id="main-content">

View File

@ -16,7 +16,7 @@ class MinimalistFlex_Color_Palette_Custom_Control extends WP_Customize_Control
public function enqueue()
{
wp_enqueue_style('color-palette-style', get_template_directory_uri().'/css/color-palette.css');
wp_enqueue_script('color-palette-script', get_template_directory_uri().'/js/color-palette.js', array( 'jquery' ), rand(), true);
wp_enqueue_script('color-palette-script', get_template_directory_uri().'/js/color-palette.js', array( 'jquery' ), null, true);
}
public function render_content()

View File

@ -17,7 +17,7 @@ class MinimalistFlex_Multi_Image_Custom_Control extends WP_Customize_Control
{
wp_enqueue_media();
wp_enqueue_style('multi-image-style', get_template_directory_uri().'/css/multi-image.css');
wp_enqueue_script('multi-image-script', get_template_directory_uri().'/js/multi-image.js', array( 'jquery' ), rand(), true);
wp_enqueue_script('multi-image-script', get_template_directory_uri().'/js/multi-image.js', array( 'jquery' ), null, true);
}
public function render_content()

View File

@ -15,14 +15,14 @@ if ( !defined( 'WPINC' ) ) {
--minimalistflex-header: <?php
$header_textcolor = get_header_textcolor();
if ( preg_match( '/#/', $header_textcolor ) ) {
echo $header_textcolor;
echo esc_html( $header_textcolor );
} else {
echo '#' . $header_textcolor;
echo esc_html( '#' . $header_textcolor );
}
?>;
<?php $color_keys = array_keys( $colors ); ?>
<?php foreach( $color_keys as $color_key ): ?>
--minimalistflex-<?php echo $color_key; ?>: <?php echo esc_html( get_theme_mod( 'minimalistflex_color_' . $color_key, $colors[$color_key] ) ); ?>;
--minimalistflex-<?php echo esc_html( $color_key ) ?>: <?php echo esc_html( get_theme_mod( 'minimalistflex_color_' . $color_key, $colors[$color_key] ) ); ?>;
<?php endforeach; ?>
--minimalistflex-max-height: <?php
if ( get_theme_mod( 'minimalistflex_interface_thumbnail_height', 'flexible' ) === 'fixed' ) {

View File

@ -31,6 +31,4 @@ if ( !defined( 'WPINC' ) ) {
</div>
<?php endif; ?>
<?php ?>
<?php get_footer(); ?>

View File

@ -34,7 +34,7 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf(
/* translators: %s: Title of the post. */
esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ),
get_the_title()
esc_attr( get_the_title() )
)
?>">
</div>

View File

@ -20,7 +20,7 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf(
/* translators: %s: Post title associated with the thumbnail image. */
esc_attr__( 'Thumbnail image of %s. Also a link that navigates to it.', 'minimalistflex' ),
get_the_title()
esc_attr( get_the_title() )
) ?>">
<?php the_post_thumbnail( 'large' ); ?>
</a>
@ -37,13 +37,13 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf(
/* translators: %s: Post title associated with the thumbnail image. */
esc_attr__( 'The thhumbnail image link for %s', 'minimalistflex' ),
get_the_title()
esc_attr( get_the_title() )
) ?>">
<img src="<?php echo esc_url( $mf_imgsrc );?>" aria-label="<?php
printf(
/* translators: %s: Title of the post. */
esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ),
get_the_title()
esc_attr( get_the_title() )
)
?>">
</a>
@ -53,14 +53,15 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
<div class="panel-comment-count">
<?php
printf(
_nx(
'1 Comment',
/* translators: %d: Number of comments. */
esc_html( _nx(
'%d Comment',
'%d Comments',
get_comments_number(),
'comment count',
'minimalistflex'
),
number_format_i18n( get_comments_number() )
) ),
esc_html( number_format_i18n( get_comments_number() ) )
);
?>
</div>
@ -86,13 +87,13 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
<?php printf(
/* translators: %s: Post publish time. */
esc_html__( 'Published on %s', 'minimalistflex' ),
get_the_date()
esc_html( get_the_date() )
) ?>
<?php else: ?>
<?php printf(
/* translators: %s: Post last modified time. */
esc_html__( 'Last modified on %s', 'minimalistflex' ),
get_the_modified_date()
esc_html( get_the_modified_date() )
) ?>
<?php endif; ?>
</div>
@ -101,7 +102,7 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf(
/* translators: %s: Post title. */
esc_attr__( 'Read more of %s', 'minimalistflex' ),
get_the_title()
esc_attr( get_the_title() )
)
?>">
<?php echo esc_html( get_theme_mod( 'minimalistflex_interface_readlink', __( 'Read More', 'minimalistflex' ) ) ); ?>

View File

@ -14,7 +14,7 @@ if ( !defined( 'WPINC' ) ) {
<?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category">
<a href="<?php echo esc_url( get_category_link( $mf_tag ) ) ?>">
<?php echo $mf_tag->name; ?>
<?php echo esc_html( $mf_tag->name ) ?>
</a>
</div>
<?php } ?>
@ -29,7 +29,7 @@ if ( !defined( 'WPINC' ) ) {
<?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category singular-tag">
<a href="<?php echo esc_url( get_tag_link( $mf_tag ) ) ?>">
<?php echo $mf_tag->name; ?>
<?php echo esc_html( $mf_tag->name ) ?>
</a>
</div>
<?php } ?>