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:
@ -12,7 +12,6 @@
|
||||
|
||||
namespace WP_Ultimo\Managers;
|
||||
|
||||
use WP_Ultimo\Managers\Base_Manager;
|
||||
use WP_Ultimo\Domain_Mapping\Helper;
|
||||
|
||||
// Exit if accessed directly
|
||||
@ -72,7 +71,7 @@ class Domain_Manager extends Base_Manager {
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $id The id of the integration. e.g. runcloud.
|
||||
* @return WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider
|
||||
* @return \WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider|false
|
||||
*/
|
||||
public function get_integration_instance($id) {
|
||||
|
||||
@ -255,8 +254,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'domain-mapping',
|
||||
'domain_mapping_header',
|
||||
[
|
||||
'title' => __('Domain Mapping Settings', 'wp-ultimo'),
|
||||
'desc' => __('Define the domain mapping settings for your network.', 'wp-ultimo'),
|
||||
'title' => __('Domain Mapping Settings', 'wp-multisite-waas'),
|
||||
'desc' => __('Define the domain mapping settings for your network.', 'wp-multisite-waas'),
|
||||
'type' => 'header',
|
||||
]
|
||||
);
|
||||
@ -265,8 +264,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'domain-mapping',
|
||||
'enable_domain_mapping',
|
||||
[
|
||||
'title' => __('Enable Domain Mapping?', 'wp-ultimo'),
|
||||
'desc' => __('Do you want to enable domain mapping?', 'wp-ultimo'),
|
||||
'title' => __('Enable Domain Mapping?', 'wp-multisite-waas'),
|
||||
'desc' => __('Do you want to enable domain mapping?', 'wp-multisite-waas'),
|
||||
'type' => 'toggle',
|
||||
'default' => 1,
|
||||
]
|
||||
@ -276,16 +275,16 @@ class Domain_Manager extends Base_Manager {
|
||||
'domain-mapping',
|
||||
'force_admin_redirect',
|
||||
[
|
||||
'title' => __('Force Admin Redirect', 'wp-ultimo'),
|
||||
'desc' => __('Select how you want your users to access the admin panel if they have mapped domains.', 'wp-ultimo') . '<br><br>' . __('Force Redirect to Mapped Domain: your users with mapped domains will be redirected to theirdomain.com/wp-admin, even if they access using yournetworkdomain.com/wp-admin.', 'wp-ultimo') . '<br><br>' . __('Force Redirect to Network Domain: your users with mapped domains will be redirect to yournetworkdomain.com/wp-admin, even if they access using theirdomain.com/wp-admin.', 'wp-ultimo'),
|
||||
'title' => __('Force Admin Redirect', 'wp-multisite-waas'),
|
||||
'desc' => __('Select how you want your users to access the admin panel if they have mapped domains.', 'wp-multisite-waas') . '<br><br>' . __('Force Redirect to Mapped Domain: your users with mapped domains will be redirected to theirdomain.com/wp-admin, even if they access using yournetworkdomain.com/wp-admin.', 'wp-multisite-waas') . '<br><br>' . __('Force Redirect to Network Domain: your users with mapped domains will be redirect to yournetworkdomain.com/wp-admin, even if they access using theirdomain.com/wp-admin.', 'wp-multisite-waas'),
|
||||
'tooltip' => '',
|
||||
'type' => 'select',
|
||||
'default' => 'both',
|
||||
'require' => ['enable_domain_mapping' => 1],
|
||||
'options' => [
|
||||
'both' => __('Allow access to the admin by both mapped domain and network domain', 'wp-ultimo'),
|
||||
'force_map' => __('Force Redirect to Mapped Domain', 'wp-ultimo'),
|
||||
'force_network' => __('Force Redirect to Network Domain', 'wp-ultimo'),
|
||||
'both' => __('Allow access to the admin by both mapped domain and network domain', 'wp-multisite-waas'),
|
||||
'force_map' => __('Force Redirect to Mapped Domain', 'wp-multisite-waas'),
|
||||
'force_network' => __('Force Redirect to Network Domain', 'wp-multisite-waas'),
|
||||
],
|
||||
]
|
||||
);
|
||||
@ -294,8 +293,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'domain-mapping',
|
||||
'custom_domains',
|
||||
[
|
||||
'title' => __('Enable Custom Domains?', 'wp-ultimo'),
|
||||
'desc' => __('Toggle this option if you wish to allow end-customers to add their own domains. This can be controlled on a plan per plan basis.', 'wp-ultimo'),
|
||||
'title' => __('Enable Custom Domains?', 'wp-multisite-waas'),
|
||||
'desc' => __('Toggle this option if you wish to allow end-customers to add their own domains. This can be controlled on a plan per plan basis.', 'wp-multisite-waas'),
|
||||
'type' => 'toggle',
|
||||
'default' => 1,
|
||||
'require' => [
|
||||
@ -308,9 +307,9 @@ class Domain_Manager extends Base_Manager {
|
||||
'domain-mapping',
|
||||
'domain_mapping_instructions',
|
||||
[
|
||||
'title' => __('Add New Domain Instructions', 'wp-ultimo'),
|
||||
'tooltip' => __('Display a customized message with instructions for the mapping and alerting the end-user of the risks of mapping a misconfigured domain.', 'wp-ultimo'),
|
||||
'desc' => __('You can use the placeholder <code>%NETWORK_DOMAIN%</code> and <code>%NETWORK_IP%</code>.', 'wp-ultimo'),
|
||||
'title' => __('Add New Domain Instructions', 'wp-multisite-waas'),
|
||||
'tooltip' => __('Display a customized message with instructions for the mapping and alerting the end-user of the risks of mapping a misconfigured domain.', 'wp-multisite-waas'),
|
||||
'desc' => __('You can use the placeholder <code>%NETWORK_DOMAIN%</code> and <code>%NETWORK_IP%</code>.', 'wp-multisite-waas'),
|
||||
'type' => 'textarea',
|
||||
'default' => [$this, 'default_domain_mapping_instructions'],
|
||||
'html_attr' => [
|
||||
@ -336,8 +335,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'sso',
|
||||
'sso_header',
|
||||
[
|
||||
'title' => __('Single Sign-On Settings', 'wp-ultimo'),
|
||||
'desc' => __('Settings to configure the Single Sign-On functionality of WP Multisite WaaS, responsible for keeping customers and admins logged in across all network domains.', 'wp-ultimo'),
|
||||
'title' => __('Single Sign-On Settings', 'wp-multisite-waas'),
|
||||
'desc' => __('Settings to configure the Single Sign-On functionality of WP Multisite WaaS, responsible for keeping customers and admins logged in across all network domains.', 'wp-multisite-waas'),
|
||||
'type' => 'header',
|
||||
]
|
||||
);
|
||||
@ -346,8 +345,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'sso',
|
||||
'enable_sso',
|
||||
[
|
||||
'title' => __('Enable Single Sign-On', 'wp-ultimo'),
|
||||
'desc' => __('Enables the Single Sign-on functionality.', 'wp-ultimo'),
|
||||
'title' => __('Enable Single Sign-On', 'wp-multisite-waas'),
|
||||
'desc' => __('Enables the Single Sign-on functionality.', 'wp-multisite-waas'),
|
||||
'type' => 'toggle',
|
||||
'default' => 1,
|
||||
]
|
||||
@ -357,8 +356,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'sso',
|
||||
'restrict_sso_to_login_pages',
|
||||
[
|
||||
'title' => __('Restrict SSO Checks to Login Pages', 'wp-ultimo'),
|
||||
'desc' => __('The Single Sign-on feature adds one extra ajax calls to every page load on sites with custom domains active to check if it should perform an auth loopback. You can restrict these extra calls to the login pages of sub-sites using this option. If enabled, SSO will only work on login pages.', 'wp-ultimo'),
|
||||
'title' => __('Restrict SSO Checks to Login Pages', 'wp-multisite-waas'),
|
||||
'desc' => __('The Single Sign-on feature adds one extra ajax calls to every page load on sites with custom domains active to check if it should perform an auth loopback. You can restrict these extra calls to the login pages of sub-sites using this option. If enabled, SSO will only work on login pages.', 'wp-multisite-waas'),
|
||||
'type' => 'toggle',
|
||||
'default' => 0,
|
||||
'require' => [
|
||||
@ -371,8 +370,8 @@ class Domain_Manager extends Base_Manager {
|
||||
'sso',
|
||||
'enable_sso_loading_overlay',
|
||||
[
|
||||
'title' => __('Enable SSO Loading Overlay', 'wp-ultimo'),
|
||||
'desc' => __('When active, a loading overlay will be added on-top of the site currently being viewed while the SSO auth loopback is performed on the background.', 'wp-ultimo'),
|
||||
'title' => __('Enable SSO Loading Overlay', 'wp-multisite-waas'),
|
||||
'desc' => __('When active, a loading overlay will be added on-top of the site currently being viewed while the SSO auth loopback is performed on the background.', 'wp-multisite-waas'),
|
||||
'type' => 'toggle',
|
||||
'default' => 1,
|
||||
'require' => [
|
||||
@ -391,11 +390,11 @@ class Domain_Manager extends Base_Manager {
|
||||
|
||||
$instructions = [];
|
||||
|
||||
$instructions[] = __("Cool! You're about to make this site accessible using your own domain name!", 'wp-ultimo');
|
||||
$instructions[] = __("Cool! You're about to make this site accessible using your own domain name!", 'wp-multisite-waas');
|
||||
|
||||
$instructions[] = __("For that to work, you'll need to create a new CNAME record pointing to <code>%NETWORK_DOMAIN%</code> on your DNS manager.", 'wp-ultimo');
|
||||
$instructions[] = __("For that to work, you'll need to create a new CNAME record pointing to <code>%NETWORK_DOMAIN%</code> on your DNS manager.", 'wp-multisite-waas');
|
||||
|
||||
$instructions[] = __('After you finish that step, come back to this screen and click the button below.', 'wp-ultimo');
|
||||
$instructions[] = __('After you finish that step, come back to this screen and click the button below.', 'wp-multisite-waas');
|
||||
|
||||
return implode(PHP_EOL . PHP_EOL, $instructions);
|
||||
}
|
||||
@ -480,7 +479,7 @@ class Domain_Manager extends Base_Manager {
|
||||
$domain_url = $domain->get_domain();
|
||||
|
||||
// translators: %s is the domain name
|
||||
wu_log_add("domain-{$domain_url}", sprintf(__('Starting Check for %s', 'wp-ultimo'), $domain_url));
|
||||
wu_log_add("domain-{$domain_url}", sprintf(__('Starting Check for %s', 'wp-multisite-waas'), $domain_url));
|
||||
|
||||
if ('checking-dns' === $stage) {
|
||||
if ($domain->has_correct_dns()) {
|
||||
@ -490,7 +489,7 @@ class Domain_Manager extends Base_Manager {
|
||||
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
__('- DNS propagation finished, advancing domain to next step...', 'wp-ultimo')
|
||||
__('- DNS propagation finished, advancing domain to next step...', 'wp-multisite-waas')
|
||||
);
|
||||
|
||||
wu_enqueue_async_action(
|
||||
@ -517,7 +516,7 @@ class Domain_Manager extends Base_Manager {
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
// translators: %d is the number of minutes to try again.
|
||||
sprintf(__('- DNS propagation checks tried for the max amount of times (5 times, one every %d minutes). Marking as failed.', 'wp-ultimo'), $try_again_time)
|
||||
sprintf(__('- DNS propagation checks tried for the max amount of times (5 times, one every %d minutes). Marking as failed.', 'wp-multisite-waas'), $try_again_time)
|
||||
);
|
||||
|
||||
return;
|
||||
@ -526,7 +525,7 @@ class Domain_Manager extends Base_Manager {
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
// translators: %d is the number of minutes before trying again.
|
||||
sprintf(__('- DNS propagation not finished, retrying in %d minutes...', 'wp-ultimo'), $try_again_time)
|
||||
sprintf(__('- DNS propagation not finished, retrying in %d minutes...', 'wp-multisite-waas'), $try_again_time)
|
||||
);
|
||||
|
||||
wu_schedule_single_action(
|
||||
@ -551,7 +550,7 @@ class Domain_Manager extends Base_Manager {
|
||||
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
__('- Valid SSL cert found. Marking domain as done.', 'wp-ultimo')
|
||||
__('- Valid SSL cert found. Marking domain as done.', 'wp-multisite-waas')
|
||||
);
|
||||
|
||||
return;
|
||||
@ -567,7 +566,7 @@ class Domain_Manager extends Base_Manager {
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
// translators: %d is the number of minutes to try again.
|
||||
sprintf(__('- SSL checks tried for the max amount of times (5 times, one every %d minutes). Marking as ready without SSL.', 'wp-ultimo'), $try_again_time)
|
||||
sprintf(__('- SSL checks tried for the max amount of times (5 times, one every %d minutes). Marking as ready without SSL.', 'wp-multisite-waas'), $try_again_time)
|
||||
);
|
||||
|
||||
return;
|
||||
@ -576,7 +575,7 @@ class Domain_Manager extends Base_Manager {
|
||||
wu_log_add(
|
||||
"domain-{$domain_url}",
|
||||
// translators: %d is the number of minutes before trying again.
|
||||
sprintf(__('- SSL Cert not found, retrying in %d minute(s)...', 'wp-ultimo'), $try_again_time)
|
||||
sprintf(__('- SSL Cert not found, retrying in %d minute(s)...', 'wp-multisite-waas'), $try_again_time)
|
||||
);
|
||||
|
||||
wu_schedule_single_action(
|
||||
@ -665,7 +664,7 @@ class Domain_Manager extends Base_Manager {
|
||||
$domain = wu_request('domain');
|
||||
|
||||
if ( ! $domain) {
|
||||
wp_send_json_error(new \WP_Error('domain-missing', __('A valid domain was not passed.', 'wp-ultimo')));
|
||||
wp_send_json_error(new \WP_Error('domain-missing', __('A valid domain was not passed.', 'wp-multisite-waas')));
|
||||
}
|
||||
|
||||
$auth_ns = [];
|
||||
@ -678,7 +677,7 @@ class Domain_Manager extends Base_Manager {
|
||||
wp_send_json_error(
|
||||
new \WP_Error(
|
||||
'error',
|
||||
__('Not able to fetch DNS entries.', 'wp-ultimo'),
|
||||
__('Not able to fetch DNS entries.', 'wp-multisite-waas'),
|
||||
[
|
||||
'exception' => $e->getMessage(),
|
||||
]
|
||||
@ -687,7 +686,7 @@ class Domain_Manager extends Base_Manager {
|
||||
}
|
||||
|
||||
if (false === $result) {
|
||||
wp_send_json_error(new \WP_Error('error', __('Not able to fetch DNS entries.', 'wp-ultimo')));
|
||||
wp_send_json_error(new \WP_Error('error', __('Not able to fetch DNS entries.', 'wp-multisite-waas')));
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
@ -738,7 +737,7 @@ class Domain_Manager extends Base_Manager {
|
||||
if ( ! $integration) {
|
||||
wp_send_json_error(
|
||||
[
|
||||
'message' => __('Invalid Integration ID', 'wp-ultimo'),
|
||||
'message' => __('Invalid Integration ID', 'wp-multisite-waas'),
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -750,14 +749,15 @@ class Domain_Manager extends Base_Manager {
|
||||
wp_send_json_error(
|
||||
[
|
||||
'message' => sprintf(
|
||||
__('The necessary constants were not found on your wp-config.php file: %s', 'wp-ultimo'),
|
||||
// translators: %s is the name of the missing constant
|
||||
__('The necessary constants were not found on your wp-config.php file: %s', 'wp-multisite-waas'),
|
||||
implode(', ', $integration->get_missing_constants())
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $integration->test_connection();
|
||||
$integration->test_connection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user