Use new code style

This commit is contained in:
David Stone
2025-02-07 19:02:33 -07:00
parent 0181024ae1
commit 8433379d90
672 changed files with 37107 additions and 45249 deletions
.phpcs.xml.distcomposer.jsonconstants.php
inc
admin-pages
class-about-admin-page.phpclass-base-admin-page.phpclass-base-customer-facing-admin-page.phpclass-broadcast-edit-admin-page.phpclass-broadcast-list-admin-page.phpclass-checkout-form-edit-admin-page.phpclass-checkout-form-list-admin-page.phpclass-customer-edit-admin-page.phpclass-customer-list-admin-page.phpclass-customizer-admin-page.phpclass-dashboard-admin-page.phpclass-discount-code-edit-admin-page.phpclass-discount-code-list-admin-page.phpclass-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-list-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-list-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-jobs-list-admin-page.phpclass-list-admin-page.phpclass-membership-edit-admin-page.phpclass-membership-list-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-payment-list-admin-page.phpclass-placeholders-admin-page.phpclass-product-edit-admin-page.phpclass-product-list-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-shortcodes-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-admin-page.phpclass-system-info-admin-page.phpclass-tax-rates-admin-page.phpclass-template-previewer-customize-admin-page.phpclass-top-admin-nav-menu.phpclass-view-logs-admin-page.phpclass-webhook-edit-admin-page.phpclass-webhook-list-admin-page.phpclass-wizard-admin-page.php
customer-panel
debug
api
builders
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
signup-fields
class-admin-notices.phpclass-admin-themes-compatibility.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-autoloader.phpclass-cron.phpclass-current.phpclass-dashboard-statistics.phpclass-dashboard-widgets.phpclass-documentation.phpclass-domain-mapping.phpclass-faker.phpclass-geolocation.phpclass-helper.phpclass-hooks.phpclass-license.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-newsletter.phpclass-requirements.phpclass-scripts.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-user-switching.phpclass-views.phpclass-whitelabel.phpclass-wp-ultimo.php
compat
contracts
country
database
debug
deprecated
development
domain-mapping
duplication
exception
functions
gateways
helpers
installers
integrations
internal
invoices
limitations
limits
list-tables
loaders
managers
models
objects
site-templates
sso
tax
traits
ui
updater
sunrise.php
tests
uninstall.php
views
about.phpadmin-notices.php
admin-pages
base
broadcast
checkout
customers
dashboard-statistics
dashboard-widgets
domain
dynamic-styles
emails
events
invoice
legacy
limitations
memberships
payments
settings
shortcodes
sites
system-info
taxes
ui
wizards
wp-multisite-waas.php

@@ -78,8 +78,7 @@ class Closte_Host_Provider extends Base_Host_Provider {
public function detect() {
return defined('CLOSTE_CLIENT_API_KEY') && CLOSTE_CLIENT_API_KEY;
} // end detect;
}
/**
* This method gets called when a new domain is mapped.
@@ -91,12 +90,14 @@ class Closte_Host_Provider extends Base_Host_Provider {
*/
public function on_add_domain($domain, $site_id) {
$this->send_closte_api_request('/adddomainalias', array(
'domain' => $domain,
'wildcard' => strncmp($domain, '*.', strlen('*.')) === 0
));
} // end on_add_domain;
$this->send_closte_api_request(
'/adddomainalias',
array(
'domain' => $domain,
'wildcard' => strncmp($domain, '*.', strlen('*.')) === 0,
)
);
}
/**
* This method gets called when a mapped domain is removed.
@@ -108,12 +109,14 @@ class Closte_Host_Provider extends Base_Host_Provider {
*/
public function on_remove_domain($domain, $site_id) {
$this->send_closte_api_request('/deletedomainalias', array(
'domain' => $domain,
'wildcard' => strncmp($domain, '*.', strlen('*.')) === 0
));
} // end on_remove_domain;
$this->send_closte_api_request(
'/deletedomainalias',
array(
'domain' => $domain,
'wildcard' => strncmp($domain, '*.', strlen('*.')) === 0,
)
);
}
/**
* This method gets called when a new subdomain is being added.
@@ -125,7 +128,7 @@ class Closte_Host_Provider extends Base_Host_Provider {
* @param int $site_id ID of the site that is receiving that mapping.
* @return void
*/
public function on_add_subdomain($subdomain, $site_id) {} // end on_add_subdomain;
public function on_add_subdomain($subdomain, $site_id) {}
/**
* This method gets called when a new subdomain is being removed.
@@ -137,7 +140,7 @@ class Closte_Host_Provider extends Base_Host_Provider {
* @param int $site_id ID of the site that is receiving that mapping.
* @return void
*/
public function on_remove_subdomain($subdomain, $site_id) {} // end on_remove_subdomain;
public function on_remove_subdomain($subdomain, $site_id) {}
/**
* Tests the connection with the API.
@@ -152,18 +155,17 @@ class Closte_Host_Provider extends Base_Host_Provider {
$response = $this->send_closte_api_request('/adddomainalias', array());
if (wu_get_isset($response, 'error') === 'Invalid or empty domain: ') {
wp_send_json_success(array(
'message' => __('Access Authorized'),
));
} // end if;
wp_send_json_success(
array(
'message' => __('Access Authorized'),
)
);
}
$error = new \WP_Error('not-auth', __('Something went wrong', 'wp-ultimo'));
wp_send_json_error($error);
} // end test_connection;
}
/**
* Sends a request to Closte, with the right API key.
@@ -176,47 +178,43 @@ class Closte_Host_Provider extends Base_Host_Provider {
public function send_closte_api_request($endpoint, $data) {
if (defined('CLOSTE_CLIENT_API_KEY') === false) {
return (object) array(
'success' => false,
'error' => 'Closte API Key not found.',
);
} // end if;
}
$post_fields = array(
'blocking' => true,
'timeout' => 45,
'method' => 'POST',
'body' => array_merge(array(
'apikey' => CLOSTE_CLIENT_API_KEY,
), $data)
'body' => array_merge(
array(
'apikey' => CLOSTE_CLIENT_API_KEY,
),
$data
),
);
$response = wp_remote_post('https://app.closte.com/api/client' . $endpoint, $post_fields);
wu_log_add('integration-closte', wp_remote_retrieve_body($response));
if (!is_wp_error($response)) {
if ( ! is_wp_error($response)) {
$body = json_decode(wp_remote_retrieve_body($response), true);
if (json_last_error() === JSON_ERROR_NONE) {
return $body;
} // end if;
}
return (object) array(
'success' => false,
'error' => 'unknown'
'error' => 'unknown',
);
} // end if;
}
return $response;
} // end send_closte_api_request;
}
/**
* Returns the description of this integration.
@@ -227,8 +225,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');
} // end get_description;
}
/**
* Returns the logo for the integration.
@@ -239,7 +236,5 @@ class Closte_Host_Provider extends Base_Host_Provider {
public function get_logo() {
return wu_get_asset('closte.svg', 'img/hosts');
} // end get_logo;
} // end class Closte_Host_Provider;
}
}