Prep Plugin for release on WordPress.org

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.
This commit is contained in:
David Stone
2025-04-07 09:15:21 -06:00
parent f05ab77418
commit a815fdf179
290 changed files with 2999 additions and 3269 deletions

View File

@ -4,40 +4,28 @@
*
* @since 2.0.0
*/
?>
<div class="wu-bg-white wu-p-4 wu--mx-6 wu-flex wu-content-center" style="height: 400px;">
<div class="wu-self-center wu-text-center wu-w-full">
<span class="dashicons dashicons-warning wu-w-auto wu-h-auto wu-text-5xl wu-mb-2"></span>
<h1 class="wu-text-gray-800">
<?php _e('Caution!', 'wp-multisite-waas'); ?>
</h1>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('This action is irreversible and may cause unexpected behavior in your data, be sure of what you are doing and have a backup in case of some trouble!', 'wp-multisite-waas'); ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('This will forcely rerun our Migration Wizard on your installation. If you tried to migrate after install but your v1 data is missing, this can resolve.', 'wp-multisite-waas'); ?>
</p>
<span class="dashicons dashicons-warning wu-w-auto wu-h-auto wu-text-5xl wu-mb-2"></span>
<h1 class="wu-text-gray-800">
<?php esc_html_e('Caution!', 'wp-multisite-waas'); ?>
</h1>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php esc_html_e('This action is irreversible and may cause unexpected behavior in your data, be sure of what you are doing and have a backup in case of some trouble!', 'wp-multisite-waas'); ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php esc_html_e('This will forcely rerun our Migration Wizard on your installation. If you tried to migrate after install but your v1 data is missing, this can resolve.', 'wp-multisite-waas'); ?>
</p>
</div>
</div>
<!-- Submit Box -->
<div class="wu-bg-gray-100 wu--m-in wu-mt-4 wu-p-4 wu-overflow-hidden wu-border-t wu-border-solid wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300">
<span class="wu-float-right">
<button name="next" value="1" class="wu-next-button button button-primary button-large wu-ml-2">
<?php _e('Proceed', 'wp-multisite-waas'); ?>
</button>
<button name="next" value="1" class="wu-next-button button button-primary button-large wu-ml-2">
<?php esc_html_e('Proceed', 'wp-multisite-waas'); ?>
</button>
</span>
</div>
<!-- End Submit Box -->
<!-- End Submit Box -->

View File

@ -6,54 +6,37 @@
*/
?>
<h1>
<?php echo $title; ?>
<?php echo esc_html($title); ?>
</h1>
<?php if ($description) : ?>
<p class="wu-text-lg wu-text-gray-600 wu-mt-4 wu-mb-0">
<?php echo $description; ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-mt-4 wu-mb-0">
<?php echo esc_html($description); ?>
</p>
<?php endif; ?>
<div class="wu-bg-white wu-p-4 wu--mx-5">
<?php echo $content; ?>
<?php echo wp_kses_post($content); ?>
</div>
<!-- Submit Box -->
<div class="wu-flex wu-justify-between wu-bg-gray-100 wu--m-in wu-mt-4 wu-p-4 wu-overflow-hidden wu-border-t wu-border-solid wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300">
<?php if ($back) : ?>
<a href="<?php echo esc_attr($page->get_prev_section_link()); ?>" class="wu-self-center button button-large wu-float-left">
<?php echo $back_label; ?>
</a>
<?php endif; ?>
<div class="wu-text-right wu-relative wu-w-full">
<?php if ($skip) : ?>
<a href="<?php echo esc_attr($page->get_next_section_link()); ?>" class="wu-skip-button button button-large">
<?php echo $skip_label; ?>
</a>
<?php endif; ?>
<?php if ($next) : ?>
<button name="next" value="1" class="wu-next-button button button-primary button-large wu-ml-2">
<?php echo $next_label; ?>
</button>
<?php endif; ?>
</div>
<?php if ($back) : ?>
<a href="<?php echo esc_url($page->get_prev_section_link()); ?>" class="wu-self-center button button-large wu-float-left">
<?php echo esc_html($back_label); ?>
</a>
<?php endif; ?>
<div class="wu-text-right wu-relative wu-w-full">
<?php if ($skip) : ?>
<a href="<?php echo esc_url($page->get_next_section_link()); ?>" class="wu-skip-button button button-large">
<?php echo esc_html($skip_label); ?>
</a>
<?php endif; ?>
<?php if ($next) : ?>
<button name="next" value="1" class="wu-next-button button button-primary button-large wu-ml-2">
<?php echo esc_html($next_label); ?>
</button>
<?php endif; ?>
</div>
</div>
<!-- End Submit Box -->

View File

