Prep Plugin for release on WordPress.org
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.
This commit is contained in:
.phpcs.xml.distsetuptest.shsunrise.php
assets
inc
admin-pages
class-broadcast-edit-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-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-membership-edit-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-product-edit-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-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
api
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
class-admin-notices.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-dashboard-widgets.phpclass-domain-mapping.phpclass-faker.phpclass-helper.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-newsletter.phpclass-requirements.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-views.phpclass-whitelabel.phpsignup-fields
debug
development
functions
compatiblity.phpdate.phpfinancial.phplegacy.phpmarkup-helpers.phpoptions.phpsort.phpstring-helpers.phpsunrise.phpurl.php
gateways
helpers
integrations
host-providers
limitations
limits
list-tables
class-base-list-table.phpclass-checkout-form-list-table.phpclass-customer-list-table.phpclass-customers-payment-list-table.phpclass-email-list-table.phpclass-membership-line-item-list-table.phpclass-membership-list-table-widget.phpclass-membership-list-table.phpclass-memberships-site-list-table.phpclass-payment-line-item-list-table.phpclass-payment-list-table-widget.phpclass-payment-list-table.phpclass-product-list-table.phpclass-site-list-table.php
managers
class-customer-manager.phpclass-domain-manager.phpclass-email-manager.phpclass-event-manager.phpclass-gateway-manager.phpclass-limitation-manager.phpclass-notes-manager.phpclass-site-manager.phpclass-webhook-manager.php
models
tax
ui
views
about.phpadmin-notices.php
admin-pages
fields
field-actions.phpfield-code-editor.phpfield-color-picker.phpfield-dashicon.phpfield-group.phpfield-header.phpfield-hidden.phpfield-html.phpfield-image.phpfield-link.phpfield-multiselect.phpfield-note.phpfield-repeater.phpfield-select-icon.phpfield-select.phpfield-small-header.phpfield-submit.phpfield-tab-select.phpfield-text-display.phpfield-text-edit.phpfield-text.phpfield-textarea.phpfield-toggle.phpfield-wp-editor.phpform.php
partials
base
centered.php
checkout-forms
customers
dash.phpedit.phpedit
empty-state.phpfilter.phpgrid.phplist.phpproducts
responsive-table-row.phpsettings.phpwizard.phpwizard
broadcast
checkout
fields
field-checkbox-multi.phpfield-checkbox.phpfield-group.phpfield-hidden.phpfield-html.phpfield-note.phpfield-password.phpfield-payment-methods.phpfield-products.phpfield-radio.phpfield-select.phpfield-submit.phpfield-text.phpfield-toggle.phpform.php
partials
paypal
templates
order-bump
order-summary
period-selection
pricing-table
steps
template-selection
customers
dashboard-statistics
filter.phpwidget-countries.phpwidget-forms.phpwidget-most-visited-sites.phpwidget-mrr-growth.phpwidget-new-accounts.phpwidget-revenue.phpwidget-tax-by-code.phpwidget-tax-by-day.phpwidget-tax-graph.phpwidget-taxes.php
dashboard-widgets
account-summary.phpactivity-stream.phpbilling-info.phpcurrent-membership-product-details.phpcurrent-membership.phpcurrent-site.phpdomain-mapping.phpfirst-steps.phpinvoices.phplimits-and-quotas.phplogin-form.phpmy-sites.phpsite-actions.phpsummary.phpthank-you.php
domain
email
emails
admin
customer
events
invoice
legacy
signup
limitations
memberships
payments
settings
shortcodes
sites
system-info
taxes
ui
wizards
@ -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,7 +151,7 @@ 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-multisite-waas'));
|
||||
|
||||
@ -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-multisite-waas'));
|
||||
$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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user