Prep Plugin for release on WordPress.org (#23)

* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
This commit is contained in:
David Stone
2025-04-14 11:36:46 -06:00
committed by GitHub
parent a31cfcb565
commit d88e50df38
1087 changed files with 12586 additions and 18535 deletions

View File

@ -41,7 +41,7 @@ class Core_Installer extends Base_Installer {
if ( ! (defined('SUNRISE') && SUNRISE)) {
// translators: %s is a URL to a documentation link.
$closte_message = sprintf(__('You are using Closte and they prevent the wp-config.php file from being written to. <a href="%s" target="_blank">Follow these instructions to do it manually</a>.', 'wp-ultimo'), wu_get_documentation_url('wp-ultimo-closte-config'));
$closte_message = sprintf(__('You are using Closte and they prevent the wp-config.php file from being written to. <a href="%s" target="_blank">Follow these instructions to do it manually</a>.', 'wp-multisite-waas'), wu_get_documentation_url('wp-ultimo-closte-config'));
throw new \Exception($closte_message);
}
@ -68,21 +68,21 @@ class Core_Installer extends Base_Installer {
$steps['database_tables'] = [
'done' => $has_tables_installed,
'title' => __('Create Database Tables', 'wp-ultimo'),
'description' => __('WP Multisite WaaS uses custom tables for performance reasons. We need to create those tables and make sure they are setup properly before we can activate the plugin.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating default tables...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create Database Tables', 'wp-multisite-waas'),
'description' => __('WP Multisite WaaS uses custom tables for performance reasons. We need to create those tables and make sure they are setup properly before we can activate the plugin.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating default tables...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
$steps['sunrise'] = [
'done' => defined('SUNRISE') && SUNRISE && defined('WP_ULTIMO_SUNRISE_VERSION'),
'title' => __('Install <code>sunrise.php</code> File', 'wp-ultimo'),
'description' => __('We need to add our own sunrise.php file to the wp-content folder in order to be able to control access to sites and plugins before anything else happens on WordPress. ', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Installing sunrise file...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Install <code>sunrise.php</code> File', 'wp-multisite-waas'),
'description' => __('We need to add our own sunrise.php file to the wp-content folder in order to be able to control access to sites and plugins before anything else happens on WordPress. ', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Installing sunrise file...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
@ -117,7 +117,7 @@ class Core_Installer extends Base_Installer {
if (false === $success) {
// translators: %s is the name of a database table, e.g. wu_memberships.
$error_message = sprintf(__('Installation of the table %s failed', 'wp-ultimo'), $table->get_name());
$error_message = sprintf(__('Installation of the table %s failed', 'wp-multisite-waas'), $table->get_name());
throw new \Exception($error_message);
}

View File

@ -147,51 +147,51 @@ class Default_Content_Installer extends Base_Installer {
$steps['create_template_site'] = [
'done' => $this->done_creating_template_site(),
'title' => __('Create Example Template Site', 'wp-ultimo'),
'description' => __('This will create a template site on your network that you can use as a starting point.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating Template Site...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create Example Template Site', 'wp-multisite-waas'),
'description' => __('This will create a template site on your network that you can use as a starting point.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating Template Site...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
$steps['create_products'] = [
'done' => $this->done_creating_products(),
'title' => __('Create Example Products', 'wp-ultimo'),
'description' => __('This action will create example products (plans, packages, and services), so you have an starting point.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating Products...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create Example Products', 'wp-multisite-waas'),
'description' => __('This action will create example products (plans, packages, and services), so you have an starting point.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating Products...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
$steps['create_checkout'] = [
'done' => $this->done_creating_checkout_forms(),
'title' => __('Create a Checkout Form', 'wp-ultimo'),
'description' => __('This action will create a single-step checkout form that your customers will use to place purchases, as well as the page that goes with it.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating Checkout Form and Registration Page...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create a Checkout Form', 'wp-multisite-waas'),
'description' => __('This action will create a single-step checkout form that your customers will use to place purchases, as well as the page that goes with it.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating Checkout Form and Registration Page...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
$steps['create_emails'] = [
'done' => $this->done_creating_emails(),
'title' => __('Create the System Emails', 'wp-ultimo'),
'description' => __('This action will create all emails sent by WP Multisite WaaS.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating System Emails...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create the System Emails', 'wp-multisite-waas'),
'description' => __('This action will create all emails sent by WP Multisite WaaS.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating System Emails...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
$steps['create_login_page'] = [
'done' => $this->done_creating_login_page(),
'title' => __('Create Custom Login Page', 'wp-ultimo'),
'description' => __('This action will create a custom login page and replace the default one.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Creating Custom Login Page...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Create Custom Login Page', 'wp-multisite-waas'),
'description' => __('This action will create a custom login page and replace the default one.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Creating Custom Login Page...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('installation-errors'),
];
@ -214,7 +214,7 @@ class Default_Content_Installer extends Base_Installer {
$template_site = [
'domain' => $d->domain,
'path' => $d->path,
'title' => __('Template Site', 'wp-ultimo'),
'title' => __('Template Site', 'wp-multisite-waas'),
'type' => 'site_template',
];
@ -225,7 +225,7 @@ class Default_Content_Installer extends Base_Installer {
}
if ( ! $status) {
$error_message = __('Template Site was not created. Maybe a site with the /template path already exists?', 'wp-ultimo');
$error_message = __('Template Site was not created. Maybe a site with the /template path already exists?', 'wp-multisite-waas');
throw new \Exception($error_message);
}
@ -256,8 +256,8 @@ class Default_Content_Installer extends Base_Installer {
* Free Plan
*/
$products[] = [
'name' => __('Free', 'wp-ultimo'),
'description' => __('This is an example of a free plan.', 'wp-ultimo'),
'name' => __('Free', 'wp-multisite-waas'),
'description' => __('This is an example of a free plan.', 'wp-multisite-waas'),
'currency' => wu_get_setting('currency_symbol', 'USD'),
'pricing_type' => 'free',
'duration' => 1,
@ -276,8 +276,8 @@ class Default_Content_Installer extends Base_Installer {
* Premium Plan
*/
$products[] = [
'name' => __('Premium', 'wp-ultimo'),
'description' => __('This is an example of a paid plan.', 'wp-ultimo'),
'name' => __('Premium', 'wp-multisite-waas'),
'description' => __('This is an example of a paid plan.', 'wp-multisite-waas'),
'currency' => wu_get_setting('currency_symbol', 'USD'),
'pricing_type' => 'paid',
'type' => 'plan',
@ -296,8 +296,8 @@ class Default_Content_Installer extends Base_Installer {
* Service
*/
$products[] = [
'name' => __('SEO Consulting', 'wp-ultimo'),
'description' => __('This is an example of a service that you can create and charge customers for.', 'wp-ultimo'),
'name' => __('SEO Consulting', 'wp-multisite-waas'),
'description' => __('This is an example of a service that you can create and charge customers for.', 'wp-multisite-waas'),
'currency' => wu_get_setting('currency_symbol', 'USD'),
'pricing_type' => 'paid',
'type' => 'service',
@ -335,7 +335,7 @@ class Default_Content_Installer extends Base_Installer {
public function _install_create_checkout(): void {
$checkout_form = [
'name' => __('Registration Form', 'wp-ultimo'),
'name' => __('Registration Form', 'wp-multisite-waas'),
'slug' => 'main-form',
'settings' => [],
];
@ -361,7 +361,7 @@ class Default_Content_Installer extends Base_Installer {
*/
$post_details = [
'post_name' => 'register',
'post_title' => __('Register', 'wp-ultimo'),
'post_title' => __('Register', 'wp-multisite-waas'),
'post_content' => sprintf($post_content, $status->get_slug()),
'post_status' => 'publish',
'post_type' => 'page',
@ -408,7 +408,7 @@ class Default_Content_Installer extends Base_Installer {
';
$page_args = [
'post_title' => __('Login', 'wp-ultimo'),
'post_title' => __('Login', 'wp-multisite-waas'),
'post_content' => $page_content,
'post_status' => 'publish',
'post_author' => get_current_user_id(),

View File

@ -253,12 +253,12 @@ class Migrator extends Base_Installer {
if ($dry_run && ! $force_all) {
$steps['dry_run_check'] = [
'title' => __('Pre-Migration Check', 'wp-ultimo'),
'description' => __('Runs all migrations in a sand-boxed environment to see if it hits an error.', 'wp-ultimo'),
'title' => __('Pre-Migration Check', 'wp-multisite-waas'),
'description' => __('Runs all migrations in a sand-boxed environment to see if it hits an error.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Checking...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Checking...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'done' => false,
];
@ -267,105 +267,105 @@ class Migrator extends Base_Installer {
if ( ! $dry_run) {
$steps['backup'] = [
'title' => __('Prepare for Migration', 'wp-ultimo'),
'description' => __('Verifies the data before going forward with the migration.', 'wp-ultimo'),
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Preparing...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'title' => __('Prepare for Migration', 'wp-multisite-waas'),
'description' => __('Verifies the data before going forward with the migration.', 'wp-multisite-waas'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Preparing...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
}
$steps['settings'] = [
'title' => __('Settings', 'wp-ultimo'),
'description' => __('Migrates the settings from the older version.', 'wp-ultimo'),
'title' => __('Settings', 'wp-multisite-waas'),
'description' => __('Migrates the settings from the older version.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['products'] = [
'title' => __('Plans to Products', 'wp-ultimo'),
'description' => __('Converts the old plans into products.', 'wp-ultimo'),
'title' => __('Plans to Products', 'wp-multisite-waas'),
'description' => __('Converts the old plans into products.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['customers'] = [
'title' => __('Users to Customers', 'wp-ultimo'),
'description' => __('Creates customers based on the existing users.', 'wp-ultimo'),
'title' => __('Users to Customers', 'wp-multisite-waas'),
'description' => __('Creates customers based on the existing users.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['memberships'] = [
'title' => __('Subscriptions to Memberships', 'wp-ultimo'),
'description' => __('Converts subscriptions into Memberships.', 'wp-ultimo'),
'title' => __('Subscriptions to Memberships', 'wp-multisite-waas'),
'description' => __('Converts subscriptions into Memberships.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['transactions'] = [
'title' => __('Transactions to Payments & Events', 'wp-ultimo'),
'description' => __('Converts transactions into payments and events.', 'wp-ultimo'),
'title' => __('Transactions to Payments & Events', 'wp-multisite-waas'),
'description' => __('Converts transactions into payments and events.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['discount_codes'] = [
'title' => __('Coupons to Discount Codes', 'wp-ultimo'),
'description' => __('Converts coupons into discount codes.', 'wp-ultimo'),
'title' => __('Coupons to Discount Codes', 'wp-multisite-waas'),
'description' => __('Converts coupons into discount codes.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['sites'] = [
'title' => __('Customer Sites', 'wp-ultimo'),
'description' => __('Adjusts existing customer sites.', 'wp-ultimo'),
'installing' => __('Making Adjustments...', 'wp-ultimo'),
'title' => __('Customer Sites', 'wp-multisite-waas'),
'description' => __('Adjusts existing customer sites.', 'wp-multisite-waas'),
'installing' => __('Making Adjustments...', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['site_templates'] = [
'title' => __('Sites Templates', 'wp-ultimo'),
'description' => __('Adjusts existing site templates.', 'wp-ultimo'),
'installing' => __('Making Adjustments...', 'wp-ultimo'),
'title' => __('Sites Templates', 'wp-multisite-waas'),
'description' => __('Adjusts existing site templates.', 'wp-multisite-waas'),
'installing' => __('Making Adjustments...', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['domains'] = [
'title' => __('Mapped Domains', 'wp-ultimo'),
'description' => __('Converts mapped domains.', 'wp-ultimo'),
'title' => __('Mapped Domains', 'wp-multisite-waas'),
'description' => __('Converts mapped domains.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['forms'] = [
'title' => __('Checkout Forms', 'wp-ultimo'),
'description' => __('Creates a checkout form based on the existing signup flow.', 'wp-ultimo'),
'title' => __('Checkout Forms', 'wp-multisite-waas'),
'description' => __('Creates a checkout form based on the existing signup flow.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['emails'] = [
'title' => __('Emails & Broadcasts', 'wp-ultimo'),
'description' => __('Converts the emails and broadcasts.', 'wp-ultimo'),
'title' => __('Emails & Broadcasts', 'wp-multisite-waas'),
'description' => __('Converts the emails and broadcasts.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['webhooks'] = [
'title' => __('Webhooks', 'wp-ultimo'),
'description' => __('Migrates existing webhooks.', 'wp-ultimo'),
'title' => __('Webhooks', 'wp-multisite-waas'),
'description' => __('Migrates existing webhooks.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
$steps['other'] = [
'title' => __('Other Migrations', 'wp-ultimo'),
'description' => __('Other migrations that don\'t really fit anywhere else.', 'wp-ultimo'),
'title' => __('Other Migrations', 'wp-multisite-waas'),
'description' => __('Other migrations that don\'t really fit anywhere else.', 'wp-multisite-waas'),
'help' => wu_get_documentation_url('migration-errors'),
'done' => false,
];
@ -374,9 +374,9 @@ class Migrator extends Base_Installer {
fn($item) => wp_parse_args(
$item,
[
'pending' => __('Pending', 'wp-ultimo'),
'installing' => __('Migrating...', 'wp-ultimo'),
'success' => __('Success!', 'wp-ultimo'),
'pending' => __('Pending', 'wp-multisite-waas'),
'installing' => __('Migrating...', 'wp-multisite-waas'),
'success' => __('Success!', 'wp-multisite-waas'),
]
),
$steps
@ -578,7 +578,7 @@ class Migrator extends Base_Installer {
$caller = $dry_run ? $wu_migrator_current_installer : $installer;
// Translators: %s is the name of the installer.
$error_nice_message = sprintf(__('Critical error found when migrating "%s".', 'wp-ultimo'), $caller);
$error_nice_message = sprintf(__('Critical error found when migrating "%s".', 'wp-multisite-waas'), $caller);
if ($session) {
$errors = (array) $session->get('errors');
@ -912,7 +912,7 @@ class Migrator extends Base_Installer {
'preview_url_parameter' => 'template-preview',
'bg_color' => $this->get_old_setting('top-bar-bg-color', '#f9f9f9'),
'button_bg_color' => $this->get_old_setting('top-bar-button-bg-color', '#00a1ff'),
'button_text' => $this->get_old_setting('top-bar-button-text', __('Use this Template', 'wp-ultimo')),
'button_text' => $this->get_old_setting('top-bar-button-text', __('Use this Template', 'wp-multisite-waas')),
'display_responsive_controls' => $this->get_old_setting('top-bar-enable-resize', true),
'use_custom_logo' => $this->get_old_setting('top-bar-use-logo'),
'custom_logo' => $this->get_old_setting('top-bar-logo'),
@ -2310,7 +2310,7 @@ class Migrator extends Base_Installer {
}
$checkout_form = [
'name' => __('Signup Form', 'wp-ultimo'),
'name' => __('Signup Form', 'wp-multisite-waas'),
'slug' => 'main-form',
'allowed_countries' => $this->get_old_setting('allowed_countries', []),
'settings' => [],
@ -2347,7 +2347,7 @@ class Migrator extends Base_Installer {
*/
$post_details = [
'post_name' => $page_slug,
'post_title' => __('Signup', 'wp-ultimo'),
'post_title' => __('Signup', 'wp-multisite-waas'),
'post_status' => 'publish',
'post_type' => 'page',
'post_content' => sprintf($post_content, $status->get_slug()),
@ -2387,7 +2387,7 @@ class Migrator extends Base_Installer {
*/
$login_post_details = [
'post_name' => $login_page_slug,
'post_title' => __('Login', 'wp-ultimo'),
'post_title' => __('Login', 'wp-multisite-waas'),
'post_status' => 'publish',
'post_type' => 'page',
'post_content' => '',