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

View File

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

View File

@ -9,24 +9,24 @@ if ( !defined( 'WPINC' ) ) {
<?php <?php
if( is_home() ) { 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() ) { } 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() ) { } 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() ) { } 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() ) { } 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() ) { } 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() ) { } 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"> <aside class="minimalistflex-sidebar">
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</aside> </aside>
@ -42,13 +42,13 @@ if( is_home() ) {
<footer class="minimalistflex-footer"> <footer class="minimalistflex-footer">
<div class="minimalistflex-footer-widgets-container"> <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 <?php
get_sidebar( 'footer' ); get_sidebar( 'footer' );
if ( $sidebars === 'two' || $sidebars === 'three' ) { if ( $mf_sidebars === 'two' || $mf_sidebars === 'three' ) {
get_sidebar( 'footer-2' ); get_sidebar( 'footer-2' );
} }
if ( $sidebars === 'three' ) { if ( $mf_sidebars === 'three' ) {
get_sidebar( 'footer-3' ); get_sidebar( 'footer-3' );
} }
?> ?>
@ -67,11 +67,11 @@ if( is_home() ) {
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="footer-credits"> <div class="footer-credits">
<?php $footer_type = get_theme_mod( 'minimalistflex_footer_type', 'both' ); ?> <?php $mf_footer_type = get_theme_mod( 'minimalistflex_footer_type', 'both' ); ?>
<?php if ( $footer_type === 'both' || $footer_type === 'custom' ): ?> <?php if ( $mf_footer_type === 'both' || $mf_footer_type === 'custom' ): ?>
<?php echo wp_kses_data( get_theme_mod( 'minimalistflex_footer_text' ) ) ?> <?php echo wp_kses_data( get_theme_mod( 'minimalistflex_footer_text' ) ) ?>
<?php endif; ?> <?php endif; ?>
<?php if ( $footer_type === 'both' || $footer_type === 'minimalistflex' ): ?> <?php if ( $mf_footer_type === 'both' || $mf_footer_type === 'minimalistflex' ): ?>
<?php <?php
printf( printf(
/* translators: %s: Link to theme author website. */ /* translators: %s: Link to theme author website. */

View File

@ -22,58 +22,58 @@ if ( function_exists( 'wp_body_open' ) ) {
<?php <?php
if( is_home() ) { if( is_home() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_home_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_home_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_home_header', 'yes' );
} elseif ( is_front_page() ) { } elseif ( is_front_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_front_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_front_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_front_header', 'yes' );
} elseif ( is_search() ) { } elseif ( is_search() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_search_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_search_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_search_header', 'yes' );
} elseif ( is_author() ) { } elseif ( is_author() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_author_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_author_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_author_header', 'yes' );
} elseif ( is_archive() ) { } elseif ( is_archive() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_archive_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_archive_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_archive_header', 'yes' );
} elseif ( is_single() ) { } elseif ( is_single() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_singular_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_singular_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_singular_header', 'yes' );
} elseif ( is_page() ) { } elseif ( is_page() ) {
$sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' ); $mf_sidebar = get_theme_mod( 'minimalistflex_layout_page_sidebar', 'right' );
$header = get_theme_mod( 'minimalistflex_layout_page_header', 'yes' ); $mf_header = get_theme_mod( 'minimalistflex_layout_page_header', 'yes' );
} }
$link = get_theme_mod( 'minimalistflex_header_link' ); $mf_link = get_theme_mod( 'minimalistflex_header_link' );
$label = get_theme_mod( 'minimalistflex_header_label' ); $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> <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"> <header class="minimalistflex-header-image">
<?php if ( strlen( $link ) ): ?> <?php if ( strlen( $mf_link ) ): ?>
<a href="<?php echo esc_url( $link ) ?>" aria-label="<?php <a href="<?php echo esc_url( $mf_link ) ?>" aria-label="<?php
if ( strlen( $label ) ) { if ( strlen( $mf_label ) ) {
echo esc_attr( $label ); echo esc_attr( $mf_label );
} else { } else {
esc_attr_e( 'The header image link.', 'minimalistflex' ); esc_attr_e( 'The header image link.', 'minimalistflex' );
} }
?>"> ?>">
<?php endif; ?> <?php endif; ?>
<img src="<?php header_image(); ?>" aria-label="<?php <img src="<?php header_image(); ?>" aria-label="<?php
if ( strlen( $label ) ) { if ( strlen( $mf_label ) ) {
printf( printf(
/* translators: %s: The label of the header image link. */ /* translators: %s: The label of the header image link. */
esc_attr__( 'The image of the header image link to "%s".', 'minimalistflex' ), esc_attr__( 'The image of the header image link to "%s".', 'minimalistflex' ),
esc_attr( $label ) esc_attr( $mf_label )
); );
} else { } else {
esc_attr_e( 'The header image.', 'minimalistflex' ); esc_attr_e( 'The header image.', 'minimalistflex' );
} }
?>"> ?>">
<?php if ( strlen( $link ) ): ?> <?php if ( strlen( $mf_link ) ): ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
</header> </header>
@ -81,11 +81,11 @@ $label = get_theme_mod( 'minimalistflex_header_label' );
<header class="minimalistflex-header"> <header class="minimalistflex-header">
<?php if ( has_custom_logo() ): ?> <?php if ( has_custom_logo() ): ?>
<?php echo get_custom_logo(); ?> <?php echo get_custom_logo() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?> <?php endif; ?>
<?php if ( display_header_text() ): ?> <?php if ( display_header_text() ): ?>
<h1 class="blog-title"> <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> </h1>
<?php endif; ?> <?php endif; ?>
<div class="spacer"></div> <div class="spacer"></div>
@ -105,7 +105,7 @@ $label = get_theme_mod( 'minimalistflex_header_label' );
<?php endif; ?> <?php endif; ?>
</header> </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"> <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() public function enqueue()
{ {
wp_enqueue_style('color-palette-style', get_template_directory_uri().'/css/color-palette.css'); 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() 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_media();
wp_enqueue_style('multi-image-style', get_template_directory_uri().'/css/multi-image.css'); 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() public function render_content()

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf( printf(
/* translators: %s: Post title associated with the thumbnail image. */ /* translators: %s: Post title associated with the thumbnail image. */
esc_attr__( 'Thumbnail image of %s. Also a link that navigates to it.', 'minimalistflex' ), 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' ); ?> <?php the_post_thumbnail( 'large' ); ?>
</a> </a>
@ -37,13 +37,13 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf( printf(
/* translators: %s: Post title associated with the thumbnail image. */ /* translators: %s: Post title associated with the thumbnail image. */
esc_attr__( 'The thhumbnail image link for %s', 'minimalistflex' ), 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 <img src="<?php echo esc_url( $mf_imgsrc );?>" aria-label="<?php
printf( printf(
/* translators: %s: Title of the post. */ /* translators: %s: Title of the post. */
esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ), esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ),
get_the_title() esc_attr( get_the_title() )
) )
?>"> ?>">
</a> </a>
@ -53,14 +53,15 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
<div class="panel-comment-count"> <div class="panel-comment-count">
<?php <?php
printf( printf(
_nx( /* translators: %d: Number of comments. */
'1 Comment', esc_html( _nx(
'%d Comment',
'%d Comments', '%d Comments',
get_comments_number(), get_comments_number(),
'comment count', 'comment count',
'minimalistflex' 'minimalistflex'
), ) ),
number_format_i18n( get_comments_number() ) esc_html( number_format_i18n( get_comments_number() ) )
); );
?> ?>
</div> </div>
@ -86,13 +87,13 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
<?php printf( <?php printf(
/* translators: %s: Post publish time. */ /* translators: %s: Post publish time. */
esc_html__( 'Published on %s', 'minimalistflex' ), esc_html__( 'Published on %s', 'minimalistflex' ),
get_the_date() esc_html( get_the_date() )
) ?> ) ?>
<?php else: ?> <?php else: ?>
<?php printf( <?php printf(
/* translators: %s: Post last modified time. */ /* translators: %s: Post last modified time. */
esc_html__( 'Last modified on %s', 'minimalistflex' ), esc_html__( 'Last modified on %s', 'minimalistflex' ),
get_the_modified_date() esc_html( get_the_modified_date() )
) ?> ) ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -101,7 +102,7 @@ $mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_ima
printf( printf(
/* translators: %s: Post title. */ /* translators: %s: Post title. */
esc_attr__( 'Read more of %s', 'minimalistflex' ), 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' ) ) ); ?> <?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 ) { ?> <?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category"> <div class="singular-category">
<a href="<?php echo esc_url( get_category_link( $mf_tag ) ) ?>"> <a href="<?php echo esc_url( get_category_link( $mf_tag ) ) ?>">
<?php echo $mf_tag->name; ?> <?php echo esc_html( $mf_tag->name ) ?>
</a> </a>
</div> </div>
<?php } ?> <?php } ?>
@ -29,7 +29,7 @@ if ( !defined( 'WPINC' ) ) {
<?php foreach( $mf_tags as $mf_tag ) { ?> <?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category singular-tag"> <div class="singular-category singular-tag">
<a href="<?php echo esc_url( get_tag_link( $mf_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> </a>
</div> </div>
<?php } ?> <?php } ?>