Used === instead of ==. Improved security.

This commit is contained in:
Frank419 2024-08-27 18:10:48 +08:00
parent 3daee81a3a
commit 52e0c6309c
8 changed files with 20 additions and 20 deletions

View File

@ -8,7 +8,7 @@ if ( !defined( 'WPINC' ) ) {
<?php if ( have_posts() ) : ?>
<div class="minimalistflex-archive">
<?php if ( get_theme_mod( 'minimalistflex_layout_archive_title', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_archive_title', 'yes' ) === 'yes' ): ?>
<h1 class="archive-title panel">
<?php the_archive_title() ?>
</h1>

View File

@ -10,10 +10,10 @@ if ( !defined( 'WPINC' ) ) {
<div class="minimalistflex-author">
<?php $id = get_the_author_meta( 'ID' ); ?>
<h1 class="author-title panel">
<?php if ( get_theme_mod( 'minimalistflex_layout_author_title', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_author_title', 'yes' ) === 'yes' ): ?>
<?php the_archive_title() ?>
<?php endif; ?>
<div class="author-page-avatar<?php if ( user_can( $id, 'administrator' ) && get_theme_mod( 'minimalistflex_layout_author_admin', 'yes' ) == 'yes' ) {
<div class="author-page-avatar<?php if ( user_can( $id, 'administrator' ) && get_theme_mod( 'minimalistflex_layout_author_admin', 'yes' ) === 'yes' ) {
echo ' author-admin';
} ?>" aria-hidden="true">
<?php echo get_avatar( $id, 150 ); ?>
@ -37,7 +37,7 @@ if ( !defined( 'WPINC' ) ) {
?>
<?php while ( $i < count( $metas ) ): ?>
<?php $meta = get_the_author_meta( $metas[$i] ); ?>
<?php if ( strlen( $meta ) && get_theme_mod( 'minimalistflex_layout_author_elements_' . $metas[$i], 'yes' ) == 'yes' ): ?>
<?php if ( strlen( $meta ) && get_theme_mod( 'minimalistflex_layout_author_elements_' . $metas[$i], 'yes' ) === 'yes' ): ?>
<div class="author-detail">
<h2><?php echo $titles[$i] ?></h2>
<?php echo esc_html( $meta ) ?>

View File

@ -35,7 +35,7 @@ if( is_home() ) {
</main>
<ul class="minimalistflex-controls">
<?php if ( get_theme_mod( 'minimalistflex_interface_scroll_top', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_interface_scroll_top', 'yes' ) === 'yes' ): ?>
<li><a href="#main-content" aria-label="<?php esc_attr_e( 'Back to top', 'minimalistflex' ) ?>">:D</a></li>
<?php endif; ?>
</ul>
@ -45,10 +45,10 @@ if( is_home() ) {
<?php $sidebars = get_theme_mod( 'minimalistflex_footer_widget_layout', 'one' ); ?>
<?php
get_sidebar( 'footer' );
if ( $sidebars == 'two' || $sidebars == 'three' ) {
if ( $sidebars === 'two' || $sidebars === 'three' ) {
get_sidebar( 'footer-2' );
}
if ( $sidebars == 'three' ) {
if ( $sidebars === 'three' ) {
get_sidebar( 'footer-3' );
}
?>
@ -68,10 +68,10 @@ if( is_home() ) {
<?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 if ( $footer_type === 'both' || $footer_type === 'custom' ): ?>
<?php echo wp_filter_post_kses( get_theme_mod( 'minimalistflex_footer_text' ) ) ?>
<?php endif; ?>
<?php if ( $footer_type == 'both' || $footer_type == 'minimalistflex' ): ?>
<?php if ( $footer_type === 'both' || $footer_type === 'minimalistflex' ): ?>
<?php
printf(
/* translators: %s: Link to theme author website. */

View File

@ -51,7 +51,7 @@ $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() && $header === 'yes' ): ?>
<header class="minimalistflex-header-image">
<?php if ( strlen( $link ) ): ?>
<a href="<?php echo esc_url( $link ) ?>" aria-label="<?php

View File

@ -31,7 +31,7 @@ if ( !defined( 'WPINC' ) ) {
echo esc_html( 'auto;' );
}
?>
<?php if ( get_theme_mod( 'minimalistflex_color_disable_shadow', 'no' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_color_disable_shadow', 'no' ) === 'yes' ): ?>
--minimalistflex-shadow: transparent;
--minimalistflex-shadow-light: transparent;
<?php else: ?>

View File

@ -8,7 +8,7 @@ if ( !defined( 'WPINC' ) ) {
<?php if ( have_posts() ) : ?>
<div class="minimalistflex-search">
<?php if ( get_theme_mod( 'minimalistflex_layout_search_title', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_title', 'yes' ) === 'yes' ): ?>
<h1 class="search-title panel">
<?php
printf(
@ -19,7 +19,7 @@ if ( !defined( 'WPINC' ) ) {
?>
</h1>
<?php endif; ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_form', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_form', 'yes' ) === 'yes' ): ?>
<div class="search-form panel">
<p>
<?php esc_html_e( 'Not finding what you are looking at? You may refine your search below:', 'minimalistflex' ) ?>
@ -32,7 +32,7 @@ if ( !defined( 'WPINC' ) ) {
<?php the_posts_pagination(); ?>
<?php else: ?>
<div class="minimalistflex-search">
<?php if ( get_theme_mod( 'minimalistflex_layout_search_title', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_title', 'yes' ) === 'yes' ): ?>
<h1 class="search-title panel">
<?php
printf(
@ -43,7 +43,7 @@ if ( !defined( 'WPINC' ) ) {
?>
</h1>
<?php endif; ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_form', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_layout_search_form', 'yes' ) === 'yes' ): ?>
<div class="search-form panel">
<p>
<?php esc_html_e( 'We are unable to find anything with this query. Try refine your search below:', 'minimalistflex' ) ?>

View File

@ -21,7 +21,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<?php the_post_thumbnail( 'large' ); ?>
</div>
<?php elseif ( ( $default_images[0] <> '' || minimalistflex_get_first_image() ) && $default_image_location <> 'no' && $default_image_location <> 'archive' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) == 'yes' && minimalistflex_get_first_image() ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) === 'yes' && minimalistflex_get_first_image() ): ?>
<?php $imgsrc = minimalistflex_get_first_image(); ?>
<?php else: ?>
<?php

View File

@ -25,7 +25,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<?php the_post_thumbnail( 'large' ); ?>
</a>
<?php elseif ( ( $default_images[0] <> '' || minimalistflex_get_first_image() ) && $default_image_location <> 'no' && $default_image_location <> 'single' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) == 'yes' && minimalistflex_get_first_image() ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) === 'yes' && minimalistflex_get_first_image() ): ?>
<?php $imgsrc = minimalistflex_get_first_image(); ?>
<?php else: ?>
<?php
@ -49,7 +49,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
</a>
<?php endif; ?>
<div class="panel-content">
<?php if ( get_theme_mod( 'minimalistflex_interface_comment_count', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_interface_comment_count', 'yes' ) === 'yes' ): ?>
<div class="panel-comment-count">
<?php
printf(
@ -73,7 +73,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
) ); ?>
</div>
<div class="panel-meta">
<?php if ( get_theme_mod( 'minimalistflex_interface_publisher', 'yes' ) == 'yes' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_interface_publisher', 'yes' ) === 'yes' ): ?>
<a class="panel-author" href="<?php echo esc_url( get_author_posts_url($id) ) ?>">
<span aria-hidden="true"><?php echo get_avatar( $id, 80 ) ?></span>
<?php the_author() ?>
@ -82,7 +82,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
<?php $datemode = get_theme_mod( 'minimalistflex_interface_date', 'modify' ); ?>
<?php if ( $datemode <> 'no' ): ?>
<div class="panel-author">
<?php if ( $datemode == 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php if ( $datemode === 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php printf(
/* translators: %s: Post publish time. */
__( 'Published on %s', 'minimalistflex' ),