Remove notices from other plugins on applications pages#2120
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested labels
Warning Rate limit exceeded@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 41 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
classes/controllers/FrmAppController.php (1)
1367-1380: LGTM! Consider adding a constant for the taxonomy name.The method correctly identifies Formidable admin pages by checking:
- Standard Formidable admin pages
- Logs post type pages
- Application taxonomy pages
Consider defining 'frm_application' as a class constant to avoid magic strings and improve maintainability:
+private const TAXONOMY_APPLICATION = 'frm_application'; private static function in_our_pages() { global $current_screen, $pagenow; if ( FrmAppHelper::is_formidable_admin() ) { return true; } if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) { return true; } if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && - 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) { + self::TAXONOMY_APPLICATION === FrmAppHelper::simple_get( 'taxonomy' ) ) { return true; } return false; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
classes/controllers/FrmAppController.php(1 hunks)
🔇 Additional comments (1)
classes/controllers/FrmAppController.php (1)
Line range hint 1381-1430: LGTM! Clean implementation of admin notice filtering.
The method effectively filters out third-party admin notices while preserving Formidable's own notices:
- Early return if not on Formidable pages
- Properly handles both function and class method callbacks
- Maintains Formidable notices by checking callback names
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Warning Rate limit exceeded@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 38 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
classes/controllers/FrmAppController.php (2)
1367-1380: LGTM! Consider extracting taxonomy check to a constant.The enhanced page detection logic is well-structured and covers all necessary cases. The addition of the taxonomy check for 'frm_application' improves the functionality.
Consider extracting the taxonomy name to a class constant for better maintainability:
class FrmAppController { + const APPLICATION_TAXONOMY = 'frm_application'; + // ... other code ... private static function in_our_pages() { global $current_screen, $pagenow; if ( FrmAppHelper::is_formidable_admin() ) { return true; } if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) { return true; } - if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) { + if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && self::APPLICATION_TAXONOMY === FrmAppHelper::simple_get( 'taxonomy' ) ) { return true; } return false; }
Line range hint
1381-1424: Add error handling for edge cases.The notice filtering logic is well-implemented but could be more robust.
Consider these improvements:
- Add null checks for
$wp_filter[$action]:foreach ( $actions as $action ) { + if ( ! isset( $wp_filter[ $action ] ) ) { + continue; + } if ( empty( $wp_filter[ $action ]->callbacks ) ) { continue; }
- Add type checking for callback validation:
private static function is_our_callback_array( $callback ) { + if ( ! is_array( $callback ) || ! isset( $callback['function'] ) ) { + return false; + } return ! empty( $callback['function'] ) && is_array( $callback['function'] ) &&
No description provided.