Skip to content

Commit 169c21e

Browse files
committed
Fix PHPCS violations
1 parent edc53f2 commit 169c21e

31 files changed

+1212
-841
lines changed

404.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646

4747
echo '<h2>' . esc_html__( 'Product Categories', 'storefront' ) . '</h2>';
4848

49-
the_widget( 'WC_Widget_Product_Categories', array(
50-
'count' => 1,
51-
) );
49+
the_widget(
50+
'WC_Widget_Product_Categories', array(
51+
'count' => 1,
52+
)
53+
);
5254

5355
echo '</nav>';
5456

@@ -58,10 +60,14 @@
5860

5961
echo '<h2>' . esc_html__( 'Popular Products', 'storefront' ) . '</h2>';
6062

61-
echo storefront_do_shortcode( 'best_selling_products', array(
62-
'per_page' => 4,
63-
'columns' => 4,
64-
) );
63+
$shortcode_content = storefront_do_shortcode(
64+
'best_selling_products', array(
65+
'per_page' => 4,
66+
'columns' => 4,
67+
)
68+
);
69+
70+
echo wp_kses_post( $shortcode_content );
6571

6672
echo '</section>';
6773
}
@@ -73,4 +79,5 @@
7379
</main><!-- #main -->
7480
</div><!-- #primary -->
7581

76-
<?php get_footer();
82+
<?php
83+
get_footer();

archive.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
?>
2222
</header><!-- .page-header -->
2323

24-
<?php get_template_part( 'loop' );
24+
<?php
25+
get_template_part( 'loop' );
2526

2627
else :
2728

2829
get_template_part( 'content', 'none' );
2930

30-
endif; ?>
31+
endif;
32+
?>
3133

3234
</main><!-- #main -->
3335
</div><!-- #primary -->

comments.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
<section id="comments" class="comments-area" aria-label="<?php esc_html_e( 'Post Comments', 'storefront' ); ?>">
2222

2323
<?php
24-
if ( have_comments() ) : ?>
24+
if ( have_comments() ) :
25+
?>
2526
<h2 class="comments-title">
2627
<?php
2728
printf( // WPCS: XSS OK.
28-
esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'storefront' ) ),
29+
/* translators: 1: number of comments, 2: post title */
30+
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'storefront' ) ),
2931
number_format_i18n( get_comments_number() ),
3032
'<span>' . get_the_title() . '</span>'
3133
);
@@ -42,11 +44,13 @@
4244

4345
<ol class="comment-list">
4446
<?php
45-
wp_list_comments( array(
46-
'style' => 'ol',
47-
'short_ping' => true,
48-
'callback' => 'storefront_comment',
49-
) );
47+
wp_list_comments(
48+
array(
49+
'style' => 'ol',
50+
'short_ping' => true,
51+
'callback' => 'storefront_comment',
52+
)
53+
);
5054
?>
5155
</ol><!-- .comment-list -->
5256

@@ -56,19 +60,25 @@
5660
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'storefront' ) ); ?></div>
5761
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'storefront' ) ); ?></div>
5862
</nav><!-- #comment-nav-below -->
59-
<?php endif; // Check for comment navigation.
63+
<?php
64+
endif; // Check for comment navigation.
6065

6166
endif;
6267

63-
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
68+
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
69+
?>
6470
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'storefront' ); ?></p>
65-
<?php endif;
71+
<?php
72+
endif;
6673

67-
$args = apply_filters( 'storefront_comment_form_args', array(
68-
'title_reply_before' => '<span id="reply-title" class="gamma comment-reply-title">',
69-
'title_reply_after' => '</span>',
70-
) );
74+
$args = apply_filters(
75+
'storefront_comment_form_args', array(
76+
'title_reply_before' => '<span id="reply-title" class="gamma comment-reply-title">',
77+
'title_reply_after' => '</span>',
78+
)
79+
);
7180

72-
comment_form( $args ); ?>
81+
comment_form( $args );
82+
?>
7383

7484
</section><!-- #comments -->

content-homepage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$featured_image = get_the_post_thumbnail_url( get_the_ID(), 'thumbnail' );
1111
?>
1212

13-
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="<?php storefront_homepage_content_styles(); ?>" data-featured-image="<?php echo $featured_image; ?>">
13+
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="<?php storefront_homepage_content_styles(); ?>" data-featured-image="<?php echo esc_url( $featured_image ); ?>">
1414
<div class="col-full">
1515
<?php
1616
/**

content-none.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
<div class="page-content">
1818
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
1919

20-
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'storefront' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
20+
<p>
21+
<?php
22+
/* translators: 1: URL */
23+
printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'storefront' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) );
24+
?>
25+
</p>
2126

