-
-
Notifications
You must be signed in to change notification settings - Fork 64
fix Activate wizard #230
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 Activate wizard #230
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis change set updates branding/URLs to ultimatemultisite.com, adjusts setup-wizard scripts/localizations and html_attr propagation, changes newsletter endpoints and admin messages, reorders Newsletter/Credits initialization, adds a plugin activation step in the recommended plugins installer, refreshes translations, and replaces two encoded literals. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Admin
participant WizardUI as Setup Wizard UI
participant Settings as WP_Ultimo\Settings
participant UIForm as UI\Form
Admin->>WizardUI: Open Setup Wizard
WizardUI->>Settings: get_all_with_defaults(true)
Settings-->>WizardUI: settings data
WizardUI->>WizardUI: build section.html_attr (data-*)
WizardUI->>UIForm: new Form(... html_attr: section.html_attr ...)
Note right of UIForm #DDF2E6: Form renders fields with extra HTML attributes
WizardUI->>Admin: enqueue wu-vue, masks, apps
WizardUI->>Admin: localize wu_selectizer, wu_settings, wu_ticker
sequenceDiagram
autonumber
actor Admin
participant Installer as RecommendedPluginsInstaller
participant WPorg as WordPress.org API
participant WP as WP Plugins API
Admin->>Installer: Run "Activate User Switching"
alt Plugin not installed
Installer->>WPorg: request install (slug)
WPorg-->>Installer: package installed
end
Installer->>WP: is_plugin_active(slug)?
alt Inactive
Installer->>WP: activate_plugin(slug)
WP-->>Installer: success / WP_Error
opt Error
Installer->>Installer: wu_log_add(Throwable)
end
end
Installer-->>Admin: step complete
sequenceDiagram
autonumber
participant Core as WP_Ultimo::init
participant Newsletter as \WP_Ultimo\Newsletter
participant Credits as \WP_Ultimo\Credits
Note over Core: Early-load for wizard readiness
Core->>Newsletter: get_instance()
Core->>Credits: get_instance()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
inc/installers/class-recommended-plugins-installer.php (1)
84-170: Avoid PHP 8-only helpers in PHP 7.4-compatible codeThe plugin still advertises PHP 7.4.30 support, but these new
str_starts_with()calls require PHP 8+ and will hard-fatal on every PHP 7.x install.(wordpress.org) Please stick to prefix checks that work on PHP 7.4.- if (str_starts_with($installer, 'install_plugin_')) { + if (strpos($installer, 'install_plugin_') === 0) { $plugin_slug = substr($installer, strlen('install_plugin_')); @@ - if (str_starts_with($installer, 'activate_plugin_')) { + if (strpos($installer, 'activate_plugin_') === 0) { $plugin_slug = substr($installer, strlen('activate_plugin_')); @@ - if (str_starts_with($file, $plugin_slug . '/')) { + if (strpos($file, $plugin_slug . '/') === 0) { @@ - if (str_starts_with($file, $plugin_slug . '/')) { + if (strpos($file, $plugin_slug . '/') === 0) {
🧹 Nitpick comments (1)
inc/stuff.php (1)
3-4: Add documentation for the base64-encoded values.The purpose and contents of these base64-encoded strings are unclear. Consider:
- Adding comments explaining what these values represent
- Using descriptive array keys instead of numeric indices
- Moving sensitive data (if applicable) to environment variables or a secure configuration system
This improves maintainability and makes the code's intent transparent.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
composer.json(1 hunks)inc/admin-pages/class-addons-admin-page.php(1 hunks)inc/admin-pages/class-setup-wizard-admin-page.php(4 hunks)inc/admin-pages/class-wizard-admin-page.php(1 hunks)inc/class-addon-repository.php(1 hunks)inc/class-credits.php(1 hunks)inc/class-newsletter.php(2 hunks)inc/class-wp-ultimo.php(1 hunks)inc/installers/class-recommended-plugins-installer.php(4 hunks)inc/stuff.php(1 hunks)lang/ultimate-multisite.pot(13 hunks)readme.txt(2 hunks)sunrise.php(1 hunks)ultimate-multisite.php(2 hunks)views/base/addons.php(1 hunks)views/ui/branding/footer.php(1 hunks)views/wizards/setup/ready.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
inc/admin-pages/class-setup-wizard-admin-page.php (7)
inc/class-wp-ultimo.php (1)
WP_Ultimo(23-942)inc/class-settings.php (2)
Settings(23-1684)get_all_with_defaults(165-178)inc/functions/array-helpers.php (1)
wu_array_map_keys(136-143)inc/functions/url.php (1)
wu_ajax_url(73-95)inc/functions/settings.php (1)
wu_get_setting(39-42)inc/functions/currency.php (1)
wu_get_currency_symbol(174-354)inc/functions/date.php (1)
wu_get_current_time(89-98)
inc/class-wp-ultimo.php (2)
inc/class-newsletter.php (1)
Newsletter(13-109)inc/class-credits.php (1)
Credits(24-306)
inc/installers/class-recommended-plugins-installer.php (2)
inc/functions/helper.php (1)
wu_log_add(208-211)inc/class-wp-ultimo.php (1)
WP_Ultimo(23-942)
🪛 GitHub Check: Code Quality Checks
inc/stuff.php
[failure] 5-5:
Expected 1 newline at end of file; 0 found
[failure] 4-4:
Array item not aligned correctly; expected 4 spaces but found 2
[warning] 4-4:
Found precision alignment of 2 spaces.
[failure] 3-3:
Array item not aligned correctly; expected 4 spaces but found 2
[warning] 3-3:
Found precision alignment of 2 spaces.
[failure] 2-2:
There should be no space between the "array" keyword and the open parenthesis. Found: 1 space
🪛 PHPMD (2.15.0)
inc/installers/class-recommended-plugins-installer.php
163-163: Avoid unused local variables such as '$data'. (undefined)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: cypress (8.1, chrome)
- GitHub Check: cypress (8.2, chrome)
🔇 Additional comments (9)
inc/class-addon-repository.php (1)
229-229: LGTM! Domain branding update is consistent.The admin notices now correctly reference "UltimateMultisite.com" instead of the old domain, aligning with the broader rebranding effort across the codebase.
Also applies to: 237-237
inc/admin-pages/class-wizard-admin-page.php (1)
347-347: LGTM! Clean propagation of HTML attributes to form wrapper.The addition of
html_attrwith a safe default (??[]) enables sections to attach data attributes to the form element, supporting dynamic UI features like Vue apps without breaking existing code.readme.txt (2)
132-136: LGTM! Update Server domain references updated consistently.The service description and associated Terms/Privacy Policy URLs now correctly point to ultimatemultisite.com, maintaining consistency with the broader rebranding effort.
206-212: LGTM! Newsletter Service domain references updated consistently.The Newsletter Service description and associated URLs now correctly point to ultimatemultisite.com, completing the domain rebranding for external service disclosures.
inc/admin-pages/class-setup-wizard-admin-page.php (4)
21-21: LGTM! Settings import added for dynamic state generation.The import enables direct access to
Settings::get_instance()used in line 479 for building the data-state attribute.
903-937: LGTM! Script localizations added for enhanced wizard functionality.The three localization blocks provide necessary data for:
wu_selectizer: AJAX endpoint for dynamic selectswu_settings: Currency and formatting configurationwu_ticker: Timezone and clock offset for time-based featuresAll values are retrieved via safe getter functions (
wu_get_setting,wu_get_currency_symbol, etc.).
958-962: Vue dependencies registered for footer credits toggle UI.The comment clarifies these scripts support the dynamic footer credits options in the wizard. The dependency chain is correct:
wu-vue→wu-money-mask/wu-input-mask→wu-vue-apps.Note: Only
wu-vue-appsis enqueued; others are registered as dependencies and will load automatically.
476-480: Confirm key mapping, escaping, and sensitive values
- wu_replace_dashes only replaces “-” with “_”; ensure your setting slugs can’t contain other unsafe characters.
- Verify that the JSON string from wp_json_encode() is passed through esc_attr (or equivalent) when rendered via html_attr.
- Explicitly omit any sensitive fields (API keys, secrets, tokens) from the array returned by Settings::get_all_with_defaults(true) before encoding.
inc/class-wp-ultimo.php (1)
156-158: Remove unnecessary dependency caution.Newsletter and Credits only register hooks and use global functions defined during plugin bootstrap; they don’t depend on services or managers loaded later, so early instantiation here is safe.
Likely an incorrect or invalid review comment.
| return array ( | ||
| 0 => 'ekmN3BXJCSjIWYaZzdR8sUtwRnRBemd1Z08ySVB2Z3I2NTNJS0FSREExNzhJYlloRDhTMlhldjR6UHc1RTFKM1Exam5pOG1RV2V2NHlyNk0=', | ||
| 1 => '4r+6L3n+zDRa6Leurkn4jUFpMGlkeG9LaHdBbE9HamZrNVlLNHdYRzhYVnJNSWI5T0d2SVVxdWNWWlVOSmVxTVhoWElvVjlOcU9rRnF6UFI=', | ||
| ); |
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.
Fix formatting issues flagged by static analysis.
Multiple formatting issues need to be addressed:
- Remove the space between "array" and the opening parenthesis
- Align array items with 4 spaces (not 2)
- Add a newline at the end of the file
Apply this diff to fix the formatting:
-return array (
- 0 => 'ekmN3BXJCSjIWYaZzdR8sUtwRnRBemd1Z08ySVB2Z3I2NTNJS0FSREExNzhJYlloRDhTMlhldjR6UHc1RTFKM1Exam5pOG1RV2V2NHlyNk0=',
- 1 => '4r+6L3n+zDRa6Leurkn4jUFpMGlkeG9LaHdBbE9HamZrNVlLNHdYRzhYVnJNSWI5T0d2SVVxdWNWWlVOSmVxTVhoWElvVjlOcU9rRnF6UFI=',
-);
+return array(
+ 0 => 'ekmN3BXJCSjIWYaZzdR8sUtwRnRBemd1Z08ySVB2Z3I2NTNJS0FSREExNzhJYlloRDhTMlhldjR6UHc1RTFKM1Exam5pOG1RV2V2NHlyNk0=',
+ 1 => '4r+6L3n+zDRa6Leurkn4jUFpMGlkeG9LaHdBbE9HamZrNVlLNHdYRzhYVnJNSWI5T0d2SVVxdWNWWlVOSmVxTVhoWElvVjlOcU9rRnF6UFI=',
+);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return array ( | |
| 0 => 'ekmN3BXJCSjIWYaZzdR8sUtwRnRBemd1Z08ySVB2Z3I2NTNJS0FSREExNzhJYlloRDhTMlhldjR6UHc1RTFKM1Exam5pOG1RV2V2NHlyNk0=', | |
| 1 => '4r+6L3n+zDRa6Leurkn4jUFpMGlkeG9LaHdBbE9HamZrNVlLNHdYRzhYVnJNSWI5T0d2SVVxdWNWWlVOSmVxTVhoWElvVjlOcU9rRnF6UFI=', | |
| ); | |
| return array( | |
| 0 => 'ekmN3BXJCSjIWYaZzdR8sUtwRnRBemd1Z08ySVB2Z3I2NTNJS0FSREExNzhJYlloRDhTMlhldjR6UHc1RTFKM1Exam5pOG1RV2V2NHlyNk0=', | |
| 1 => '4r+6L3n+zDRa6Leurkn4jUFpMGlkeG9LaHdBbE9HamZrNVlLNHdYRzhYVnJNSWI5T0d2SVVxdWNWWlVOSmVxTVhoWElvVjlOcU9rRnF6UFI=', | |
| ); |
🧰 Tools
🪛 GitHub Check: Code Quality Checks
[failure] 5-5:
Expected 1 newline at end of file; 0 found
[failure] 4-4:
Array item not aligned correctly; expected 4 spaces but found 2
[warning] 4-4:
Found precision alignment of 2 spaces.
[failure] 3-3:
Array item not aligned correctly; expected 4 spaces but found 2
[warning] 3-3:
Found precision alignment of 2 spaces.
[failure] 2-2:
There should be no space between the "array" keyword and the open parenthesis. Found: 1 space
🤖 Prompt for AI Agents
In inc/stuff.php around lines 2 to 5, the array formatting must be corrected:
remove the space between "array" and the opening parenthesis so it reads
"array(", re-indent the array items using 4 spaces for each item (not 2), and
ensure the file ends with a single newline; apply these formatting changes to
the shown lines and save the file with a trailing newline.
Summary by CodeRabbit
New Features
Chores
Documentation