@ -7,61 +7,48 @@
?>
<div class="wu-advanced-filters">
<table class="widefat fixed striped wu-border-b" data-id="<?php echo esc_attr($page->get_current_section()); ?>">
<thead>
<thead>
<tr>
<?php if ($checks) : ?>
<th class="check" style="width: 30px;"></th>
<?php endif ?>
<th class="item"><?php _e('Item', 'wp-multisite-waas'); ?></th>
<th class="status" style="width: 40%;"><?php _e('Status', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($steps as $slug => $default) : ?>
<tr
<?php echo ! $default['done'] ? 'data-content="' . esc_attr($slug) . '"' : ''; ?>
<?php echo wu_array_to_html_attrs(wu_get_isset($default, 'html_attr', [])); ?>
>
<?php if ($checks) : ?>
<td>
<?php if ( ! $default['done']) : ?>
<input type="checkbox" name="default_content[<?php echo esc_attr($slug); ?>]" id="default_content_<?php echo esc_attr($slug); ?>" value="1" checked>
<?php endif ?>
</td>
<th class="check" style="width: 30px;"></th>
<?php endif ?>
<td>
<label class="wu-font-semibold wu-text-gray-700" for="default_content_<?php echo esc_attr($slug); ?>">
<?php echo $default['title']; ?>
</label>
<span class="wu-text-xs wu-block wu-mt-1">
<?php echo $default['description']; ?>
</span>
</td>
<?php if ($default['done']) : ?>
<td class="status">
<span class="wu-text-green-600">
<?php echo $default['completed'] ?? __('Completed!', 'wp-multisite-waas'); ?>
</span>
</td>
<?php else : ?>
<td class="status">
<span><?php echo $default['pending']; ?></span>
<div class="spinner"></div>
<!-- <a style="display: none;" class="wu-no-underline wu-block help" href="<?php echo $default['help']; ?>" title="<?php esc_attr_e('Help', 'wp-multisite-waas'); ?>">
<?php _e('Read More', 'wp-multisite-waas'); ?>
<span class="dashicons-wu-help-with-circle"></span>
</a> -->
</td>
<?php endif; ?>
<th class="item"><?php esc_html_e('Item', 'wp-multisite-waas'); ?></th>
<th class="status" style="width: 40%;"><?php esc_html_e('Status', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($steps as $slug => $default) : ?>
<tr <?php echo ! $default['done'] ? 'data-content="' . esc_attr($slug) . '"' : ''; ?> <?php echo wu_array_to_html_attrs(wu_get_isset($default, 'html_attr', [])); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php if ($checks) : ?>
<td>
<?php if ( ! $default['done']) : ?>
<input type="checkbox" name="default_content[<?php echo esc_attr($slug); ?>]" id="default_content_<?php echo esc_attr($slug); ?>" value="1" <?php checked(true, isset($default['checked']) ? $default['checked'] : false); ?>>
<?php endif ?>
</td>
<?php endif; ?>
<td>
<label class="wu-font-semibold wu-text-gray-700" for="default_content_<?php echo esc_attr($slug); ?>">
<?php echo esc_html($default['title']); ?>
</label>
<span class="wu-text-xs wu-block wu-mt-1">
<?php echo esc_html($default['description']); ?>
</span>
</td>
<?php if ($default['done']) : ?>
<td class="status">
<span class="wu-text-green-600">
<?php echo esc_html($default['completed'] ?? __('Completed!', 'wp-multisite-waas')); ?>
</span>
</td>
<?php else : ?>
<td class="status">
<span><?php echo esc_html($default['pending']); ?></span>
<div class="spinner"></div>
<!-- Removed the help link as it was not properly escaped -->
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</tbody>
</table>
</div>

View File

@ -12,23 +12,24 @@
<span class="dashicons dashicons-yes-alt wu-text-green-400 wu-w-auto wu-h-auto wu-text-5xl wu-mb-2"></span>
<h1 class="wu-text-gray-800">
<?php printf(__('We are ready, %s!', 'wp-multisite-waas'), apply_filters('wu_setup_step_done_name', $page->customer->first ?? __('my friend', 'wp-multisite-waas'))); ?>
<?php // translators: %s customer's name ?>
<?php echo esc_html(sprintf(__('We are ready, %s!', 'wp-multisite-waas'), apply_filters('wu_setup_step_done_name', $page->customer->first ?? __('my friend', 'wp-multisite-waas')))); ?>
</h1>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('WP Multisite WaaS would not be possible without the work of <a href="https://wpultimo.com/" target="_blank">Arindo Duque</a> and <a href="https://nextpress.co" target="_blank">NextPress</a>.', 'wp-multisite-waas'); ?>
<?php esc_html_e('WP Multisite WaaS would not be possible without the work of <a href="https://wpultimo.com/" target="_blank">Arindo Duque</a> and <a href="https://nextpress.co" target="_blank">NextPress</a>.', 'wp-multisite-waas'); ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('WP Multisite WaaS is maintained by volunteer open source developers. Please consider sponsoring the project on <a href="https://github.com/superdav42/wp-multisite-waas" target="_blank">GitHub</a>', 'wp-multisite-waas'); ?>
<?php esc_html_e('WP Multisite WaaS is maintained by volunteer open source developers. Please consider sponsoring the project on <a href="https://github.com/superdav42/wp-multisite-waas" target="_blank">GitHub</a>', 'wp-multisite-waas'); ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('Paid support is available. Go to <a href="https://wpmultisitewaas.org/support" target="_blank">The Support Page</a> to find an expert who can assist in setting up WP Multisite WaaS or custom development.', 'wp-multisite-waas'); ?>
<?php esc_html_e('Paid support is available. Go to <a href="https://wpmultisitewaas.org/support" target="_blank">The Support Page</a> to find an expert who can assist in setting up WP Multisite WaaS or custom development.', 'wp-multisite-waas'); ?>
</p>
<p class="wu-text-lg wu-text-gray-600 wu-my-4">
<?php _e('You now have everything you need in place to start building your Website as a Service business!', 'wp-multisite-waas'); ?>
<?php esc_html_e('You now have everything you need in place to start building your Website as a Service business!', 'wp-multisite-waas'); ?>
</p>
<p>
@ -46,7 +47,7 @@
<span class="wu-float-right">
<a href="<?php echo esc_url(network_admin_url('index.php')); ?>" class="button button-primary button-large">
<?php _e('Thanks!', 'wp-multisite-waas'); ?>
<?php esc_html_e('Thanks!', 'wp-multisite-waas'); ?>
</a>
</span>

View File

@ -15,31 +15,31 @@
<table class="widefat fixed striped wu-border-b">
<thead>
<tr>
<th><?php _e('Item', 'wp-multisite-waas'); ?></th>
<th><?php _e('Minimum Version', 'wp-multisite-waas'); ?></th>
<th><?php _e('Recommended', 'wp-multisite-waas'); ?></th>
<th><?php _e('Installed', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Item', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Minimum Version', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Recommended', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Installed', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($requirements as $req) : ?>
<tr class="">
<td><?php echo $req['name']; ?></td>
<td><?php echo $req['required_version']; ?></td>
<td><?php echo esc_html($req['name']); ?></td>
<td><?php echo esc_html($req['required_version']); ?></td>
<?php // translators: %s is the requirement version ?>
<td><?php printf(__('%s or later'), $req['recommended_version']); ?></td>
<td><?php printf(esc_html__('%s or later', 'wp-multisite-waas'), esc_html($req['recommended_version'])); ?></td>
<td class="<?php echo $req['pass_requirements'] ? 'wu-text-green-600' : 'wu-text-red-600'; ?>">
<?php echo $req['installed_version']; ?>
<?php echo $req['pass_requirements'] ? '<span class="dashicons-wu-check"></span>' : '<span class="dashicons-wu-cross"></span>'; ?>
<?php echo esc_html($req['installed_version']); ?>
<?php echo $req['pass_requirements'] ? '<span class="dashicons-wu-check"></span>' : '<span class="dashicons-wu-cross"></span>'; ?>
<?php if ( ! $req['pass_requirements']) : ?>
<?php if ( ! $req['pass_requirements']) : ?>
<a class="wu-no-underline wu-block" href="<?php echo $req['help']; ?>" title="<?php esc_attr_e('Help', 'wp-multisite-waas'); ?>">
<?php _e('Read More', 'wp-multisite-waas'); ?>
<span class="dashicons-wu-help-with-circle"></span>
</a>
<a class="wu-no-underline wu-block" href="<?php echo esc_url($req['help']); ?>" title="<?php esc_attr_e('Help', 'wp-multisite-waas'); ?>">
<?php esc_html_e('Read More', 'wp-multisite-waas'); ?>
<span class="dashicons-wu-help-with-circle"></span>
</a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
@ -49,30 +49,30 @@
</div>
<div class="wu-block wu-text-gray-700 wu-font-bold wu-uppercase wu-text-xs wu-py-2">
<?php echo __('And', 'wp-multisite-waas'); ?>
<?php echo esc_html__('And', 'wp-multisite-waas'); ?>
</div>
<div class="wu-advanced-filters">
<table class="widefat fixed striped wu-border-b">
<thead>
<tr>
<th><?php _e('Item', 'wp-multisite-waas'); ?></th>
<th><?php _e('Condition', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Item', 'wp-multisite-waas'); ?></th>
<th><?php esc_html_e('Condition', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($plugin_requirements as $req) : ?>
<tr class="">
<td><?php echo $req['name']; ?></td>
<td><?php echo esc_html($req['name']); ?></td>
<td class="<?php echo $req['pass_requirements'] ? 'wu-text-green-600' : 'wu-text-red-600'; ?>">
<?php echo $req['condition']; ?>
<?php echo esc_html($req['condition']); ?>
<?php echo $req['pass_requirements'] ? '<span class="dashicons-wu-check"></span>' : '<span class="dashicons-wu-cross wu-align-middle"></span>'; ?>
<?php if ( ! $req['pass_requirements']) : ?>
<a target="_blank" class="wu-no-underline wu-ml-2" href="<?php echo $req['help']; ?>" title="<?php esc_attr_e('Help', 'wp-multisite-waas'); ?>">
<a target="_blank" class="wu-no-underline wu-ml-2" href="<?php echo esc_url($req['help']); ?>" title="<?php esc_attr_e('Help', 'wp-multisite-waas'); ?>">
<span class="dashicons-wu-help-with-circle wu-align-baseline"></span>
<?php _e('Read More', 'wp-multisite-waas'); ?>
<?php esc_html_e('Read More', 'wp-multisite-waas'); ?>
</a>
<?php endif; ?>
@ -87,7 +87,7 @@
<?php if (\WP_Ultimo\Requirements::met() === false) : ?>
<div class="wu-mt-4 wu-p-4 wu-bg-red-100 wu-border wu-border-solid wu-border-red-200 wu-rounded-sm wu-text-red-500">
<?php _e('It looks like your hosting environment does not support the current version of WP Multisite WaaS. Visit the <strong>Read More</strong> links on each item to see what steps you need to take to bring your environment up to the WP Multisite WaaS current requirements.', 'wp-multisite-waas'); ?>
<?php esc_html_e('It looks like your hosting environment does not support the current version of WP Multisite WaaS. Visit the <strong>Read More</strong> links on each item to see what steps you need to take to bring your environment up to the WP Multisite WaaS current requirements.', 'wp-multisite-waas'); ?>
</div>
<?php endif; ?>

View File

@ -6,37 +6,37 @@
*/
?>
<div class="wu--mt-7">
<p><?php _e('This plugin comes with support for issues you may have. Support can be requested via email on <a class="wu-no-underline" href="mailto:support@wpultimo.com" target="_blank">support@wpultimo.com</a> and includes:', 'wp-multisite-waas'); ?></p>
<p><?php esc_html_e('This plugin comes with support for issues you may have. Support can be requested via email on <a class="wu-no-underline" href="mailto:support@wpultimo.com" target="_blank">support@wpultimo.com</a> and includes:', 'wp-multisite-waas'); ?></p>
<ul class="support-available">
<li class="wu-text-green-700">
<span class="dashicons-wu-check"></span>
<?php _e('Availability of the author to answer questions', 'wp-multisite-waas'); ?>
<?php esc_html_e('Availability of the author to answer questions', 'wp-multisite-waas'); ?>
</li>
<li class="wu-text-green-700">
<span class="dashicons-wu-check"></span>
<?php _e('Answering technical questions about item features', 'wp-multisite-waas'); ?>
<?php esc_html_e('Answering technical questions about item features', 'wp-multisite-waas'); ?>
</li>
<li class="wu-text-green-700">
<span class="dashicons-wu-check"></span>
<?php _e('Assistance with reported bugs and issues', 'wp-multisite-waas'); ?>
<?php esc_html_e('Assistance with reported bugs and issues', 'wp-multisite-waas'); ?>
</li>
</ul>
<p><?php _e('Support <strong>DOES NOT</strong> Include:', 'wp-multisite-waas'); ?></p>
<p><?php esc_html_e('Support <strong>DOES NOT</strong> Include:', 'wp-multisite-waas'); ?></p>
<ul class="support-unavailable">
<li class="wu-text-red-500">
<span class="dashicons-wu-circle-with-cross wu-align-middle"></span>
<?php _e('Customization services', 'wp-multisite-waas'); ?>
<?php esc_html_e('Customization services', 'wp-multisite-waas'); ?>
</li>
<li class="wu-text-red-500">
<span class="dashicons-wu-circle-with-cross wu-align-middle"></span>
<?php _e('Installation services', 'wp-multisite-waas'); ?>
<?php esc_html_e('Installation services', 'wp-multisite-waas'); ?>
</li>
<li class="wu-text-red-500">
<span class="dashicons-wu-circle-with-cross wu-align-middle"></span>
<?php _e('Support for 3rd party plugins (i.e. plugins you install yourself later on)', 'wp-multisite-waas'); ?>
<?php esc_html_e('Support for 3rd party plugins (i.e. plugins you install yourself later on)', 'wp-multisite-waas'); ?>
</li>
</ul>