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

@ -9,8 +9,6 @@
namespace WP_Ultimo\UI;
use WP_Ultimo\UI\Base_Element;
// Exit if accessed directly
defined('ABSPATH') || exit;
@ -46,6 +44,8 @@ class Site_Maintenance_Element extends Base_Element {
*/
protected $public = true;
private \WP_Ultimo\Models\Site $site;
/**
* Initializes the singleton.
*
@ -81,14 +81,14 @@ class Site_Maintenance_Element extends Base_Element {
*
* This is used on the Blocks list of Gutenberg.
* You should return a string with the localized title.
* e.g. return __('My Element', 'wp-ultimo').
* e.g. return __('My Element', 'wp-multisite-waas').
*
* @since 2.0.0
* @return string
*/
public function get_title() {
return __('Site Maintenance', 'wp-ultimo');
return __('Site Maintenance', 'wp-multisite-waas');
}
/**
@ -97,14 +97,14 @@ class Site_Maintenance_Element extends Base_Element {
* This is also used on the Gutenberg block list
* to explain what this block is about.
* You should return a string with the localized title.
* e.g. return __('Adds a checkout form to the page', 'wp-ultimo').
* e.g. return __('Adds a checkout form to the page', 'wp-multisite-waas').
*
* @since 2.0.0
* @return string
*/
public function get_description() {
return __('Adds the toggle control to turn maintenance mode on.', 'wp-ultimo');
return __('Adds the toggle control to turn maintenance mode on.', 'wp-multisite-waas');
}
/**
@ -129,23 +129,23 @@ class Site_Maintenance_Element extends Base_Element {
$fields = [];
$fields['header'] = [
'title' => __('General', 'wp-ultimo'),
'desc' => __('General', 'wp-ultimo'),
'title' => __('General', 'wp-multisite-waas'),
'desc' => __('General', 'wp-multisite-waas'),
'type' => 'header',
];
$fields['title'] = [
'type' => 'text',
'title' => __('Label', 'wp-ultimo'),
'value' => __('Toggle Maintenance Mode', 'wp-ultimo'),
'placeholder' => __('e.g. Toggle Maintenance Mode', 'wp-ultimo'),
'title' => __('Label', 'wp-multisite-waas'),
'value' => __('Toggle Maintenance Mode', 'wp-multisite-waas'),
'placeholder' => __('e.g. Toggle Maintenance Mode', 'wp-multisite-waas'),
'tooltip' => '',
];
$fields['desc'] = [
'type' => 'textarea',
'title' => __('Description', 'wp-ultimo'),
'value' => __('Put your site on maintenance mode. When activated, the front-end will only be accessible to logged users.', 'wp-ultimo'),
'title' => __('Description', 'wp-multisite-waas'),
'value' => __('Put your site on maintenance mode. When activated, the front-end will only be accessible to logged users.', 'wp-multisite-waas'),
'tooltip' => '',
];
@ -196,8 +196,8 @@ class Site_Maintenance_Element extends Base_Element {
public function defaults() {
return [
'title' => __('Toggle Maintenance Mode', 'wp-ultimo'),
'desc' => __('Put your site on maintenance mode. When activated, the front-end will only be accessible to logged users.', 'wp-ultimo'),
'title' => __('Toggle Maintenance Mode', 'wp-multisite-waas'),
'desc' => __('Put your site on maintenance mode. When activated, the front-end will only be accessible to logged users.', 'wp-multisite-waas'),
];
}
@ -209,12 +209,12 @@ class Site_Maintenance_Element extends Base_Element {
*/
public function setup(): void {
$this->site = WP_Ultimo()->currents->get_site();
$site = WP_Ultimo()->currents->get_site();
if ( ! $this->site || ! $this->site->is_customer_allowed()) {
if ( ! $site || ! $site->is_customer_allowed()) {
$this->set_display(false);
return;
} else {
$this->site = $site;
}
}
@ -237,7 +237,7 @@ class Site_Maintenance_Element extends Base_Element {
*/
public function register_scripts(): void {
wp_register_script('wu-site-maintenance', wu_get_asset('site-maintenance.js', 'js'), ['jquery', 'wu-functions'], wu_get_version());
wp_register_script('wu-site-maintenance', wu_get_asset('site-maintenance.js', 'js'), ['jquery', 'wu-functions'], wu_get_version(), true);
wp_localize_script(
'wu-site-maintenance',