Use new code style
This commit is contained in:
.phpcs.xml.distcomposer.jsonconstants.phpsunrise.phpuninstall.php
inc
admin-pages
class-about-admin-page.phpclass-base-admin-page.phpclass-base-customer-facing-admin-page.phpclass-broadcast-edit-admin-page.phpclass-broadcast-list-admin-page.phpclass-checkout-form-edit-admin-page.phpclass-checkout-form-list-admin-page.phpclass-customer-edit-admin-page.phpclass-customer-list-admin-page.phpclass-customizer-admin-page.phpclass-dashboard-admin-page.phpclass-discount-code-edit-admin-page.phpclass-discount-code-list-admin-page.phpclass-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-list-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-list-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-jobs-list-admin-page.phpclass-list-admin-page.phpclass-membership-edit-admin-page.phpclass-membership-list-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-payment-list-admin-page.phpclass-placeholders-admin-page.phpclass-product-edit-admin-page.phpclass-product-list-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-shortcodes-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-admin-page.phpclass-system-info-admin-page.phpclass-tax-rates-admin-page.phpclass-template-previewer-customize-admin-page.phpclass-top-admin-nav-menu.phpclass-view-logs-admin-page.phpclass-webhook-edit-admin-page.phpclass-webhook-list-admin-page.phpclass-wizard-admin-page.php
customer-panel
class-account-admin-page.phpclass-add-new-site-admin-page.phpclass-checkout-admin-page.phpclass-my-sites-admin-page.phpclass-template-switching-admin-page.php
debug
api
builders
block-editor
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
class-admin-notices.phpclass-admin-themes-compatibility.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-autoloader.phpclass-cron.phpclass-current.phpclass-dashboard-statistics.phpclass-dashboard-widgets.phpclass-documentation.phpclass-domain-mapping.phpclass-faker.phpclass-geolocation.phpclass-helper.phpclass-hooks.phpclass-license.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-newsletter.phpclass-requirements.phpclass-scripts.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-user-switching.phpclass-views.phpclass-whitelabel.phpclass-wp-ultimo.phpsignup-fields
class-base-signup-field.phpclass-signup-field-billing-address.phpclass-signup-field-checkbox.phpclass-signup-field-color.phpclass-signup-field-discount-code.phpclass-signup-field-email.phpclass-signup-field-hidden.phpclass-signup-field-order-bump.phpclass-signup-field-order-summary.phpclass-signup-field-password.phpclass-signup-field-payment.phpclass-signup-field-period-selection.phpclass-signup-field-pricing-table.phpclass-signup-field-products.phpclass-signup-field-select.phpclass-signup-field-shortcode.phpclass-signup-field-site-title.phpclass-signup-field-site-url.phpclass-signup-field-steps.phpclass-signup-field-submit-button.phpclass-signup-field-template-selection.phpclass-signup-field-terms-of-use.phpclass-signup-field-text.phpclass-signup-field-username.php
field-templates
class-base-field-template.php
order-bump
order-summary
period-selection
pricing-table
steps
class-clean-steps-field-template.phpclass-legacy-steps-field-template.phpclass-minimal-steps-field-template.php
template-selection
compat
class-as-admin-view.phpclass-discount-code-compat.phpclass-domain-mapping-compat.phpclass-elementor-compat.phpclass-general-compat.phpclass-gutenberg-support.phpclass-legacy-shortcodes.phpclass-multiple-accounts-compat.phpclass-product-compat.php
contracts
country
class-country-br.phpclass-country-ca.phpclass-country-cn.phpclass-country-de.phpclass-country-default.phpclass-country-es.phpclass-country-fr.phpclass-country-gb.phpclass-country-in.phpclass-country-jp.phpclass-country-mx.phpclass-country-my.phpclass-country-ne.phpclass-country-nl.phpclass-country-ru.phpclass-country-sg.phpclass-country-tr.phpclass-country-us.phpclass-country-za.phpclass-country.php
database
broadcasts
checkout-forms
class-checkout-form-query.phpclass-checkout-forms-meta-table.phpclass-checkout-forms-schema.phpclass-checkout-forms-table.php
customers
class-customer-query.phpclass-customers-meta-table.phpclass-customers-schema.phpclass-customers-table.php
discount-codes
class-discount-code-query.phpclass-discount-codes-meta-table.phpclass-discount-codes-schema.phpclass-discount-codes-table.php
domains
emails
engine
class-base.phpclass-column.phpclass-compare.phpclass-date.phpclass-enum.phpclass-meta.phpclass-query.phpclass-row.phpclass-schema.phpclass-table.php
events
memberships
class-membership-query.phpclass-membership-status.phpclass-memberships-meta-table.phpclass-memberships-schema.phpclass-memberships-table.php
payments
class-payment-query.phpclass-payment-status.phpclass-payments-meta-table.phpclass-payments-schema.phpclass-payments-table.php
posts
products
class-product-query.phpclass-product-type.phpclass-products-meta-table.phpclass-products-schema.phpclass-products-table.php
sites
class-site-query.phpclass-site-type.phpclass-sites-meta-table.phpclass-sites-schema.phpclass-sites-table.php
webhooks
debug
deprecated
development
domain-mapping
duplication
exception
functions
admin.phparray-helpers.phpassets.phpbroadcast.phpcheckout-form.phpcheckout.phpcolor.phpcountries.phpcurrency.phpcustomer.phpdanger.phpdate.phpdebug.phpdiscount-code.phpdocumentation.phpdomain.phpelement.phpemail.phpenv.phpevent.phpfinancial.phpform.phpfs.phpgateway.phpgenerator.phpgeolocation.phphelper.phphttp.phpinvoice.phplegacy.phplimitations.phpmarkup-helpers.phpmembership.phpmock.phpmodel.phpnumber-helpers.phpoptions.phppages.phppayment.phpproduct.phpreflection.phprest.phpscheduler.phpsession.phpsettings.phpsite-context.phpsite.phpsort.phpstring-helpers.phpsunrise.phptax.phptemplate.phptranslation.phpurl.phpuser.phpwebhook.php
gateways
class-base-gateway.phpclass-base-stripe-gateway.phpclass-free-gateway.phpclass-ignorable-exception.phpclass-manual-gateway.phpclass-paypal-gateway.phpclass-stripe-checkout-gateway.phpclass-stripe-gateway.php
helpers
class-arr.phpclass-hash.phpclass-screenshot.phpclass-sender.phpclass-site-duplicator.phpclass-validator.phpclass-wp-config.php
validation-rules
installers
class-base-installer.phpclass-core-installer.phpclass-default-content-installer.phpclass-migrator.php
integrations
host-providers
class-base-host-provider.phpclass-closte-host-provider.phpclass-cloudflare-host-provider.phpclass-cloudways-host-provider.phpclass-cpanel-host-provider.phpclass-gridpane-host-provider.phpclass-runcloud-host-provider.phpclass-serverpilot-host-provider.phpclass-wpengine-host-provider.phpclass-wpmudev-host-provider.php
cpanel-api
internal
invoices
limitations
class-limit-customer-user-role.phpclass-limit-disk-space.phpclass-limit-domain-mapping.phpclass-limit-plugins.phpclass-limit-post-types.phpclass-limit-site-templates.phpclass-limit-sites.phpclass-limit-subtype.phpclass-limit-themes.phpclass-limit-users.phpclass-limit-visits.phpclass-limit.php
limits
class-customer-user-role-limits.phpclass-disk-space-limits.phpclass-plugin-limits.phpclass-post-type-limits.phpclass-site-template-limits.phpclass-theme-limits.phpclass-trial-limits.php
list-tables
class-base-list-table.phpclass-broadcast-list-table.phpclass-checkout-form-list-table.phpclass-customer-list-table.phpclass-customers-membership-list-table.phpclass-customers-payment-list-table.phpclass-customers-site-list-table.phpclass-discount-code-list-table.phpclass-domain-list-table.phpclass-email-list-table.phpclass-event-list-table.phpclass-inside-events-list-table.phpclass-line-item-list-table.phpclass-membership-line-item-list-table.phpclass-membership-list-table-widget.phpclass-membership-list-table.phpclass-memberships-site-list-table.phpclass-payment-line-item-list-table.phpclass-payment-list-table-widget.phpclass-payment-list-table.phpclass-product-list-table.phpclass-site-customer-list-table.phpclass-site-list-table.phpclass-sites-domain-list-table.phpclass-webhook-list-table.php
customer-panel
loaders
managers
class-base-manager.phpclass-block-manager.phpclass-broadcast-manager.phpclass-cache-manager.phpclass-checkout-form-manager.phpclass-customer-manager.phpclass-discount-code-manager.phpclass-domain-manager.phpclass-email-manager.phpclass-event-manager.phpclass-field-templates-manager.phpclass-form-manager.phpclass-gateway-manager.phpclass-job-manager.phpclass-limitation-manager.phpclass-membership-manager.phpclass-notes-manager.phpclass-notification-manager.phpclass-payment-manager.phpclass-product-manager.phpclass-signup-fields-manager.phpclass-site-manager.phpclass-visits-manager.phpclass-webhook-manager.php
models
class-base-model.phpclass-broadcast.phpclass-checkout-form.phpclass-customer.phpclass-discount-code.phpclass-domain.phpclass-email.phpclass-event.phpclass-membership.phpclass-payment.phpclass-post-base-model.phpclass-product.phpclass-site.phpclass-webhook.php
traits
objects
site-templates
sso
tax
traits
trait-singleton.phptrait-wp-ultimo-coupon-deprecated.phptrait-wp-ultimo-deprecated.phptrait-wp-ultimo-plan-deprecated.phptrait-wp-ultimo-settings-deprecated.phptrait-wp-ultimo-site-deprecated.phptrait-wp-ultimo-subscription-deprecated.php
ui
class-account-summary-element.phpclass-base-element.phpclass-billing-info-element.phpclass-checkout-element.phpclass-current-membership-element.phpclass-current-site-element.phpclass-domain-mapping-element.phpclass-field.phpclass-form.phpclass-invoices-element.phpclass-jumper.phpclass-limits-element.phpclass-login-form-element.phpclass-my-sites-element.phpclass-payment-methods-element.phpclass-simple-text-element.phpclass-site-actions-element.phpclass-site-maintenance-element.phpclass-template-previewer.phpclass-template-switching-element.phpclass-thank-you-element.phpclass-toolbox.phpclass-tours.php
updater
tests
Admin_Pages
Gateway_Functions_Test.phpWP_Ultimo
WP_Ultimo_Test.phpbootstrap.phpviews
about.phpadmin-notices.php
wp-multisite-waas.phpadmin-pages
fields
field-code-editor.phpfield-color-picker.phpfield-dashicon.phpfield-group.phpfield-header.phpfield-hidden.phpfield-html.phpfield-image.phpfield-link.phpfield-multiselect.phpfield-note.phpfield-repeater.phpfield-select-icon.phpfield-select.phpfield-small-header.phpfield-submit.phpfield-tab-select.phpfield-text-display.phpfield-text-edit.phpfield-text.phpfield-textarea.phpfield-toggle.phpfield-wp-editor.phpform.php
partials
base
centered.php
checkout-forms
customers
dash.phpedit.phpedit
empty-state.phpfilter.phpgrid.phplist.phpproducts
responsive-table-row.phpsettings.phpsites
wizard.phpwizard
broadcast
checkout
confirmation.php
fields
field-checkbox-multi.phpfield-checkbox.phpfield-group.phpfield-hidden.phpfield-html.phpfield-note.phpfield-password.phpfield-payment-methods.phpfield-products.phpfield-radio.phpfield-select.phpfield-submit.phpfield-text.phpfield-toggle.phpform.php
form.phppartials
partials
paypal
register.phptemplates
order-bump
order-summary
period-selection
pricing-table
steps
template-selection
customers
dashboard-statistics
filter.phpwidget-countries.phpwidget-forms.phpwidget-most-visited-sites.phpwidget-mrr-growth.phpwidget-new-accounts.phpwidget-revenue.phpwidget-tax-by-code.phpwidget-tax-by-day.phpwidget-tax-graph.phpwidget-taxes.php
dashboard-widgets
account-summary.phpactivity-stream.phpbilling-info.phpcurrent-membership-product-details.phpcurrent-membership.phpcurrent-site.phpdomain-mapping.phpfirst-steps.phpinvoices.phplimits-and-quotas.phplogin-additional-forms.phplogin-form.phpmy-sites.phpsimple-text.phpsite-actions.phpsite-maintenance.phpsummary.phpthank-you.php
domain
dynamic-styles
emails
admin
customer
events
invoice
legacy
signup
limitations
memberships
payments
settings
fields
shortcodes
sites
system-info
taxes
ui
branding
container-toggle.phpjumper-trigger.phpjumper.phpselectize-templates.phptemplate-previewer.phptoolbox.phpwizards
@ -12,10 +12,10 @@ namespace WP_Ultimo\Admin_Pages;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Installers\Migrator;
|
||||
use \WP_Ultimo\Installers\Core_Installer;
|
||||
use \WP_Ultimo\Installers\Default_Content_Installer;
|
||||
use \WP_Ultimo\Logger;
|
||||
use WP_Ultimo\Installers\Migrator;
|
||||
use WP_Ultimo\Installers\Core_Installer;
|
||||
use WP_Ultimo\Installers\Default_Content_Installer;
|
||||
use WP_Ultimo\Logger;
|
||||
|
||||
/**
|
||||
* WP Multisite WaaS Dashboard Admin Page.
|
||||
@ -23,10 +23,10 @@ use \WP_Ultimo\Logger;
|
||||
class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
/**
|
||||
* Holds the ID for this page, this is also used as the page slug.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
* Holds the ID for this page, this is also used as the page slug.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = 'wp-ultimo-setup';
|
||||
|
||||
/**
|
||||
@ -76,11 +76,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
);
|
||||
|
||||
/**
|
||||
* Is this an old install migrating.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var bool|null
|
||||
*/
|
||||
* Is this an old install migrating.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @var bool|null
|
||||
*/
|
||||
private ?bool $is_migration = null;
|
||||
|
||||
/**
|
||||
@ -103,8 +103,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
if (!$this->is_core_loaded()) {
|
||||
|
||||
if ( ! $this->is_core_loaded()) {
|
||||
require_once wu_path('inc/functions/documentation.php');
|
||||
|
||||
/**
|
||||
@ -121,8 +120,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$this->menu_icon = 'dashicons-wu-wp-ultimo';
|
||||
|
||||
add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
@ -144,8 +142,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* Redirect on activation
|
||||
*/
|
||||
add_action('wu_activation', array($this, 'redirect_to_wizard'));
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the migration logs.
|
||||
@ -172,8 +169,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
readfile($file);
|
||||
|
||||
exit;
|
||||
|
||||
} // end download_migration_logs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the extra elements we need on the wizard itself.
|
||||
@ -186,8 +182,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
parent::page_loaded();
|
||||
|
||||
$this->set_settings();
|
||||
|
||||
} // end page_loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this is a migration or not.
|
||||
@ -198,14 +193,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function is_migration() {
|
||||
|
||||
if ($this->is_migration === null) {
|
||||
|
||||
$this->is_migration = Migrator::is_legacy_network();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $this->is_migration;
|
||||
|
||||
} // end is_migration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds missing setup from settings when WP Multisite WaaS is not fully loaded.
|
||||
@ -216,8 +208,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function set_settings() {
|
||||
|
||||
WP_Ultimo()->settings->default_sections();
|
||||
|
||||
} // end set_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects to the wizard, if we need to.
|
||||
@ -227,15 +218,12 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function redirect_to_wizard() {
|
||||
|
||||
if (!\WP_Ultimo\Requirements::run_setup() && wu_request('page') !== 'wp-ultimo-setup') {
|
||||
|
||||
if ( ! \WP_Ultimo\Requirements::run_setup() && wu_request('page') !== 'wp-ultimo-setup') {
|
||||
wp_redirect(wu_network_admin_url('wp-ultimo-setup'));
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end redirect_to_wizard;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the ajax actions for installers and migrators.
|
||||
@ -247,13 +235,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
if (!current_user_can('manage_network')) {
|
||||
|
||||
if ( ! current_user_can('manage_network')) {
|
||||
wp_send_json_error(new \WP_Error('not-allowed', __('Permission denied.', 'wp-ultimo')));
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load tables.
|
||||
@ -268,14 +254,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$status = apply_filters('wu_handle_ajax_installers', true, $installer, $this);
|
||||
|
||||
if (is_wp_error($status)) {
|
||||
|
||||
wp_send_json_error($status);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
|
||||
} // end setup_install;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the core was loaded.
|
||||
@ -286,8 +269,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function is_core_loaded() {
|
||||
|
||||
return \WP_Ultimo\Requirements::met() && \WP_Ultimo\Requirements::run_setup();
|
||||
|
||||
} // end is_core_loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the logo for the wizard.
|
||||
@ -298,8 +280,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function get_logo() {
|
||||
|
||||
return wu_get_asset('logo.png', 'img');
|
||||
|
||||
} // end get_logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
@ -310,8 +291,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function get_title(): string {
|
||||
|
||||
return sprintf(__('Installation', 'wp-ultimo'));
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of menu for this page.
|
||||
@ -322,8 +302,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function get_menu_title() {
|
||||
|
||||
return WP_Ultimo()->is_loaded() ? __('WP Multisite WaaS Install', 'wp-ultimo') : __('WP Multisite WaaS', 'wp-ultimo');
|
||||
|
||||
} // end get_menu_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sections for this Wizard.
|
||||
@ -336,11 +315,14 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$sections = array(
|
||||
'welcome' => array(
|
||||
'title' => __('Welcome', 'wp-ultimo'),
|
||||
'description' => implode('<br><br>', array(
|
||||
__('...and thanks for choosing WP Multisite WaaS!', 'wp-ultimo'),
|
||||
__('This quick setup wizard will make sure your server is correctly setup, help you configure your new network, and migrate data from previous WP Multisite WaaS versions if necessary.', 'wp-ultimo'),
|
||||
__('You will also have the option of importing default content. It should take 10 minutes or less!', 'wp-ultimo')
|
||||
)),
|
||||
'description' => implode(
|
||||
'<br><br>',
|
||||
array(
|
||||
__('...and thanks for choosing WP Multisite WaaS!', 'wp-ultimo'),
|
||||
__('This quick setup wizard will make sure your server is correctly setup, help you configure your new network, and migrate data from previous WP Multisite WaaS versions if necessary.', 'wp-ultimo'),
|
||||
__('You will also have the option of importing default content. It should take 10 minutes or less!', 'wp-ultimo'),
|
||||
)
|
||||
),
|
||||
'next_label' => __('Get Started →', 'wp-ultimo'),
|
||||
'back' => false,
|
||||
),
|
||||
@ -354,7 +336,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'requirements' => array(
|
||||
'type' => 'note',
|
||||
'desc' => array($this, 'renders_requirements_table'),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
'installation' => array(
|
||||
@ -374,7 +356,6 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* In case of migrations, add different sections.
|
||||
*/
|
||||
if ($this->is_migration()) {
|
||||
|
||||
$dry_run = wu_request('dry-run', true);
|
||||
|
||||
$next = true;
|
||||
@ -388,12 +369,10 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$description = __('No errors found during dry run! Now it is time to actually migrate! <br><br><strong>We strongly recommend creating a backup of your database before moving forward with the migration.</strong>', 'wp-ultimo');
|
||||
|
||||
if ($dry_run) {
|
||||
|
||||
$next_label = __('Run Check', 'wp-ultimo');
|
||||
|
||||
$description = __('It seems that you were running WP Multisite WaaS 1.X on this network. This migrator will convert the data from the old version to the new one.', 'wp-ultimo') . '<br><br>' . __('First, let\'s run a test migration to see if we can spot any potential errors.', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'migration' => array(
|
||||
@ -403,7 +382,6 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
);
|
||||
|
||||
if ($errors) {
|
||||
|
||||
$subject = 'Errors on migrating my network';
|
||||
|
||||
$user = wp_get_current_user();
|
||||
@ -415,7 +393,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'Here are the error messages I got:',
|
||||
sprintf('```%s%s%s```', PHP_EOL, implode(PHP_EOL, $errors), PHP_EOL),
|
||||
sprintf('```%s%s%s```', PHP_EOL, $back_traces ? implode(PHP_EOL, $back_traces) : 'No backtraces found.', PHP_EOL),
|
||||
'Kind regards.'
|
||||
'Kind regards.',
|
||||
);
|
||||
|
||||
$message = implode(PHP_EOL . PHP_EOL, $message_lines);
|
||||
@ -428,35 +406,50 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
$error_list = '<strong>' . __('List of errors detected:', 'wp-ultimo') . '</strong><br><br>';
|
||||
|
||||
$errors[] = sprintf('<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-download wu-mr-2"></span>%1$s</a>', __('Download migration error log', 'wp-ultimo'), add_query_arg(array(
|
||||
'action' => 'download_migration_logs',
|
||||
'nonce' => wp_create_nonce('download_migration_logs'),
|
||||
), network_admin_url('admin.php')));
|
||||
$errors[] = sprintf(
|
||||
'<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-download wu-mr-2"></span>%1$s</a>',
|
||||
__('Download migration error log', 'wp-ultimo'),
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'download_migration_logs',
|
||||
'nonce' => wp_create_nonce('download_migration_logs'),
|
||||
),
|
||||
network_admin_url('admin.php')
|
||||
)
|
||||
);
|
||||
|
||||
$errors[] = sprintf('<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-back-in-time wu-mr-2"></span>%1$s</a>', __('Rollback to version 1.10.13', 'wp-ultimo'), add_query_arg(array(
|
||||
'page' => 'wp-ultimo-rollback',
|
||||
'version' => '1.10.13',
|
||||
'type' => 'select-version',
|
||||
), network_admin_url('admin.php')));
|
||||
$errors[] = sprintf(
|
||||
'<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-back-in-time wu-mr-2"></span>%1$s</a>',
|
||||
__('Rollback to version 1.10.13', 'wp-ultimo'),
|
||||
add_query_arg(
|
||||
array(
|
||||
'page' => 'wp-ultimo-rollback',
|
||||
'version' => '1.10.13',
|
||||
'type' => 'select-version',
|
||||
),
|
||||
network_admin_url('admin.php')
|
||||
)
|
||||
);
|
||||
|
||||
$error_list .= implode('<br>', $errors);
|
||||
|
||||
$fields = array_merge(array(
|
||||
'errors' => array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu-flex-grow',
|
||||
'desc' => function() use ($error_list) {
|
||||
$fields = array_merge(
|
||||
array(
|
||||
'errors' => array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu-flex-grow',
|
||||
'desc' => function () use ($error_list) {
|
||||
|
||||
/** Reset errors */
|
||||
Migrator::get_instance()->session->set('errors', array());
|
||||
/** Reset errors */
|
||||
Migrator::get_instance()->session->set('errors', array());
|
||||
|
||||
return sprintf('<div class="wu-mt-0 wu-p-4 wu-bg-red-100 wu-border wu-border-solid wu-border-red-200 wu-rounded-sm wu-text-red-500">%s</div>', $error_list);
|
||||
|
||||
},
|
||||
return sprintf('<div class="wu-mt-0 wu-p-4 wu-bg-red-100 wu-border wu-border-solid wu-border-red-200 wu-rounded-sm wu-text-red-500">%s</div>', $error_list);
|
||||
},
|
||||
),
|
||||
),
|
||||
), $fields);
|
||||
|
||||
} // end if;
|
||||
$fields
|
||||
);
|
||||
}
|
||||
|
||||
$sections['migration'] = array(
|
||||
'title' => __('Migration', 'wp-ultimo'),
|
||||
@ -467,9 +460,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'handler' => array($this, 'handle_migration'),
|
||||
'fields' => $fields,
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$sections['your-company'] = array(
|
||||
'title' => __('Your Company', 'wp-ultimo'),
|
||||
'description' => __('Before we move on, let\'s configure the basic settings of your network, shall we?', 'wp-ultimo'),
|
||||
@ -488,8 +479,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$sections['done'] = array(
|
||||
'title' => __('Ready!', 'wp-ultimo'),
|
||||
@ -507,8 +497,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @return array
|
||||
*/
|
||||
return apply_filters('wu_setup_wizard', $sections, $this->is_migration(), $this);
|
||||
|
||||
} // end get_sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the general settings to add to the wizard.
|
||||
@ -533,10 +522,8 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
);
|
||||
|
||||
foreach ($fields_to_unset as $field_to_unset) {
|
||||
|
||||
unset($general_fields[$field_to_unset]);
|
||||
|
||||
} // end foreach;
|
||||
unset($general_fields[ $field_to_unset ]);
|
||||
}
|
||||
|
||||
// Adds a fake first field to bypass some styling issues with the top-border
|
||||
$fake_field = array(
|
||||
@ -548,8 +535,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$fields = array_merge($fake_field, $general_fields);
|
||||
|
||||
return apply_filters('wu_setup_get_general_settings', $fields);
|
||||
|
||||
} // end get_general_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the payment settings to add to the setup wizard.
|
||||
@ -568,16 +554,13 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
);
|
||||
|
||||
foreach ($fields_to_unset as $field_to_unset) {
|
||||
|
||||
unset($payment_fields[$field_to_unset]);
|
||||
|
||||
} // end foreach;
|
||||
unset($payment_fields[ $field_to_unset ]);
|
||||
}
|
||||
|
||||
$fields = array_merge($payment_fields);
|
||||
|
||||
return apply_filters('wu_setup_get_payment_settings', $fields);
|
||||
|
||||
} // end get_payment_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the installation steps table.
|
||||
@ -592,20 +575,26 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wp_localize_script('wu-setup-wizard', 'wu_setup', $steps);
|
||||
|
||||
wp_localize_script('wu-setup-wizard', 'wu_setup_settings', array(
|
||||
'dry_run' => wu_request('dry-run', true),
|
||||
'generic_error_message' => __('A server error happened while processing this item.', 'wp-ultimo'),
|
||||
));
|
||||
wp_localize_script(
|
||||
'wu-setup-wizard',
|
||||
'wu_setup_settings',
|
||||
array(
|
||||
'dry_run' => wu_request('dry-run', true),
|
||||
'generic_error_message' => __('A server error happened while processing this item.', 'wp-ultimo'),
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-setup-wizard');
|
||||
|
||||
return wu_get_template_contents('wizards/setup/installation_steps', array(
|
||||
'page' => $this,
|
||||
'steps' => $steps,
|
||||
'checks' => $checks,
|
||||
));
|
||||
|
||||
} // end render_installation_steps;
|
||||
return wu_get_template_contents(
|
||||
'wizards/setup/installation_steps',
|
||||
array(
|
||||
'page' => $this,
|
||||
'steps' => $steps,
|
||||
'checks' => $checks,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the terms of support.
|
||||
@ -616,8 +605,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function _terms_of_support() {
|
||||
|
||||
return wu_get_template_contents('wizards/setup/support_terms');
|
||||
|
||||
} // end _terms_of_support;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the requirements tables.
|
||||
@ -637,7 +625,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'recommended_version' => \WP_Ultimo\Requirements::$php_recommended_version,
|
||||
'installed_version' => phpversion(),
|
||||
'pass_requirements' => version_compare(phpversion(), \WP_Ultimo\Requirements::$php_version, '>='),
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$php_recommended_version, '>=')
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$php_recommended_version, '>='),
|
||||
),
|
||||
'wordpress' => array(
|
||||
'name' => __('WordPress', 'wp-ultimo'),
|
||||
@ -646,7 +634,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'recommended_version' => \WP_Ultimo\Requirements::$wp_recommended_version,
|
||||
'installed_version' => $wp_version,
|
||||
'pass_requirements' => version_compare(phpversion(), \WP_Ultimo\Requirements::$wp_version, '>='),
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$wp_recommended_version, '>=')
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$wp_recommended_version, '>='),
|
||||
),
|
||||
);
|
||||
|
||||
@ -671,12 +659,14 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
),
|
||||
);
|
||||
|
||||
return wu_get_template_contents('wizards/setup/requirements_table', array(
|
||||
'requirements' => $requirements,
|
||||
'plugin_requirements' => $plugin_requirements,
|
||||
));
|
||||
|
||||
} // end renders_requirements_table;
|
||||
return wu_get_template_contents(
|
||||
'wizards/setup/requirements_table',
|
||||
array(
|
||||
'requirements' => $requirements,
|
||||
'plugin_requirements' => $plugin_requirements,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the final section.
|
||||
@ -694,21 +684,25 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.7
|
||||
*/
|
||||
if (Migrator::is_legacy_network()) {
|
||||
|
||||
update_network_option(null, 'wu_is_migration_done', true);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
wu_enqueue_async_action(
|
||||
'wu_async_take_screenshot',
|
||||
array(
|
||||
'site_id' => wu_get_main_site_id(),
|
||||
),
|
||||
'site'
|
||||
);
|
||||
|
||||
wu_enqueue_async_action('wu_async_take_screenshot', array(
|
||||
'site_id' => wu_get_main_site_id(),
|
||||
), 'site');
|
||||
|
||||
wu_get_template('wizards/setup/ready', array(
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
));
|
||||
|
||||
} // end section_ready;
|
||||
wu_get_template(
|
||||
'wizards/setup/ready',
|
||||
array(
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the requirements check.
|
||||
@ -719,18 +713,15 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function handle_checks() {
|
||||
|
||||
if (\WP_Ultimo\Requirements::met() === false) {
|
||||
|
||||
wp_redirect(add_query_arg());
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
wp_redirect($this->get_next_section_link());
|
||||
|
||||
exit;
|
||||
|
||||
} // end handle_checks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the saving of setting steps.
|
||||
@ -745,18 +736,12 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$step = wu_request('step');
|
||||
|
||||
if ($step === 'your-company') {
|
||||
|
||||
$fields_to_save = $this->get_general_settings();
|
||||
|
||||
} elseif ($step === 'payment-gateways') {
|
||||
|
||||
$fields_to_save = $this->get_payment_settings();
|
||||
|
||||
} else {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$settings_to_save = array_intersect_key($_POST, $fields_to_save);
|
||||
|
||||
@ -765,8 +750,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
wp_redirect($this->get_next_section_link());
|
||||
|
||||
exit;
|
||||
|
||||
} // end handle_save_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the migration step and checks for a test run.
|
||||
@ -781,28 +765,17 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$errors = Migrator::get_instance()->get_errors();
|
||||
|
||||
if ($dry_run) {
|
||||
|
||||
$url = add_query_arg('dry-run', empty($errors) ? 0 : 1);
|
||||
|
||||
} else {
|
||||
|
||||
if (empty($errors)) {
|
||||
|
||||
} elseif (empty($errors)) {
|
||||
$url = remove_query_arg('dry-run', $this->get_next_section_link());
|
||||
|
||||
} else {
|
||||
|
||||
$url = add_query_arg('dry-run', 0);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
} else {
|
||||
$url = add_query_arg('dry-run', 0);
|
||||
}
|
||||
|
||||
wp_redirect($url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end handle_migration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the configuration of a given integration.
|
||||
@ -813,7 +786,6 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function handle_configuration() {
|
||||
|
||||
if ($_POST['submit'] === '1') {
|
||||
|
||||
$this->integration->setup_constants($_POST);
|
||||
|
||||
$redirect_url = $this->get_next_section_link();
|
||||
@ -821,10 +793,8 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
wp_redirect($redirect_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end handle_configuration;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the testing of a given configuration.
|
||||
@ -837,13 +807,15 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wp_enqueue_script('wu-vue');
|
||||
|
||||
wu_get_template('wizards/host-integrations/test', array(
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
));
|
||||
|
||||
} // end section_test;
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/test',
|
||||
array(
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the necessary missing scripts if WP Multisite WaaS was not loaded.
|
||||
@ -854,7 +826,6 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
public function register_scripts() {
|
||||
|
||||
if (WP_Ultimo()->is_loaded() === false) {
|
||||
|
||||
wp_enqueue_style('wu-styling', wu_get_asset('framework.css', 'css'), false, wu_get_version());
|
||||
|
||||
wp_enqueue_style('wu-admin', wu_get_asset('admin.css', 'css'), array('wu-styling'), wu_get_version());
|
||||
@ -874,30 +845,37 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
/*
|
||||
* Localize components
|
||||
*/
|
||||
wp_localize_script('wu-fields', 'wu_fields', array(
|
||||
'l10n' => array(
|
||||
'image_picker_title' => __('Select an Image.', 'wp-ultimo'),
|
||||
'image_picker_button_text' => __('Use this image', 'wp-ultimo'),
|
||||
),
|
||||
));
|
||||
wp_localize_script(
|
||||
'wu-fields',
|
||||
'wu_fields',
|
||||
array(
|
||||
'l10n' => array(
|
||||
'image_picker_title' => __('Select an Image.', 'wp-ultimo'),
|
||||
'image_picker_button_text' => __('Use this image', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script('wu-functions', wu_get_asset('functions.js', 'js'), array('jquery'));
|
||||
|
||||
wp_register_script('wubox', wu_get_asset('wubox.js', 'js'), array('wu-functions'));
|
||||
|
||||
wp_localize_script('wubox', 'wuboxL10n', array(
|
||||
'next' => __('Next >'),
|
||||
'prev' => __('< Prev'),
|
||||
'image' => __('Image'),
|
||||
'of' => __('of'),
|
||||
'close' => __('Close'),
|
||||
'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
|
||||
'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
|
||||
));
|
||||
wp_localize_script(
|
||||
'wubox',
|
||||
'wuboxL10n',
|
||||
array(
|
||||
'next' => __('Next >'),
|
||||
'prev' => __('< Prev'),
|
||||
'image' => __('Image'),
|
||||
'of' => __('of'),
|
||||
'close' => __('Close'),
|
||||
'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
|
||||
'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
|
||||
)
|
||||
);
|
||||
|
||||
wp_add_inline_script('wu-setup-wizard-polyfill', 'document.addEventListener("DOMContentLoaded", () => wu_initialize_imagepicker());', 'after');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
wp_enqueue_script('wu-setup-wizard-polyfill', wu_get_asset('setup-wizard-polyfill.js', 'js'), array('jquery', 'wu-fields', 'wu-functions', 'wubox'), wu_get_version());
|
||||
|
||||
@ -905,12 +883,16 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wp_register_script('wu-setup-wizard', wu_get_asset('setup-wizard.js', 'js'), array('jquery'), wu_get_version());
|
||||
|
||||
wp_add_inline_style('wu-admin', sprintf('
|
||||
wp_add_inline_style(
|
||||
'wu-admin',
|
||||
sprintf(
|
||||
'
|
||||
body.wu-page-wp-ultimo-setup #wpwrap {
|
||||
background: url("%s") right bottom no-repeat;
|
||||
background-size: 90%%;
|
||||
}', wu_get_asset('bg-setup.png', 'img')));
|
||||
|
||||
} // end register_scripts;
|
||||
|
||||
} // end class Setup_Wizard_Admin_Page;
|
||||
}',
|
||||
wu_get_asset('bg-setup.png', 'img')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user