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

@ -20,12 +20,12 @@
<span class="wu-font-bold wu-block wu-text-xs wu-uppercase wu-text-gray-700">
<?php echo $plugin_data['Name']; ?>
<?php echo esc_html($plugin_data['Name']); ?>
<?php if (is_plugin_active_for_network($plugin_path)) : ?>
<span class="wu-text-xs wu-normal-case wu-font-normal wu-ml-2 wu-text-green-600">
<?php _e('Network Active', 'wp-ultimo'); ?>
<?php esc_html_e('Network Active', 'wp-multisite-waas'); ?>
</span>
<?php endif; ?>
@ -34,7 +34,7 @@
<span class="wu-my-2 wu-block">
<?php echo strip_tags($plugin_data['Description']); ?>
<?php echo wp_strip_all_tags($plugin_data['Description']); ?>
</span>
@ -43,11 +43,11 @@
<div class="wu-block wu-mt-4">
<span class="wu-text-xs wu-text-gray-700 wu-my-1 wu-mr-4 wu-block">
<?php printf(__('Version %s', 'wp-ultimo'), $plugin_data['Version']); ?>
<?php printf(esc_html__('Version %s', 'wp-multisite-waas'), esc_html($plugin_data['Version'])); ?>
</span>
<span class="wu-text-xs wu-text-gray-700 wu-my-1 wu-mr-4 wu-block">
<?php printf(__('by %s', 'wp-ultimo'), wp_strip_all_tags($plugin_data['Author'])); ?>
<?php printf(esc_html__('by %s', 'wp-multisite-waas'), wp_strip_all_tags($plugin_data['Author'])); ?>
</span>
</div>
@ -58,27 +58,27 @@
<h3 class="wu-mb-1 wu-text-2xs wu-uppercase wu-text-gray-600">
<?php _e('Visibility', 'wp-ultimo'); ?>
<?php esc_html_e('Visibility', 'wp-multisite-waas'); ?>
</h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][visibility]" class="wu-w-full">
<option <?php selected('visible' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected('hidden' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
<option <?php selected('visible' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="visible"><?php esc_html_e('Visible', 'wp-multisite-waas'); ?></option>
<option <?php selected('hidden' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="hidden"><?php esc_html_e('Hidden', 'wp-multisite-waas'); ?></option>
</select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
<?php _e('Behavior', 'wp-ultimo'); ?>
<?php esc_html_e('Behavior', 'wp-multisite-waas'); ?>
</h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][behavior]" class="wu-w-full">
<option <?php selected('default' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="default"><?php _e('Default', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_active' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_inactive' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive"><?php _e('Force Inactivate', 'wp-ultimo'); ?></option>
<option <?php selected('force_active_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active_locked"><?php _e('Force Activate & Lock', 'wp-ultimo'); ?></option>
<option <?php selected('force_inactive_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
<option <?php selected('default' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="default"><?php esc_html_e('Default', 'wp-multisite-waas'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_active' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active"><?php esc_html_e('Force Activate', 'wp-multisite-waas'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_inactive' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive"><?php esc_html_e('Force Inactivate', 'wp-multisite-waas'); ?></option>
<option <?php selected('force_active_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active_locked"><?php esc_html_e('Force Activate & Lock', 'wp-multisite-waas'); ?></option>
<option <?php selected('force_inactive_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive_locked"><?php esc_html_e('Force Inactivate & Lock', 'wp-multisite-waas'); ?></option>
</select>
</div>
@ -90,7 +90,7 @@
<?php if ('product' !== $object->model && $object->get_limitations(false)->plugins->exists($plugin_path)) : ?>
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>
<?php esc_html_e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-multisite-waas'); ?>
</p>
<?php endif; ?>

View File

@ -30,19 +30,19 @@
<span class="wu-font-bold wu-block wu-text-xs wu-uppercase wu-text-gray-700">
<?php echo $site_template->get_title(); ?>
<?php echo esc_html($site_template->get_title()); ?>
</span>
<span class="wu-mt-2 wu-block">
<?php echo wp_trim_words(strip_tags($site_template->get_description()), 40); ?>
<?php echo esc_html(wp_trim_words(wp_strip_all_tags($site_template->get_description()), 40)); ?>
</span>
<span class="wu-mt-2 wu-block wu-text-xs">
<?php echo ! $site_template->get_categories() ? __('No categories', 'wp-ultimo') : implode(', ', $site_template->get_categories()); ?>
<?php echo ! $site_template->get_categories() ? esc_html__('No categories', 'wp-multisite-waas') : esc_html(implode(', ', $site_template->get_categories())); ?>
</span>
@ -52,7 +52,7 @@
<h3 class="wu-my-1 wu-text-2xs wu-uppercase wu-text-gray-600">
<?php _e('Behavior', 'wp-ultimo'); ?>
<?php esc_html_e('Behavior', 'wp-multisite-waas'); ?>
</h3>
@ -61,9 +61,9 @@
name="modules[site_templates][limit][<?php echo esc_attr($site_template->get_id()); ?>][behavior]"
class="wu-w-full"
>
<option <?php selected('available' === $template_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected('not_available' === $template_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected('pre_selected' === $template_settings->behavior); ?> value="pre_selected"><?php _e('Pre-Selected', 'wp-ultimo'); ?></option>
<option <?php selected('available' === $template_settings->behavior); ?> value="available"><?php esc_html_e('Available', 'wp-multisite-waas'); ?></option>
<option <?php selected('not_available' === $template_settings->behavior); ?> value="not_available"><?php esc_html_e('Not Available', 'wp-multisite-waas'); ?></option>
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected('pre_selected' === $template_settings->behavior); ?> value="pre_selected"><?php esc_html_e('Pre-Selected', 'wp-multisite-waas'); ?></option>
</select>
</div>

View File

@ -12,7 +12,7 @@
if ('force_active' === $theme_settings->behavior) {
$section['state']['force_active_theme'] = $theme_path;
} // end if;
}
?>
@ -28,13 +28,13 @@
<span class="wu-font-bold wu-block wu-text-xs wu-uppercase wu-text-gray-700">
<?php echo $theme_data['Name']; ?>
<?php echo esc_html($theme_data['Name']); ?>
</span>
<span class="wu-my-2 wu-block">
<?php echo wp_trim_words(strip_tags($theme_data['Description']), 40); ?>
<?php echo esc_html(wp_trim_words(wp_strip_all_tags($theme_data['Description']), 40)); ?>
</span>
@ -43,11 +43,11 @@
<div class="wu-block wu-mt-4">
<span class="wu-text-xs wu-text-gray-700 wu-my-1 wu-mr-4 wu-block">
<?php printf(__('Version %s', 'wp-ultimo'), $theme_data['Version']); ?>
<?php printf(esc_html__('Version %s', 'wp-multisite-waas'), esc_html($theme_data['Version'])); ?>
</span>
<span class="wu-text-xs wu-text-gray-700 wu-my-1 wu-mr-4 wu-block">
<?php printf(__('by %s', 'wp-ultimo'), $theme_data['Author']); ?>
<?php printf(esc_html__('by %s', 'wp-multisite-waas'), $theme_data['Author']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</span>
</div>
@ -59,26 +59,24 @@
<img class="wu-rounded wu-w-full wu-image-preview" src="<?php echo esc_url($theme_data->get_screenshot()); ?>" data-image="<?php echo esc_url($theme_data->get_screenshot()); ?>">
<h3 class="wu-mb-1 wu-text-2xs wu-uppercase wu-text-gray-600">
<?php _e('Visibility', 'wp-ultimo'); ?>
<?php esc_html_e('Visibility', 'wp-multisite-waas'); ?>
</h3>
<select name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][visibility]" class="wu-w-full">
<option <?php selected('visible' === $theme_settings->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected('hidden' === $theme_settings->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
<option <?php selected('visible' === $theme_settings->visibility); ?> value="visible"><?php esc_html_e('Visible', 'wp-multisite-waas'); ?></option>
<option <?php selected('hidden' === $theme_settings->visibility); ?> value="hidden"><?php esc_html_e('Hidden', 'wp-multisite-waas'); ?></option>
</select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
<?php _e('Behavior', 'wp-ultimo'); ?>
<?php esc_html_e('Behavior', 'wp-multisite-waas'); ?>
</h3>
<select v-on:change="force_active_theme = ($event.target.value === 'force_active' ? '<?php echo esc_attr($theme_path); ?>' : '')" name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][behavior]" class="wu-w-full">
<option <?php selected('available' === $theme_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected('not_available' === $theme_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected('force_active' === $theme_settings->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
<option <?php selected('available' === $theme_settings->behavior); ?> value="available"><?php esc_html_e('Available', 'wp-multisite-waas'); ?></option>
<option <?php selected('not_available' === $theme_settings->behavior); ?> value="not_available"><?php esc_html_e('Not Available', 'wp-multisite-waas'); ?></option>
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected('force_active' === $theme_settings->behavior); ?> value="force_active"><?php esc_html_e('Force Activate', 'wp-multisite-waas'); ?></option>
</select>
</div>
@ -88,7 +86,7 @@
<?php if ('product' !== $object->model && $object->get_limitations(false)->themes->exists($theme_path)) : ?>
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>
<?php esc_html_e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-multisite-waas'); ?>
</p>
<?php endif; ?>