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

@ -92,7 +92,8 @@ abstract class Base_Host_Provider {
/*
* Adds an admin notice telling the admin that they should probably enable this integration.
*/
return $this->alert_provider_detected();
$this->alert_provider_detected();
return;
}
/*
@ -106,7 +107,8 @@ abstract class Base_Host_Provider {
/*
* Adds an admin notice telling the admin that the provider is not correctly setup.
*/
return $this->alert_provider_not_setup();
$this->alert_provider_not_setup();
return;
}
/*
@ -200,7 +202,7 @@ abstract class Base_Host_Provider {
$slug = $this->get_id();
$html = $this->is_enabled() ? sprintf('<span class="wu-self-center wu-text-green-800 wu-mr-4"><span class="dashicons-wu-check"></span> %s</span>', __('Activated', 'wp-ultimo')) : '';
$html = $this->is_enabled() ? sprintf('<span class="wu-self-center wu-text-green-800 wu-mr-4"><span class="dashicons-wu-check"></span> %s</span>', __('Activated', 'wp-multisite-waas')) : '';
$url = wu_network_admin_url(
'wp-ultimo-hosting-integration-wizard',
@ -209,14 +211,14 @@ abstract class Base_Host_Provider {
]
);
$html .= sprintf('<a href="%s" class="button-primary">%s</a>', $url, __('Configuration', 'wp-ultimo'));
$html .= sprintf('<a href="%s" class="button-primary">%s</a>', $url, __('Configuration', 'wp-multisite-waas'));
// translators: %s is the name of a host provider (e.g. Cloudways, WPMUDev, Closte...).
$title = sprintf(__('%s Integration', 'wp-ultimo'), $this->get_title());
$title = sprintf(__('%s Integration', 'wp-multisite-waas'), $this->get_title());
$title .= sprintf(
"<span class='wu-normal-case wu-block wu-text-xs wu-font-normal wu-mt-1'>%s</span>",
__('Go to the setup wizard to setup this integration.', 'wp-ultimo')
__('Go to the setup wizard to setup this integration.', 'wp-multisite-waas')
);
wu_register_settings_field(
@ -243,14 +245,14 @@ abstract class Base_Host_Provider {
}
// translators: %1$s will be replaced with the integration title. E.g. RunCloud
$message = sprintf(__('It looks like you are using %1$s as your hosting provider, yet the %1$s integration module is not active. In order for the domain mapping integration to work with %1$s, you might want to activate that module.', 'wp-ultimo'), $this->get_title());
$message = sprintf(__('It looks like you are using %1$s as your hosting provider, yet the %1$s integration module is not active. In order for the domain mapping integration to work with %1$s, you might want to activate that module.', 'wp-multisite-waas'), $this->get_title());
$slug = $this->get_id();
$actions = [
'activate' => [
// translators: %s is the integration name.
'title' => sprintf(__('Activate %s', 'wp-ultimo'), $this->get_title()),
'title' => sprintf(__('Activate %s', 'wp-multisite-waas'), $this->get_title()),
'url' => wu_network_admin_url(
'wp-ultimo-hosting-integration-wizard',
[
@ -276,14 +278,14 @@ abstract class Base_Host_Provider {
}
// translators: %1$s will be replaced with the integration title. E.g. RunCloud.
$message = sprintf(__('It looks like you are using %1$s as your hosting provider, yet the %1$s integration module was not properly setup. In order for the domain mapping integration to work with %1$s, you need to configure that module.', 'wp-ultimo'), $this->get_title());
$message = sprintf(__('It looks like you are using %1$s as your hosting provider, yet the %1$s integration module was not properly setup. In order for the domain mapping integration to work with %1$s, you need to configure that module.', 'wp-multisite-waas'), $this->get_title());
$slug = $this->get_id();
$actions = [
'activate' => [
// translators: %s is the integration name
'title' => sprintf(__('Setup %s', 'wp-ultimo'), $this->get_title()),
'title' => sprintf(__('Setup %s', 'wp-multisite-waas'), $this->get_title()),
'url' => wu_network_admin_url(
'wp-ultimo-hosting-integration-wizard',
[
@ -301,7 +303,7 @@ abstract class Base_Host_Provider {
* Get Fields for the integration.
*
* @since 2.0.0
* @return string
* @return array
*/
public function get_fields() {
@ -560,7 +562,7 @@ abstract class Base_Host_Provider {
$explainer_lines = [
'will' => [
// translators: %s is the name of the integration e.g. RunCloud
'send_domains' => sprintf(__('Send API calls to %s servers with domain names added to this network', 'wp-ultimo'), $this->get_title()),
'send_domains' => sprintf(__('Send API calls to %s servers with domain names added to this network', 'wp-multisite-waas'), $this->get_title()),
],
'will_not' => [],
];
@ -568,11 +570,11 @@ abstract class Base_Host_Provider {
if ($this->supports('autossl')) {
// translators: %s is the name of the integration e.g. RunCloud
$explainer_lines['will'][] = sprintf(__('Fetch and install a SSL certificate on %s platform after the domain is added.', 'wp-ultimo'), $this->get_title());
$explainer_lines['will'][] = sprintf(__('Fetch and install a SSL certificate on %s platform after the domain is added.', 'wp-multisite-waas'), $this->get_title());
} else {
// translators: %s is the name of the integration e.g. RunCloud
$explainer_lines['will_not'][] = sprintf(__('Fetch and install a SSL certificate on %s platform after the domain is added. This needs to be done manually.', 'wp-ultimo'), $this->get_title());
$explainer_lines['will_not'][] = sprintf(__('Fetch and install a SSL certificate on %s platform after the domain is added. This needs to be done manually.', 'wp-multisite-waas'), $this->get_title());
}
return $explainer_lines;
@ -643,7 +645,7 @@ abstract class Base_Host_Provider {
*/
public function get_description() {
return __('No description provided.', 'wp-ultimo');
return __('No description provided.', 'wp-multisite-waas');
}
/**

View File

@ -162,7 +162,7 @@ class Closte_Host_Provider extends Base_Host_Provider {
);
}
$error = new \WP_Error('not-auth', __('Something went wrong', 'wp-ultimo'));
$error = new \WP_Error('not-auth', __('Something went wrong', 'wp-multisite-waas'));
wp_send_json_error($error);
}
@ -224,7 +224,7 @@ class Closte_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('Closte is not just another web hosting who advertise their services as a cloud hosting while still provides fixed plans like in 1995.', 'wp-ultimo');
return __('Closte is not just another web hosting who advertise their services as a cloud hosting while still provides fixed plans like in 1995.', 'wp-multisite-waas');
}
/**

View File

@ -116,9 +116,9 @@ class Cloudflare_Host_Provider extends Base_Host_Provider {
);
if ( ! empty($dns_entries->result)) {
$proxied_tag = sprintf('<span class="wu-bg-orange-500 wu-text-white wu-p-1 wu-rounded wu-text-3xs wu-uppercase wu-ml-2 wu-font-bold" %s>%s</span>', wu_tooltip_text(__('Proxied', 'wp-ultimo')), __('Cloudflare', 'wp-ultimo'));
$proxied_tag = sprintf('<span class="wu-bg-orange-500 wu-text-white wu-p-1 wu-rounded wu-text-3xs wu-uppercase wu-ml-2 wu-font-bold" %s>%s</span>', wu_tooltip_text(__('Proxied', 'wp-multisite-waas')), __('Cloudflare', 'wp-multisite-waas'));
$not_proxied_tag = sprintf('<span class="wu-bg-gray-700 wu-text-white wu-p-1 wu-rounded wu-text-3xs wu-uppercase wu-ml-2 wu-font-bold" %s>%s</span>', wu_tooltip_text(__('Not Proxied', 'wp-ultimo')), __('Cloudflare', 'wp-ultimo'));
$not_proxied_tag = sprintf('<span class="wu-bg-gray-700 wu-text-white wu-p-1 wu-rounded wu-text-3xs wu-uppercase wu-ml-2 wu-font-bold" %s>%s</span>', wu_tooltip_text(__('Not Proxied', 'wp-multisite-waas')), __('Cloudflare', 'wp-multisite-waas'));
foreach ($dns_entries->result as $entry) {
$dns_records[] = [
@ -163,12 +163,12 @@ class Cloudflare_Host_Provider extends Base_Host_Provider {
return [
'WU_CLOUDFLARE_ZONE_ID' => [
'title' => __('Zone ID', 'wp-ultimo'),
'placeholder' => __('e.g. 644c7705723d62e31f700bb798219c75', 'wp-ultimo'),
'title' => __('Zone ID', 'wp-multisite-waas'),
'placeholder' => __('e.g. 644c7705723d62e31f700bb798219c75', 'wp-multisite-waas'),
],
'WU_CLOUDFLARE_API_KEY' => [
'title' => __('API Key', 'wp-ultimo'),
'placeholder' => __('e.g. xKGbxxVDpdcUv9dUzRf4i4ngv0QNf1wCtbehiec_o', 'wp-ultimo'),
'title' => __('API Key', 'wp-multisite-waas'),
'placeholder' => __('e.g. xKGbxxVDpdcUv9dUzRf4i4ngv0QNf1wCtbehiec_o', 'wp-multisite-waas'),
],
];
}
@ -423,7 +423,7 @@ class Cloudflare_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('Cloudflare secures and ensures the reliability of your external-facing resources such as websites, APIs, and applications. It protects your internal resources such as behind-the-firewall applications, teams, and devices. And it is your platform for developing globally-scalable applications.', 'wp-ultimo');
return __('Cloudflare secures and ensures the reliability of your external-facing resources such as websites, APIs, and applications. It protects your internal resources such as behind-the-firewall applications, teams, and devices. And it is your platform for developing globally-scalable applications.', 'wp-multisite-waas');
}
/**
@ -451,12 +451,12 @@ class Cloudflare_Host_Provider extends Base_Host_Provider {
];
if (is_subdomain_install()) {
$explainer_lines['will']['send_sub_domains'] = __('Add a new proxied subdomain to the configured CloudFlare zone whenever a new site gets created', 'wp-ultimo');
$explainer_lines['will']['send_sub_domains'] = __('Add a new proxied subdomain to the configured CloudFlare zone whenever a new site gets created', 'wp-multisite-waas');
} else {
$explainer_lines['will']['subdirectory'] = __('Do nothing! The CloudFlare integration has no effect in subdirectory multisite installs such as this one', 'wp-ultimo');
$explainer_lines['will']['subdirectory'] = __('Do nothing! The CloudFlare integration has no effect in subdirectory multisite installs such as this one', 'wp-multisite-waas');
}
$explainer_lines['will_not']['send_domain'] = __('Add domain mappings as new CloudFlare zones', 'wp-ultimo');
$explainer_lines['will_not']['send_domain'] = __('Add domain mappings as new CloudFlare zones', 'wp-multisite-waas');
return $explainer_lines;
}

View File

@ -11,10 +11,6 @@ namespace WP_Ultimo\Integrations\Host_Providers;
use Psr\Log\LogLevel;
use WP_Ultimo\Domain_Mapping\Helper;
use WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* This base class should be extended to implement new host integrations for SSL and domains.
@ -120,7 +116,7 @@ class Cloudways_Host_Provider extends Base_Host_Provider {
if (is_wp_error($ssl_response)) {
wu_log_add('integration-cloudways', '[SSL]' . $ssl_response->get_error_message(), LogLevel::ERROR);
} else {
wu_log_add('integration-cloudways', '[SSL]' . print_r($ssl_response, true));
wu_log_add('integration-cloudways', '[SSL]' . print_r($ssl_response, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
}
}
@ -146,30 +142,30 @@ class Cloudways_Host_Provider extends Base_Host_Provider {
return [
'WU_CLOUDWAYS_EMAIL' => [
'title' => __('Cloudways Account Email', 'wp-ultimo'),
'desc' => __('Your Cloudways account email address.', 'wp-ultimo'),
'placeholder' => __('e.g. me@gmail.com', 'wp-ultimo'),
'title' => __('Cloudways Account Email', 'wp-multisite-waas'),
'desc' => __('Your Cloudways account email address.', 'wp-multisite-waas'),
'placeholder' => __('e.g. me@gmail.com', 'wp-multisite-waas'),
],
'WU_CLOUDWAYS_API_KEY' => [
'title' => __('Cloudways API Key', 'wp-ultimo'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. eYP0Jo3Fzzm5SOZCi5nLR0Mki2lbYZ', 'wp-ultimo'),
'title' => __('Cloudways API Key', 'wp-multisite-waas'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. eYP0Jo3Fzzm5SOZCi5nLR0Mki2lbYZ', 'wp-multisite-waas'),
],
'WU_CLOUDWAYS_SERVER_ID' => [
'title' => __('Cloudways Server ID', 'wp-ultimo'),
'desc' => __('The Server ID retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. 11667', 'wp-ultimo'),
'title' => __('Cloudways Server ID', 'wp-multisite-waas'),
'desc' => __('The Server ID retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. 11667', 'wp-multisite-waas'),
],
'WU_CLOUDWAYS_APP_ID' => [
'title' => __('Cloudways App ID', 'wp-ultimo'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. 940288', 'wp-ultimo'),
'title' => __('Cloudways App ID', 'wp-multisite-waas'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. 940288', 'wp-multisite-waas'),
],
'WU_CLOUDWAYS_EXTRA_DOMAINS' => [
'title' => __('Cloudways Extra Domains', 'wp-ultimo'),
'tooltip' => __('The Cloudways API is a bit strange in that it doesnt offer a way to add or remove just one domain, only a way to update the whole domain list. That means that WP Multisite WaaS will replace all domains you might have there with the list of mapped domains of the network every time a new domain is added.', 'wp-ultimo'),
'desc' => __('Comma-separated list of additional domains to add to Cloudways.', 'wp-ultimo'),
'placeholder' => __('e.g. *.test.com, test.com', 'wp-ultimo'),
'title' => __('Cloudways Extra Domains', 'wp-multisite-waas'),
'tooltip' => __('The Cloudways API is a bit strange in that it doesnt offer a way to add or remove just one domain, only a way to update the whole domain list. That means that WP Multisite WaaS will replace all domains you might have there with the list of mapped domains of the network every time a new domain is added.', 'wp-multisite-waas'),
'desc' => __('Comma-separated list of additional domains to add to Cloudways.', 'wp-multisite-waas'),
'placeholder' => __('e.g. *.test.com, test.com', 'wp-multisite-waas'),
],
];
}
@ -246,7 +242,7 @@ class Cloudways_Host_Provider extends Base_Host_Provider {
if (is_wp_error($alias_response)) {
wu_log_add('integration-cloudways', '[Alias]' . $alias_response->get_error_message(), LogLevel::ERROR);
} else {
wu_log_add('integration-cloudways', '[Alias]' . print_r($alias_response, true));
wu_log_add('integration-cloudways', '[Alias]' . print_r($alias_response, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
}
}
@ -530,7 +526,7 @@ class Cloudways_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('Focus on your business and avoid all the web hosting hassles. Our managed hosting guarantees unmatched performance, reliability and choice with 24/7 support that acts as your extended team, making Cloudways an ultimate choice for growing agencies and e-commerce businesses.', 'wp-ultimo');
return __('Focus on your business and avoid all the web hosting hassles. Our managed hosting guarantees unmatched performance, reliability and choice with 24/7 support that acts as your extended team, making Cloudways an ultimate choice for growing agencies and e-commerce businesses.', 'wp-multisite-waas');
}
/**

View File

@ -10,7 +10,6 @@
namespace WP_Ultimo\Integrations\Host_Providers;
use Psr\Log\LogLevel;
use WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider;
use WP_Ultimo\Integrations\Host_Providers\CPanel_API\CPanel_API;
// Exit if accessed directly
@ -85,7 +84,7 @@ class CPanel_Host_Provider extends Base_Host_Provider {
* Holds the API object.
*
* @since 2.0.0
* @var WP_Ultimo\Integrations\Host_Providers\CPanel_API\CPanel_API
* @var \WP_Ultimo\Integrations\Host_Providers\CPanel_API\CPanel_API
*/
protected $api = null;
@ -112,26 +111,26 @@ class CPanel_Host_Provider extends Base_Host_Provider {
return [
'WU_CPANEL_USERNAME' => [
'title' => __('cPanel Username', 'wp-ultimo'),
'placeholder' => __('e.g. username', 'wp-ultimo'),
'title' => __('cPanel Username', 'wp-multisite-waas'),
'placeholder' => __('e.g. username', 'wp-multisite-waas'),
],
'WU_CPANEL_PASSWORD' => [
'type' => 'password',
'title' => __('cPanel Password', 'wp-ultimo'),
'placeholder' => __('password', 'wp-ultimo'),
'title' => __('cPanel Password', 'wp-multisite-waas'),
'placeholder' => __('password', 'wp-multisite-waas'),
],
'WU_CPANEL_HOST' => [
'title' => __('cPanel Host', 'wp-ultimo'),
'placeholder' => __('e.g. yourdomain.com', 'wp-ultimo'),
'title' => __('cPanel Host', 'wp-multisite-waas'),
'placeholder' => __('e.g. yourdomain.com', 'wp-multisite-waas'),
],
'WU_CPANEL_PORT' => [
'title' => __('cPanel Port', 'wp-ultimo'),
'placeholder' => __('Defaults to 2083', 'wp-ultimo'),
'title' => __('cPanel Port', 'wp-multisite-waas'),
'placeholder' => __('Defaults to 2083', 'wp-multisite-waas'),
'value' => 2083,
],
'WU_CPANEL_ROOT_DIR' => [
'title' => __('Root Directory', 'wp-ultimo'),
'placeholder' => __('Defaults to /public_html', 'wp-ultimo'),
'title' => __('Root Directory', 'wp-multisite-waas'),
'placeholder' => __('Defaults to /public_html', 'wp-multisite-waas'),
'value' => '/public_html',
],
];
@ -237,7 +236,7 @@ class CPanel_Host_Provider extends Base_Host_Provider {
* Load the CPanel API.
*
* @since 2.0.0
* @return WU_CPanel
* @return CPanel_API
*/
public function load_api() {
@ -293,17 +292,19 @@ class CPanel_Host_Provider extends Base_Host_Provider {
*
* @since 1.6.2
* @param object $results Results of the cPanel call.
* @return bool
* @return void
*/
public function log_calls($results) {
if (is_object($results->cpanelresult->data)) {
return wu_log_add('integration-cpanel', $results->cpanelresult->data->reason);
wu_log_add('integration-cpanel', $results->cpanelresult->data->reason);
return;
} elseif ( ! isset($results->cpanelresult->data[0])) {
return wu_log_add('integration-cpanel', __('Unexpected error ocurred trying to sync domains with CPanel', 'wp-ultimo'), LogLevel::ERROR);
wu_log_add('integration-cpanel', __('Unexpected error ocurred trying to sync domains with CPanel', 'wp-multisite-waas'), LogLevel::ERROR);
return;
}
return wu_log_add('integration-cpanel', $results->cpanelresult->data[0]->reason);
wu_log_add('integration-cpanel', $results->cpanelresult->data[0]->reason);
}
/**
@ -314,7 +315,7 @@ class CPanel_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('cPanel is the management panel being used on a large number of shared and dedicated hosts across the globe.', 'wp-ultimo');
return __('cPanel is the management panel being used on a large number of shared and dedicated hosts across the globe.', 'wp-multisite-waas');
}
/**
@ -359,13 +360,13 @@ class CPanel_Host_Provider extends Base_Host_Provider {
$explainer_lines = [
'will' => [
'send_domains' => __('Add a new Addon Domain on cPanel whenever a new domain mapping gets created on your network', 'wp-ultimo'),
'send_domains' => __('Add a new Addon Domain on cPanel whenever a new domain mapping gets created on your network', 'wp-multisite-waas'),
],
'will_not' => [],
];
if (is_subdomain_install()) {
$explainer_lines['will']['send_sub_domains'] = __('Add a new SubDomain on cPanel whenever a new site gets created on your network', 'wp-ultimo');
$explainer_lines['will']['send_sub_domains'] = __('Add a new SubDomain on cPanel whenever a new site gets created on your network', 'wp-multisite-waas');
}
return $explainer_lines;

View File

@ -208,7 +208,7 @@ class Gridpane_Host_Provider extends Base_Host_Provider {
if (wu_get_isset($results, 'message') === 'This action is unauthorized.') {
wp_send_json_error(
[
'error' => __('We were not able to successfully establish a connection.', 'wp-ultimo'),
'error' => __('We were not able to successfully establish a connection.', 'wp-multisite-waas'),
]
);
}
@ -216,14 +216,14 @@ class Gridpane_Host_Provider extends Base_Host_Provider {
if (is_wp_error($results)) {
wp_send_json_error(
[
'error' => __('We were not able to successfully establish a connection.', 'wp-ultimo'),
'error' => __('We were not able to successfully establish a connection.', 'wp-multisite-waas'),
]
);
}
wp_send_json_success(
[
'success' => __('Connection successfully established.', 'wp-ultimo'),
'success' => __('Connection successfully established.', 'wp-multisite-waas'),
]
);
}
@ -247,7 +247,7 @@ class Gridpane_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __("GridPane is the world's first hosting control panel built exclusively for serious WordPress professionals.", 'wp-ultimo');
return __("GridPane is the world's first hosting control panel built exclusively for serious WordPress professionals.", 'wp-multisite-waas');
}
/**

View File

@ -10,7 +10,6 @@
namespace WP_Ultimo\Integrations\Host_Providers;
use Psr\Log\LogLevel;
use WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider;
// Exit if accessed directly
defined('ABSPATH') || exit;
@ -91,24 +90,24 @@ class Runcloud_Host_Provider extends Base_Host_Provider {
return [
'WU_RUNCLOUD_API_KEY' => [
'title' => __('RunCloud API Key', 'wp-ultimo'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. Sx9tHAn5XMrkeyZKS1a7uj8dGTLgKnlEOaJEFRt1m95L', 'wp-ultimo'),
'title' => __('RunCloud API Key', 'wp-multisite-waas'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. Sx9tHAn5XMrkeyZKS1a7uj8dGTLgKnlEOaJEFRt1m95L', 'wp-multisite-waas'),
],
'WU_RUNCLOUD_API_SECRET' => [
'title' => __('RunCloud API Secret', 'wp-ultimo'),
'desc' => __('The API secret retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. ZlAebXp2sa6J5xsrPoiPcMXZRIVsHJ2rEkNCNGknZnF0UK5cSNSePS8GBW9FXIQd', 'wp-ultimo'),
'title' => __('RunCloud API Secret', 'wp-multisite-waas'),
'desc' => __('The API secret retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. ZlAebXp2sa6J5xsrPoiPcMXZRIVsHJ2rEkNCNGknZnF0UK5cSNSePS8GBW9FXIQd', 'wp-multisite-waas'),
],
'WU_RUNCLOUD_SERVER_ID' => [
'title' => __('RunCloud Server ID', 'wp-ultimo'),
'desc' => __('The Server ID retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. 11667', 'wp-ultimo'),
'title' => __('RunCloud Server ID', 'wp-multisite-waas'),
'desc' => __('The Server ID retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. 11667', 'wp-multisite-waas'),
],
'WU_RUNCLOUD_APP_ID' => [
'title' => __('RunCloud App ID', 'wp-ultimo'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. 940288', 'wp-ultimo'),
'title' => __('RunCloud App ID', 'wp-multisite-waas'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. 940288', 'wp-multisite-waas'),
],
];
}
@ -168,7 +167,7 @@ class Runcloud_Host_Provider extends Base_Host_Provider {
$domain_id = $this->get_runcloud_domain_id($domain);
if ( ! $domain_id) {
wu_log_add('integration-runcloud', __('Domain name not found on runcloud', 'wp-ultimo'));
wu_log_add('integration-runcloud', __('Domain name not found on runcloud', 'wp-multisite-waas'));
}
$response = $this->send_runcloud_request($this->get_runcloud_base_url("domains/$domain_id"), [], 'DELETE');
@ -260,7 +259,7 @@ class Runcloud_Host_Provider extends Base_Host_Provider {
'body' => $data,
'method' => $method,
'headers' => [
'Authorization' => 'Basic ' . base64_encode($username . ':' . $password),
'Authorization' => 'Basic ' . base64_encode($username . ':' . $password), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
],
]
);
@ -325,7 +324,7 @@ class Runcloud_Host_Provider extends Base_Host_Provider {
} else {
$data = $this->maybe_return_runcloud_body($response);
wu_log_add('integration-runcloud', json_encode($data));
wu_log_add('integration-runcloud', wp_json_encode($data));
if (property_exists($data, 'id')) {
$ssl_id = $data->id;
@ -372,7 +371,7 @@ class Runcloud_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('With RunCloud, you dont need to be a Linux expert to build a website powered by DigitalOcean, AWS, or Google Cloud. Use our graphical interface and build a business on the cloud affordably.', 'wp-ultimo');
return __('With RunCloud, you dont need to be a Linux expert to build a website powered by DigitalOcean, AWS, or Google Cloud. Use our graphical interface and build a business on the cloud affordably.', 'wp-multisite-waas');
}
/**

View File

@ -10,10 +10,6 @@
namespace WP_Ultimo\Integrations\Host_Providers;
use Psr\Log\LogLevel;
use WP_Ultimo\Integrations\Host_Providers\Base_Host_Provider;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* This base class should be extended to implement new host integrations for SSL and domains.
@ -91,19 +87,19 @@ class ServerPilot_Host_Provider extends Base_Host_Provider {
return [
'WU_SERVER_PILOT_CLIENT_ID' => [
'title' => __('ServerPilot Client ID', 'wp-ultimo'),
'desc' => __('Your ServerPilot Client ID.', 'wp-ultimo'),
'placeholder' => __('e.g. cid_lSmjevkdoSOpasYVqm', 'wp-ultimo'),
'title' => __('ServerPilot Client ID', 'wp-multisite-waas'),
'desc' => __('Your ServerPilot Client ID.', 'wp-multisite-waas'),
'placeholder' => __('e.g. cid_lSmjevkdoSOpasYVqm', 'wp-multisite-waas'),
],
'WU_SERVER_PILOT_API_KEY' => [
'title' => __('ServerPilot API Key', 'wp-ultimo'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. eYP0Jo3Fzzm5SOZCi5nLR0Mki2lbYZ', 'wp-ultimo'),
'title' => __('ServerPilot API Key', 'wp-multisite-waas'),
'desc' => __('The API Key retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. eYP0Jo3Fzzm5SOZCi5nLR0Mki2lbYZ', 'wp-multisite-waas'),
],
'WU_SERVER_PILOT_APP_ID' => [
'title' => __('ServerPilot App ID', 'wp-ultimo'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-ultimo'),
'placeholder' => __('e.g. 940288', 'wp-ultimo'),
'title' => __('ServerPilot App ID', 'wp-multisite-waas'),
'desc' => __('The App ID retrieved in the previous step.', 'wp-multisite-waas'),
'placeholder' => __('e.g. 940288', 'wp-multisite-waas'),
],
];
}
@ -219,9 +215,9 @@ class ServerPilot_Host_Provider extends Base_Host_Provider {
'timeout' => 45,
'blocking' => true,
'method' => $method,
'body' => $data ? json_encode($data) : [],
'body' => $data ? wp_json_encode($data) : [],
'headers' => [
'Authorization' => 'Basic ' . base64_encode(WU_SERVER_PILOT_CLIENT_ID . ':' . WU_SERVER_PILOT_API_KEY),
'Authorization' => 'Basic ' . base64_encode(WU_SERVER_PILOT_CLIENT_ID . ':' . WU_SERVER_PILOT_API_KEY), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
'Content-Type' => 'application/json',
],
];
@ -243,7 +239,7 @@ class ServerPilot_Host_Provider extends Base_Host_Provider {
* Makes sure ServerPilot autoSSL is always on, when possible.
*
* @since 1.7.4
* @return bool
* @return object
*/
public function turn_server_pilot_auto_ssl_on() {
@ -273,8 +269,8 @@ class ServerPilot_Host_Provider extends Base_Host_Provider {
* Log response so we can see what went wrong
*/
// translators: %s is the json_encode of the error.
wu_log_add('integration-serverpilot', sprintf(__('An error occurred while trying to get the current list of domains: %s', 'wp-ultimo'), json_encode($app_info)), LogLevel::ERROR);
// translators: %s is the wp_json_encode of the error.
wu_log_add('integration-serverpilot', sprintf(__('An error occurred while trying to get the current list of domains: %s', 'wp-multisite-waas'), wp_json_encode($app_info)), LogLevel::ERROR);
return false;
}
@ -315,7 +311,7 @@ class ServerPilot_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('ServerPilot is a cloud service for hosting WordPress and other PHP websites on servers at DigitalOcean, Amazon, Google, or any other server provider. You can think of ServerPilot as a modern, centralized hosting control panel.', 'wp-ultimo');
return __('ServerPilot is a cloud service for hosting WordPress and other PHP websites on servers at DigitalOcean, Amazon, Google, or any other server provider. You can think of ServerPilot as a modern, centralized hosting control panel.', 'wp-multisite-waas');
}
/**

View File

@ -172,9 +172,9 @@ class WPEngine_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'wp-ultimo');
$description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'wp-multisite-waas');
$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'wp-ultimo') . '</b>';
$description .= '<br><br><b>' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'wp-multisite-waas') . '</b>';
return $description;
}

View File

@ -157,7 +157,7 @@ class WPMUDEV_Host_Provider extends Base_Host_Provider {
if (is_wp_error($response)) {
// translators: The %s placeholder will be replaced with the domain name.
wu_log_add('integration-wpmudev', sprintf(__('An error occurred while trying to add the custom domain %s to WPMU Dev hosting.', 'wp-ultimo'), $_domain), LogLevel::ERROR);
wu_log_add('integration-wpmudev', sprintf(__('An error occurred while trying to add the custom domain %s to WPMU Dev hosting.', 'wp-multisite-waas'), $_domain), LogLevel::ERROR);
}
$body = json_decode(wp_remote_retrieve_body($response));
@ -165,11 +165,11 @@ class WPMUDEV_Host_Provider extends Base_Host_Provider {
if ($body->message) {
// translators: The %1$s will be replaced with the domain name and %2$s is the error message.
wu_log_add('integration-wpmudev', sprintf(__('An error occurred while trying to add the custom domain %1$s to WPMU Dev hosting: %2$s', 'wp-ultimo'), $_domain, $body->message->message), LogLevel::ERROR);
wu_log_add('integration-wpmudev', sprintf(__('An error occurred while trying to add the custom domain %1$s to WPMU Dev hosting: %2$s', 'wp-multisite-waas'), $_domain, $body->message->message), LogLevel::ERROR);
} else {
// translators: The %s placeholder will be replaced with the domain name.
wu_log_add('integration-wpmudev', sprintf(__('Domain %s added to WPMU Dev hosting successfully.', 'wp-ultimo'), $_domain));
wu_log_add('integration-wpmudev', sprintf(__('Domain %s added to WPMU Dev hosting successfully.', 'wp-multisite-waas'), $_domain));
}
}
}
@ -253,7 +253,7 @@ class WPMUDEV_Host_Provider extends Base_Host_Provider {
*/
public function get_description() {
return __('WPMU DEV is one of the largest companies in the WordPress space. Founded in 2004, it was one of the first companies to scale the Website as a Service model with products such as Edublogs and CampusPress.', 'wp-ultimo');
return __('WPMU DEV is one of the largest companies in the WordPress space. Founded in 2004, it was one of the first companies to scale the Website as a Service model with products such as Edublogs and CampusPress.', 'wp-multisite-waas');
}
/**

View File

@ -128,11 +128,10 @@ class CPanel_API {
*
* @since 1.6.2
* @param string $message Message to be logged.
* @return boolean
*/
public function log($message) {
return wu_log_add('integration-cpanel', $message);
wu_log_add('integration-cpanel', $message);
}
/**
@ -152,15 +151,15 @@ class CPanel_API {
if ( ! file_exists($this->cookie_file)) {
try {
fopen($this->cookie_file, 'w');
} catch (Exception $ex) {
} catch (\Exception $ex) {
if ( ! file_exists($this->cookie_file)) {
$this->log($ex . __('Cookie file missing.', 'wp-ultimo'));
$this->log($ex . __('Cookie file missing.', 'wp-multisite-waas'));
return false;
}
}
} elseif ( ! is_writable($this->cookie_file)) {
$this->log(__('Cookie file not writable', 'wp-ultimo'));
$this->log(__('Cookie file not writable', 'wp-multisite-waas'));
return false;
}
@ -204,7 +203,7 @@ class CPanel_API {
if (curl_error($ch)) {
// translators: %s is the cURL error.
$this->log(sprintf(__('cPanel API Error: %s', 'wp-ultimo'), curl_error($ch)));
$this->log(sprintf(__('cPanel API Error: %s', 'wp-multisite-waas'), curl_error($ch)));
return false;
}
@ -232,12 +231,11 @@ class CPanel_API {
* Signs in on the cPanel.
*
* @since 1.6.2
* @return boolean
*/
private function sign_in() {
$url = $this->get_base_url() . '/login/?login_only=1';
$url .= '&user=' . $this->username . '&pass=' . urlencode($this->password);
$url .= '&user=' . $this->username . '&pass=' . rawurlencode($this->password);
$reply = $this->request($url);
@ -249,7 +247,7 @@ class CPanel_API {
$this->homepage = $this->get_base_url() . $reply['redirect'];
$this->ex_page = $this->get_base_url() . "/{$this->cpsess}/execute/";
} else {
return $this->log(__('Cannot connect to your cPanel server : Invalid Credentials', 'wp-ultimo'));
$this->log(__('Cannot connect to your cPanel server : Invalid Credentials', 'wp-multisite-waas'));
}
}
@ -257,22 +255,22 @@ class CPanel_API {
* Executes API calls, taking the request to the right API version
*
* @since 1.6.2
* @throws Exception Throwns exception when the api is invalid.
* @throws \Exception Throwns exception when the api is invalid.
* @param string $api API version.
* @param string $module Module name, to build the endpoint.
* @param string $function Endpoint function to call.
* @param string $function_name Endpoint function to call.
* @param array $parameters Parameters to the API endpoint.
* @return boolean
*/
public function execute($api, $module, $function, array $parameters = []) {
public function execute($api, $module, $function_name, array $parameters = []) {
switch ($api) {
case 'api2':
return $this->api2($module, $function, $parameters);
return $this->api2($module, $function_name, $parameters);
case 'uapi':
return $this->uapi($module, $function, $parameters);
return $this->uapi($module, $function_name, $parameters);
default:
throw new Exception('Invalid API type : api2 and uapi are accepted', 1);
throw new \Exception('Invalid API type : api2 and uapi are accepted', 1);
}
}
@ -281,11 +279,11 @@ class CPanel_API {
*
* @since 1.6.2
* @param string $module Module name, to build the endpoint.
* @param string $function Endpoint function to call.
* @param string $function_name Endpoint function to call.
* @param array $parameters Parameters to the API endpoint.
* @return mixed
*/
public function uapi($module, $function, array $parameters = []) {
public function uapi($module, $function_name, array $parameters = []) {
if (count($parameters) < 1) {
$parameters = '';
@ -293,7 +291,7 @@ class CPanel_API {
$parameters = (http_build_query($parameters));
}
return json_decode((string) $this->request($this->ex_page . $module . '/' . $function . '?' . $parameters));
return json_decode((string) $this->request($this->ex_page . $module . '/' . $function_name . '?' . $parameters));
}
/**
@ -301,11 +299,11 @@ class CPanel_API {
*
* @since 1.6.2
* @param string $module Module name, to build the endpoint.
* @param string $function Endpoint function to call.
* @param string $function_name Endpoint function to call.
* @param array $parameters Parameters to the API endpoint.
* @return mixed
*/
public function api2($module, $function, array $parameters = []) {
public function api2($module, $function_name, array $parameters = []) {
if (count($parameters) < 1) {
$parameters = '';
@ -314,9 +312,9 @@ class CPanel_API {
}
$url = $this->get_base_url() . $this->cpsess . '/json-api/cpanel' .
'?cpanel_jsonapi_version=2' .
"&cpanel_jsonapi_func={$function}" .
"&cpanel_jsonapi_module={$module}&" . $parameters;
'?cpanel_jsonapi_version=2' .
"&cpanel_jsonapi_func={$function_name}" .
"&cpanel_jsonapi_module={$module}&" . $parameters;
return json_decode((string) $this->request($url, $parameters));
}