Change how icons are rendered for inserting shortcodes to reduce numb…#2779
Conversation
…er of phpcs ignore comments for echoing unescaped html
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
classes/helpers/FrmFormsHelper.php (1)
708-721: Refactoring looks correct; consider simplifying the redundant checks.The switch to
FrmAppHelper::icon_by_class()is appropriate since it internally handles sanitization viakses_icon()when echoing, achieving the PR goal of reducing phpcs ignore comments.However, since lines 688-689 ensure
$field['icon']is always set with a default value, theif ( isset( $field['icon'] ) )checks on lines 708 and 718 are now always true and could be removed for cleaner code.♻️ Optional: Remove redundant isset checks
?> <li class="<?php echo esc_attr( $class ); ?>"> <a href="javascript:void(0)" class="frmids frm_insert_code" data-code="<?php echo esc_attr( $args['id'] ); ?>"> <?php - if ( isset( $field['icon'] ) ) { - FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); - } + FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); echo esc_html( $truncated_name ); ?> <span>[<?php echo esc_attr( $args['id_label'] ?? $args['id'] ); ?>]</span> </a> <a href="javascript:void(0)" class="frmkeys frm_insert_code frm_hidden" data-code="<?php echo esc_attr( $args['key'] ); ?>"> <?php - if ( isset( $field['icon'] ) ) { - FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); - } + FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); echo esc_html( $truncated_name ); ?>
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
classes/helpers/FrmFormsHelper.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/helpers/FrmFormsHelper.php (1)
classes/helpers/FrmAppHelper.php (2)
FrmAppHelper(6-5027)icon_by_class(1365-1406)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
…d_to_reduce_number_of_phpcs_ignore_comments_for_echoing_unescaped_html Change how icons are rendered for inserting shortcodes to reduce numb…
…er of phpcs ignore comments for echoing unescaped html.
This update prevents the useless
echo '';as well.