Added proper escaping. Imrpoved security.

This commit is contained in:
Frank419 2024-08-29 15:18:30 +08:00
parent 7a913f5e83
commit 7f3d6330eb
10 changed files with 24 additions and 23 deletions

View File

@ -8,11 +8,11 @@ if ( !defined( 'WPINC' ) ) {
<div class="singular">
<div class="singular-main">
<h1 class="404-title"><?php _e( 'You&apos;ve reached the edge of the world.', 'minimalistflex' ) ?></h1>
<p><?php _e( 'It looks like the page you are looking for doesn&apos;t exist.', 'minimalistflex' ) ?></p>
<p><?php _e( 'What about a search?', 'minimalistflex' ) ?></p>
<h1 class="404-title"><?php esc_html_e( 'You&apos;ve reached the edge of the world.', 'minimalistflex' ) ?></h1>
<p><?php esc_html_e( 'It looks like the page you are looking for doesn&apos;t exist.', 'minimalistflex' ) ?></p>
<p><?php esc_html_e( 'What about a search?', 'minimalistflex' ) ?></p>
<?php get_search_form() ?>
<p><a href="javascript:history.go(-1)"><?php _e( 'Go back', 'minimalistflex' ) ?></a></p>
<p><a href="javascript:history.go(-1)"><?php esc_html_e( 'Go back', 'minimalistflex' ) ?></a></p>
</div>
</div>

View File

@ -16,13 +16,13 @@ if ( post_password_required() ) {
<?php
printf(
/* translators: %1$s: Number of comments. %2$s: Post title. */
_nx(
esc_html( _nx(
'One 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>'
);
@ -41,14 +41,14 @@ if ( post_password_required() ) {
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav class="nav-links navigation comment-navigation" role="navigation">
<h1 class="screen-reader-text section-heading"><?php _e( 'Comment navigation', 'minimalistflex' ); ?></h1>
<div class="previous"><?php previous_comments_link( __( '&larr; Older Comments', 'minimalistflex' ) ); ?></div>
<div class="next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'minimalistflex' ) ); ?></div>
<h1 class="screen-reader-text section-heading"><?php esc_html_e( 'Comment navigation', 'minimalistflex' ); ?></h1>
<div class="previous"><?php previous_comments_link( esc_html__( '&larr; Older Comments', 'minimalistflex' ) ); ?></div>
<div class="next"><?php next_comments_link( esc_html__( 'Newer Comments &rarr;', 'minimalistflex' ) ); ?></div>
</nav>
<?php endif; ?>
<?php if ( ! comments_open() && get_comments_number() ) : ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'minimalistflex' ); ?></p>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'minimalistflex' ); ?></p>
<?php endif; ?>
<?php endif; ?>

View File

@ -36,7 +36,7 @@ if( is_home() ) {
<ul class="minimalistflex-controls">
<?php if ( get_theme_mod( 'minimalistflex_interface_scroll_top', 'yes' ) === 'yes' ): ?>
<li><a href="#" aria-label="<?php esc_attr_e( 'Back to top', 'minimalistflex' ) ?>">:D</a></li>
<li><a href="#" aria-label="<?php esc_attr_e( 'Back to top', 'minimalistflex' ) ?>"><i class="dashicons dashicons-arrow-up-alt"></i></a></li>
<?php endif; ?>
</ul>
@ -75,7 +75,7 @@ if( is_home() ) {
<?php
printf(
/* translators: %s: Link to theme author website. */
__( 'Theme <a href="%s">MinimalistFlex</a>.', 'minimalistflex' ),
esc_html__( 'Theme <a href="%s">MinimalistFlex</a>.', 'minimalistflex' ),
esc_url( 'https://onmyodev.com/' )
)
?>

View File

@ -53,6 +53,7 @@ add_action( 'after_setup_theme', 'minimalistflex_add_supports' );
function minimalistflex_enqueue_files() {
wp_enqueue_script( 'comment-reply' );
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'dashicons' );
wp_enqueue_script( 'minimalistflex-script', get_template_directory_uri() . '/js/menu.js', array('jquery'), null, true);
if ( get_theme_mod( 'minimalistflex_interface_autoh2label', 'no' ) == 'yes' ) {
wp_enqueue_style( 'minimalistflex-autoh2label-style', get_template_directory_uri() . '/css/autoh2label.css' );

View File

@ -13,7 +13,7 @@ if ( !defined( 'WPINC' ) ) {
<?php
printf(
/* translators: %s: The search query. */
__( 'You have searched for: "%s"', 'minimalistflex' ),
esc_html__( 'You have searched for: "%s"', 'minimalistflex' ),
get_search_query()
)
?>
@ -37,7 +37,7 @@ if ( !defined( 'WPINC' ) ) {
<?php
printf(
/* translators: %s: The search query. */
__( 'You have searched for: "%s"', 'minimalistflex' ),
esc_html__( 'You have searched for: "%s"', 'minimalistflex' ),
get_search_query()
)
?>

View File

@ -23,7 +23,7 @@ if ( !defined( 'WPINC' ) ) {
</li>
<li id="archives" class="panel widget">
<h3 class="widget-title"><?php _e( 'Archives', 'minimalistflex' ); ?></h3>
<h3 class="widget-title"><?php esc_html_e( 'Archives', 'minimalistflex' ); ?></h3>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>

View File

@ -55,7 +55,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<?php if ( comments_open() || get_comments_number() ) :
comments_template();
else: ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'minimalistflex' ); ?></p>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'minimalistflex' ); ?></p>
<?php endif; ?>
</div>
<?php else: ?>

View File

@ -11,7 +11,7 @@ if ( !defined( 'WPINC' ) ) {
<?php echo get_avatar( $userid, 80 ); ?>
</div>
<div class="author-description">
<a class="author-link" href="<?php echo get_author_posts_url( $userid ) ?>"><?php the_author() ?></a>
<a class="author-link" href="<?php echo esc_url( get_author_posts_url( $userid ) ) ?>"><?php the_author() ?></a>
<p class="author-tagline"><?php the_author_meta( 'description' ) ?></p>
</div>
</div>

View File

@ -69,7 +69,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<div class="panel-main">
<?php the_excerpt(); ?>
<?php wp_link_pages( Array(
'before' => '<p class="panel post-nav-links"><span class="post-nav-links-indicator">' . __('Pages: ', 'minimalistflex') . '</span>'
'before' => '<p class="panel post-nav-links"><span class="post-nav-links-indicator">' . esc_html__('Pages: ', 'minimalistflex') . '</span></p>'
) ); ?>
</div>
<div class="panel-meta">
@ -85,13 +85,13 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<?php if ( $datemode === 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php printf(
/* translators: %s: Post publish time. */
__( 'Published on %s', 'minimalistflex' ),
esc_html__( 'Published on %s', 'minimalistflex' ),
get_the_date()
) ?>
<?php else: ?>
<?php printf(
/* translators: %s: Post last modified time. */
__( 'Last modified on %s', 'minimalistflex' ),
esc_html__( 'Last modified on %s', 'minimalistflex' ),
get_the_modified_date()
) ?>
<?php endif; ?>
@ -100,7 +100,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<a class="panel panel-link" href="<?php the_permalink(); ?>" aria-label="<?php
printf(
/* translators: %s: Post title. */
__( 'Read more of %s', 'minimalistflex' ),
esc_attr__( 'Read more of %s', 'minimalistflex' ),
get_the_title()
)
?>">

View File

@ -16,13 +16,13 @@ if ( !defined( 'WPINC' ) ) {
<?php if ( $datemode == 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php printf(
/* translators: %s: Post publish time. */
__( 'Published on %s', 'minimalistflex' ),
esc_html__( 'Published on %s', 'minimalistflex' ),
get_the_date()
) ?>
<?php else: ?>
<?php printf(
/* translators: %s: Post last modified time. */
__( 'Last modified on %s', 'minimalistflex' ),
esc_html__( 'Last modified on %s', 'minimalistflex' ),
get_the_modified_date()
) ?>
<?php endif; ?>