CS: prefix all variables

While template files are intended to be included from within a function, this doesn't guarantee they always will be.

Therefore all variables declared within template files also need to be prefixed with a theme specific prefix.

As these are "local" variables, renaming them does not constitute a BC-break.
This commit is contained in:
jrfnl 2018-02-27 11:35:30 +01:00
parent ec877e48c3
commit 98e3e75109
3 changed files with 9 additions and 9 deletions

View File

@ -44,8 +44,8 @@ get_header();
<?php
/* translators: %1$s: smiley */
$archive_content = '<p>' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', '_s' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$archive_content" );
$_s_archive_content = '<p>' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', '_s' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$_s_archive_content" );
the_widget( 'WP_Widget_Tag_Cloud' );
?>

View File

@ -28,8 +28,8 @@ if ( post_password_required() ) {
?>
<h2 class="comments-title">
<?php
$comment_count = get_comments_number();
if ( '1' === $comment_count ) {
$_s_comment_count = get_comments_number();
if ( '1' === $_s_comment_count ) {
printf(
/* translators: 1: title. */
esc_html__( 'One thought on &ldquo;%1$s&rdquo;', '_s' ),
@ -38,8 +38,8 @@ if ( post_password_required() ) {
} else {
printf( // WPCS: XSS OK.
/* translators: 1: comment count number, 2: title. */
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $comment_count, 'comments title', '_s' ) ),
number_format_i18n( $comment_count ),
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $_s_comment_count, 'comments title', '_s' ) ),
number_format_i18n( $_s_comment_count ),
'<span>' . get_the_title() . '</span>'
);
}

View File

@ -37,10 +37,10 @@
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php
endif;
$description = get_bloginfo( 'description', 'display' );
if ( $description || is_customize_preview() ) :
$_s_description = get_bloginfo( 'description', 'display' );
if ( $_s_description || is_customize_preview() ) :
?>
<p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p>
<p class="site-description"><?php echo $_s_description; /* WPCS: xss ok. */ ?></p>
<?php endif; ?>
</div><!-- .site-branding -->