-
Notifications
You must be signed in to change notification settings - Fork 138
Implement mechanism to not load module if core version is available #390
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c3170fe
Added: Mechanism to not load module if core version is available
mukeshpanchal27 6219d96
Added: New line
mukeshpanchal27 42a82fc
Fix: Code linting
mukeshpanchal27 5294f83
Fix: Docblock for functions
mukeshpanchal27 eef08c5
Update some tests
mukeshpanchal27 1ee0028
Fix: PHP lint
mukeshpanchal27 8750d5a
Simplify boolean check for function existence.
felixarntz f06ba7d
Fix: Text related changes
mukeshpanchal27 073d872
Update: logic for perflab_can_load_module
mukeshpanchal27 a0235c8
Fix: Feedback related to disabled checkbox
mukeshpanchal27 ca1cd0f
Fix: Lint white space issue
mukeshpanchal27 3f6244d
Perflab_get_active_and_valid_modules() is introduced, and review is i…
mukeshpanchal27 7c5365c
Fix: Admin settings review
mukeshpanchal27 7dda6e8
Fix: review of the new function
mukeshpanchal27 41b2834
Fix: review of tests
mukeshpanchal27 4d1e220
Added: Unit test for new functions
mukeshpanchal27 2371a46
Fix: Lint
mukeshpanchal27 e432764
Unit test for perflab_can_load_module()
mukeshpanchal27 acd3ed5
Fix: Lint
mukeshpanchal27 110656c
Feedback implemented
mukeshpanchal27 d403b7a
Update unit tests in response to the review
mukeshpanchal27 232d462
Correct lint
mukeshpanchal27 3388874
Update function name for test
mukeshpanchal27 a156b1a
Address code review feedback
mukeshpanchal27 ac6163a
Fix minor lint issue
mukeshpanchal27 b759790
Address review feedback
mukeshpanchal27 09c507f
Fix: Minor lind error
mukeshpanchal27 88eca52
Merge branch 'trunk' into fix/293-mechanism-not-load-module
felixarntz e54b7d7
Add test case for file_exists check in perflab_is_valid_module().
felixarntz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
| /** | ||
| * Can load function to determine if WebP Uploads module already marge in WordPress core. | ||
| * | ||
| * @since n.e.x.t | ||
| * @package performance-lab | ||
| */ | ||
|
|
||
| /** | ||
| * Filters whether the module can load or not. | ||
| * | ||
| * @since n.e.x.t | ||
| * | ||
| * @param bool $can_load Whether to load module. default true. | ||
mukeshpanchal27 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * @param string $module The name of the module. | ||
| * @return bool Whether to load module or not. | ||
| */ | ||
| function perflab_check_webp_uploads_core_functions( $can_load, $module ) { | ||
|
|
||
| if ( 'images/webp-uploads' !== $module ) { | ||
| return $can_load; | ||
| } | ||
|
|
||
| if ( function_exists( 'wp_image_use_alternate_mime_types' ) ) { | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
felixarntz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| add_filter( 'perflab_can_load_module', 'perflab_check_webp_uploads_core_functions', 10, 2 ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.