-
Notifications
You must be signed in to change notification settings - Fork 12
feat: added compatibility notices for lazy loading #964
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
Conversation
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.
Pull Request Overview
Adds admin UI indicators and clearer conflict notices when other plugins provide overlapping lazy loading functionality. Key changes include: updated translated conflict messages for WP Rocket and Jetpack, added an admin menu badge showing the number of active conflicts, and refactored the conflict item UI styling in the dashboard.
- Added conflict count badge to the admin menu icon.
- Rewrote conflict messages for clarity and consistency.
- Updated conflict item component styling to WordPress-like notice style.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
inc/conflicts/wprocket.php | Updated i18n message for WP Rocket lazy load conflict. |
inc/conflicts/jetpack_lazyload.php | Updated i18n message for Jetpack lazy load conflict. |
inc/admin.php | Added conflict count badge logic and helper method. |
assets/src/dashboard/parts/connected/conflicts/ConflictItem.js | Replaced severity-based background classes with styled notice box and adjusted dismissal button styling. |
Comments suppressed due to low confidence (1)
inc/conflicts/wprocket.php:1
- Translator comment lists two placeholders (1 and 2), but the string only contains %1$s and only one argument is passed. Update the comment to reflect a single placeholder (the settings link) to avoid confusing translators.
<?php
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
/** | ||
* Get the number of active notices (not dismissed). | ||
* | ||
* @return int - Number of active notices | ||
*/ | ||
private function get_active_notices_count() { | ||
$conflicting_plugins = $this->conflicting_plugins->get_conflicting_plugins(); | ||
|
||
foreach ( $conflicting_plugins as $key => $plugin ) { | ||
$class_name = 'Optml_' . ucfirst( $key ); | ||
|
||
if ( class_exists( $class_name ) ) { | ||
try { | ||
$conflict_instance = new $class_name(); | ||
|
||
if ( method_exists( $conflict_instance, 'is_conflict_valid' ) && ! $conflict_instance->is_conflict_valid() ) { | ||
unset( $conflicting_plugins[ $key ] ); | ||
} | ||
} catch ( Exception $e ) { | ||
unset( $conflicting_plugins[ $key ] ); | ||
} | ||
} | ||
} | ||
|
||
return count( $conflicting_plugins ); | ||
} |
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.
We can simplify it with something like this:
<?php
/**
* Get the number of active notices (not dismissed).
*
* @return int - Number of active notices
*/
private function get_active_notices_count() {
$conflicting_plugins = $this->conflicting_plugins->get_conflicting_plugins();
$conflicts_count = 0;
foreach ( $conflicting_plugins as $key => $plugin ) {
$class_name = 'Optml_' . ucfirst( $key );
if ( ! class_exists( $class_name ) ) {
continue;
}
$conflict_instance = new $class_name();
if ( ! is_a( $conflict_instance, 'Optml_Abstract_Conflict' ) ) {
continue;
}
if ( $conflict_instance->is_conflict_valid() ) {
$conflicts_count++;
}
}
return $conflicts_count;
}
945cb43
to
95ab1e0
Compare
All Submissions:
Changes proposed in this Pull Request:
Now, if there are any conflicts with other plugins, it will display a red label near Optimole's icon.
Closes https://github.com/Codeinwp/optimole-service/issues/1526
Other information: