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:
@ -130,16 +130,16 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
$fields = [
|
||||
'confirm' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Confirm Publication', 'wp-ultimo'),
|
||||
'desc' => __('This action can not be undone.', 'wp-ultimo'),
|
||||
'title' => __('Confirm Publication', 'wp-multisite-waas'),
|
||||
'desc' => __('This action can not be undone.', 'wp-multisite-waas'),
|
||||
'html_attr' => [
|
||||
'v-model' => 'confirmed',
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Publish', 'wp-ultimo'),
|
||||
'placeholder' => __('Publish', 'wp-ultimo'),
|
||||
'title' => __('Publish', 'wp-multisite-waas'),
|
||||
'placeholder' => __('Publish', 'wp-multisite-waas'),
|
||||
'value' => 'publish',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
@ -166,7 +166,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'true',
|
||||
'data-state' => json_encode(
|
||||
'data-state' => wp_json_encode(
|
||||
[
|
||||
'confirmed' => false,
|
||||
]
|
||||
@ -189,13 +189,13 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
$membership = wu_get_membership(wu_request('membership_id'));
|
||||
|
||||
if ( ! $membership) {
|
||||
wp_send_json_error(new \WP_Error('not-found', __('Pending site not found.', 'wp-ultimo')));
|
||||
wp_send_json_error(new \WP_Error('not-found', __('Pending site not found.', 'wp-multisite-waas')));
|
||||
}
|
||||
|
||||
$pending_site = $membership->get_pending_site();
|
||||
|
||||
if ( ! is_a($pending_site, '\\WP_Ultimo\\Models\\Site')) {
|
||||
wp_send_json_error(new \WP_Error('not-found', __('Pending site not found.', 'wp-ultimo')));
|
||||
wp_send_json_error(new \WP_Error('not-found', __('Pending site not found.', 'wp-multisite-waas')));
|
||||
}
|
||||
|
||||
$pending_site->set_type('customer_owned');
|
||||
@ -267,7 +267,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
if ($site->get_blog_id() === false) {
|
||||
$error = new \WP_Error('error', __('Something wrong happened.', 'wp-ultimo'));
|
||||
$error = new \WP_Error('error', __('Something wrong happened.', 'wp-multisite-waas'));
|
||||
|
||||
return wp_send_json_error($error);
|
||||
}
|
||||
@ -313,20 +313,20 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
if ($duplicate_id && $site) {
|
||||
|
||||
// translators: the %s is the site title.
|
||||
$title = sprintf(__('Copy of %s', 'wp-ultimo'), $site->get_title());
|
||||
// translators: the %s is the thing copied.
|
||||
$title = sprintf(__('Copy of %s', 'wp-multisite-waas'), $site->get_title());
|
||||
$path = sprintf('%s%s', trim($site->get_path(), '/'), 'copy');
|
||||
$type = $site->get_type();
|
||||
$template_id = $duplicate_id;
|
||||
$membership_id = $site->get_membership_id();
|
||||
}
|
||||
|
||||
$save_label = $duplicate_id ? __('Duplicate Site', 'wp-ultimo') : __('Add new Site', 'wp-ultimo');
|
||||
$save_label = $duplicate_id ? __('Duplicate Site', 'wp-multisite-waas') : __('Add new Site', 'wp-multisite-waas');
|
||||
|
||||
$options = [
|
||||
'sub-domain' => __('Subdomain', 'wp-ultimo'),
|
||||
'sub-directory' => __('Subdirectory', 'wp-ultimo'),
|
||||
'domain' => __('Domain', 'wp-ultimo'),
|
||||
'sub-domain' => __('Subdomain', 'wp-multisite-waas'),
|
||||
'sub-directory' => __('Subdirectory', 'wp-multisite-waas'),
|
||||
'domain' => __('Domain', 'wp-multisite-waas'),
|
||||
];
|
||||
|
||||
/*
|
||||
@ -351,19 +351,19 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Site Title', 'wp-ultimo'),
|
||||
'placeholder' => __('New Network Site', 'wp-ultimo'),
|
||||
'title' => __('Site Title', 'wp-multisite-waas'),
|
||||
'placeholder' => __('New Network Site', 'wp-multisite-waas'),
|
||||
'value' => $title,
|
||||
],
|
||||
'domain_group' => [
|
||||
'type' => 'group',
|
||||
// translators: the %s is the site preview url.
|
||||
'desc' => sprintf(__('The site URL will be: %s', 'wp-ultimo'), '<span class="wu-font-mono">{{ tab === "domain" ? domain : ( tab === "sub-directory" ? scheme + base_url + domain : scheme + domain + "." + base_url ) }}</span>'),
|
||||
'desc' => sprintf(__('The site URL will be: %s', 'wp-multisite-waas'), '<span class="wu-font-mono">{{ tab === "domain" ? domain : ( tab === "sub-directory" ? scheme + base_url + domain : scheme + domain + "." + base_url ) }}</span>'),
|
||||
'fields' => [
|
||||
'domain' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Site Domain/Path', 'wp-ultimo'),
|
||||
'tooltip' => __('Enter the complete domain for the site', 'wp-ultimo'),
|
||||
'title' => __('Site Domain/Path', 'wp-multisite-waas'),
|
||||
'tooltip' => __('Enter the complete domain for the site', 'wp-multisite-waas'),
|
||||
'wrapper_classes' => 'wu-w-full',
|
||||
'html_attr' => [
|
||||
'v-bind:placeholder' => 'tab === "domain" ? "mysite.com" : "mysite"',
|
||||
@ -375,13 +375,13 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Site Type', 'wp-ultimo'),
|
||||
'title' => __('Site Type', 'wp-multisite-waas'),
|
||||
'value' => $type,
|
||||
'placeholder' => '',
|
||||
'options' => [
|
||||
'default' => __('Regular WP Site', 'wp-ultimo'),
|
||||
'site_template' => __('Site Template', 'wp-ultimo'),
|
||||
'customer_owned' => __('Customer-Owned', 'wp-ultimo'),
|
||||
'default' => __('Regular WP Site', 'wp-multisite-waas'),
|
||||
'site_template' => __('Site Template', 'wp-multisite-waas'),
|
||||
'customer_owned' => __('Customer-Owned', 'wp-multisite-waas'),
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
@ -389,8 +389,8 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
],
|
||||
'membership_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Associated Membership', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Membership...', 'wp-ultimo'),
|
||||
'title' => __('Associated Membership', 'wp-multisite-waas'),
|
||||
'placeholder' => __('Search Membership...', 'wp-multisite-waas'),
|
||||
'value' => '',
|
||||
'tooltip' => '',
|
||||
'wrapper_html_attr' => [
|
||||
@ -406,21 +406,21 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
],
|
||||
'copy' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Copy Site', 'wp-ultimo'),
|
||||
'desc' => __('Select an existing site to use as a starting point.', 'wp-ultimo'),
|
||||
'title' => __('Copy Site', 'wp-multisite-waas'),
|
||||
'desc' => __('Select an existing site to use as a starting point.', 'wp-multisite-waas'),
|
||||
'html_attr' => [
|
||||
'v-model' => 'copy',
|
||||
],
|
||||
],
|
||||
'template_site' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Template Site', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Sites...', 'wp-ultimo'),
|
||||
'desc' => __('The site selected will be copied and used as a starting point.', 'wp-ultimo'),
|
||||
'title' => __('Template Site', 'wp-multisite-waas'),
|
||||
'placeholder' => __('Search Sites...', 'wp-multisite-waas'),
|
||||
'desc' => __('The site selected will be copied and used as a starting point.', 'wp-multisite-waas'),
|
||||
'value' => $template_id,
|
||||
'html_attr' => [
|
||||
'data-model' => 'site',
|
||||
'data-selected' => $site ? json_encode($site->to_search_results()) : '',
|
||||
'data-selected' => $site ? wp_json_encode($site->to_search_results()) : '',
|
||||
'data-value-field' => 'blog_id',
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
@ -432,8 +432,8 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
],
|
||||
'copy_media' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Copy Media on Duplication', 'wp-ultimo'),
|
||||
'desc' => __('Copy media files from the template site on duplication. Disabling this can lead to broken images on the new site.', 'wp-ultimo'),
|
||||
'title' => __('Copy Media on Duplication', 'wp-multisite-waas'),
|
||||
'desc' => __('Copy media files from the template site on duplication. Disabling this can lead to broken images on the new site.', 'wp-multisite-waas'),
|
||||
'value' => true,
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'copy',
|
||||
@ -503,8 +503,8 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
public function get_labels() {
|
||||
|
||||
return [
|
||||
'deleted_message' => __('Site removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Site', 'wp-ultimo'),
|
||||
'deleted_message' => __('Site removed successfully.', 'wp-multisite-waas'),
|
||||
'search_label' => __('Search Site', 'wp-multisite-waas'),
|
||||
];
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_title() {
|
||||
|
||||
return __('Sites', 'wp-ultimo');
|
||||
return __('Sites', 'wp-multisite-waas');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -527,7 +527,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_menu_title() {
|
||||
|
||||
return __('Sites', 'wp-ultimo');
|
||||
return __('Sites', 'wp-multisite-waas');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -538,7 +538,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_submenu_title() {
|
||||
|
||||
return __('Sites', 'wp-ultimo');
|
||||
return __('Sites', 'wp-multisite-waas');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user