Skip to content

Commit cab3423

Browse files
authored
Minor Fixes
1 parent 847523f commit cab3423

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### Fixed
1919

20+
- **Code Quality**: Refactored textarea rendering to place PHP open/close tags on their own lines, resolving Codacy best-practice warnings
2021
- **Critical**: Fixed whitespace embedded inside form field `name` attributes (checkbox and textarea) that prevented settings from ever being saved — `$_POST['es_optimizer_options']` was never set because browsers sent the literal newlines/tabs as part of the field name
2122
- **Critical**: Fixed inverted IP-validation logic in `es_optimizer_validate_single_domain()` that caused every domain name (e.g. `fonts.googleapis.com`) to be incorrectly rejected when saving preconnect/DNS-prefetch settings
2223
- **Critical**: Fixed `es_optimizer_clear_options_cache()` which created an independent closure-scoped static variable and therefore never cleared the cache inside `es_optimizer_get_options()`

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ No, the plugin has a simple interface where you can toggle features on and off.
5555
* **CODE QUALITY**: Unified all option retrieval calls to use the `es_optimizer_get_options()` caching wrapper
5656
* **CODE QUALITY**: Settings page heading, description, and submit button are now fully translatable
5757
* **CODE QUALITY**: Removed unreachable dead code in `es_optimizer_add_settings_page()`
58+
* **CODE QUALITY**: Refactored textarea rendering to place PHP open/close tags on their own lines, resolving Codacy best-practice warnings
5859

5960
= 1.8.0 - 2025-10-23 =
6061
* **FEATURE**: Added new option to remove RSD (Really Simple Discovery) link from WordPress header

simple-wp-optimizer.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,10 @@ function es_optimizer_render_textarea_option( $options, $option_name, $title, $d
498498
echo esc_html( $description );
499499
?>
500500
</small></p>
501-
<textarea name="<?php printf( 'es_optimizer_options[%s]', esc_attr( $option_name ) ); ?>" rows="5" cols="50" class="large-text code"><?php
502-
if ( isset( $options[ $option_name ] ) ) {
503-
echo esc_textarea( $options[ $option_name ] );
504-
}
505-
?></textarea>
501+
<?php
502+
$textarea_value = isset( $options[ $option_name ] ) ? esc_textarea( $options[ $option_name ] ) : '';
503+
?>
504+
<textarea name="<?php printf( 'es_optimizer_options[%s]', esc_attr( $option_name ) ); ?>" rows="5" cols="50" class="large-text code"><?php echo $textarea_value; ?></textarea>
506505
</td>
507506
</tr>
508507
<?php

0 commit comments

Comments
 (0)