Skip to content
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

Fix/general code tidy #995

Merged
merged 43 commits into from
Sep 9, 2023
Merged

Fix/general code tidy #995

merged 43 commits into from
Sep 9, 2023

Conversation

GaryJones
Copy link
Contributor

Description

A general tidy-up of code. There should be no breaking changes here. All still compatible with PHP 5.6.

Easiest to look through the individual commits than look at the whole set of changes in one go.

Not supported until PHP 7.0.
Replace `dirname( __FILE__ )` with `__DIR__`.
This allows file and directory paths to the root plugin file to be referenced irrespective of where the CoAuthors_Plus class lives.
The `can_edit_coauthors()` doesn't take any parameters.
The first part of the condition means the second parts were redundant.
While some of these may be architecturally better as non-public, that would be a breaking change, so leave as `public` for now.
Added for portability to make it binary safe.
`get_queried_object()` returns one of `WP_Term|WP_Post_Type|WP_Post|WP_User|null`, never `false`, so `empty()` is not the right check here.
Run less expensive bit first
@GaryJones GaryJones added this to the 3.5.16 milestone Sep 3, 2023
@GaryJones GaryJones self-assigned this Sep 3, 2023
@GaryJones GaryJones force-pushed the fix/general-code-tidy branch from ecb236e to e1b84e0 Compare September 3, 2023 10:15
@GaryJones GaryJones merged commit 9b60b87 into develop Sep 9, 2023
@GaryJones GaryJones deleted the fix/general-code-tidy branch September 9, 2023 15:33
@alecgeatches alecgeatches mentioned this pull request Apr 12, 2024
@alecgeatches alecgeatches modified the milestones: 3.5.16, 3.6 Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants