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

@ -7,37 +7,37 @@
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<div class="wu-widget-inset">
<?php
<?php
$data = [];
$slug = 'signup_countries';
$headers = [
__('Country', 'wp-multisite-waas'),
__('Customer Count', 'wp-multisite-waas'),
];
$data = [];
$slug = 'signup_countries';
$headers = [
__('Country', 'wp-multisite-waas'),
__('Customer Count', 'wp-multisite-waas'),
];
foreach ($countries as $country_code => $count) {
$line = [
wu_get_country_name($country_code),
$count,
];
foreach ($countries as $country_code => $count) {
$line = [
wu_get_country_name($country_code),
$count,
];
$data[] = $line;
}
$data[] = $line;
}
$page->render_csv_button(
[
'headers' => $headers,
'data' => $data,
'slug' => $slug,
]
);
$page->render_csv_button(
[
'headers' => $headers,
'data' => $data,
'slug' => $slug,
]
);
?>
?>
</div>
</div>
</div>
@ -45,68 +45,61 @@ $page->render_csv_button(
<div class="wu-advanced-filters wu--mx-3 wu--mb-3 wu-mt-3">
<table class="wp-list-table widefat fixed striped wu-border-t-0 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th><?php esc_html_e('Country', 'wp-multisite-waas'); ?></th>
<th class="wu-text-right"><?php esc_html_e('Customer Count', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($countries as $country_code => $count) : ?>
<table class="wp-list-table widefat fixed striped wu-border-t-0 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<td>
<th><?php esc_html_e('Country', 'wp-multisite-waas'); ?></th>
<th class="wu-text-right"><?php esc_html_e('Customer Count', 'wp-multisite-waas'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($countries as $country_code => $count) : ?>
<tr>
<td>
<?php
printf(
'<span class="wu-flag-icon wu-w-5 wu-mr-1" %s>%s</span>',
wu_tooltip_text(esc_html(wu_get_country_name($country_code))), // phpcs:ignore WordPress.Security.EscapeOutput
esc_html(wu_get_flag_emoji($country_code)),
);
?>
<?php echo esc_html(wu_get_country_name($country_code)); ?>
</td>
<td class="wu-text-right"><?php echo esc_html($count); ?></td>
</tr>
<?php
printf(
'<span class="wu-flag-icon wu-w-5 wu-mr-1" %s>%s</span>',
wu_tooltip_text(wu_get_country_name($country_code)), // phpcs:ignore WordPress.Security.EscapeOutput
esc_html(wu_get_flag_emoji($country_code)),
);
$state_list = wu_get_states_of_customers($country_code);
$_state_count = 0;
?>
<?php echo esc_html(wu_get_country_name($country_code)); ?>
</td>
<td class="wu-text-right"><?php echo esc_html($count); ?></td>
</tr>
<?php
<?php foreach ($state_list as $state => $state_count) : ?>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php echo esc_html($state); ?></td>
<td class="wu-text-right"><?php echo esc_html($state_count); ?></td>
</tr>
<?php endforeach; ?>
$state_list = wu_get_states_of_customers($country_code);
$_state_count = 0;
?>
<?php
foreach ($state_list as $state => $state_count) :
$_state_count += $state_count;
?>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php echo esc_html($state); ?></td>
<td class="wu-text-right"><?php echo esc_html($state_count); ?></td>
</tr>
<?php if ($state_list && $count - $_state_count >= 0) : ?>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php esc_html_e('Other', 'wp-multisite-waas'); ?></td>
<td class="wu-text-right"><?php echo esc_html($count - $_state_count); ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($state_list && $count - $_state_count >= 0) : ?>
</tbody>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php esc_html_e('Other', 'wp-multisite-waas'); ?></td>
<td class="wu-text-right"><?php echo esc_html($count - $_state_count); ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
</table>
</div>
@ -114,7 +107,7 @@ $page->render_csv_button(
<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mt-6">
<?php esc_html_e('No countries registered yet.', 'wp-multisite-waas'); ?>
<?php esc_html_e('No countries registered yet.', 'wp-multisite-waas'); ?>
</div>