-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue/1091 Fix Simplify give_is_admin_page conditional #2639
Conversation
includes/admin/admin-pages.php
Outdated
if ( | ||
( 'give_forms' === $typenow || 'give_forms' === $query_args['post_type'] ) | ||
|| in_array( $passed_page, $expected_pages, true ) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than nesting everything in this can you do the opposite condition and pass $found = false
?
I would prefer less nesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will be great, I am working on this. @DevinWalker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the status on this @emgk ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How many conditions and lines was this previous as compared to how it is now?
@DevinWalker Previously the number of lines was 238 after optimizing the code the now number of lines is 95, lots of nesting conditional has been reduced, also used new function |
Thanks @emgk it's looking much better. Can you now finish it up with a solid unit test written for |
@DevinWalker I am working on PHPUnit testing. |
@DevinWalker @ravinderk I have added unit test cases for non-give and give pages. |
Good job on this one @emgk 👍 |
Description
This PR fixes #1091
How Has This Been Tested?
admin_init
hook and compare the result with old function's code.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: