Skip to content

Commit 05780b0

Browse files
authored
Minor Fixes
1 parent 682273f commit 05780b0

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

simple-wp-optimizer.php

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ function es_optimizer_get_default_options() {
9292
'remove_shortlink' => 1,
9393
'remove_recent_comments_style' => 1,
9494
'enable_dns_prefetch' => 1,
95-
'dns_prefetch_domains' => implode( "\n", array(
96-
'https://fonts.googleapis.com',
97-
'https://fonts.gstatic.com',
98-
'https://ajax.googleapis.com',
99-
'https://apis.google.com',
100-
'https://www.google-analytics.com',
101-
)
95+
'dns_prefetch_domains' => implode(
96+
"\n",
97+
array(
98+
'https://fonts.googleapis.com',
99+
'https://fonts.gstatic.com',
100+
'https://ajax.googleapis.com',
101+
'https://apis.google.com',
102+
'https://www.google-analytics.com',
103+
)
102104
),
103105
'disable_jetpack_ads' => 1,
104106
'disable_post_via_email' => 1,
@@ -295,21 +297,24 @@ function es_optimizer_render_additional_options( $options ) {
295297
function es_optimizer_render_checkbox_option( $options, $option_name, $title, $description ) {
296298
?>
297299
<tr valign="top">
298-
<th scope="row"><?php
300+
<th scope="row">
301+
<?php
299302
// Using esc_html for secure output of titles.
300303
echo esc_html( $title );
301-
?></th>
304+
?>
305+
</th>
302306
<td>
303307
<label>
304308
<input type="checkbox" name="<?php
305309
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
310+
306311
/*
307312
* Using printf with esc_attr for attribute name which cannot be avoided.
308313
* The $option_name values are hardcoded strings from render functions, not user input.
309314
* This is a controlled environment where these values are defined within the plugin.
310315
*/
311316
printf( 'es_optimizer_options[%s]', esc_attr( $option_name ) );
312-
?>" value="1"
317+
?>" value="1"
313318
<?php checked( 1, isset( $options[ $option_name ] ) ? $options[ $option_name ] : 0 ); ?> />
314319
<?php
315320
// Using esc_html for secure output of descriptions.
@@ -337,15 +342,19 @@ function es_optimizer_render_checkbox_option( $options, $option_name, $title, $d
337342
function es_optimizer_render_textarea_option( $options, $option_name, $title, $description ) {
338343
?>
339344
<tr valign="top">
340-
<th scope="row"><?php
345+
<th scope="row">
346+
<?php
341347
// Using esc_html for secure output of titles.
342348
echo esc_html( $title );
343-
?></th>
349+
?>
350+
</th>
344351
<td>
345-
<p><small><?php
352+
<p><small>
353+
<?php
346354
// Using esc_html for secure output of descriptions.
347355
echo esc_html( $description );
348-
?></small></p>
356+
?>
357+
</small></p>
349358
<textarea name="<?php
350359
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
351360
/*
@@ -354,7 +363,7 @@ function es_optimizer_render_textarea_option( $options, $option_name, $title, $d
354363
* This is a controlled environment where these values are defined within the plugin.
355364
*/
356365
printf( 'es_optimizer_options[%s]', esc_attr( $option_name ) );
357-
?>" rows="5" cols="50" class="large-text code"><?php
366+
?>" rows="5" cols="50" class="large-text code"><?php
358367
if ( isset( $options[ $option_name ] ) ) {
359368
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
360369
/*
@@ -364,7 +373,8 @@ function es_optimizer_render_textarea_option( $options, $option_name, $title, $d
364373
*/
365374
printf( '%s', esc_textarea( $options[ $option_name ] ) );
366375
}
367-
?></textarea>
376+
?>
377+
</textarea>
368378
</td>
369379
</tr>
370380
<?php
@@ -504,7 +514,7 @@ function es_optimizer_validate_single_domain( $domain ) {
504514
$host = $parsed_url['host'];
505515

506516
// Prevent localhost and private IP ranges for security.
507-
$is_local = in_array( $host, array( 'localhost', '127.0.0.1', '::1' ), true );
517+
$is_local = in_array( $host, array( 'localhost', '127.0.0.1', '::1' ), true );
508518
$is_private_ip = false !== filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE );
509519

510520
if ( $is_local || ! $is_private_ip ) {
@@ -636,7 +646,7 @@ function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
636646
/**
637647
* Remove JQuery Migrate
638648
*
639-
* jQuery Migrate is primarily used for backward compatibility with older jQuery code.
649+
* JQuery Migrate is primarily used for backward compatibility with older jQuery code.
640650
* Modern themes and plugins generally don't need it, so removing it improves load time.
641651
*
642652
* @since 1.0.0

0 commit comments

Comments
 (0)