2227
<?php elseif ( is_search() ) : ?>
2328

footer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* @hooked storefront_footer_widgets - 10
2525
* @hooked storefront_credit - 20
2626
*/
27-
do_action( 'storefront_footer' ); ?>
27+
do_action( 'storefront_footer' );
28+
?>
2829

2930
</div><!-- .col-full -->
3031
</footer><!-- #colophon -->

header.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
* @hooked storefront_header_cart - 60
4444
* @hooked storefront_primary_navigation_wrapper_close - 68
4545
*/
46-
do_action( 'storefront_header' ); ?>
46+
do_action( 'storefront_header' );
47+
?>
4748

4849
</header><!-- #masthead -->
4950

@@ -54,7 +55,8 @@
5455
* @hooked storefront_header_widget_region - 10
5556
* @hooked woocommerce_breadcrumb - 10
5657
*/
57-
do_action( 'storefront_before_content' ); ?>
58+
do_action( 'storefront_before_content' );
59+
?>
5860

5961
<div id="content" class="site-content" tabindex="-1">
6062
<div class="col-full">

inc/admin/class-storefront-admin.php

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class Storefront_Admin {
2222
* @since 1.0
2323
*/
2424
public function __construct() {
25-
add_action( 'admin_menu', array( $this, 'welcome_register_menu' ) );
26-
add_action( 'admin_enqueue_scripts', array( $this, 'welcome_style' ) );
25+
add_action( 'admin_menu', array( $this, 'welcome_register_menu' ) );
26+
add_action( 'admin_enqueue_scripts', array( $this, 'welcome_style' ) );
2727
}
2828

2929
/**
@@ -87,7 +87,8 @@ public function storefront_welcome_screen() {
8787
$referrer = wp_get_referer();
8888

8989
if ( strpos( $referrer, 'sf_starter_content' ) !== false ) {
90-
echo '<h1>' . sprintf( esc_attr__( 'Setup complete %sYour Storefront adventure begins now 🚀%s ', 'storefront' ), '<span>', '</span>' ) . '</h1>';
90+
/* translators: 1: HTML, 2: HTML */
91+
echo '<h1>' . sprintf( esc_attr__( 'Setup complete %1$sYour Storefront adventure begins now 🚀%2$s ', 'storefront' ), '<span>', '</span>' ) . '</h1>';
9192
echo '<p>' . esc_attr__( 'One more thing... You might be interested in the following Storefront extensions and designs.', 'storefront' ) . '</p>';
9293
} else {
9394
echo '<p>' . esc_attr__( 'Hello! You might be interested in the following Storefront extensions and designs.', 'storefront' ) . '</p>';
@@ -139,7 +140,10 @@ public function storefront_welcome_screen() {
139140

140141
<div class="automattic">
141142
<p>
142-
<?php printf( esc_html__( 'An %s project', 'storefront' ), '<a href="https://automattic.com/"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/admin/welcome-screen/automattic.png" alt="Automattic" /></a>' ); ?>
143+
<?php
144+
/* translators: %s: Automattic branding */
145+
printf( esc_html__( 'An %s project', 'storefront' ), '<a href="https://automattic.com/"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/admin/welcome-screen/automattic.png" alt="Automattic" /></a>' );
146+
?>
143147
</p>
144148
</div>
145149
</div>
@@ -165,31 +169,31 @@ public function welcome_intro() {
165169
public function install_plugin_button( $plugin_slug, $plugin_file ) {
166170
if ( current_user_can( 'install_plugins' ) && current_user_can( 'activate_plugins' ) ) {
167171
if ( is_plugin_active( $plugin_slug . '/' . $plugin_file ) ) {
168-
/**
169-
* The plugin is already active
170-
*/
172+
// The plugin is already active.
171173
$button = array(
172174
'message' => esc_attr__( 'Activated', 'storefront' ),
173175
'url' => '#',
174176
'classes' => 'disabled',
175177
);
176-
} elseif ( $url = $this->_is_plugin_installed( $plugin_slug ) ) {
177-
/**
178-
* The plugin exists but isn't activated yet.
179-
*/
178+
} elseif ( $this->_is_plugin_installed( $plugin_slug ) ) {
179+
$url = $this->_is_plugin_installed( $plugin_slug );
180+
181+
// The plugin exists but isn't activated yet.
180182
$button = array(
181183
'message' => esc_attr__( 'Activate', 'storefront' ),
182184
'url' => $url,
183185
'classes' => 'activate-now',
184186
);
185187
} else {
186-
/**
187-
* The plugin doesn't exist.
188-
*/
189-
$url = wp_nonce_url( add_query_arg( array(
190-
'action' => 'install-plugin',
191-
'plugin' => $plugin_slug,
192-
), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
188+
// The plugin doesn't exist.
189+
$url = wp_nonce_url(
190+
add_query_arg(
191+
array(
192+
'action' => 'install-plugin',
193+
'plugin' => $plugin_slug,
194+
), self_admin_url( 'update.php' )
195+
), 'install-plugin_' . $plugin_slug
196+
);
193197
$button = array(
194198
'message' => esc_attr__( 'Install now', 'storefront' ),
195199
'url' => $url,
@@ -214,10 +218,14 @@ public function _is_plugin_installed( $plugin_slug ) {
214218
if ( ! empty( $plugins ) ) {
215219
$keys = array_keys( $plugins );
216220
$plugin_file = $plugin_slug . '/' . $keys[0];
217-
$url = wp_nonce_url( add_query_arg( array(
218-
'action' => 'activate',
219-
'plugin' => $plugin_file,
220-
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
221+
$url = wp_nonce_url(
222+
add_query_arg(
223+
array(
224+
'action' => 'activate',
225+
'plugin' => $plugin_file,
226+
), admin_url( 'plugins.php' )
227+
), 'activate-plugin_' . $plugin_file
228+
);
221229
return $url;
222230
}
223231
}

inc/admin/class-storefront-plugin-install.php

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ public function plugin_install_scripts( $hook_suffix ) {
4848
*
4949
* @param string $plugin_slug The plugin slug.
5050
* @param string $plugin_file The plugin file.
51+
* @param string $plugin_name The plugin name.
52+
* @param string $classes CSS classes.
53+
* @param string $activated Button activated text.
54+
* @param string $activate Button activate text.
55+
* @param string $install Button install text.
5156
*/
5257
public static function install_plugin_button( $plugin_slug, $plugin_file, $plugin_name, $classes = array(), $activated = '', $activate = '', $install = '' ) {
5358
if ( current_user_can( 'install_plugins' ) && current_user_can( 'activate_plugins' ) ) {
5459
if ( is_plugin_active( $plugin_slug . '/' . $plugin_file ) ) {
55-
// The plugin is already active
60+
// The plugin is already active.
5661
$button = array(
5762
'message' => esc_attr__( 'Activated', 'storefront' ),
5863
'url' => '#',
@@ -62,7 +67,9 @@ public static function install_plugin_button( $plugin_slug, $plugin_file, $plugi
6267
if ( '' !== $activated ) {
6368
$button['message'] = esc_attr( $activated );
6469
}
65-
} elseif ( $url = self::_is_plugin_installed( $plugin_slug ) ) {
70+
} elseif ( self::_is_plugin_installed( $plugin_slug ) ) {
71+
$url = self::_is_plugin_installed( $plugin_slug );
72+
6673
// The plugin exists but isn't activated yet.
6774
$button = array(
6875
'message' => esc_attr__( 'Activate', 'storefront' ),
@@ -75,10 +82,14 @@ public static function install_plugin_button( $plugin_slug, $plugin_file, $plugi
7582
}
7683
} else {
7784
// The plugin doesn't exist.
78-
$url = wp_nonce_url( add_query_arg( array(
79-
'action' => 'install-plugin',
80-
'plugin' => $plugin_slug,
81-
), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
85+
$url = wp_nonce_url(
86+
add_query_arg(
87+
array(
88+
'action' => 'install-plugin',
89+
'plugin' => $plugin_slug,
90+
), self_admin_url( 'update.php' )
91+
), 'install-plugin_' . $plugin_slug
92+
);
8293
$button = array(
8394
'message' => esc_attr__( 'Install now', 'storefront' ),
8495
'url' => $url,
@@ -116,10 +127,14 @@ private static function _is_plugin_installed( $plugin_slug ) {
116127
if ( ! empty( $plugins ) ) {
117128
$keys = array_keys( $plugins );
118129
$plugin_file = $plugin_slug . '/' . $keys[0];
119-
$url = wp_nonce_url( add_query_arg( array(
120-
'action' => 'activate',
121-
'plugin' => $plugin_file,
122-
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
130+
$url = wp_nonce_url(
131+
add_query_arg(
132+
array(
133+
'action' => 'activate',
134+
'plugin' => $plugin_file,
135+
), admin_url( 'plugins.php' )
136+
), 'activate-plugin_' . $plugin_file
137+
);
123138
return $url;
124139
}
125140
}

0 commit comments

Comments
 (0)