Update prefer esc_html_e/esc_attr_e sniff to catch more cases#2906
Conversation
📝 WalkthroughWalkthroughThis pull request refactors WordPress i18n function calls across multiple template and view files to use direct echo variants (esc_html_e, esc_attr_e) instead of combining echo with return-based variants (esc_html__, esc_attr__). Additionally, a PHP CodeSniffer sniff was enhanced to detect and auto-fix these patterns, including handling of direct combined function calls. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 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 |
esc_html_e/esc_attr_e sniff to catch more cases
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@classes/views/dashboard/templates/notification-banner.php`:
- Line 17: The anchor that opens a new tab (the link using
FrmAppHelper::admin_upgrade_link and class "frm-button-secondary") should
include rel="noopener noreferrer" to mitigate reverse-tabnabbing; update the <a>
tag that currently has target="_blank" (the one generating the upgrade link) to
add rel="noopener noreferrer" while keeping the existing esc_url() href and
esc_html_e() label intact.
| </div> | ||
| <div class="frm-shrink-0"> | ||
| <a target="_blank" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php echo esc_html__( 'Check All Features', 'formidable' ); ?></a> | ||
| <a target="_blank" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php esc_html_e( 'Check All Features', 'formidable' ); ?></a> |
There was a problem hiding this comment.
Add rel="noopener noreferrer" for the new-tab link.
Line 17 opens a new tab to an external site; add rel to mitigate reverse‑tabnabbing.
🔧 Suggested change
- <a target="_blank" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php esc_html_e( 'Check All Features', 'formidable' ); ?></a>
+ <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php esc_html_e( 'Check All Features', 'formidable' ); ?></a>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <a target="_blank" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php esc_html_e( 'Check All Features', 'formidable' ); ?></a> | |
| <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( '', 'features' ) ); ?>" class="frm-button-secondary"><?php esc_html_e( 'Check All Features', 'formidable' ); ?></a> |
🤖 Prompt for AI Agents
In `@classes/views/dashboard/templates/notification-banner.php` at line 17, The
anchor that opens a new tab (the link using FrmAppHelper::admin_upgrade_link and
class "frm-button-secondary") should include rel="noopener noreferrer" to
mitigate reverse-tabnabbing; update the <a> tag that currently has
target="_blank" (the one generating the upgrade link) to add rel="noopener
noreferrer" while keeping the existing esc_url() href and esc_html_e() label
intact.
…ff_to_catch_more_cases Update prefer `esc_html_e`/`esc_attr_e` sniff to catch more cases
Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.