Repository navigation
Conversation
Show an admin notice when the WordPress AI Client (AiClient) is missing — only for users with activate_plugins capability; uses localization and proper escaping (plugin.php). Add a function_exists check around _doing_it_wrong in GoogleImageGenerationModel to avoid fatal errors on installs lacking that helper. Also apply minor formatting / EOF newline fix in GoogleTextAndImageGenerationModel.php. Modified files: plugin.php, src/Models/GoogleImageGenerationModel.php, src/Models/GoogleTextAndImageGenerationModel.php Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| return; | ||
| } | ||
|
|
||
| if (!function_exists('is_admin') || !is_admin()) { |
There was a problem hiding this comment.
The code is heavily over-defensive. Since this function is hooked to admin_notices, WordPress core is guaranteed to be fully loaded when it runs, so all the function_exists() checks for core functions (is_admin, current_user_can, __, esc_attr, esc_html) are unnecessary. The is_admin() check itself is also redundant, because admin_notices only fires on admin screens.
|
@murshed are you able to update the PR based on the feedback above? |
Show an admin notice when the WordPress AI Client (AiClient) is missing — only for users with activate_plugins capability; uses localization and proper escaping (plugin.php). Add a function_exists check around _doing_it_wrong in GoogleImageGenerationModel to avoid fatal errors on installs lacking that helper. Also apply minor formatting / EOF newline fix in GoogleTextAndImageGenerationModel.php.
Modified files: plugin.php, src/Models/GoogleImageGenerationModel.php, src/Models/GoogleTextAndImageGenerationModel.php