"Assign Site Template" forces new accounts with this plan to use a particular template site (this option removes the template selection field from the signup, if one exists).
Finally, "Choose Available Site Templates", overrides the templates selected on the checkout form with the templates selected here, while also giving you the chance of pre-select a template to be used as default.', 'wp-ultimo'),
'value' => 'default',
- 'options' => array(
+ 'options' => [
'default' => __('Default', 'wp-ultimo'),
'assign_template' => __('Assign Site Template', 'wp-ultimo'),
'choose_available_templates' => __('Choose Available Site Templates', 'wp-ultimo'),
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'site_template_selection_mode',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
'v-show' => 'allow_site_templates',
- ),
- ),
- 'templates' => array(
+ ],
+ ],
+ 'templates' => [
'type' => 'html',
'title' => __('Site Templates', 'wp-ultimo'),
'desc' => esc_attr(sprintf('{{ site_template_selection_mode === "assign_template" ? "%s" : "%s" }}', __('Select the Site Template to assign.', 'wp-ultimo'), __('Customize the access level of each Site Template below.', 'wp-ultimo'))),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
'v-show' => "allow_site_templates && site_template_selection_mode !== 'default'",
- ),
+ ],
'content' => fn() => $this->get_site_template_selection_list($this->get_object()),
- ),
- ),
- );
+ ],
+ ],
+ ];
return apply_filters('wu_product_options_sections', $sections, $this->get_object());
}
@@ -925,10 +925,10 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
return wu_get_template_contents(
'limitations/site-template-selector',
- array(
+ [
'templates' => $all_templates,
'product' => $product,
- )
+ ]
);
}
@@ -962,18 +962,18 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
*/
public function action_links() {
- $actions = array();
+ $actions = [];
if ($this->get_object()->get_type() === 'plan' && $this->edit) {
$shareable_link = $this->get_object()->get_shareable_link();
- $actions[] = array(
+ $actions[] = [
'url' => '#',
'label' => __('Click to copy Shareable Link', 'wp-ultimo'),
'icon' => 'wu-attachment',
'classes' => 'wu-copy',
'attrs' => 'data-clipboard-text="' . esc_attr($shareable_link) . '"',
- );
+ ];
}
return $actions;
@@ -987,7 +987,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
*/
public function get_labels() {
- return array(
+ return [
'edit_label' => __('Edit Product', 'wp-ultimo'),
'add_new_label' => __('Add new Product', 'wp-ultimo'),
'updated_message' => __('Product updated with success!', 'wp-ultimo'),
@@ -997,7 +997,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
'save_description' => '',
'delete_button_label' => __('Delete Product', 'wp-ultimo'),
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -1010,10 +1010,10 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
*/
public function query_filter($args) {
- $extra_args = array(
+ $extra_args = [
'object_type' => 'product',
'object_id' => absint($this->get_object()->get_id()),
- );
+ ];
return array_merge($args, $extra_args);
}
@@ -1066,7 +1066,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function handle_save() {
+ public function handle_save(): void {
/*
* Set the recurring value to zero if the toggle is disabled.
*/
@@ -1100,7 +1100,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
* Set the setup fee value to zero if the toggle is disabled.
*/
if ( ! wu_request('price_variations')) {
- $_POST['price_variations'] = array();
+ $_POST['price_variations'] = [];
}
/*
diff --git a/inc/admin-pages/class-product-list-admin-page.php b/inc/admin-pages/class-product-list-admin-page.php
index 9683304..72d1ef3 100644
--- a/inc/admin-pages/class-product-list-admin-page.php
+++ b/inc/admin-pages/class-product-list-admin-page.php
@@ -50,9 +50,9 @@ class Product_List_Admin_Page extends List_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'network_admin_menu' => 'wu_read_products',
- );
+ ];
/**
* Allow child classes to register widgets, if they need them.
@@ -70,10 +70,10 @@ class Product_List_Admin_Page extends List_Admin_Page {
*/
public function get_labels() {
- return array(
+ return [
'deleted_message' => __('Product removed successfully.', 'wp-ultimo'),
'search_label' => __('Search Product', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -117,13 +117,13 @@ class Product_List_Admin_Page extends List_Admin_Page {
*/
public function action_links() {
- return array(
- array(
+ return [
+ [
'url' => wu_network_admin_url('wp-ultimo-edit-product'),
'label' => __('Add Product'),
'icon' => 'wu-circle-with-plus',
- ),
- );
+ ],
+ ];
}
/**
diff --git a/inc/admin-pages/class-settings-admin-page.php b/inc/admin-pages/class-settings-admin-page.php
index fb98554..36864f1 100644
--- a/inc/admin-pages/class-settings-admin-page.php
+++ b/inc/admin-pages/class-settings-admin-page.php
@@ -62,9 +62,9 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'network_admin_menu' => 'wu_read_settings',
- );
+ ];
/**
* Should we hide admin notices on this page?
@@ -104,7 +104,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
wp_enqueue_editor();
@@ -130,56 +130,56 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
parent::register_widgets();
wu_register_settings_side_panel(
'login-and-registration',
- array(
+ [
'title' => __('Checkout Forms', 'wp-ultimo'),
- 'render' => array($this, 'render_checkout_forms_side_panel'),
- )
+ 'render' => [$this, 'render_checkout_forms_side_panel'],
+ ]
);
wu_register_settings_side_panel(
'sites',
- array(
+ [
'title' => __('Template Previewer', 'wp-ultimo'),
- 'render' => array($this, 'render_site_template_side_panel'),
- )
+ 'render' => [$this, 'render_site_template_side_panel'],
+ ]
);
wu_register_settings_side_panel(
'sites',
- array(
+ [
'title' => __('Placeholder Editor', 'wp-ultimo'),
- 'render' => array($this, 'render_site_placeholders_side_panel'),
- )
+ 'render' => [$this, 'render_site_placeholders_side_panel'],
+ ]
);
wu_register_settings_side_panel(
'payment-gateways',
- array(
+ [
'title' => __('Invoices', 'wp-ultimo'),
- 'render' => array($this, 'render_invoice_side_panel'),
- )
+ 'render' => [$this, 'render_invoice_side_panel'],
+ ]
);
wu_register_settings_side_panel(
'emails',
- array(
+ [
'title' => __('System Emails', 'wp-ultimo'),
- 'render' => array($this, 'render_system_emails_side_panel'),
- )
+ 'render' => [$this, 'render_system_emails_side_panel'],
+ ]
);
wu_register_settings_side_panel(
'emails',
- array(
+ [
'title' => __('Email Template', 'wp-ultimo'),
- 'render' => array($this, 'render_email_template_side_panel'),
- )
+ 'render' => [$this, 'render_email_template_side_panel'],
+ ]
);
}
@@ -189,7 +189,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_checkout_forms_side_panel() {
+ public function render_checkout_forms_side_panel(): void {
?>
@@ -201,7 +201,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -231,7 +231,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_site_template_side_panel() {
+ public function render_site_template_side_panel(): void {
?>
@@ -244,7 +244,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -274,7 +274,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_site_placeholders_side_panel() {
+ public function render_site_placeholders_side_panel(): void {
?>
@@ -287,7 +287,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -317,7 +317,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_invoice_side_panel() {
+ public function render_invoice_side_panel(): void {
?>
@@ -330,7 +330,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -360,7 +360,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_system_emails_side_panel() {
+ public function render_system_emails_side_panel(): void {
?>
@@ -373,7 +373,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -403,7 +403,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_email_template_side_panel() {
+ public function render_email_template_side_panel(): void {
?>
@@ -416,7 +416,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
-
+
@@ -470,7 +470,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Enqueue the base Dashboard Scripts
*/
@@ -486,14 +486,14 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
wu_get_template(
'base/settings',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'classes' => '',
'sections' => $this->get_sections(),
'current_section' => $this->get_current_section(),
'clickable_navigation' => $this->clickable_navigation,
- )
+ ]
);
}
@@ -514,14 +514,14 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function default_handler() {
+ public function default_handler(): void {
if ( ! current_user_can('wu_edit_settings')) {
wp_die(__('You do not have the permissions required to change settings.', 'wp-ultimo'));
}
if ( ! isset($_POST['active_gateways']) && wu_request('tab') === 'payment-gateways') {
- $_POST['active_gateways'] = array();
+ $_POST['active_gateways'] = [];
}
WP_Ultimo()->settings->save_settings($_POST);
@@ -537,7 +537,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function default_view() {
+ public function default_view(): void {
$sections = $this->get_sections();
@@ -552,15 +552,15 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
/*
* Get Field to save
*/
- $fields['save'] = array(
+ $fields['save'] = [
'type' => 'submit',
'title' => __('Save Settings', 'wp-ultimo'),
'classes' => 'button button-primary button-large wu-ml-auto wu-w-full md:wu-w-auto',
'wrapper_classes' => 'wu-sticky wu-bottom-0 wu-save-button wu-mr-px wu-w-full md:wu-w-auto',
- 'html_attr' => array(
+ 'html_attr' => [
'v-on:click' => 'send("window", "wu_block_ui", "#wpcontent")',
- ),
- );
+ ],
+ ];
if ( ! current_user_can('wu_edit_settings')) {
$fields['save']['html_attr']['disabled'] = 'disabled';
@@ -569,17 +569,17 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
$form = new Form(
$section_slug,
$fields,
- array(
+ [
'views' => 'admin-pages/fields',
'classes' => 'wu-modal-form wu-widget-list wu-striped wu--mt-5 wu--mx-in wu--mb-in',
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-py-5 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' => array(
+ 'html_attr' => [
'style' => '',
'data-on-load' => 'remove_block_ui',
'data-wu-app' => str_replace('-', '_', $section_slug),
'data-state' => json_encode(wu_array_map_keys('wu_replace_dashes', Settings::get_instance()->get_all(true))),
- ),
- )
+ ],
+ ]
);
$form->render();
diff --git a/inc/admin-pages/class-setup-wizard-admin-page.php b/inc/admin-pages/class-setup-wizard-admin-page.php
index f3007af..cfc4984 100644
--- a/inc/admin-pages/class-setup-wizard-admin-page.php
+++ b/inc/admin-pages/class-setup-wizard-admin-page.php
@@ -71,9 +71,9 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'network_admin_menu' => 'manage_network',
- );
+ ];
/**
* Is this an old install migrating.
@@ -119,29 +119,29 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
$this->menu_icon = 'dashicons-wu-wp-ultimo';
- add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
+ add_action('admin_enqueue_scripts', [$this, 'register_scripts']);
}
parent::__construct();
- add_action('admin_action_download_migration_logs', array($this, 'download_migration_logs'));
+ add_action('admin_action_download_migration_logs', [$this, 'download_migration_logs']);
/*
* Serve the installers
*/
- add_action('wp_ajax_wu_setup_install', array($this, 'setup_install'));
+ add_action('wp_ajax_wu_setup_install', [$this, 'setup_install']);
/*
* Load installers
*/
- add_action('wu_handle_ajax_installers', array(Core_Installer::get_instance(), 'handle'), 10, 3);
- add_action('wu_handle_ajax_installers', array(Default_Content_Installer::get_instance(), 'handle'), 10, 3);
- add_action('wu_handle_ajax_installers', array(Migrator::get_instance(), 'handle'), 10, 3);
+ add_action('wu_handle_ajax_installers', [Core_Installer::get_instance(), 'handle'], 10, 3);
+ add_action('wu_handle_ajax_installers', [Default_Content_Installer::get_instance(), 'handle'], 10, 3);
+ add_action('wu_handle_ajax_installers', [Migrator::get_instance(), 'handle'], 10, 3);
/*
* Redirect on activation
*/
- add_action('wu_activation', array($this, 'redirect_to_wizard'));
+ add_action('wu_activation', [$this, 'redirect_to_wizard']);
}
/**
@@ -150,7 +150,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.7
* @return void
*/
- public function download_migration_logs() {
+ public function download_migration_logs(): void {
check_admin_referer('download_migration_logs', 'nonce');
@@ -177,7 +177,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
parent::page_loaded();
@@ -205,7 +205,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function set_settings() {
+ public function set_settings(): void {
WP_Ultimo()->settings->default_sections();
}
@@ -216,7 +216,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function redirect_to_wizard() {
+ public function redirect_to_wizard(): void {
if ( ! \WP_Ultimo\Requirements::run_setup() && wu_request('page') !== 'wp-ultimo-setup') {
wp_redirect(wu_network_admin_url('wp-ultimo-setup'));
@@ -231,7 +231,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function setup_install() {
+ public function setup_install(): void {
global $wpdb;
@@ -279,7 +279,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
*/
public function get_logo() {
- return wu_get_asset('logo.png', 'img');
+ return wu_get_asset('logo.webp', 'img');
}
/**
@@ -312,45 +312,45 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
*/
public function get_sections() {
- $sections = array(
- 'welcome' => array(
+ $sections = [
+ 'welcome' => [
'title' => __('Welcome', 'wp-ultimo'),
'description' => implode(
'
',
- array(
+ [
__('...and thanks for choosing WP Multisite WaaS!', 'wp-ultimo'),
__('This quick setup wizard will make sure your server is correctly setup, help you configure your new network, and migrate data from previous WP Multisite WaaS versions if necessary.', 'wp-ultimo'),
__('You will also have the option of importing default content. It should take 10 minutes or less!', 'wp-ultimo'),
- )
+ ]
),
'next_label' => __('Get Started →', 'wp-ultimo'),
'back' => false,
- ),
- 'checks' => array(
+ ],
+ 'checks' => [
'title' => __('Pre-install Checks', 'wp-ultimo'),
'description' => __('Now it is time to see if this machine has what it takes to run WP Multisite WaaS well!', 'wp-ultimo'),
'next_label' => \WP_Ultimo\Requirements::met() ? __('Go to the Next Step →', 'wp-ultimo') : __('Check Again', 'wp-ultimo'),
- 'handler' => array($this, 'handle_checks'),
+ 'handler' => [$this, 'handle_checks'],
'back' => false,
- 'fields' => array(
- 'requirements' => array(
+ 'fields' => [
+ 'requirements' => [
'type' => 'note',
- 'desc' => array($this, 'renders_requirements_table'),
- ),
- ),
- ),
- 'installation' => array(
+ 'desc' => [$this, 'renders_requirements_table'],
+ ],
+ ],
+ ],
+ 'installation' => [
'title' => __('Installation', 'wp-ultimo'),
'description' => __('Now, let\'s update your database and install the Sunrise.php file, which are necessary for the correct functioning of WP Multisite WaaS.', 'wp-ultimo'),
'next_label' => Core_Installer::get_instance()->all_done() ? __('Go to the Next Step →', 'wp-ultimo') : __('Install', 'wp-ultimo'),
- 'fields' => array(
- 'terms' => array(
+ 'fields' => [
+ 'terms' => [
'type' => 'note',
'desc' => fn() => $this->render_installation_steps(Core_Installer::get_instance()->get_steps(), false),
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
/*
* In case of migrations, add different sections.
@@ -374,19 +374,19 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
$description = __('It seems that you were running WP Multisite WaaS 1.X on this network. This migrator will convert the data from the old version to the new one.', 'wp-ultimo') . '
' . __('First, let\'s run a test migration to see if we can spot any potential errors.', 'wp-ultimo');
}
- $fields = array(
- 'migration' => array(
+ $fields = [
+ 'migration' => [
'type' => 'note',
'desc' => fn() => $this->render_installation_steps(Migrator::get_instance()->get_steps(), false),
- ),
- );
+ ],
+ ];
if ($errors) {
$subject = 'Errors on migrating my network';
$user = wp_get_current_user();
- $message_lines = array(
+ $message_lines = [
'Hi there,',
sprintf('My name is %s.', $user->display_name),
'I tried to migrate my network from version 1 to version 2, but was not able to do it successfully...',
@@ -394,7 +394,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
sprintf('```%s%s%s```', PHP_EOL, implode(PHP_EOL, $errors), PHP_EOL),
sprintf('```%s%s%s```', PHP_EOL, $back_traces ? implode(PHP_EOL, $back_traces) : 'No backtraces found.', PHP_EOL),
'Kind regards.',
- );
+ ];
$message = implode(PHP_EOL . PHP_EOL, $message_lines);
@@ -410,10 +410,10 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
' %1$s',
__('Download migration error log', 'wp-ultimo'),
add_query_arg(
- array(
+ [
'action' => 'download_migration_logs',
'nonce' => wp_create_nonce('download_migration_logs'),
- ),
+ ],
network_admin_url('admin.php')
)
);
@@ -422,11 +422,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
' %1$s',
__('Rollback to version 1.10.13', 'wp-ultimo'),
add_query_arg(
- array(
+ [
'page' => 'wp-ultimo-rollback',
'version' => '1.10.13',
'type' => 'select-version',
- ),
+ ],
network_admin_url('admin.php')
)
);
@@ -434,57 +434,57 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
$error_list .= implode(' ', $errors);
$fields = array_merge(
- array(
- 'errors' => array(
+ [
+ 'errors' => [
'type' => 'note',
'classes' => 'wu-flex-grow',
'desc' => function () use ($error_list) {
/** Reset errors */
- Migrator::get_instance()->session->set('errors', array());
+ Migrator::get_instance()->session->set('errors', []);
return sprintf('
';
- $view = isset($this->current_section['view']) ? $this->current_section['view'] : array($this, 'default_view');
+ $view = $this->current_section['view'] ?? [$this, 'default_view'];
/*
* Calls the view function.
@@ -192,13 +192,13 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/wizard',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'logo' => $this->get_logo(),
@@ -208,7 +208,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
'classes' => 'wu-w-full wu-mx-auto sm:wu-w-11/12 xl:wu-w-8/12 wu-mt-8 sm:wu-max-w-screen-lg',
'clickable_navigation' => $this->clickable_navigation,
'form_id' => $this->form_id,
- )
+ ]
);
}
@@ -297,7 +297,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function default_handler() {
+ public function default_handler(): void {
wp_redirect($this->get_next_section_link());
@@ -310,22 +310,22 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function default_view() {
+ public function default_view(): void {
$section = wp_parse_args(
$this->current_section,
- array(
+ [
'title' => '',
'description' => '',
'content' => '',
- 'fields' => array(),
+ 'fields' => [],
'next_label' => __('Continue →', 'wp-ultimo'),
'back_label' => __('← Go Back', 'wp-ultimo'),
'skip_label' => __('Skip this Step', 'wp-ultimo'),
'back' => false,
'skip' => false,
'next' => true,
- )
+ ]
);
/*
@@ -339,11 +339,11 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
$form = new \WP_Ultimo\UI\Form(
$this->get_current_section(),
$section['fields'],
- array(
+ [
'views' => 'admin-pages/fields',
'classes' => 'wu-widget-list wu-striped wu-m-0 wu-mt-2 wu--mb-6 wu--mx-6',
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-px-6 wu-py-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',
- )
+ ]
);
ob_start();
@@ -357,9 +357,9 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
'wizards/setup/default',
array_merge(
$section,
- array(
+ [
'page' => $this,
- )
+ ]
)
);
}
@@ -370,15 +370,15 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_submit_box() {
+ public function render_submit_box(): void {
wu_get_template(
'base/wizard/submit-box',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'labels' => $this->get_labels(),
- )
+ ]
);
}
diff --git a/inc/admin-pages/customer-panel/class-account-admin-page.php b/inc/admin-pages/customer-panel/class-account-admin-page.php
index d2bb1f2..12ae960 100644
--- a/inc/admin-pages/customer-panel/class-account-admin-page.php
+++ b/inc/admin-pages/customer-panel/class-account-admin-page.php
@@ -68,10 +68,10 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'admin_menu' => 'exist',
'user_admin_menu' => 'exist',
- );
+ ];
/**
* The current site instance.
@@ -113,7 +113,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
$this->current_site = wu_get_current_site();
@@ -166,7 +166,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
@@ -186,7 +186,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
- \WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', array('show_admin_link' => false));
+ \WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', ['show_admin_link' => false]);
}
/**
@@ -228,17 +228,17 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/dash',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
- )
+ ]
);
}
}
diff --git a/inc/admin-pages/customer-panel/class-add-new-site-admin-page.php b/inc/admin-pages/customer-panel/class-add-new-site-admin-page.php
index 171d9c7..a33d664 100644
--- a/inc/admin-pages/customer-panel/class-add-new-site-admin-page.php
+++ b/inc/admin-pages/customer-panel/class-add-new-site-admin-page.php
@@ -84,10 +84,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'admin_menu' => 'exist',
'user_admin_menu' => 'exist',
- );
+ ];
/**
* The current customer instance.
@@ -137,7 +137,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
$this->customer = wu_get_current_customer();
}
@@ -157,7 +157,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function force_screen_options() {
+ public function force_screen_options(): void {
if (get_current_screen()->id !== 'toplevel_page_sites') {
return;
@@ -166,10 +166,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
// Forces Screen options so we can add our links.
add_screen_option(
'wu_fix',
- array(
+ [
'option' => 'test',
'value' => true,
- )
+ ]
);
}
@@ -187,17 +187,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
\WP_Ultimo\UI\Checkout_Element::get_instance()->as_inline_content(
get_current_screen()->id,
'wu_dash_before_metaboxes',
- array(
+ [
'slug' => 'wu-add-new-site',
- 'membership_limitations' => array('sites'),
- )
+ 'membership_limitations' => ['sites'],
+ ]
);
}
@@ -240,17 +240,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/dash',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
- )
+ ]
);
}
}
diff --git a/inc/admin-pages/customer-panel/class-checkout-admin-page.php b/inc/admin-pages/customer-panel/class-checkout-admin-page.php
index a34f5ec..3b6af34 100644
--- a/inc/admin-pages/customer-panel/class-checkout-admin-page.php
+++ b/inc/admin-pages/customer-panel/class-checkout-admin-page.php
@@ -66,10 +66,10 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'user_admin_menu' => 'read',
'admin_menu' => 'read',
- );
+ ];
/**
* Should we hide admin notices on this page?
@@ -115,7 +115,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
* @since 2.0.0
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
do_action('wu_checkout_scripts', null, null);
}
@@ -126,7 +126,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
* @since 2.0.0
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
do_action('wu_setup_checkout', null);
@@ -141,12 +141,12 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
*/
public function get_sections() {
- $sections = array(
- 'plan' => array(
+ $sections = [
+ 'plan' => [
'title' => __('Change Membership', 'wp-ultimo'),
- 'view' => array($this, 'display_checkout_form'),
- ),
- );
+ 'view' => [$this, 'display_checkout_form'],
+ ],
+ ];
return $sections;
}
@@ -157,17 +157,17 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
* @since 2.0.0
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/centered',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'content' => do_shortcode('[wu_checkout slug="wu-checkout"]'),
- )
+ ]
);
}
@@ -177,7 +177,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
diff --git a/inc/admin-pages/customer-panel/class-my-sites-admin-page.php b/inc/admin-pages/customer-panel/class-my-sites-admin-page.php
index ff4c9c4..80fdeef 100644
--- a/inc/admin-pages/customer-panel/class-my-sites-admin-page.php
+++ b/inc/admin-pages/customer-panel/class-my-sites-admin-page.php
@@ -68,10 +68,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'admin_menu' => 'exist',
'user_admin_menu' => 'exist',
- );
+ ];
/**
* The current customer instance.
@@ -113,11 +113,11 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
if ($this->current_site->get_type() === 'customer_owned') {
parent::__construct();
- add_action('admin_menu', array($this, 'unset_default_my_sites_menu'));
+ add_action('admin_menu', [$this, 'unset_default_my_sites_menu']);
- add_action('admin_bar_menu', array($this, 'change_my_sites_link'), 90);
+ add_action('admin_bar_menu', [$this, 'change_my_sites_link'], 90);
- add_action('current_screen', array($this, 'force_screen_options'));
+ add_action('current_screen', [$this, 'force_screen_options']);
}
}
@@ -127,7 +127,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
$this->customer = wu_get_current_customer();
}
@@ -147,7 +147,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function unset_default_my_sites_menu() {
+ public function unset_default_my_sites_menu(): void {
global $submenu;
@@ -162,7 +162,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @param object $wp_admin_bar The admin bar object.
* @return void
*/
- public function change_my_sites_link($wp_admin_bar) {
+ public function change_my_sites_link($wp_admin_bar): void {
$my_sites = $wp_admin_bar->get_node('my-sites');
@@ -170,9 +170,9 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
return;
}
- $args = array(
+ $args = [
'page' => 'sites',
- );
+ ];
$my_sites->href = add_query_arg($args, admin_url('admin.php'));
@@ -185,7 +185,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function force_screen_options() {
+ public function force_screen_options(): void {
if (get_current_screen()->id !== 'toplevel_page_sites') {
return;
@@ -194,10 +194,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
// Forces Screen options so we can add our links.
add_screen_option(
'wu_fix',
- array(
+ [
'option' => 'test',
'value' => true,
- )
+ ]
);
}
@@ -215,7 +215,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
\WP_Ultimo\UI\Login_Form_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
@@ -263,17 +263,17 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/dash',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'has_full_position' => false,
- )
+ ]
);
}
}
diff --git a/inc/admin-pages/customer-panel/class-template-switching-admin-page.php b/inc/admin-pages/customer-panel/class-template-switching-admin-page.php
index be5935c..a52ce91 100644
--- a/inc/admin-pages/customer-panel/class-template-switching-admin-page.php
+++ b/inc/admin-pages/customer-panel/class-template-switching-admin-page.php
@@ -66,10 +66,10 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'user_admin_menu' => 'read',
'admin_menu' => 'read',
- );
+ ];
/**
* Should we hide admin notices on this page?
@@ -123,7 +123,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
* @since 2.0.0
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
do_action('wu_template_switching_admin_page_scripts', null, null);
}
@@ -134,7 +134,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
* @since 2.0.0
* @return void
*/
- public function page_loaded() {
+ public function page_loaded(): void {
do_action('wu_template_switching_admin_page', null);
@@ -147,20 +147,20 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
* @since 2.0.0
* @return void
*/
- public function output() {
+ public function output(): void {
/*
* Renders the base edit page layout, with the columns and everything else =)
*/
wu_get_template(
'base/centered',
- array(
+ [
'screen' => get_current_screen(),
'page' => $this,
'content' => '',
- 'labels' => array(
+ 'labels' => [
'updated_message' => __('Template switched successfully!', 'wp-ultimo'),
- ),
- )
+ ],
+ ]
);
}
@@ -170,7 +170,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
\WP_Ultimo\UI\Template_Switching_Element::get_instance()->as_metabox(get_current_screen()->id);
}
diff --git a/inc/admin-pages/debug/class-debug-admin-page.php b/inc/admin-pages/debug/class-debug-admin-page.php
index 1a08492..ebfa24a 100644
--- a/inc/admin-pages/debug/class-debug-admin-page.php
+++ b/inc/admin-pages/debug/class-debug-admin-page.php
@@ -69,9 +69,9 @@ class Debug_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @var array
*/
- protected $supported_panels = array(
+ protected $supported_panels = [
'network_admin_menu' => 'capability_here',
- );
+ ];
/**
* Allow child classes to register widgets, if they need them.
@@ -79,12 +79,12 @@ class Debug_Admin_Page extends Base_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
add_meta_box(
'wp-ultimo-debug-pages',
__('All Registered Pages', 'wp-ultimo'),
- array($this, 'render_debug_pages'),
+ [$this, 'render_debug_pages'],
get_current_screen()->id,
'normal',
null
@@ -97,7 +97,7 @@ class Debug_Admin_Page extends Base_Admin_Page {
* @since 2.0.0
* @return void
*/
- public function render_debug_pages() {
+ public function render_debug_pages(): void {
$pages = Debug::get_instance()->get_pages();
@@ -157,15 +157,15 @@ class Debug_Admin_Page extends Base_Admin_Page {
* @since 1.8.2
* @return void
*/
- public function output() {
+ public function output(): void {
wu_get_template(
'base/dash',
- array(
+ [
'page' => $this,
'screen' => get_current_screen(),
'has_full_position' => false,
- )
+ ]
);
}
}
diff --git a/inc/api/class-register-endpoint.php b/inc/api/class-register-endpoint.php
index d7e7626..c168e91 100644
--- a/inc/api/class-register-endpoint.php
+++ b/inc/api/class-register-endpoint.php
@@ -33,9 +33,9 @@ class Register_Endpoint {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- add_action('wu_register_rest_routes', array($this, 'register_route'));
+ add_action('wu_register_rest_routes', [$this, 'register_route']);
}
/**
@@ -46,29 +46,29 @@ class Register_Endpoint {
* @param \WP_Ultimo\API $api The API main singleton.
* @return void
*/
- public function register_route($api) {
+ public function register_route($api): void {
$namespace = $api->get_namespace();
register_rest_route(
$namespace,
'/register',
- array(
+ [
'methods' => \WP_REST_Server::READABLE,
- 'callback' => array($this, 'handle_get'),
- 'permission_callback' => \Closure::fromCallable(array($api, 'check_authorization')),
- )
+ 'callback' => [$this, 'handle_get'],
+ 'permission_callback' => \Closure::fromCallable([$api, 'check_authorization']),
+ ]
);
register_rest_route(
$namespace,
'/register',
- array(
+ [
'methods' => \WP_REST_Server::CREATABLE,
- 'callback' => array($this, 'handle_endpoint'),
- 'permission_callback' => \Closure::fromCallable(array($api, 'check_authorization')),
+ 'callback' => [$this, 'handle_endpoint'],
+ 'permission_callback' => \Closure::fromCallable([$api, 'check_authorization']),
'args' => $this->get_rest_args(),
- )
+ ]
);
}
@@ -82,9 +82,9 @@ class Register_Endpoint {
*/
public function handle_get($request) {
- return array(
+ return [
'registration_status' => wu_get_setting('enable_registration', true) ? 'open' : 'closed',
- );
+ ];
}
/**
@@ -109,9 +109,9 @@ class Register_Endpoint {
if (is_wp_error($validation_errors)) {
$validation_errors->add_data(
- array(
+ [
'status' => 400,
- )
+ ]
);
return $validation_errors;
@@ -129,10 +129,10 @@ class Register_Endpoint {
$customer->update_last_login(true, true);
$customer->add_note(
- array(
+ [
'text' => __('Created via REST API', 'wp-ultimo'),
'author_id' => $customer->get_user_id(),
- )
+ ]
);
/*
@@ -140,12 +140,12 @@ class Register_Endpoint {
*/
$payment_method = wp_parse_args(
wu_get_isset($params, 'payment_method'),
- array(
+ [
'gateway' => '',
'gateway_customer_id' => '',
'gateway_subscription_id' => '',
'gateway_payment_id' => '',
- )
+ ]
);
/*
@@ -155,9 +155,9 @@ class Register_Endpoint {
$cart_params = wp_parse_args(
$cart_params,
- array(
+ [
'type' => 'new',
- )
+ ]
);
$cart = new Cart($cart_params);
@@ -171,9 +171,9 @@ class Register_Endpoint {
__('Products are required.', 'wp-ultimo'),
array_merge(
(array) $cart->done(),
- array(
+ [
'status' => 400,
- )
+ ]
)
);
}
@@ -188,9 +188,9 @@ class Register_Endpoint {
wu_get_isset(
$params,
'membership',
- array(
+ [
'status' => Membership_Status::PENDING,
- )
+ ]
)
);
@@ -214,10 +214,10 @@ class Register_Endpoint {
}
$membership->add_note(
- array(
+ [
'text' => __('Created via REST API', 'wp-ultimo'),
'author_id' => $customer->get_user_id(),
- )
+ ]
);
$payment_data = $cart->to_payment_data();
@@ -227,9 +227,9 @@ class Register_Endpoint {
wu_get_isset(
$params,
'payment',
- array(
+ [
'status' => Payment_Status::PENDING,
- )
+ ]
)
);
@@ -252,10 +252,10 @@ class Register_Endpoint {
}
$payment->add_note(
- array(
+ [
'text' => __('Created via REST API', 'wp-ultimo'),
'author_id' => $customer->get_user_id(),
- )
+ ]
);
$site = false;
@@ -301,7 +301,7 @@ class Register_Endpoint {
} catch (\Throwable $e) {
$wpdb->query('ROLLBACK');
- return new \WP_Error('registration_error', $e->getMessage(), array('status' => 500));
+ return new \WP_Error('registration_error', $e->getMessage(), ['status' => 500]);
}
$wpdb->query('COMMIT');
@@ -309,12 +309,12 @@ class Register_Endpoint {
/*
* We have everything we need now.
*/
- return array(
+ return [
'membership' => $membership->to_array(),
'customer' => $customer->to_array(),
'payment' => $payment->to_array(),
- 'site' => $site ? $site : array('id' => 0),
- );
+ 'site' => $site ?: ['id' => 0],
+ ];
}
/**
@@ -331,203 +331,203 @@ class Register_Endpoint {
*/
$billing_address_fields = Billing_Address::fields_for_rest(false);
- $customer_args = array(
- 'customer_id' => array(
+ $customer_args = [
+ 'customer_id' => [
'description' => __('The customer ID, if the customer already exists. If you also need to create a customer/wp user, use the "customer" property.', 'wp-ultimo'),
'type' => 'integer',
- ),
- 'customer' => array(
+ ],
+ 'customer' => [
'description' => __('Customer data. Needs to be present when customer id is not.', 'wp-ultimo'),
'type' => 'object',
- 'properties' => array(
- 'user_id' => array(
+ 'properties' => [
+ 'user_id' => [
'description' => __('Existing WordPress user id to attach this customer to. If you also need to create a WordPress user, pass the properties "username", "password", and "email".', 'wp-ultimo'),
'type' => 'integer',
- ),
- 'username' => array(
+ ],
+ 'username' => [
'description' => __('The customer username. This is used to create the WordPress user.', 'wp-ultimo'),
'type' => 'string',
'minLength' => 4,
- ),
- 'password' => array(
+ ],
+ 'password' => [
'description' => __('The customer password. This is used to create the WordPress user. Note that no validation is performed here to enforce strength.', 'wp-ultimo'),
'type' => 'string',
'minLength' => 6,
- ),
- 'email' => array(
+ ],
+ 'email' => [
'description' => __('The customer email address. This is used to create the WordPress user.', 'wp-ultimo'),
'type' => 'string',
'format' => 'email',
- ),
- 'billing_address' => array(
+ ],
+ 'billing_address' => [
'type' => 'object',
'properties' => $billing_address_fields,
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $membership_args = array(
- 'membership' => array(
+ $membership_args = [
+ 'membership' => [
'description' => __('The membership data is automatically generated based on the cart info passed (e.g. products) but can be overridden with this property.', 'wp-ultimo'),
'type' => 'object',
- 'properties' => array(
- 'status' => array(
+ 'properties' => [
+ 'status' => [
'description' => __('The membership status.', 'wp-ultimo'),
'type' => 'string',
'enum' => array_values(Membership_Status::get_allowed_list()),
'default' => Membership_Status::PENDING,
- ),
- 'date_expiration' => array(
+ ],
+ 'date_expiration' => [
'description' => __('The membership expiration date. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- 'date_trial_end' => array(
+ ],
+ 'date_trial_end' => [
'description' => __('The membership trial end date. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- 'date_activated' => array(
+ ],
+ 'date_activated' => [
'description' => __('The membership activation date. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- 'date_renewed' => array(
+ ],
+ 'date_renewed' => [
'description' => __('The membership last renewed date. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- 'date_cancellation' => array(
+ ],
+ 'date_cancellation' => [
'description' => __('The membership cancellation date. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- 'date_payment_plan_completed' => array(
+ ],
+ 'date_payment_plan_completed' => [
'description' => __('The membership completion date. Used when the membership is limited to a limited number of billing cycles. Must be a valid PHP date format.', 'wp-ultimo'),
'type' => 'string',
'format' => 'date-time',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $payment_args = array(
- 'payment' => array(
+ $payment_args = [
+ 'payment' => [
'description' => __('The payment data is automatically generated based on the cart info passed (e.g. products) but can be overridden with this property.', 'wp-ultimo'),
'type' => 'object',
- 'properties' => array(
- 'status' => array(
+ 'properties' => [
+ 'status' => [
'description' => __('The payment status.', 'wp-ultimo'),
'type' => 'string',
'enum' => array_values(Payment_Status::get_allowed_list()),
'default' => Payment_Status::PENDING,
- ),
- ),
- ),
- 'payment_method' => array(
+ ],
+ ],
+ ],
+ 'payment_method' => [
'description' => __('Payment method information. Useful when using the REST API to integrate other payment methods.', 'wp-ultimo'),
'type' => 'object',
- 'properties' => array(
- 'gateway' => array(
+ 'properties' => [
+ 'gateway' => [
'description' => __('The gateway name. E.g. stripe.', 'wp-ultimo'),
'type' => 'string',
- ),
- 'gateway_customer_id' => array(
+ ],
+ 'gateway_customer_id' => [
'description' => __('The customer ID on the gateway system.', 'wp-ultimo'),
'type' => 'string',
- ),
- 'gateway_subscription_id' => array(
+ ],
+ 'gateway_subscription_id' => [
'description' => __('The subscription ID on the gateway system.', 'wp-ultimo'),
'type' => 'string',
- ),
- 'gateway_payment_id' => array(
+ ],
+ 'gateway_payment_id' => [
'description' => __('The payment ID on the gateway system.', 'wp-ultimo'),
'type' => 'string',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $site_args = array(
- 'site' => array(
+ $site_args = [
+ 'site' => [
'type' => 'object',
- 'properties' => array(
- 'site_url' => array(
+ 'properties' => [
+ 'site_url' => [
'type' => 'string',
'description' => __('The site subdomain or subdirectory (depending on your Multisite install). This would be "test" in "test.your-network.com".', 'wp-ultimo'),
'minLength' => 4,
'required' => true,
- ),
- 'site_title' => array(
+ ],
+ 'site_title' => [
'type' => 'string',
'description' => __('The site title. E.g. My Amazing Site', 'wp-ultimo'),
'minLength' => 4,
'required' => true,
- ),
- 'publish' => array(
+ ],
+ 'publish' => [
'description' => __('If we should publish this site regardless of membership/payment status. Sites are created as pending by default, and are only published when a payment is received or the status of the membership changes to "active". This flag allows you to bypass the pending state.', 'wp-ultimo'),
'type' => 'boolean',
'default' => false,
- ),
- 'template_id' => array(
+ ],
+ 'template_id' => [
'description' => __('The template ID we should copy when creating this site. If left empty, the value dictated by the products will be used.', 'wp-ultimo'),
'type' => 'integer',
- ),
- 'site_meta' => array(
+ ],
+ 'site_meta' => [
'description' => __('An associative array of key values to be saved as site_meta.', 'wp-ultimo'),
'type' => 'object',
- ),
- 'site_option' => array(
+ ],
+ 'site_option' => [
'description' => __('An associative array of key values to be saved as site_options. Useful for changing plugin settings and other site configurations.', 'wp-ultimo'),
'type' => 'object',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $cart_args = array(
- 'products' => array(
+ $cart_args = [
+ 'products' => [
'description' => __('The products to be added to this membership. Takes an array of product ids or slugs.', 'wp-ultimo'),
'uniqueItems' => true,
'type' => 'array',
- ),
- 'duration' => array(
+ ],
+ 'duration' => [
'description' => __('The membership duration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'duration_unit' => array(
+ ],
+ 'duration_unit' => [
'description' => __('The membership duration unit.', 'wp-ultimo'),
'type' => 'string',
'default' => 'month',
- 'enum' => array(
+ 'enum' => [
'day',
'week',
'month',
'year',
- ),
- ),
- 'discount_code' => array(
+ ],
+ ],
+ 'discount_code' => [
'description' => __('A discount code. E.g. PROMO10.', 'wp-ultimo'),
'type' => 'string',
- ),
- 'auto_renew' => array(
+ ],
+ 'auto_renew' => [
'description' => __('The membership auto-renew status. Useful when integrating with other payment options via this REST API.', 'wp-ultimo'),
'type' => 'boolean',
'default' => false,
'required' => true,
- ),
- 'country' => array(
+ ],
+ 'country' => [
'description' => __('The customer country. Used to calculate taxes and check if registration is allowed for that country.', 'wp-ultimo'),
'type' => 'string',
'default' => '',
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __('The currency to be used.', 'wp-ultimo'),
'type' => 'string',
- ),
- );
+ ],
+ ];
$args = array_merge($customer_args, $membership_args, $cart_args, $payment_args, $site_args);
@@ -616,13 +616,13 @@ class Register_Endpoint {
* the site on WordPress.
*/
$transient = array_merge(
- wu_get_isset($site_data, 'site_meta', array()),
- wu_get_isset($site_data, 'site_option', array())
+ wu_get_isset($site_data, 'site_meta', []),
+ wu_get_isset($site_data, 'site_option', [])
);
$template_id = apply_filters('wu_checkout_template_id', (int) wu_get_isset($site_data, 'template_id'), $membership, $this);
- $site_data = array(
+ $site_data = [
'domain' => $d->domain,
'path' => $d->path,
'title' => wu_get_isset($site_data, 'site_title'),
@@ -630,10 +630,10 @@ class Register_Endpoint {
'customer_id' => $membership->get_customer()->get_id(),
'membership_id' => $membership->get_id(),
'transient' => $transient,
- 'signup_meta' => wu_get_isset($site_data, 'site_meta', array()),
- 'signup_options' => wu_get_isset($site_data, 'site_option', array()),
+ 'signup_meta' => wu_get_isset($site_data, 'site_meta', []),
+ 'signup_options' => wu_get_isset($site_data, 'site_option', []),
'type' => Site_Type::CUSTOMER_OWNED,
- );
+ ];
$membership->create_pending_site($site_data);
@@ -664,7 +664,7 @@ class Register_Endpoint {
*/
public function validation_rules() {
- return array(
+ return [
'customer_id' => 'required_without:customer',
'customer' => 'required_without:customer_id',
'customer.username' => 'required_without_all:customer_id,customer.user_id',
@@ -673,7 +673,7 @@ class Register_Endpoint {
'customer.user_id' => 'required_without_all:customer_id,customer.username,customer.password,customer.email',
'site.site_url' => 'required_with:site|alpha_num|min:4|lowercase|unique_site',
'site.site_title' => 'required_with:site|min:4',
- );
+ ];
}
/**
* Validates the rules and make sure we only save models when necessary.
diff --git a/inc/api/schemas/broadcast-create.php b/inc/api/schemas/broadcast-create.php
index 441e779..1f23764 100644
--- a/inc/api/schemas/broadcast-create.php
+++ b/inc/api/schemas/broadcast-create.php
@@ -18,76 +18,76 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'migrated_from_id' => array(
+return [
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'notice_type' => array(
+ ],
+ 'notice_type' => [
'description' => __('Can be info, success, warning or error.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'info',
'success',
'warning',
'error',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'description' => __('This broadcast name, which is used as broadcast title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type being set.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __('The status being set.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'author_id' => array(
+ ],
+ 'author_id' => [
'description' => __('The author ID.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('Post title.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'content' => array(
+ ],
+ 'content' => [
'description' => __('Post content.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'excerpt' => array(
+ ],
+ 'excerpt' => [
'description' => __('Post excerpt.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Post creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Post last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The slug.', 'wp-ultimo'),
'type' => 'mixed',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/broadcast-update.php b/inc/api/schemas/broadcast-update.php
index f4623f2..bf2abcf 100644
--- a/inc/api/schemas/broadcast-update.php
+++ b/inc/api/schemas/broadcast-update.php
@@ -18,76 +18,76 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'migrated_from_id' => array(
+return [
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'notice_type' => array(
+ ],
+ 'notice_type' => [
'description' => __('Can be info, success, warning or error.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'info',
'success',
'warning',
'error',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'description' => __('This broadcast name, which is used as broadcast title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type being set.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __('The status being set.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'author_id' => array(
+ ],
+ 'author_id' => [
'description' => __('The author ID.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('Post title.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'content' => array(
+ ],
+ 'content' => [
'description' => __('Post content.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'excerpt' => array(
+ ],
+ 'excerpt' => [
'description' => __('Post excerpt.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Post creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Post last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The slug.', 'wp-ultimo'),
'type' => 'mixed',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/checkout-form-create.php b/inc/api/schemas/checkout-form-create.php
index b2ff915..afb13ad 100644
--- a/inc/api/schemas/checkout-form-create.php
+++ b/inc/api/schemas/checkout-form-create.php
@@ -18,75 +18,75 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'slug' => array(
+return [
+ 'slug' => [
'description' => __('The checkout form slug. It needs to be unique and preferably make it clear what it is about. E.g. my_checkout_form.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('Your checkout form name, which is used as checkout form title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this checkout form as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => true,
- ),
- 'custom_css' => array(
+ ],
+ 'custom_css' => [
'description' => __('Custom CSS code for the checkout form.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'settings' => array(
+ ],
+ 'settings' => [
'description' => __('The checkout form settings and configurations.', 'wp-ultimo'),
'type' => 'object',
'required' => false,
- ),
- 'allowed_countries' => array(
+ ],
+ 'allowed_countries' => [
'description' => __('The allowed countries that can access this checkout.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'thank_you_page_id' => array(
+ ],
+ 'thank_you_page_id' => [
'description' => __('The thank you page ID. This page is shown after a successful purchase.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'conversion_snippets' => array(
+ ],
+ 'conversion_snippets' => [
'description' => __('Snippets to run on thank you page.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'template' => array(
+ ],
+ 'template' => [
'description' => __("Template mode. Can be either 'blank', 'single-step' or 'multi-step'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'blank',
'single-step',
'multi-step',
- ),
- ),
- 'date_created' => array(
+ ],
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/checkout-form-update.php b/inc/api/schemas/checkout-form-update.php
index bbdbe4c..04cf99b 100644
--- a/inc/api/schemas/checkout-form-update.php
+++ b/inc/api/schemas/checkout-form-update.php
@@ -18,75 +18,75 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'slug' => array(
+return [
+ 'slug' => [
'description' => __('The checkout form slug. It needs to be unique and preferably make it clear what it is about. E.g. my_checkout_form.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('Your checkout form name, which is used as checkout form title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this checkout form as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'custom_css' => array(
+ ],
+ 'custom_css' => [
'description' => __('Custom CSS code for the checkout form.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'settings' => array(
+ ],
+ 'settings' => [
'description' => __('The checkout form settings and configurations.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'allowed_countries' => array(
+ ],
+ 'allowed_countries' => [
'description' => __('The allowed countries that can access this checkout.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'thank_you_page_id' => array(
+ ],
+ 'thank_you_page_id' => [
'description' => __('The thank you page ID. This page is shown after a successful purchase.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'conversion_snippets' => array(
+ ],
+ 'conversion_snippets' => [
'description' => __('Snippets to run on thank you page.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'template' => array(
+ ],
+ 'template' => [
'description' => __("Template mode. Can be either 'blank', 'single-step' or 'multi-step'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'blank',
'single-step',
'multi-step',
- ),
- ),
- 'date_created' => array(
+ ],
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/customer-create.php b/inc/api/schemas/customer-create.php
index a19585b..3204a0f 100644
--- a/inc/api/schemas/customer-create.php
+++ b/inc/api/schemas/customer-create.php
@@ -18,83 +18,83 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'user_id' => array(
+return [
+ 'user_id' => [
'description' => __('The WordPress user ID attached to this customer.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'date_registered' => array(
+ ],
+ 'date_registered' => [
'description' => __('Date when the customer was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'email_verification' => array(
+ ],
+ 'email_verification' => [
'description' => __('Email verification status - either `none`, `pending`, or `verified`.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'verified',
'pending',
'none',
- ),
- ),
- 'last_login' => array(
+ ],
+ ],
+ 'last_login' => [
'description' => __('Date this customer last logged in.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'has_trialed' => array(
+ ],
+ 'has_trialed' => [
'description' => __('Whether or not the customer has trialed before.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'vip' => array(
+ ],
+ 'vip' => [
'description' => __('If this customer is a VIP customer or not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'ips' => array(
+ ],
+ 'ips' => [
'description' => __('List of IP addresses used by this customer.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'extra_information' => array(
+ ],
+ 'extra_information' => [
'description' => __('Any extra information related to this customer.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The customer type. Can be 'customer'.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'customer',
- ),
- ),
- 'signup_form' => array(
+ ],
+ ],
+ 'signup_form' => [
'description' => __('The form used to signup.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/customer-update.php b/inc/api/schemas/customer-update.php
index ad04cf0..7a31b9c 100644
--- a/inc/api/schemas/customer-update.php
+++ b/inc/api/schemas/customer-update.php
@@ -18,83 +18,83 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'user_id' => array(
+return [
+ 'user_id' => [
'description' => __('The WordPress user ID attached to this customer.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_registered' => array(
+ ],
+ 'date_registered' => [
'description' => __('Date when the customer was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'email_verification' => array(
+ ],
+ 'email_verification' => [
'description' => __('Email verification status - either `none`, `pending`, or `verified`.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'verified',
'pending',
'none',
- ),
- ),
- 'last_login' => array(
+ ],
+ ],
+ 'last_login' => [
'description' => __('Date this customer last logged in.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'has_trialed' => array(
+ ],
+ 'has_trialed' => [
'description' => __('Whether or not the customer has trialed before.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'vip' => array(
+ ],
+ 'vip' => [
'description' => __('If this customer is a VIP customer or not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'ips' => array(
+ ],
+ 'ips' => [
'description' => __('List of IP addresses used by this customer.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'extra_information' => array(
+ ],
+ 'extra_information' => [
'description' => __('Any extra information related to this customer.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The customer type. Can be 'customer'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'customer',
- ),
- ),
- 'signup_form' => array(
+ ],
+ ],
+ 'signup_form' => [
'description' => __('The form used to signup.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/discount-code-create.php b/inc/api/schemas/discount-code-create.php
index d247f66..1dbeccf 100644
--- a/inc/api/schemas/discount-code-create.php
+++ b/inc/api/schemas/discount-code-create.php
@@ -18,108 +18,108 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'name' => array(
+return [
+ 'name' => [
'description' => __('Your discount code name, which is used as discount code title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'code' => array(
+ ],
+ 'code' => [
'description' => __('A unique identification to redeem the discount code. E.g. PROMO10.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the discount code, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'uses' => array(
+ ],
+ 'uses' => [
'description' => __('Number of times this discount was applied.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'max_uses' => array(
+ ],
+ 'max_uses' => [
'description' => __('The number of times this discount can be used before becoming inactive.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'apply_to_renewals' => array(
+ ],
+ 'apply_to_renewals' => [
'description' => __('Wether or not we should apply the discount to membership renewals.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The type of the discount code. Can be 'percentage' (e.g. 10%% OFF), 'absolute' (e.g. $10 OFF).", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'percentage',
'absolute',
- ),
- ),
- 'value' => array(
+ ],
+ ],
+ 'value' => [
'description' => __('Amount discounted in cents.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'setup_fee_type' => array(
+ ],
+ 'setup_fee_type' => [
'description' => __('Type of the discount for the setup fee value. Can be a percentage or absolute.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'percentage',
'absolute',
- ),
- ),
- 'setup_fee_value' => array(
+ ],
+ ],
+ 'setup_fee_value' => [
'description' => __('Amount discounted for setup fees in cents.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this discount code as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_start' => array(
+ ],
+ 'date_start' => [
'description' => __('Start date for the coupon code to be considered valid.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_expiration' => array(
+ ],
+ 'date_expiration' => [
'description' => __('Expiration date for the coupon code.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this discount code was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'allowed_products' => array(
+ ],
+ 'allowed_products' => [
'description' => __('The list of products that allows this discount code to be used. If empty, all products will accept this code.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'limit_products' => array(
+ ],
+ 'limit_products' => [
'description' => __('This discount code will be limited to be used in certain products? If set to true, you must define a list of allowed products.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/discount-code-update.php b/inc/api/schemas/discount-code-update.php
index 98a6664..f7e5874 100644
--- a/inc/api/schemas/discount-code-update.php
+++ b/inc/api/schemas/discount-code-update.php
@@ -18,108 +18,108 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'name' => array(
+return [
+ 'name' => [
'description' => __('Your discount code name, which is used as discount code title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'code' => array(
+ ],
+ 'code' => [
'description' => __('A unique identification to redeem the discount code. E.g. PROMO10.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the discount code, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'uses' => array(
+ ],
+ 'uses' => [
'description' => __('Number of times this discount was applied.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'max_uses' => array(
+ ],
+ 'max_uses' => [
'description' => __('The number of times this discount can be used before becoming inactive.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'apply_to_renewals' => array(
+ ],
+ 'apply_to_renewals' => [
'description' => __('Wether or not we should apply the discount to membership renewals.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The type of the discount code. Can be 'percentage' (e.g. 10%% OFF), 'absolute' (e.g. $10 OFF).", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'percentage',
'absolute',
- ),
- ),
- 'value' => array(
+ ],
+ ],
+ 'value' => [
'description' => __('Amount discounted in cents.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'setup_fee_type' => array(
+ ],
+ 'setup_fee_type' => [
'description' => __('Type of the discount for the setup fee value. Can be a percentage or absolute.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'percentage',
'absolute',
- ),
- ),
- 'setup_fee_value' => array(
+ ],
+ ],
+ 'setup_fee_value' => [
'description' => __('Amount discounted for setup fees in cents.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this discount code as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_start' => array(
+ ],
+ 'date_start' => [
'description' => __('Start date for the coupon code to be considered valid.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_expiration' => array(
+ ],
+ 'date_expiration' => [
'description' => __('Expiration date for the coupon code.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this discount code was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'allowed_products' => array(
+ ],
+ 'allowed_products' => [
'description' => __('The list of products that allows this discount code to be used. If empty, all products will accept this code.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'limit_products' => array(
+ ],
+ 'limit_products' => [
'description' => __('This discount code will be limited to be used in certain products? If set to true, you must define a list of allowed products.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/domain-create.php b/inc/api/schemas/domain-create.php
index af42fa5..a851236 100644
--- a/inc/api/schemas/domain-create.php
+++ b/inc/api/schemas/domain-create.php
@@ -18,62 +18,62 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'domain' => array(
+return [
+ 'domain' => [
'description' => __("Your Domain name. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'blog_id' => array(
+ ],
+ 'blog_id' => [
'description' => __('The blog ID attached to this domain.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this domain as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'primary_domain' => array(
+ ],
+ 'primary_domain' => [
'description' => __("Define true to set this as primary domain of a site, meaning it's the main url, or set false.", 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'secure' => array(
+ ],
+ 'secure' => [
'description' => __('If this domain has some SSL security or not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'stage' => array(
+ ],
+ 'stage' => [
'description' => __('The state of the domain model object. Can be one of this options: checking-dns, checking-ssl-cert, done-without-ssl, done and failed.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'checking-dns',
'checking-ssl-cert',
'done-without-ssl',
'done',
'failed',
- ),
- ),
- 'date_created' => array(
+ ],
+ ],
+ 'date_created' => [
'description' => __('Date when the domain was created. If no date is set, the current date and time will be used.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/domain-update.php b/inc/api/schemas/domain-update.php
index af38fe9..37a35a0 100644
--- a/inc/api/schemas/domain-update.php
+++ b/inc/api/schemas/domain-update.php
@@ -18,62 +18,62 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'domain' => array(
+return [
+ 'domain' => [
'description' => __("Your Domain name. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'blog_id' => array(
+ ],
+ 'blog_id' => [
'description' => __('The blog ID attached to this domain.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this domain as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'primary_domain' => array(
+ ],
+ 'primary_domain' => [
'description' => __("Define true to set this as primary domain of a site, meaning it's the main url, or set false.", 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'secure' => array(
+ ],
+ 'secure' => [
'description' => __('If this domain has some SSL security or not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'stage' => array(
+ ],
+ 'stage' => [
'description' => __('The state of the domain model object. Can be one of this options: checking-dns, checking-ssl-cert, done-without-ssl, done and failed.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'checking-dns',
'checking-ssl-cert',
'done-without-ssl',
'done',
'failed',
- ),
- ),
- 'date_created' => array(
+ ],
+ ],
+ 'date_created' => [
'description' => __('Date when the domain was created. If no date is set, the current date and time will be used.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/email-create.php b/inc/api/schemas/email-create.php
index bc5d02b..504ec28 100644
--- a/inc/api/schemas/email-create.php
+++ b/inc/api/schemas/email-create.php
@@ -18,127 +18,127 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'style' => array(
+return [
+ 'style' => [
'description' => __("The email style. Can be 'html' or 'plain-text'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'html',
'plain-text',
- ),
- ),
- 'schedule' => array(
+ ],
+ ],
+ 'schedule' => [
'description' => __('Whether or not this is a scheduled email.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type being set.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'event' => array(
+ ],
+ 'event' => [
'description' => __('The event that needs to be fired for this email to be sent.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'send_hours' => array(
+ ],
+ 'send_hours' => [
'description' => __('The amount of hours that the email will wait before is sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'send_days' => array(
+ ],
+ 'send_days' => [
'description' => __('The amount of days that the email will wait before is sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'schedule_type' => array(
+ ],
+ 'schedule_type' => [
'description' => __("The type of schedule. Can be 'days' or 'hours'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'days',
'hours',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'description' => __('The name being set as title.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'custom_sender' => array(
+ ],
+ 'custom_sender' => [
'description' => __('If has a custom sender.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'custom_sender_name' => array(
+ ],
+ 'custom_sender_name' => [
'description' => __('The name of the custom sender. E.g. From: John Doe.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'custom_sender_email' => array(
+ ],
+ 'custom_sender_email' => [
'description' => __('The email of the custom sender. E.g. From: johndoe@gmail.com.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'target' => array(
+ ],
+ 'target' => [
'description' => __("If we should send this to a customer or to the network admin. Can be 'customer' or 'admin'.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'customer',
'admin',
- ),
- ),
- 'send_copy_to_admin' => array(
+ ],
+ ],
+ 'send_copy_to_admin' => [
'description' => __('Checks if we should send a copy of the email to the admin.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this email as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'legacy' => array(
+ ],
+ 'legacy' => [
'description' => __('Whether or not this is a legacy email.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('Post title.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'content' => array(
+ ],
+ 'content' => [
'description' => __('Post content.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'excerpt' => array(
+ ],
+ 'excerpt' => [
'description' => __('Post excerpt.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Post creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Post last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/email-update.php b/inc/api/schemas/email-update.php
index b948d31..a604767 100644
--- a/inc/api/schemas/email-update.php
+++ b/inc/api/schemas/email-update.php
@@ -18,127 +18,127 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'style' => array(
+return [
+ 'style' => [
'description' => __("The email style. Can be 'html' or 'plain-text'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'html',
'plain-text',
- ),
- ),
- 'schedule' => array(
+ ],
+ ],
+ 'schedule' => [
'description' => __('Whether or not this is a scheduled email.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type being set.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'event' => array(
+ ],
+ 'event' => [
'description' => __('The event that needs to be fired for this email to be sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'send_hours' => array(
+ ],
+ 'send_hours' => [
'description' => __('The amount of hours that the email will wait before is sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'send_days' => array(
+ ],
+ 'send_days' => [
'description' => __('The amount of days that the email will wait before is sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'schedule_type' => array(
+ ],
+ 'schedule_type' => [
'description' => __("The type of schedule. Can be 'days' or 'hours'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'days',
'hours',
- ),
- ),
- 'name' => array(
+ ],
+ ],
+ 'name' => [
'description' => __('The name being set as title.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'custom_sender' => array(
+ ],
+ 'custom_sender' => [
'description' => __('If has a custom sender.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'custom_sender_name' => array(
+ ],
+ 'custom_sender_name' => [
'description' => __('The name of the custom sender. E.g. From: John Doe.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'custom_sender_email' => array(
+ ],
+ 'custom_sender_email' => [
'description' => __('The email of the custom sender. E.g. From: johndoe@gmail.com.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'target' => array(
+ ],
+ 'target' => [
'description' => __("If we should send this to a customer or to the network admin. Can be 'customer' or 'admin'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'customer',
'admin',
- ),
- ),
- 'send_copy_to_admin' => array(
+ ],
+ ],
+ 'send_copy_to_admin' => [
'description' => __('Checks if we should send a copy of the email to the admin.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this email as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'legacy' => array(
+ ],
+ 'legacy' => [
'description' => __('Whether or not this is a legacy email.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('Post title.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'content' => array(
+ ],
+ 'content' => [
'description' => __('Post content.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'excerpt' => array(
+ ],
+ 'excerpt' => [
'description' => __('Post excerpt.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Post creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Post last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/event-create.php b/inc/api/schemas/event-create.php
index b8c463c..9f82b38 100644
--- a/inc/api/schemas/event-create.php
+++ b/inc/api/schemas/event-create.php
@@ -18,59 +18,59 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'severity' => array(
+return [
+ 'severity' => [
'description' => __('Severity of the problem.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when the event was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'payload' => array(
+ ],
+ 'payload' => [
'description' => __('Payload of the event.', 'wp-ultimo'),
'type' => 'object',
'required' => true,
- ),
- 'initiator' => array(
+ ],
+ 'initiator' => [
'description' => __('The type of user responsible for initiating the event. There are two options: Manual and System. By default, the event is saved as manual.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'system',
'manual',
- ),
- ),
- 'object_type' => array(
+ ],
+ ],
+ 'object_type' => [
'description' => __("The type of object related to this event. It's usually the model name.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The event slug. It needs to be unique and preferably make it clear what it is about. Example: account_created is about creating an account.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'object_id' => array(
+ ],
+ 'object_id' => [
'description' => __('The ID of the related objects.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/event-update.php b/inc/api/schemas/event-update.php
index 3b79553..e8abcf8 100644
--- a/inc/api/schemas/event-update.php
+++ b/inc/api/schemas/event-update.php
@@ -18,59 +18,59 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'severity' => array(
+return [
+ 'severity' => [
'description' => __('Severity of the problem.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when the event was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'payload' => array(
+ ],
+ 'payload' => [
'description' => __('Payload of the event.', 'wp-ultimo'),
'type' => 'object',
'required' => false,
- ),
- 'initiator' => array(
+ ],
+ 'initiator' => [
'description' => __('The type of user responsible for initiating the event. There are two options: Manual and System. By default, the event is saved as manual.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'system',
'manual',
- ),
- ),
- 'object_type' => array(
+ ],
+ ],
+ 'object_type' => [
'description' => __("The type of object related to this event. It's usually the model name.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The event slug. It needs to be unique and preferably make it clear what it is about. Example: account_created is about creating an account.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'object_id' => array(
+ ],
+ 'object_id' => [
'description' => __('The ID of the related objects.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/membership-create.php b/inc/api/schemas/membership-create.php
index 6b2a558..c5cbf4d 100644
--- a/inc/api/schemas/membership-create.php
+++ b/inc/api/schemas/membership-create.php
@@ -20,162 +20,162 @@ use WP_Ultimo\Database\Memberships\Membership_Status;
*
* @since 2.0.11
*/
-return array(
- 'customer_id' => array(
+return [
+ 'customer_id' => [
'description' => __('The ID of the customer attached to this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'user_id' => array(
+ ],
+ 'user_id' => [
'description' => __('The user ID attached to this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'plan_id' => array(
+ ],
+ 'plan_id' => [
'description' => __('The plan ID associated with the membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'addon_products' => array(
+ ],
+ 'addon_products' => [
'description' => __('Additional products related to this membership. Services, Packages or other types of products.', 'wp-ultimo'),
'type' => 'mixed',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency that this membership. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'duration' => array(
+ ],
+ 'duration' => [
'description' => __('The interval period between a charge. Only the interval amount, the unit will be defined in another property.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'duration_unit' => array(
+ ],
+ 'duration_unit' => [
'description' => __("The duration amount type. Can be 'day', 'week', 'month' or 'year'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'month',
'week',
'year',
- ),
- ),
- 'amount' => array(
+ ],
+ ],
+ 'amount' => [
'description' => __('The product amount.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'initial_amount' => array(
+ ],
+ 'initial_amount' => [
'description' => __('The initial amount charged for this membership, including the setup fee.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date of creation of this membership.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_activated' => array(
+ ],
+ 'date_activated' => [
'description' => __('Date when this membership was activated.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_trial_end' => array(
+ ],
+ 'date_trial_end' => [
'description' => __('Date when the trial period ends, if this membership has or had a trial period.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_renewed' => array(
+ ],
+ 'date_renewed' => [
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_cancellation' => array(
+ ],
+ 'date_cancellation' => [
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_expiration' => array(
+ ],
+ 'date_expiration' => [
'description' => __('Date when the membership will expiry.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_payment_plan_completed' => array(
+ ],
+ 'date_payment_plan_completed' => [
'description' => __('Change of the payment completion for the plan value.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'auto_renew' => array(
+ ],
+ 'auto_renew' => [
'description' => __('If this membership should auto-renewal.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'times_billed' => array(
+ ],
+ 'times_billed' => [
'description' => __('Amount of times this membership got billed.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'billing_cycles' => array(
+ ],
+ 'billing_cycles' => [
'description' => __('Maximum times we should charge this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __("The membership status. Can be 'pending', 'active', 'on-hold', 'expired', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
'enum' => Membership_Status::get_allowed_list(),
- ),
- 'gateway_customer_id' => array(
+ ],
+ 'gateway_customer_id' => [
'description' => __('The ID of the customer on the payment gateway database.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'gateway_subscription_id' => array(
+ ],
+ 'gateway_subscription_id' => [
'description' => __('The ID of the subscription on the payment gateway database.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'gateway' => array(
+ ],
+ 'gateway' => [
'description' => __('ID of the gateway being used on this subscription.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'signup_method' => array(
+ ],
+ 'signup_method' => [
'description' => __('Signup method used to create this membership.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'upgraded_from' => array(
+ ],
+ 'upgraded_from' => [
'description' => __('Plan that this membership upgraded from.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Date this membership was last modified.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'disabled' => array(
+ ],
+ 'disabled' => [
'description' => __('If this membership is a disabled one.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'recurring' => array(
+ ],
+ 'recurring' => [
'description' => __('If this membership is recurring (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/membership-update.php b/inc/api/schemas/membership-update.php
index c34fb61..2db88fa 100644
--- a/inc/api/schemas/membership-update.php
+++ b/inc/api/schemas/membership-update.php
@@ -20,162 +20,162 @@ use WP_Ultimo\Database\Memberships\Membership_Status;
*
* @since 2.0.11
*/
-return array(
- 'customer_id' => array(
+return [
+ 'customer_id' => [
'description' => __('The ID of the customer attached to this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'user_id' => array(
+ ],
+ 'user_id' => [
'description' => __('The user ID attached to this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'plan_id' => array(
+ ],
+ 'plan_id' => [
'description' => __('The plan ID associated with the membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'addon_products' => array(
+ ],
+ 'addon_products' => [
'description' => __('Additional products related to this membership. Services, Packages or other types of products.', 'wp-ultimo'),
'type' => 'mixed',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency that this membership. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'duration' => array(
+ ],
+ 'duration' => [
'description' => __('The interval period between a charge. Only the interval amount, the unit will be defined in another property.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'duration_unit' => array(
+ ],
+ 'duration_unit' => [
'description' => __("The duration amount type. Can be 'day', 'week', 'month' or 'year'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'month',
'week',
'year',
- ),
- ),
- 'amount' => array(
+ ],
+ ],
+ 'amount' => [
'description' => __('The product amount.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'initial_amount' => array(
+ ],
+ 'initial_amount' => [
'description' => __('The initial amount charged for this membership, including the setup fee.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date of creation of this membership.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_activated' => array(
+ ],
+ 'date_activated' => [
'description' => __('Date when this membership was activated.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_trial_end' => array(
+ ],
+ 'date_trial_end' => [
'description' => __('Date when the trial period ends, if this membership has or had a trial period.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_renewed' => array(
+ ],
+ 'date_renewed' => [
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_cancellation' => array(
+ ],
+ 'date_cancellation' => [
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_expiration' => array(
+ ],
+ 'date_expiration' => [
'description' => __('Date when the membership will expiry.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_payment_plan_completed' => array(
+ ],
+ 'date_payment_plan_completed' => [
'description' => __('Change of the payment completion for the plan value.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'auto_renew' => array(
+ ],
+ 'auto_renew' => [
'description' => __('If this membership should auto-renewal.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'times_billed' => array(
+ ],
+ 'times_billed' => [
'description' => __('Amount of times this membership got billed.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'billing_cycles' => array(
+ ],
+ 'billing_cycles' => [
'description' => __('Maximum times we should charge this membership.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __("The membership status. Can be 'pending', 'active', 'on-hold', 'expired', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
'enum' => Membership_Status::get_allowed_list(),
- ),
- 'gateway_customer_id' => array(
+ ],
+ 'gateway_customer_id' => [
'description' => __('The ID of the customer on the payment gateway database.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'gateway_subscription_id' => array(
+ ],
+ 'gateway_subscription_id' => [
'description' => __('The ID of the subscription on the payment gateway database.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'gateway' => array(
+ ],
+ 'gateway' => [
'description' => __('ID of the gateway being used on this subscription.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'signup_method' => array(
+ ],
+ 'signup_method' => [
'description' => __('Signup method used to create this membership.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'upgraded_from' => array(
+ ],
+ 'upgraded_from' => [
'description' => __('Plan that this membership upgraded from.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Date this membership was last modified.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'disabled' => array(
+ ],
+ 'disabled' => [
'description' => __('If this membership is a disabled one.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'recurring' => array(
+ ],
+ 'recurring' => [
'description' => __('If this membership is recurring (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/payment-create.php b/inc/api/schemas/payment-create.php
index 5ec3e2a..1975ec0 100644
--- a/inc/api/schemas/payment-create.php
+++ b/inc/api/schemas/payment-create.php
@@ -20,106 +20,106 @@ use WP_Ultimo\Database\Payments\Payment_Status;
*
* @since 2.0.11
*/
-return array(
- 'customer_id' => array(
+return [
+ 'customer_id' => [
'description' => __('The ID of the customer attached to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'membership_id' => array(
+ ],
+ 'membership_id' => [
'description' => __('The ID of the membership attached to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'parent_id' => array(
+ ],
+ 'parent_id' => [
'description' => __('The ID from another payment that this payment is related to.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency of this payment. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'subtotal' => array(
+ ],
+ 'subtotal' => [
'description' => __('Value before taxes, discounts, fees and other changes.', 'wp-ultimo'),
'type' => 'number',
'required' => true,
- ),
- 'refund_total' => array(
+ ],
+ 'refund_total' => [
'description' => __('Total amount refunded.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'tax_total' => array(
+ ],
+ 'tax_total' => [
'description' => __('The amount, in currency, of the tax.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'discount_code' => array(
+ ],
+ 'discount_code' => [
'description' => __('Discount code used.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'total' => array(
+ ],
+ 'total' => [
'description' => __('This takes into account fees, discounts and credits.', 'wp-ultimo'),
'type' => 'number',
'required' => true,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __("The payment status: Can be 'pending', 'completed', 'refunded', 'partially-refunded', 'partially-paid', 'failed', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
'enum' => Payment_Status::get_allowed_list(),
- ),
- 'gateway' => array(
+ ],
+ 'gateway' => [
'description' => __('ID of the gateway being used on this payment.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'product_id' => array(
+ ],
+ 'product_id' => [
'description' => __('The ID of the product of this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'gateway_payment_id' => array(
+ ],
+ 'gateway_payment_id' => [
'description' => __('The ID of the payment on the gateway, if it exists.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'discount_total' => array(
+ ],
+ 'discount_total' => [
'description' => __('The total value of the discounts applied to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'invoice_number' => array(
+ ],
+ 'invoice_number' => [
'description' => __('Sequential invoice number assigned to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'cancel_membership_on_refund' => array(
+ ],
+ 'cancel_membership_on_refund' => [
'description' => __('Holds if we need to cancel the membership on refund.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/payment-update.php b/inc/api/schemas/payment-update.php
index 68574cc..51aa85c 100644
--- a/inc/api/schemas/payment-update.php
+++ b/inc/api/schemas/payment-update.php
@@ -20,106 +20,106 @@ use WP_Ultimo\Database\Payments\Payment_Status;
*
* @since 2.0.11
*/
-return array(
- 'customer_id' => array(
+return [
+ 'customer_id' => [
'description' => __('The ID of the customer attached to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'membership_id' => array(
+ ],
+ 'membership_id' => [
'description' => __('The ID of the membership attached to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'parent_id' => array(
+ ],
+ 'parent_id' => [
'description' => __('The ID from another payment that this payment is related to.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency of this payment. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'subtotal' => array(
+ ],
+ 'subtotal' => [
'description' => __('Value before taxes, discounts, fees and other changes.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'refund_total' => array(
+ ],
+ 'refund_total' => [
'description' => __('Total amount refunded.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'tax_total' => array(
+ ],
+ 'tax_total' => [
'description' => __('The amount, in currency, of the tax.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'discount_code' => array(
+ ],
+ 'discount_code' => [
'description' => __('Discount code used.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'total' => array(
+ ],
+ 'total' => [
'description' => __('This takes into account fees, discounts and credits.', 'wp-ultimo'),
'type' => 'number',
'required' => false,
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => __("The payment status: Can be 'pending', 'completed', 'refunded', 'partially-refunded', 'partially-paid', 'failed', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
'enum' => Payment_Status::get_allowed_list(),
- ),
- 'gateway' => array(
+ ],
+ 'gateway' => [
'description' => __('ID of the gateway being used on this payment.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'product_id' => array(
+ ],
+ 'product_id' => [
'description' => __('The ID of the product of this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'gateway_payment_id' => array(
+ ],
+ 'gateway_payment_id' => [
'description' => __('The ID of the payment on the gateway, if it exists.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'discount_total' => array(
+ ],
+ 'discount_total' => [
'description' => __('The total value of the discounts applied to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'invoice_number' => array(
+ ],
+ 'invoice_number' => [
'description' => __('Sequential invoice number assigned to this payment.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'cancel_membership_on_refund' => array(
+ ],
+ 'cancel_membership_on_refund' => [
'description' => __('Holds if we need to cancel the membership on refund.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/product-create.php b/inc/api/schemas/product-create.php
index 3cdfa9f..b0904e2 100644
--- a/inc/api/schemas/product-create.php
+++ b/inc/api/schemas/product-create.php
@@ -18,182 +18,182 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'featured_image_id' => array(
+return [
+ 'featured_image_id' => [
'description' => __('The ID of the feature image of the product.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The product slug. It needs to be unique and preferably make it clear what it is about. Example: my_new_product.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('Your product name, which is used as product title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the product, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency that this product accepts. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'pricing_type' => array(
+ ],
+ 'pricing_type' => [
'description' => __("The pricing type can be 'free', 'paid' or 'contact_us'.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'free',
'paid',
'contact_us',
- ),
- ),
- 'trial_duration' => array(
+ ],
+ ],
+ 'trial_duration' => [
'description' => __('The duration of the trial period of this product, if the product has one.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'trial_duration_unit' => array(
+ ],
+ 'trial_duration_unit' => [
'description' => __('The unit of the trial duration amount. Can be day, week, month or year.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'week',
'month',
'year',
- ),
- ),
- 'duration' => array(
+ ],
+ ],
+ 'duration' => [
'description' => __('Time interval between charges.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'duration_unit' => array(
+ ],
+ 'duration_unit' => [
'description' => __('Time interval unit between charges.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'month',
'week',
'year',
- ),
- ),
- 'amount' => array(
+ ],
+ ],
+ 'amount' => [
'description' => __('The value of this product. E.g. 19.99.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'setup_fee' => array(
+ ],
+ 'setup_fee' => [
'description' => __('The setup fee value, if the product has one. E.g. 159.99.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this product as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The default product types are 'product', 'service' and 'package'. More types can be add using the product type filter.", 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'plan',
'service',
'package',
- ),
- ),
- 'parent_id' => array(
+ ],
+ ],
+ 'parent_id' => [
'description' => __('The ID from another Product that this product is related to.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'recurring' => array(
+ ],
+ 'recurring' => [
'description' => __('Set this product as a recurring one (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'billing_cycles' => array(
+ ],
+ 'billing_cycles' => [
'description' => __('The number of times we should charge this product.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Date when this was last modified.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'taxable' => array(
+ ],
+ 'taxable' => [
'description' => __('Set this product as a taxable one (true), which means tax rules are applied to, or not taxable (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'tax_category' => array(
+ ],
+ 'tax_category' => [
'description' => __('Category of taxes applied to this product. You need to set this if taxable is set to true.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'contact_us_label' => array(
+ ],
+ 'contact_us_label' => [
'description' => __("If the product is the 'contact_us' type, it will need a label for the contact us button.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'contact_us_link' => array(
+ ],
+ 'contact_us_link' => [
'description' => __('The url where the contact us button will lead to.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'feature_list' => array(
+ ],
+ 'feature_list' => [
'description' => __('A list (array) of features of the product.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'customer_role' => array(
+ ],
+ 'customer_role' => [
'description' => __('The customer role of this product.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'available_addons' => array(
+ ],
+ 'available_addons' => [
'description' => __('The available addons of this product.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'group' => array(
+ ],
+ 'group' => [
'description' => __('The group of this product, if has any.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'legacy_options' => array(
+ ],
+ 'legacy_options' => [
'description' => __('If the legacy options are enabled.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'featured_plan' => array(
+ ],
+ 'featured_plan' => [
'description' => __('Feature list for pricing tables.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/product-update.php b/inc/api/schemas/product-update.php
index e335a15..46a175f 100644
--- a/inc/api/schemas/product-update.php
+++ b/inc/api/schemas/product-update.php
@@ -18,182 +18,182 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'featured_image_id' => array(
+return [
+ 'featured_image_id' => [
'description' => __('The ID of the feature image of the product.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'slug' => array(
+ ],
+ 'slug' => [
'description' => __('The product slug. It needs to be unique and preferably make it clear what it is about. Example: my_new_product.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('Your product name, which is used as product title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the product, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'currency' => array(
+ ],
+ 'currency' => [
'description' => __("The currency that this product accepts. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'pricing_type' => array(
+ ],
+ 'pricing_type' => [
'description' => __("The pricing type can be 'free', 'paid' or 'contact_us'.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'free',
'paid',
'contact_us',
- ),
- ),
- 'trial_duration' => array(
+ ],
+ ],
+ 'trial_duration' => [
'description' => __('The duration of the trial period of this product, if the product has one.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'trial_duration_unit' => array(
+ ],
+ 'trial_duration_unit' => [
'description' => __('The unit of the trial duration amount. Can be day, week, month or year.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'week',
'month',
'year',
- ),
- ),
- 'duration' => array(
+ ],
+ ],
+ 'duration' => [
'description' => __('Time interval between charges.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'duration_unit' => array(
+ ],
+ 'duration_unit' => [
'description' => __('Time interval unit between charges.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'day',
'month',
'week',
'year',
- ),
- ),
- 'amount' => array(
+ ],
+ ],
+ 'amount' => [
'description' => __('The value of this product. E.g. 19.99.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'setup_fee' => array(
+ ],
+ 'setup_fee' => [
'description' => __('The setup fee value, if the product has one. E.g. 159.99.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this product as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __("The default product types are 'product', 'service' and 'package'. More types can be add using the product type filter.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'plan',
'service',
'package',
- ),
- ),
- 'parent_id' => array(
+ ],
+ ],
+ 'parent_id' => [
'description' => __('The ID from another Product that this product is related to.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'recurring' => array(
+ ],
+ 'recurring' => [
'description' => __('Set this product as a recurring one (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'billing_cycles' => array(
+ ],
+ 'billing_cycles' => [
'description' => __('The number of times we should charge this product.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Date when this was last modified.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'taxable' => array(
+ ],
+ 'taxable' => [
'description' => __('Set this product as a taxable one (true), which means tax rules are applied to, or not taxable (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'tax_category' => array(
+ ],
+ 'tax_category' => [
'description' => __('Category of taxes applied to this product. You need to set this if taxable is set to true.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'contact_us_label' => array(
+ ],
+ 'contact_us_label' => [
'description' => __("If the product is the 'contact_us' type, it will need a label for the contact us button.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'contact_us_link' => array(
+ ],
+ 'contact_us_link' => [
'description' => __('The url where the contact us button will lead to.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'feature_list' => array(
+ ],
+ 'feature_list' => [
'description' => __('A list (array) of features of the product.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'customer_role' => array(
+ ],
+ 'customer_role' => [
'description' => __('The customer role of this product.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'available_addons' => array(
+ ],
+ 'available_addons' => [
'description' => __('The available addons of this product.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'group' => array(
+ ],
+ 'group' => [
'description' => __('The group of this product, if has any.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'legacy_options' => array(
+ ],
+ 'legacy_options' => [
'description' => __('If the legacy options are enabled.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'featured_plan' => array(
+ ],
+ 'featured_plan' => [
'description' => __('Feature list for pricing tables.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/site-create.php b/inc/api/schemas/site-create.php
index 5347ae5..fdfd14e 100644
--- a/inc/api/schemas/site-create.php
+++ b/inc/api/schemas/site-create.php
@@ -18,148 +18,148 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'categories' => array(
+return [
+ 'categories' => [
'description' => __('The categories this site belongs to.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'featured_image_id' => array(
+ ],
+ 'featured_image_id' => [
'description' => __('The ID of the feature image of the site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'site_id' => array(
+ ],
+ 'site_id' => [
'description' => __('The network ID for this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('The site title.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('The site name.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the site, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'domain' => array(
+ ],
+ 'domain' => [
'description' => __("The site domain. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'path' => array(
+ ],
+ 'path' => [
'description' => __('Path of the site. Used when in sub-directory mode.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'registered' => array(
+ ],
+ 'registered' => [
'description' => __('Date when the site was registered.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'last_updated' => array(
+ ],
+ 'last_updated' => [
'description' => __('Date of the last update on this site.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Holds the ID of the customer that owns this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'public' => array(
+ ],
+ 'public' => [
'description' => __('Set true if this site is a public one, false if not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'archived' => array(
+ ],
+ 'archived' => [
'description' => __('Is this an archived site.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'mature' => array(
+ ],
+ 'mature' => [
'description' => __('Is this a site with mature content.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'spam' => array(
+ ],
+ 'spam' => [
'description' => __('Is this an spam site.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'deleted' => array(
+ ],
+ 'deleted' => [
'description' => __('Is this site deleted.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'lang_id' => array(
+ ],
+ 'lang_id' => [
'description' => __('The ID of the language being used on this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'customer_id' => array(
+ ],
+ 'customer_id' => [
'description' => __('The ID of the customer that owns this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'membership_id' => array(
+ ],
+ 'membership_id' => [
'description' => __('The ID of the membership associated with this site, if any.', 'wp-ultimo'),
'type' => 'integer',
'required' => true,
- ),
- 'template_id' => array(
+ ],
+ 'template_id' => [
'description' => __('The ID of the templated used to create this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type of this particular site. Can be default, site_template, customer_owned, pending, external, main or other values added by third-party add-ons.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- 'enum' => array(
+ 'enum' => [
'default',
'site_template',
'customer_owned',
'pending',
'external',
'main',
- ),
- ),
- 'signup_options' => array(
+ ],
+ ],
+ 'signup_options' => [
'description' => __('Keeps signup options for the site.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'signup_meta' => array(
+ ],
+ 'signup_meta' => [
'description' => __('Keeps signup meta for the site.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/site-update.php b/inc/api/schemas/site-update.php
index 92d6bc2..643306f 100644
--- a/inc/api/schemas/site-update.php
+++ b/inc/api/schemas/site-update.php
@@ -18,148 +18,148 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'categories' => array(
+return [
+ 'categories' => [
'description' => __('The categories this site belongs to.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'featured_image_id' => array(
+ ],
+ 'featured_image_id' => [
'description' => __('The ID of the feature image of the site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'site_id' => array(
+ ],
+ 'site_id' => [
'description' => __('The network ID for this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'title' => array(
+ ],
+ 'title' => [
'description' => __('The site title.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => __('The site name.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => __('A description for the site, usually a short text.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'domain' => array(
+ ],
+ 'domain' => [
'description' => __("The site domain. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'path' => array(
+ ],
+ 'path' => [
'description' => __('Path of the site. Used when in sub-directory mode.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'registered' => array(
+ ],
+ 'registered' => [
'description' => __('Date when the site was registered.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'last_updated' => array(
+ ],
+ 'last_updated' => [
'description' => __('Date of the last update on this site.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Holds the ID of the customer that owns this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'public' => array(
+ ],
+ 'public' => [
'description' => __('Set true if this site is a public one, false if not.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'archived' => array(
+ ],
+ 'archived' => [
'description' => __('Is this an archived site.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'mature' => array(
+ ],
+ 'mature' => [
'description' => __('Is this a site with mature content.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'spam' => array(
+ ],
+ 'spam' => [
'description' => __('Is this an spam site.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'deleted' => array(
+ ],
+ 'deleted' => [
'description' => __('Is this site deleted.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'lang_id' => array(
+ ],
+ 'lang_id' => [
'description' => __('The ID of the language being used on this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'customer_id' => array(
+ ],
+ 'customer_id' => [
'description' => __('The ID of the customer that owns this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'membership_id' => array(
+ ],
+ 'membership_id' => [
'description' => __('The ID of the membership associated with this site, if any.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'template_id' => array(
+ ],
+ 'template_id' => [
'description' => __('The ID of the templated used to create this site.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => __('The type of this particular site. Can be default, site_template, customer_owned, pending, external, main or other values added by third-party add-ons.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- 'enum' => array(
+ 'enum' => [
'default',
'site_template',
'customer_owned',
'pending',
'external',
'main',
- ),
- ),
- 'signup_options' => array(
+ ],
+ ],
+ 'signup_options' => [
'description' => __('Keeps signup options for the site.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'signup_meta' => array(
+ ],
+ 'signup_meta' => [
'description' => __('Keeps signup meta for the site.', 'wp-ultimo'),
'type' => 'array',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Model creation date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/webhook-create.php b/inc/api/schemas/webhook-create.php
index 77172b3..7a6160b 100644
--- a/inc/api/schemas/webhook-create.php
+++ b/inc/api/schemas/webhook-create.php
@@ -18,65 +18,65 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'name' => array(
+return [
+ 'name' => [
'description' => __('Webhook name, which is used as product title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'webhook_url' => array(
+ ],
+ 'webhook_url' => [
'description' => __('The URL used for the webhook call.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'event' => array(
+ ],
+ 'event' => [
'description' => __('The event that needs to be fired for this webhook to be sent.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'event_count' => array(
+ ],
+ 'event_count' => [
'description' => __('How many times this webhook was sent.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this webhook as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'hidden' => array(
+ ],
+ 'hidden' => [
'description' => __('Is this webhook hidden.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'integration' => array(
+ ],
+ 'integration' => [
'description' => __('The integration that created this webhook.', 'wp-ultimo'),
'type' => 'string',
'required' => true,
- ),
- 'date_last_failed' => array(
+ ],
+ 'date_last_failed' => [
'description' => __('The date when this webhook last fail.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/schemas/webhook-update.php b/inc/api/schemas/webhook-update.php
index e2d43d8..6ca7575 100644
--- a/inc/api/schemas/webhook-update.php
+++ b/inc/api/schemas/webhook-update.php
@@ -18,65 +18,65 @@ defined('ABSPATH') || exit;
*
* @since 2.0.11
*/
-return array(
- 'name' => array(
+return [
+ 'name' => [
'description' => __('Webhook name, which is used as product title as well.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'webhook_url' => array(
+ ],
+ 'webhook_url' => [
'description' => __('The URL used for the webhook call.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'event' => array(
+ ],
+ 'event' => [
'description' => __('The event that needs to be fired for this webhook to be sent.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'event_count' => array(
+ ],
+ 'event_count' => [
'description' => __('How many times this webhook was sent.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'active' => array(
+ ],
+ 'active' => [
'description' => __('Set this webhook as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'hidden' => array(
+ ],
+ 'hidden' => [
'description' => __('Is this webhook hidden.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
- 'date_created' => array(
+ ],
+ 'date_created' => [
'description' => __('Date when this was created.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'integration' => array(
+ ],
+ 'integration' => [
'description' => __('The integration that created this webhook.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_last_failed' => array(
+ ],
+ 'date_last_failed' => [
'description' => __('The date when this webhook last fail.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'date_modified' => array(
+ ],
+ 'date_modified' => [
'description' => __('Model last modification date.', 'wp-ultimo'),
'type' => 'string',
'required' => false,
- ),
- 'migrated_from_id' => array(
+ ],
+ 'migrated_from_id' => [
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
'type' => 'integer',
'required' => false,
- ),
- 'skip_validation' => array(
+ ],
+ 'skip_validation' => [
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
'type' => 'boolean',
'required' => false,
- ),
-);
+ ],
+];
diff --git a/inc/api/trait-rest-api.php b/inc/api/trait-rest-api.php
index f024b7c..c73c7ff 100644
--- a/inc/api/trait-rest-api.php
+++ b/inc/api/trait-rest-api.php
@@ -28,13 +28,13 @@ trait Rest_Api {
* @since 2.0.0
* @var array
*/
- protected $enabled_rest_endpoints = array(
+ protected $enabled_rest_endpoints = [
'get_item',
'get_items',
'create_item',
'update_item',
'delete_item',
- );
+ ];
/**
* Returns the base used right after the namespace.
@@ -54,14 +54,14 @@ trait Rest_Api {
*
* @since 2.0.0
*/
- public function enable_rest_api() {
+ public function enable_rest_api(): void {
$is_enabled = \WP_Ultimo\API::get_instance()->is_api_enabled();
if ($is_enabled) {
- add_action('rest_api_init', array($this, 'register_routes_general'));
+ add_action('rest_api_init', [$this, 'register_routes_general']);
- add_action('rest_api_init', array($this, 'register_routes_with_id'));
+ add_action('rest_api_init', [$this, 'register_routes_with_id']);
}
}
@@ -71,27 +71,27 @@ trait Rest_Api {
*
* @since 2.0.0
*/
- public function register_routes_general() {
+ public function register_routes_general(): void {
- $routes = array();
+ $routes = [];
if (in_array('get_items', $this->enabled_rest_endpoints, true)) {
- $routes = array(
- array(
+ $routes = [
+ [
'methods' => \WP_REST_Server::READABLE,
- 'callback' => array($this, 'get_items_rest'),
- 'permission_callback' => array($this, 'get_items_permissions_check'),
- ),
- );
+ 'callback' => [$this, 'get_items_rest'],
+ 'permission_callback' => [$this, 'get_items_permissions_check'],
+ ],
+ ];
}
if (in_array('create_item', $this->enabled_rest_endpoints, true)) {
- $routes[] = array(
+ $routes[] = [
'methods' => \WP_REST_Server::CREATABLE,
- 'callback' => array($this, 'create_item_rest'),
- 'permission_callback' => array($this, 'create_item_permissions_check'),
+ 'callback' => [$this, 'create_item_rest'],
+ 'permission_callback' => [$this, 'create_item_permissions_check'],
'args' => $this->get_arguments_schema(),
- );
+ ];
}
if ( ! empty($routes)) {
@@ -112,33 +112,33 @@ trait Rest_Api {
*
* @since 2.0.0
*/
- public function register_routes_with_id() {
+ public function register_routes_with_id(): void {
- $routes = array();
+ $routes = [];
if (in_array('get_item', $this->enabled_rest_endpoints, true)) {
- $routes[] = array(
+ $routes[] = [
'methods' => \WP_REST_Server::READABLE,
- 'callback' => array($this, 'get_item_rest'),
- 'permission_callback' => array($this, 'get_item_permissions_check'),
- );
+ 'callback' => [$this, 'get_item_rest'],
+ 'permission_callback' => [$this, 'get_item_permissions_check'],
+ ];
}
if (in_array('update_item', $this->enabled_rest_endpoints, true)) {
- $routes[] = array(
+ $routes[] = [
'methods' => \WP_REST_Server::EDITABLE,
- 'callback' => array($this, 'update_item_rest'),
- 'permission_callback' => array($this, 'update_item_permissions_check'),
+ 'callback' => [$this, 'update_item_rest'],
+ 'permission_callback' => [$this, 'update_item_permissions_check'],
'args' => $this->get_arguments_schema(true),
- );
+ ];
}
if (in_array('delete_item', $this->enabled_rest_endpoints, true)) {
- $routes[] = array(
+ $routes[] = [
'methods' => \WP_REST_Server::DELETABLE,
- 'callback' => array($this, 'delete_item_rest'),
- 'permission_callback' => array($this, 'delete_item_permissions_check'),
- );
+ 'callback' => [$this, 'delete_item_rest'],
+ 'permission_callback' => [$this, 'delete_item_permissions_check'],
+ ];
}
if ( ! empty($routes)) {
@@ -165,7 +165,7 @@ trait Rest_Api {
$item = $this->model_class::get_by_id($request['id']);
if (empty($item)) {
- return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
+ return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
}
return rest_ensure_response($item);
@@ -196,7 +196,7 @@ trait Rest_Api {
$body = json_decode($request->get_body(), true);
- $model_name = (new $this->model_class(array()))->model;
+ $model_name = (new $this->model_class([]))->model;
$saver_function = "wu_create_{$model_name}";
@@ -215,7 +215,7 @@ trait Rest_Api {
}
if ( ! $saved) {
- return new \WP_Error("wu_rest_{$this->slug}", __('Something went wrong (Code 1).', 'wp-ultimo'), array('status' => 400));
+ return new \WP_Error("wu_rest_{$this->slug}", __('Something went wrong (Code 1).', 'wp-ultimo'), ['status' => 400]);
}
return rest_ensure_response($item);
@@ -235,12 +235,12 @@ trait Rest_Api {
$item = $this->model_class::get_by_id($id);
if (empty($item)) {
- return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
+ return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
}
$params = array_filter(
json_decode($request->get_body(), true),
- array($this, 'is_not_credential_key'),
+ [$this, 'is_not_credential_key'],
ARRAY_FILTER_USE_KEY
);
@@ -250,7 +250,7 @@ trait Rest_Api {
if ($param === 'meta') {
$item->update_meta_batch($value);
} elseif (method_exists($item, $set_method)) {
- call_user_func(array($item, $set_method), $value);
+ call_user_func([$item, $set_method], $value);
} else {
$error_message = sprintf(
/* translators: 1. Object class name; 2. Set method name */
@@ -262,7 +262,7 @@ trait Rest_Api {
return new \WP_Error(
"wu_rest_{$this->slug}_invalid_set_method",
$error_message,
- array('status' => 400)
+ ['status' => 400]
);
}
}
@@ -292,7 +292,7 @@ trait Rest_Api {
$item = $this->model_class::get_by_id($request['id']);
if (empty($item)) {
- return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
+ return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
}
$result = $item->delete();
@@ -440,12 +440,12 @@ trait Rest_Api {
*/
private function is_not_credential_key($value) {
- $credentials_keys = array(
+ $credentials_keys = [
'api_key',
'api_secret',
'api-key',
'api-secret',
- );
+ ];
return ! in_array($value, $credentials_keys, true);
}
@@ -460,15 +460,15 @@ trait Rest_Api {
*/
private function is_not_id_key($value) {
- $arr = array(
+ $arr = [
'id',
- );
+ ];
if ($this->slug === 'site') {
- $arr = array(
+ $arr = [
'id',
'blog_id',
- );
+ ];
}
return ! in_array($value, $arr, true);
@@ -486,7 +486,7 @@ trait Rest_Api {
$schema = wu_rest_get_endpoint_schema($this->model_class, $edit ? 'update' : 'create', true);
- $args = array_filter($schema, array($this, 'is_not_id_key'), ARRAY_FILTER_USE_KEY);
+ $args = array_filter($schema, [$this, 'is_not_id_key'], ARRAY_FILTER_USE_KEY);
return $this->filter_schema_arguments($args);
}
@@ -521,12 +521,12 @@ trait Rest_Api {
$remove_status = apply_filters(
"wu_api_{$this->slug}_remove_status",
- array(
+ [
'broadcast',
'membership',
'product',
'payment',
- )
+ ]
);
if ( ! in_array($this->slug, $remove_status, true) && isset($args['status'])) {
@@ -535,12 +535,12 @@ trait Rest_Api {
$remove_slug = apply_filters(
"wu_api_{$this->slug}_remove_slug",
- array(
+ [
'broadcast',
'product',
'checkout_form',
'event',
- )
+ ]
);
if ( ! in_array($this->slug, $remove_slug, true) && isset($args['slug'])) {
diff --git a/inc/api/trait-wp-cli.php b/inc/api/trait-wp-cli.php
index ef59231..d7209f7 100644
--- a/inc/api/trait-wp-cli.php
+++ b/inc/api/trait-wp-cli.php
@@ -28,7 +28,7 @@ trait WP_CLI {
* @since 2.0.0
* @var array
*/
- protected $wp_cli_enabled_sub_commands = array();
+ protected $wp_cli_enabled_sub_commands = [];
/**
* Returns the base used right after the root.
@@ -48,7 +48,7 @@ trait WP_CLI {
*
* @since 2.0.0
*/
- public function enable_wp_cli() {
+ public function enable_wp_cli(): void {
if ( ! defined('WP_CLI')) {
return;
@@ -62,9 +62,9 @@ trait WP_CLI {
\WP_CLI::add_command(
"{$wp_cli_root} {$this->get_wp_cli_command_base()} {$sub_command}",
$sub_command_data['callback'],
- array(
+ [
'synopsis' => $sub_command_data['synopsis'],
- )
+ ]
);
}
}
@@ -72,25 +72,25 @@ trait WP_CLI {
/**
* Set wP-CLI Sub-command enabled for this entity.
*/
- public function set_wp_cli_enabled_sub_commands() {
+ public function set_wp_cli_enabled_sub_commands(): void {
- $sub_commands = array(
- 'get' => array(
- 'callback' => array($this, 'wp_cli_get_item'),
- ),
- 'list' => array(
- 'callback' => array($this, 'wp_cli_get_items'),
- ),
- 'create' => array(
- 'callback' => array($this, 'wp_cli_create_item'),
- ),
- 'update' => array(
- 'callback' => array($this, 'wp_cli_update_item'),
- ),
- 'delete' => array(
- 'callback' => array($this, 'wp_cli_delete_item'),
- ),
- );
+ $sub_commands = [
+ 'get' => [
+ 'callback' => [$this, 'wp_cli_get_item'],
+ ],
+ 'list' => [
+ 'callback' => [$this, 'wp_cli_get_items'],
+ ],
+ 'create' => [
+ 'callback' => [$this, 'wp_cli_create_item'],
+ ],
+ 'update' => [
+ 'callback' => [$this, 'wp_cli_update_item'],
+ ],
+ 'delete' => [
+ 'callback' => [$this, 'wp_cli_delete_item'],
+ ],
+ ];
$params = array_merge($this->wp_cli_get_fields(), $this->wp_cli_extra_parameters());
@@ -101,42 +101,42 @@ trait WP_CLI {
*/
$params_to_remove = apply_filters(
'wu_cli_params_to_remove',
- array(
+ [
'id',
'model',
- )
+ ]
);
$params = array_filter($params, fn($param) => ! in_array($param, $params_to_remove, true));
foreach ($sub_commands as $sub_command => &$sub_command_data) {
- $sub_command_data['synopsis'] = array();
+ $sub_command_data['synopsis'] = [];
- if (in_array($sub_command, array('get', 'update', 'delete'), true)) {
- $sub_command_data['synopsis'][] = array(
+ if (in_array($sub_command, ['get', 'update', 'delete'], true)) {
+ $sub_command_data['synopsis'][] = [
'name' => 'id',
'type' => 'positional',
'description' => __('The id for the resource.', 'wp-ultimo'),
'optional' => false,
- );
+ ];
}
- if (in_array($sub_command, array('list', 'update', 'create'), true)) {
+ if (in_array($sub_command, ['list', 'update', 'create'], true)) {
$explanation_list = wu_rest_get_endpoint_schema($this->model_class, 'update');
foreach ($params as $name) {
- $explanation = wu_get_isset($explanation_list, $name, array());
+ $explanation = wu_get_isset($explanation_list, $name, []);
$type = wu_get_isset($explanation, 'type', 'assoc');
- $field = array(
+ $field = [
'name' => $name,
'description' => wu_get_isset($explanation, 'description', __('No description found.', 'wp-ultimo')),
'optional' => ! wu_get_isset($explanation, 'required'),
'type' => 'assoc',
- );
+ ];
- $options = wu_get_isset($explanation, 'options', array());
+ $options = wu_get_isset($explanation, 'options', []);
if ($options) {
$field['options'] = $options;
@@ -146,39 +146,39 @@ trait WP_CLI {
}
}
- if (in_array($sub_command, array('create', 'update'), true)) {
- $sub_command_data['synopsis'][] = array(
+ if (in_array($sub_command, ['create', 'update'], true)) {
+ $sub_command_data['synopsis'][] = [
'name' => 'porcelain',
'type' => 'flag',
'description' => __('Output just the id when the operation is successful.', 'wp-ultimo'),
'optional' => true,
- );
+ ];
}
- if (in_array($sub_command, array('list', 'get'), true)) {
- $sub_command_data['synopsis'][] = array(
+ if (in_array($sub_command, ['list', 'get'], true)) {
+ $sub_command_data['synopsis'][] = [
'name' => 'format',
'type' => 'assoc',
'description' => __('Render response in a particular format.', 'wp-ultimo'),
'optional' => true,
'default' => 'table',
- 'options' => array(
+ 'options' => [
'table',
'json',
'csv',
'ids',
'yaml',
'count',
- ),
- );
+ ],
+ ];
- $sub_command_data['synopsis'][] = array(
+ $sub_command_data['synopsis'][] = [
'name' => 'fields',
'type' => 'assoc',
'description' => __('Limit response to specific fields. Defaults to id, name', 'wp-ultimo'),
'optional' => true,
- 'options' => array_merge(array('id'), $params),
- );
+ 'options' => array_merge(['id'], $params),
+ ];
}
}
@@ -233,7 +233,7 @@ trait WP_CLI {
* @param array $args Positional arguments passed. ID expected.
* @param array $array_assoc Assoc arguments passed.
*/
- public function wp_cli_get_item($args, $array_assoc) {
+ public function wp_cli_get_item($args, $array_assoc): void {
$item = $this->model_class::get_by_id($args[0]);
@@ -256,7 +256,7 @@ trait WP_CLI {
* @param array $args Positional arguments passed. ID expected.
* @param array $array_assoc Assoc arguments passed.
*/
- public function wp_cli_get_items($args, $array_assoc) {
+ public function wp_cli_get_items($args, $array_assoc): void {
$fields = (! empty($array_assoc['fields'])) ? $array_assoc['fields'] : $this->wp_cli_get_fields();
@@ -277,7 +277,7 @@ trait WP_CLI {
* @param array $args Positional arguments passed. ID expected.
* @param array $array_assoc Assoc arguments passed.
*/
- public function wp_cli_create_item($args, $array_assoc) {
+ public function wp_cli_create_item($args, $array_assoc): void {
$item = new $this->model_class($array_assoc);
@@ -306,7 +306,7 @@ trait WP_CLI {
* @param array $args Positional arguments passed. ID expected.
* @param array $array_assoc Assoc arguments passed.
*/
- public function wp_cli_update_item($args, $array_assoc) {
+ public function wp_cli_update_item($args, $array_assoc): void {
$item = $this->model_class::get_by_id($args[0]);
@@ -330,7 +330,7 @@ trait WP_CLI {
if ($param === 'meta') {
$item->update_meta_batch($value);
} elseif (method_exists($item, $set_method)) {
- call_user_func(array($item, $set_method), $value);
+ call_user_func([$item, $set_method], $value);
} else {
$error_message = sprintf(
/* translators: 1. Object class name; 2. Set method name */
@@ -367,7 +367,7 @@ trait WP_CLI {
*
* @param array $args Positional arguments passed. ID expected.
*/
- public function wp_cli_delete_item($args) {
+ public function wp_cli_delete_item($args): void {
$item = $this->model_class::get_by_id($args[0]);
diff --git a/inc/builders/block-editor/class-block-editor-widget-manager.php b/inc/builders/block-editor/class-block-editor-widget-manager.php
index 656f59b..2e0a96d 100644
--- a/inc/builders/block-editor/class-block-editor-widget-manager.php
+++ b/inc/builders/block-editor/class-block-editor-widget-manager.php
@@ -29,14 +29,14 @@ class Block_Editor_Widget_Manager {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
if (\WP_Ultimo\Compat\Gutenberg_Support::get_instance()->should_load()) {
- add_action('wu_element_loaded', array($this, 'handle_element'));
+ add_action('wu_element_loaded', [$this, 'handle_element']);
- add_action('init', array($this, 'register_scripts'));
+ add_action('init', [$this, 'register_scripts']);
- add_action('wu_element_is_preview', array($this, 'is_block_preview'));
+ add_action('wu_element_is_preview', [$this, 'is_block_preview']);
}
}
@@ -46,11 +46,11 @@ class Block_Editor_Widget_Manager {
* @since 2.0.0
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
- \WP_Ultimo\Scripts::get_instance()->register_script('wu-blocks', wu_get_asset('blocks.js', 'js', 'inc/builders/block-editor/assets'), array('underscore', 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wu-functions', 'wp-i18n', 'wp-polyfill'));
+ \WP_Ultimo\Scripts::get_instance()->register_script('wu-blocks', wu_get_asset('blocks.js', 'js', 'inc/builders/block-editor/assets'), ['underscore', 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wu-functions', 'wp-i18n', 'wp-polyfill']);
- $blocks = apply_filters('wu_blocks', array());
+ $blocks = apply_filters('wu_blocks', []);
wp_localize_script('wu-blocks', 'wu_blocks', $blocks);
}
@@ -79,7 +79,7 @@ class Block_Editor_Widget_Manager {
* @param \WP_Ultimo\UI\Base_Element $element The element being registered.
* @return void
*/
- public function handle_element($element) {
+ public function handle_element($element): void {
if (wu_get_current_site()->get_type() === Site_Type::CUSTOMER_OWNED) {
return;
@@ -98,7 +98,7 @@ class Block_Editor_Widget_Manager {
* @param \WP_Ultimo\UI\Base_Element $element The element being registered.
* @return void
*/
- public function register_block($element) {
+ public function register_block($element): void {
if (\WP_Block_Type_Registry::get_instance()->is_registered($element->get_id())) {
return;
@@ -108,11 +108,11 @@ class Block_Editor_Widget_Manager {
register_block_type(
$element->get_id(),
- array(
+ [
'attributes' => $attributes,
'editor_script' => 'wu-blocks',
- 'render_callback' => \Closure::fromCallable(array($element, 'display')),
- )
+ 'render_callback' => \Closure::fromCallable([$element, 'display']),
+ ]
);
}
@@ -126,20 +126,20 @@ class Block_Editor_Widget_Manager {
*/
protected function consolidate_callables($fields) {
- $callable_keys = array(
+ $callable_keys = [
'options',
'value',
- );
+ ];
- $fields_to_ignore = array(
+ $fields_to_ignore = [
'note',
- );
+ ];
foreach ($fields as $field_slug => &$field) {
/*
* Discard fields that are notes and start with _
*/
- if (in_array($field['type'], $fields_to_ignore, true) && strncmp($field_slug, '_', strlen('_')) === 0) {
+ if (in_array($field['type'], $fields_to_ignore, true) && str_starts_with($field_slug, '_')) {
unset($fields[ $field_slug ]);
}
@@ -184,13 +184,13 @@ class Block_Editor_Widget_Manager {
$fields = $this->consolidate_callables($element->fields());
- $blocks[] = array(
+ $blocks[] = [
'id' => $element->get_id(),
'title' => $element->get_title(),
'description' => $element->get_description(),
'fields' => $fields,
'keywords' => $element->keywords(),
- );
+ ];
return $blocks;
}
@@ -208,7 +208,7 @@ class Block_Editor_Widget_Manager {
$defaults = $element->defaults();
- $_fields = array();
+ $_fields = [];
foreach ($fields as $field_id => $field) {
$type = 'string';
@@ -223,10 +223,10 @@ class Block_Editor_Widget_Manager {
$default_value = wu_get_isset($defaults, $field_id, '');
- $_fields[ $field_id ] = array(
+ $_fields[ $field_id ] = [
'default' => wu_get_isset($field, 'value', $default_value),
'type' => $type,
- );
+ ];
}
return $_fields;
diff --git a/inc/checkout/class-cart.php b/inc/checkout/class-cart.php
index 3ffd4c4..445c02b 100644
--- a/inc/checkout/class-cart.php
+++ b/inc/checkout/class-cart.php
@@ -179,7 +179,7 @@ class Cart implements \JsonSerializable {
* @since 2.0.0
* @var \WP_Ultimo\Models\Product[]
*/
- protected $products = array();
+ protected $products = [];
/**
* The cart recurring products.
@@ -187,7 +187,7 @@ class Cart implements \JsonSerializable {
* @since 2.0.0
* @var \WP_Ultimo\Models\Product[]
*/
- protected $recurring_products = array();
+ protected $recurring_products = [];
/**
* The cart additional products.
@@ -195,7 +195,7 @@ class Cart implements \JsonSerializable {
* @since 2.0.0
* @var \WP_Ultimo\Models\Product[]
*/
- protected $additional_products = array();
+ protected $additional_products = [];
/**
* Line item representation of the products.
@@ -203,7 +203,7 @@ class Cart implements \JsonSerializable {
* @since 2.0.0
* @var \WP_Ultimo\Checkout\Line_Item[]
*/
- protected $line_items = array();
+ protected $line_items = [];
/**
* If this cart should auto-renew.
@@ -227,7 +227,7 @@ class Cart implements \JsonSerializable {
* @since 2.0.0
* @var array
*/
- protected $extra = array();
+ protected $extra = [];
/**
* The cart description.
@@ -255,7 +255,7 @@ class Cart implements \JsonSerializable {
* this helps us to keep things cleaner and secure.
*/
$args = shortcode_atts(
- array(
+ [
/*
* Cart Type.
@@ -265,7 +265,7 @@ class Cart implements \JsonSerializable {
/*
* The list of products being bought.
*/
- 'products' => array(),
+ 'products' => [],
/*
* The duration parameters
@@ -309,7 +309,7 @@ class Cart implements \JsonSerializable {
*/
'currency' => '',
- ),
+ ],
$args
);
@@ -411,7 +411,7 @@ class Cart implements \JsonSerializable {
* @param mixed $value The value to set.
* @return void
*/
- public function set_param($key, $value) {
+ public function set_param($key, $value): void {
$this->extra[] = $key;
@@ -504,7 +504,7 @@ class Cart implements \JsonSerializable {
$desc = wu_get_setting('company_name', __('Subscription', 'wp-ultimo'));
- $products = array();
+ $products = [];
foreach ($this->get_line_items() as $line_item) {
$product = $line_item->get_product();
@@ -529,7 +529,7 @@ class Cart implements \JsonSerializable {
* @param string $descriptor The cart description.
* @return void
*/
- public function set_cart_descriptor($descriptor) {
+ public function set_cart_descriptor($descriptor): void {
$this->cart_descriptor = $descriptor;
}
@@ -568,7 +568,7 @@ class Cart implements \JsonSerializable {
/*
* Adds the country to calculate taxes.
*/
- $this->country = $this->country ? $this->country : ($this->customer ? $this->customer->get_country() : '');
+ $this->country = ($this->country ?: $this->customer) ? $this->customer->get_country() : '';
/*
* Set the currency in cart
@@ -676,9 +676,9 @@ class Cart implements \JsonSerializable {
*/
$allowed_status = apply_filters(
'wu_cart_set_payment_allowed_status',
- array(
+ [
'pending',
- )
+ ]
);
if ( ! in_array($payment->get_status(), $allowed_status, true)) {
@@ -768,7 +768,7 @@ class Cart implements \JsonSerializable {
/*
* Adds the country to calculate taxes.
*/
- $this->country = $this->country ? $this->country : $this->customer->get_country();
+ $this->country = $this->country ?: $this->customer->get_country();
/*
* Set the currency in cart
@@ -933,8 +933,8 @@ class Cart implements \JsonSerializable {
* hev it here to prevent bugs.
*/
if ( ! $is_plan_change || ($this->get_plan_id() === $membership->get_plan_id() && $this->duration_unit === $membership->get_duration_unit() && $this->duration === $membership->get_duration())) {
- $this->products = array();
- $this->line_items = array();
+ $this->products = [];
+ $this->line_items = [];
$this->errors->add('no_changes', __('This cart proposes no changes to the current membership.', 'wp-ultimo'));
@@ -993,8 +993,8 @@ class Cart implements \JsonSerializable {
}
if ( ! $membership->is_free() && $old_price_per_day < $new_price_per_day && $days_in_old_cycle > $days_in_new_cycle && $membership->get_status() === Membership_Status::ACTIVE) {
- $this->products = array();
- $this->line_items = array();
+ $this->products = [];
+ $this->line_items = [];
$description = sprintf(
// translators: %1$s the duration, and %2$s the duration unit (day, week, month, etc)
@@ -1023,7 +1023,7 @@ class Cart implements \JsonSerializable {
if ($membership->is_active() || $membership->get_status() === Membership_Status::TRIALING) {
$line_item_params = apply_filters(
'wu_checkout_credit_line_item_params',
- array(
+ [
'type' => 'credit',
'title' => __('Scheduled Swap Credit', 'wp-ultimo'),
'description' => __('Swap scheduled to next billing cycle.', 'wp-ultimo'),
@@ -1031,7 +1031,7 @@ class Cart implements \JsonSerializable {
'taxable' => false,
'quantity' => 1,
'unit_price' => - $this->get_total(),
- )
+ ]
);
$credit_line_item = new Line_Item($line_item_params);
@@ -1061,28 +1061,28 @@ class Cart implements \JsonSerializable {
protected function search_for_same_period_plans($plan_a, $plan_b) {
if ($plan_a->get_duration_unit() === $plan_b->get_duration_unit() && $plan_a->get_duration() === $plan_b->get_duration()) {
- return array(
+ return [
$plan_a,
$plan_b,
- );
+ ];
}
$plan_a_variation = $plan_a->get_as_variation($plan_b->get_duration(), $plan_b->get_duration_unit());
if ($plan_a_variation) {
- return array(
+ return [
$plan_a_variation,
$plan_b,
- );
+ ];
}
$plan_b_variation = $plan_b->get_as_variation($plan_a->get_duration(), $plan_a->get_duration_unit());
if ($plan_b_variation) {
- return array(
+ return [
$plan_a,
$plan_b_variation,
- );
+ ];
}
if ($this->duration_unit && $this->duration && ($this->duration_unit !== $plan_b->get_duration_unit() || $this->duration !== $plan_b->get_duration())) {
@@ -1093,19 +1093,19 @@ class Cart implements \JsonSerializable {
}
if ($plan_b->get_duration_unit() === $plan_a_variation->get_duration_unit() && $plan_b->get_duration() === $plan_a_variation->get_duration()) {
- return array(
+ return [
$plan_a_variation,
$plan_b,
- );
+ ];
}
$plan_b_variation = $plan_b->get_as_variation($this->duration, $this->duration_unit);
if ($plan_b_variation) {
- return array(
+ return [
$plan_a_variation,
$plan_b_variation,
- );
+ ];
}
}
@@ -1175,7 +1175,7 @@ class Cart implements \JsonSerializable {
if ($fee_credit > 0) {
$new_line_item = new Line_Item(
- array(
+ [
'product' => $old_plan,
'type' => 'fee',
'description' => '--',
@@ -1184,7 +1184,7 @@ class Cart implements \JsonSerializable {
'recurring' => false,
'unit_price' => $fee_credit,
'quantity' => 1,
- )
+ ]
);
$new_line_item = $this->apply_taxes_to_item($new_line_item);
@@ -1217,7 +1217,7 @@ class Cart implements \JsonSerializable {
$line_item_params = apply_filters(
'wu_checkout_credit_line_item_params',
- array(
+ [
'type' => 'credit',
'title' => __('Credit', 'wp-ultimo'),
'description' => __('Prorated amount based on the previous membership.', 'wp-ultimo'),
@@ -1225,7 +1225,7 @@ class Cart implements \JsonSerializable {
'taxable' => false,
'quantity' => 1,
'unit_price' => - $credit,
- )
+ ]
);
/*
@@ -1467,7 +1467,7 @@ class Cart implements \JsonSerializable {
* @param \WP_Ultimo\Checkout\Line_Item $line_item The line item.
* @return void
*/
- public function add_line_item($line_item) {
+ public function add_line_item($line_item): void {
if ( ! is_a($line_item, '\WP_Ultimo\Checkout\Line_Item')) {
return;
@@ -1597,13 +1597,13 @@ class Cart implements \JsonSerializable {
$line_item_data = apply_filters(
'wu_add_product_line_item',
- array(
+ [
'product' => $product,
'quantity' => $quantity,
'unit_price' => $amount,
'duration' => $duration,
'duration_unit' => $duration_unit,
- ),
+ ],
$product,
$duration,
$duration_unit,
@@ -1666,7 +1666,7 @@ class Cart implements \JsonSerializable {
*/
$setup_fee_line_item = apply_filters(
'wu_add_product_setup_fee_line_item',
- array(
+ [
'product' => $product,
'type' => 'fee',
'description' => '--',
@@ -1675,7 +1675,7 @@ class Cart implements \JsonSerializable {
'recurring' => false,
'unit_price' => $product->get_setup_fee(),
'quantity' => $quantity,
- ),
+ ],
$product,
$this
);
@@ -1697,7 +1697,7 @@ class Cart implements \JsonSerializable {
$line_items = $this->line_items;
- $tax_brackets = array();
+ $tax_brackets = [];
foreach ($line_items as $line_item) {
$tax_bracket = $line_item->get_tax_rate();
@@ -1818,18 +1818,18 @@ class Cart implements \JsonSerializable {
* @param array $where_clauses Additional where clauses for search.
* @return \WP_Ultimo\Checkout\Line_Item[]
*/
- public function get_line_items_by_type($type = 'product', $where_clauses = array()): array {
+ public function get_line_items_by_type($type = 'product', $where_clauses = []): array {
- $where_clauses[] = array('type', $type);
+ $where_clauses[] = ['type', $type];
// Cast to array recursively
$line_items = json_decode(json_encode($this->line_items), true);
$line_items = Array_Search::find(
$line_items,
- array(
+ [
'where' => $where_clauses,
- )
+ ]
);
$ids = array_keys($line_items);
@@ -1958,10 +1958,10 @@ class Cart implements \JsonSerializable {
$subtotal = 0;
- $exclude_types = array(
+ $exclude_types = [
'discount',
'credit',
- );
+ ];
foreach ($this->line_items as $line_item) {
if (in_array($line_item->get_type(), $exclude_types, true)) {
@@ -2037,9 +2037,9 @@ class Cart implements \JsonSerializable {
$new_line_item = clone $line_item;
$new_line_item->attributes(
- array(
+ [
'discount_rate' => 0,
- )
+ ]
);
$new_line_item->recalculate_totals();
@@ -2230,21 +2230,21 @@ class Cart implements \JsonSerializable {
}
$line_item->attributes(
- array(
+ [
'discount_rate' => $this->discount_code->get_setup_fee_value(),
'discount_type' => $this->discount_code->get_setup_fee_type(),
'apply_discount_to_renewals' => false,
'discount_label' => strtoupper($this->discount_code->get_code()),
- )
+ ]
);
} else {
$line_item->attributes(
- array(
+ [
'discount_rate' => $this->discount_code->get_value(),
'discount_type' => $this->discount_code->get_type(),
'apply_discount_to_renewals' => $this->discount_code->should_apply_to_renewals(),
'discount_label' => strtoupper($this->discount_code->get_code()),
- )
+ ]
);
}
@@ -2301,13 +2301,13 @@ class Cart implements \JsonSerializable {
}
$line_item->attributes(
- array(
+ [
'tax_rate' => $tax_rate ?? 0,
'tax_type' => $tax_type ?? 'percentage',
'tax_label' => $tax_label ?? '',
'tax_inclusive' => wu_get_setting('inclusive_tax', false),
'tax_exempt' => $this->is_tax_exempt(),
- )
+ ]
);
$line_item->recalculate_totals();
@@ -2323,17 +2323,17 @@ class Cart implements \JsonSerializable {
*/
public function calculate_totals() {
- return (object) array(
- 'recurring' => (object) array(
+ return (object) [
+ 'recurring' => (object) [
'subtotal' => $this->get_recurring_subtotal(),
'total' => $this->get_recurring_total(),
- ),
+ ],
'subtotal' => $this->get_subtotal(),
'total_taxes' => $this->get_total_taxes(),
'total_fees' => $this->get_total_fees(),
'total_discounts' => $this->get_total_discounts(),
'total' => $this->get_total(),
- );
+ ];
}
/**
@@ -2355,7 +2355,7 @@ class Cart implements \JsonSerializable {
*/
public function get_extra_params() {
- $extra_params = array();
+ $extra_params = [];
foreach ($this->extra as $key) {
$extra_params[ $key ] = $this->get_param($key);
@@ -2374,20 +2374,20 @@ class Cart implements \JsonSerializable {
$totals = $this->calculate_totals();
- $errors = array();
+ $errors = [];
if ($this->errors->has_errors()) {
foreach ($this->errors as $code => $messages) {
foreach ($messages as $message) {
- $errors[] = array(
+ $errors[] = [
'code' => $code,
'message' => $message,
- );
+ ];
}
}
}
- return (object) array(
+ return (object) [
'errors' => $errors,
'url' => $this->get_cart_url(),
@@ -2407,12 +2407,12 @@ class Cart implements \JsonSerializable {
'extra' => $this->get_extra_params(),
- 'dates' => (object) array(
+ 'dates' => (object) [
'date_trial_end' => $this->get_billing_start_date(),
'date_next_charge' => $this->get_billing_next_charge_date(),
- ),
+ ],
- );
+ ];
}
/**
@@ -2423,23 +2423,23 @@ class Cart implements \JsonSerializable {
*/
public function to_membership_data() {
- $membership_data = array();
+ $membership_data = [];
$all_additional_products = $this->get_line_items_by_type(
'product',
- array(
- array('product_id', '!=', $this->get_plan_id()),
- )
+ [
+ ['product_id', '!=', $this->get_plan_id()],
+ ]
);
- $addon_list = array();
+ $addon_list = [];
foreach ($all_additional_products as $line_item) {
$addon_list[ $line_item->get_product_id() ] = $line_item->get_quantity();
}
$membership_data = array_merge(
- array(
+ [
'recurring' => $this->has_recurring(),
'plan_id' => $this->get_plan() ? $this->get_plan()->get_id() : 0,
'initial_amount' => $this->get_total(),
@@ -2452,7 +2452,7 @@ class Cart implements \JsonSerializable {
'billing_cycles' => $this->get_plan() ? $this->get_plan()->get_billing_cycles() : 0,
'auto_renew' => false, // @todo: revisit
'upgraded_from' => false, // @todo: revisit
- )
+ ]
);
return $membership_data;
@@ -2466,10 +2466,10 @@ class Cart implements \JsonSerializable {
*/
public function to_payment_data() {
- $payment_data = array();
+ $payment_data = [];
// Creates the pending payment
- $payment_data = array(
+ $payment_data = [
'status' => 'pending',
'tax_total' => $this->get_total_taxes(),
'fees' => $this->get_total_fees(),
@@ -2478,7 +2478,7 @@ class Cart implements \JsonSerializable {
'discount_code' => $this->get_discount_code() ? $this->get_discount_code()->get_code() : '',
'subtotal' => $this->get_subtotal(),
'total' => $this->get_total(),
- );
+ ];
return $payment_data;
}
@@ -2523,7 +2523,7 @@ class Cart implements \JsonSerializable {
* @param mixed $currency The currency code.
* @return void
*/
- public function set_currency($currency) {
+ public function set_currency($currency): void {
$this->currency = $currency;
}
@@ -2568,7 +2568,7 @@ class Cart implements \JsonSerializable {
* @param \WP_Ultimo\Models\Membership $membership A valid membership object.
* @return void
*/
- public function set_membership($membership) {
+ public function set_membership($membership): void {
$this->membership = $membership;
}
@@ -2580,7 +2580,7 @@ class Cart implements \JsonSerializable {
* @param \WP_Ultimo\Models\Customer $customer A valid customer object.
* @return void
*/
- public function set_customer($customer) {
+ public function set_customer($customer): void {
$this->customer = $customer;
}
@@ -2592,7 +2592,7 @@ class Cart implements \JsonSerializable {
* @param \WP_Ultimo\Models\Payment $payment A valid payment object.
* @return void
*/
- public function set_payment($payment) {
+ public function set_payment($payment): void {
$this->payment = $payment;
}
@@ -2637,7 +2637,7 @@ class Cart implements \JsonSerializable {
* @param string $country The country of the customer.
* @return void
*/
- public function set_country($country) {
+ public function set_country($country): void {
$this->country = $country;
}
@@ -2668,7 +2668,7 @@ class Cart implements \JsonSerializable {
$all_products = $this->products;
- $products_list = array();
+ $products_list = [];
foreach ($all_products as $product) {
if ($product->get_id() !== $this->plan_id) {
@@ -2677,9 +2677,9 @@ class Cart implements \JsonSerializable {
}
return add_query_arg(
- array(
+ [
'products' => $products_list,
- ),
+ ],
$base_url
);
}
diff --git a/inc/checkout/class-checkout-pages.php b/inc/checkout/class-checkout-pages.php
index ea25e95..b0831c8 100644
--- a/inc/checkout/class-checkout-pages.php
+++ b/inc/checkout/class-checkout-pages.php
@@ -27,18 +27,18 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- add_filter('display_post_states', array($this, 'add_wp_ultimo_status_annotation'), 10, 2);
+ add_filter('display_post_states', [$this, 'add_wp_ultimo_status_annotation'], 10, 2);
- add_action('wu_thank_you_site_block', array($this, 'add_verify_email_notice'), 10, 3);
+ add_action('wu_thank_you_site_block', [$this, 'add_verify_email_notice'], 10, 3);
- add_shortcode('wu_confirmation', array($this, 'render_confirmation_page'));
+ add_shortcode('wu_confirmation', [$this, 'render_confirmation_page']);
- add_filter('lostpassword_redirect', array($this, 'filter_lost_password_redirect'));
+ add_filter('lostpassword_redirect', [$this, 'filter_lost_password_redirect']);
if (is_main_site()) {
- add_action('before_signup_header', array($this, 'redirect_to_registration_page'));
+ add_action('before_signup_header', [$this, 'redirect_to_registration_page']);
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
@@ -46,30 +46,30 @@ class Checkout_Pages {
return;
}
- add_filter('login_url', array($this, 'filter_login_url'), 10, 3);
+ add_filter('login_url', [$this, 'filter_login_url'], 10, 3);
- add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 3);
+ add_filter('lostpassword_url', [$this, 'filter_login_url'], 10, 3);
- add_filter('retrieve_password_message', array($this, 'replace_reset_password_link'), 10, 4);
+ add_filter('retrieve_password_message', [$this, 'replace_reset_password_link'], 10, 4);
- add_filter('network_site_url', array($this, 'maybe_change_wp_login_on_urls'));
+ add_filter('network_site_url', [$this, 'maybe_change_wp_login_on_urls']);
- add_action('login_init', array($this, 'maybe_obfuscate_login_url'), 9);
+ add_action('login_init', [$this, 'maybe_obfuscate_login_url'], 9);
- add_action('template_redirect', array($this, 'maybe_redirect_to_admin_panel'));
+ add_action('template_redirect', [$this, 'maybe_redirect_to_admin_panel']);
- add_action('after_password_reset', array($this, 'maybe_redirect_to_confirm_screen'));
+ add_action('after_password_reset', [$this, 'maybe_redirect_to_confirm_screen']);
- add_action('lost_password', array($this, 'maybe_handle_password_reset_errors'));
+ add_action('lost_password', [$this, 'maybe_handle_password_reset_errors']);
- add_action('validate_password_reset', array($this, 'maybe_handle_password_reset_errors'));
+ add_action('validate_password_reset', [$this, 'maybe_handle_password_reset_errors']);
/**
* Adds the force elements controls.
*/
- add_action('post_submitbox_misc_actions', array($this, 'render_compat_mode_setting'));
+ add_action('post_submitbox_misc_actions', [$this, 'render_compat_mode_setting']);
- add_action('save_post', array($this, 'handle_compat_mode_setting'));
+ add_action('save_post', [$this, 'handle_compat_mode_setting']);
}
}
@@ -95,7 +95,7 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function render_compat_mode_setting() {
+ public function render_compat_mode_setting(): void {
$post_id = get_the_ID();
@@ -129,7 +129,7 @@ class Checkout_Pages {
* @param int $post_id The id of the post being saved.
* @return void
*/
- public function handle_compat_mode_setting($post_id) {
+ public function handle_compat_mode_setting($post_id): void {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
@@ -163,7 +163,7 @@ class Checkout_Pages {
* Only perform computational-heavy tasks if the URL has
* wp-login.php in it to begin with.
*/
- if (strpos($url, 'wp-login.php') === false) {
+ if (! str_contains($url, 'wp-login.php')) {
return $url;
}
@@ -189,7 +189,7 @@ class Checkout_Pages {
*/
public function get_error_message($error_code, $username = '') {
- $messages = array(
+ $messages = [
'incorrect_password' => sprintf(__('Error: The password you entered is incorrect.', 'wp-ultimo')),
// From here we are using the same messages as WordPress core.
'expired' => __('Your session has expired. Please log in to continue where you left off.'),
@@ -206,7 +206,7 @@ class Checkout_Pages {
'password_reset_mismatch' => __('Error: The passwords do not match.'),
'invalidkey' => __('Error: Your password reset link appears to be invalid. Please request a new link below.'),
'expiredkey' => __('Error: Your password reset link has expired. Please request a new link below.'),
- );
+ ];
/**
* Filter the error messages.
@@ -231,15 +231,15 @@ class Checkout_Pages {
* @param \WP_Error $errors The error object.
* @return void
*/
- public function maybe_handle_password_reset_errors($errors) {
+ public function maybe_handle_password_reset_errors($errors): void {
if ($errors->has_errors()) {
$url = add_query_arg(
- array(
+ [
'action' => wu_request('action', ''),
'user_login' => wu_request('user_login', ''),
'error' => $errors->get_error_code(),
- ),
+ ],
wp_login_url()
);
@@ -260,7 +260,7 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function maybe_redirect_to_confirm_screen() {
+ public function maybe_redirect_to_confirm_screen(): void {
if (wu_request('redirect_to')) {
wp_redirect(wu_request('redirect_to'));
@@ -286,7 +286,7 @@ class Checkout_Pages {
return $message;
}
- $results = array();
+ $results = [];
preg_match_all('/.*\/wp-login\.php.*/', $message, $results);
@@ -300,12 +300,12 @@ class Checkout_Pages {
$switched_locale = switch_to_locale($locale);
$new_url = add_query_arg(
- array(
+ [
'action' => 'rp',
'key' => $key,
'login' => rawurlencode($user_login),
'wp_lang' => $locale,
- ),
+ ],
wp_login_url()
);
@@ -327,7 +327,7 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function maybe_redirect_to_admin_panel() {
+ public function maybe_redirect_to_admin_panel(): void {
global $post;
@@ -356,14 +356,14 @@ class Checkout_Pages {
*/
$exclusion_list = apply_filters(
'wu_maybe_redirect_to_admin_panel_exclusion_list',
- array(
+ [
'preview', // WordPress Preview
'ct_builder', // Oxygen Builder
'fl_builder', // Beaver Builder
'elementor-preview', // Elementor
'brizy-edit', // Brizy
'brizy-edit-iframe', // Brizy
- ),
+ ],
$custom_login_page,
$post,
$this
@@ -410,7 +410,7 @@ class Checkout_Pages {
* @param \WP_Ultimo\Models\Customer $customer the current customer.
* @return void
*/
- public function add_verify_email_notice($payment, $membership, $customer) {
+ public function add_verify_email_notice($payment, $membership, $customer): void {
if ($payment->get_total() == 0 && $customer->get_email_verification() === 'pending') {
$html = '
%s
';
@@ -429,7 +429,7 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function maybe_obfuscate_login_url() {
+ public function maybe_obfuscate_login_url(): void {
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
@@ -484,7 +484,7 @@ class Checkout_Pages {
* @since 2.0.0
* @return void
*/
- public function redirect_to_registration_page() {
+ public function redirect_to_registration_page(): void {
$registration_url = $this->get_page_url('register');
@@ -520,7 +520,7 @@ class Checkout_Pages {
return $login_url;
}
- $params = array();
+ $params = [];
$old_url_params = wp_parse_url($login_url, PHP_URL_QUERY);
@@ -555,13 +555,13 @@ class Checkout_Pages {
*/
public function get_signup_pages() {
- return array(
+ return [
'register' => wu_guess_registration_page(),
'update' => wu_get_setting('default_update_page', false),
'login' => wu_get_setting('default_login_page', false),
'block_frontend' => wu_get_setting('default_block_frontend_page', false),
'new_site' => wu_get_setting('default_new_site_page', false),
- );
+ ];
}
/**
* Returns the WP_Post object for one of the pages.
@@ -617,13 +617,13 @@ class Checkout_Pages {
return $states;
}
- $labels = array(
+ $labels = [
'register' => __('WP Multisite WaaS - Register Page', 'wp-ultimo'),
'login' => __('WP Multisite WaaS - Login Page', 'wp-ultimo'),
'block_frontend' => __('WP Multisite WaaS - Site Blocked Page', 'wp-ultimo'),
'update' => __('WP Multisite WaaS - Membership Update Page', 'wp-ultimo'),
'new_site' => __('WP Multisite WaaS - New Site Page', 'wp-ultimo'),
- );
+ ];
$pages = array_map('absint', $this->get_signup_pages());
@@ -649,10 +649,10 @@ class Checkout_Pages {
return wu_get_template_contents(
'checkout/confirmation',
- array(
+ [
'errors' => Checkout::get_instance()->errors,
'membership' => wu_get_membership_by_hash(wu_request('membership')),
- )
+ ]
);
}
}
diff --git a/inc/checkout/class-checkout.php b/inc/checkout/class-checkout.php
index 98c439b..9c80c2c 100644
--- a/inc/checkout/class-checkout.php
+++ b/inc/checkout/class-checkout.php
@@ -159,44 +159,44 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
/*
* Setup and handle checkout
*/
- add_action('wu_setup_checkout', array($this, 'setup_checkout'));
+ add_action('wu_setup_checkout', [$this, 'setup_checkout']);
- add_action('wu_setup_checkout', array($this, 'maybe_process_checkout'), 20);
+ add_action('wu_setup_checkout', [$this, 'maybe_process_checkout'], 20);
/*
* Add the rewrite rules.
*/
- add_action('init', array($this, 'add_rewrite_rules'), 20);
+ add_action('init', [$this, 'add_rewrite_rules'], 20);
- add_filter('wu_request', array($this, 'get_checkout_from_query_vars'), 10, 2);
+ add_filter('wu_request', [$this, 'get_checkout_from_query_vars'], 10, 2);
/*
* Creates the order object to display to the customer
*/
- add_action('wu_ajax_wu_create_order', array($this, 'create_order'));
+ add_action('wu_ajax_wu_create_order', [$this, 'create_order']);
- add_action('wu_ajax_nopriv_wu_create_order', array($this, 'create_order'));
+ add_action('wu_ajax_nopriv_wu_create_order', [$this, 'create_order']);
/*
* Validates form and process preflight.
*/
- add_action('wu_ajax_wu_validate_form', array($this, 'maybe_handle_order_submission'));
+ add_action('wu_ajax_wu_validate_form', [$this, 'maybe_handle_order_submission']);
- add_action('wu_ajax_nopriv_wu_validate_form', array($this, 'maybe_handle_order_submission'));
+ add_action('wu_ajax_nopriv_wu_validate_form', [$this, 'maybe_handle_order_submission']);
/*
* Adds the necessary scripts
*/
- add_action('wu_checkout_scripts', array($this, 'register_scripts'));
+ add_action('wu_checkout_scripts', [$this, 'register_scripts']);
/*
* Errors
*/
- add_action('wu_checkout_errors', array($this, 'maybe_display_checkout_errors'));
+ add_action('wu_checkout_errors', [$this, 'maybe_display_checkout_errors']);
}
/**
@@ -213,7 +213,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function add_rewrite_rules() {
+ public function add_rewrite_rules(): void {
$register = Checkout_Pages::get_instance()->get_signup_page('register');
@@ -297,13 +297,13 @@ class Checkout {
$cart_arguments = apply_filters(
'wu_get_checkout_from_query_vars',
- array(
+ [
'products',
'duration',
'duration_unit',
'template_id',
'wu_preselected',
- )
+ ]
);
/**
@@ -345,7 +345,7 @@ class Checkout {
* @param \WP_Ultimo\UI\Checkout_Element $element The checkout element.
* @return void
*/
- public function setup_checkout($element = null) {
+ public function setup_checkout($element = null): void {
if ($this->already_setup) {
return;
@@ -362,7 +362,7 @@ class Checkout {
if ( ! $checkout_form_slug && is_a($element, \WP_Ultimo\UI\Checkout_Element::class)) {
$pre_loaded_checkout_form_slug = $element->get_pre_loaded_attribute('slug', $checkout_form_slug);
- $checkout_form_slug = $pre_loaded_checkout_form_slug ? $pre_loaded_checkout_form_slug : $checkout_form_slug;
+ $checkout_form_slug = $pre_loaded_checkout_form_slug ?: $checkout_form_slug;
}
$this->checkout_form = wu_get_checkout_form_by_slug($checkout_form_slug);
@@ -382,7 +382,7 @@ class Checkout {
$this->step = $this->checkout_form->get_step($this->step_name, true);
- $this->step['fields'] ??= array();
+ $this->step['fields'] ??= [];
$this->auto_submittable_field = $this->contains_auto_submittable_field($this->step['fields']);
@@ -408,19 +408,19 @@ class Checkout {
*/
public function contains_auto_submittable_field($fields) {
- $relevant_fields = array();
+ $relevant_fields = [];
- $field_types_to_ignore = array(
+ $field_types_to_ignore = [
'hidden',
'products',
'submit_button',
'period_selection',
'steps',
- );
+ ];
// Extra check to prevent error messages from being displayed.
if ( ! is_array($fields)) {
- $fields = array();
+ $fields = [];
}
foreach ($fields as $field) {
@@ -457,10 +457,10 @@ class Checkout {
* while the value should be the parameter we should watch for changes
* so we can submit the form when we detect one.
*/
- $auto_submittable_fields = array(
+ $auto_submittable_fields = [
'template_selection' => 'template_id',
'pricing_table' => 'products',
- );
+ ];
return apply_filters('wu_checkout_get_auto_submittable_fields', $auto_submittable_fields, $this);
}
@@ -471,7 +471,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function maybe_handle_order_submission() {
+ public function maybe_handle_order_submission(): void {
$this->setup_checkout();
@@ -484,7 +484,7 @@ class Checkout {
wp_send_json_error($validation);
}
- wp_send_json_success(array());
+ wp_send_json_success([]);
}
}
@@ -498,7 +498,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function handle_order_submission() {
+ public function handle_order_submission(): void {
global $wpdb;
@@ -545,7 +545,7 @@ class Checkout {
$wpdb->query('COMMIT');
- $this->session->set('signup', array());
+ $this->session->set('signup', []);
$this->session->commit();
wp_send_json_success($results);
@@ -589,8 +589,8 @@ class Checkout {
$cart = new Cart(
apply_filters(
'wu_cart_parameters',
- array(
- 'products' => $this->request_or_session('products', array()),
+ [
+ 'products' => $this->request_or_session('products', []),
'discount_code' => $this->request_or_session('discount_code'),
'country' => $this->request_or_session('billing_country'),
'state' => $this->request_or_session('billing_state'),
@@ -601,7 +601,7 @@ class Checkout {
'duration' => $this->request_or_session('duration'),
'duration_unit' => $this->request_or_session('duration_unit'),
'cart_type' => $this->request_or_session('cart_type', 'new'),
- ),
+ ],
$this
)
);
@@ -684,7 +684,7 @@ class Checkout {
/*
* Handles display names, if needed.
*/
- add_filter('pre_user_display_name', array($this, 'handle_display_name'));
+ add_filter('pre_user_display_name', [$this, 'handle_display_name']);
/*
* If we get to this point, most of the validations are done.
@@ -834,7 +834,7 @@ class Checkout {
$gateway->trigger_payment_processed($this->payment, $this->membership);
}
- $success_data = array(
+ $success_data = [
'nonce' => wp_create_nonce('wp-ultimo-register-nonce'),
'customer' => $this->customer->to_search_results(),
'total' => $this->order->get_total(),
@@ -843,11 +843,11 @@ class Checkout {
'payment_id' => $this->payment->get_id(),
'cart_type' => $this->order->get_cart_type(),
'auto_renew' => $this->order->should_auto_renew(),
- 'gateway' => array(
+ 'gateway' => [
'slug' => $gateway->get_id(),
- 'data' => array(),
- ),
- );
+ 'data' => [],
+ ],
+ ];
/*
* Let's the gateway do its thing.
@@ -862,7 +862,7 @@ class Checkout {
/*
* Attach the gateway results to the return array.
*/
- $success_data['gateway']['data'] = $result && is_array($result) ? $result : array();
+ $success_data['gateway']['data'] = $result && is_array($result) ? $result : [];
/*
* On error, bail.
@@ -941,24 +941,24 @@ class Checkout {
*
* Next step then would be to create one.
*/
- $customer_data = array(
+ $customer_data = [
'username' => $username,
'email' => $this->request_or_session('email_address'),
'password' => $this->request_or_session('password'),
'email_verification' => $this->get_customer_email_verification_status(),
'signup_form' => $form_slug,
- 'meta' => array(),
- );
+ 'meta' => [],
+ ];
/*
* If the user is logged in,
* we use the existing email address to create the customer.
*/
if ($this->is_existing_user()) {
- $customer_data = array(
+ $customer_data = [
'email' => wp_get_current_user()->user_email,
'email_verification' => 'verified',
- );
+ ];
} elseif (isset($customer_data['email']) && get_user_by('email', $customer_data['email'])) {
return new \WP_Error('email_exists', __('The email address you entered is already in use.', 'wp-ultimo'));
}
@@ -993,7 +993,7 @@ class Checkout {
* class, so there's no problem in passing
* the entire post array in here.
*/
- $session = $this->session->get('signup') ?? array();
+ $session = $this->session->get('signup') ?? [];
$billing_address->attributes(array_merge($session, $_POST));
/*
@@ -1068,7 +1068,7 @@ class Checkout {
if ($checkout_form) {
$customer_meta_fields = $checkout_form->get_all_meta_fields('customer_meta');
- $meta_repository = array();
+ $meta_repository = [];
foreach ($customer_meta_fields as $customer_meta_field) {
/*
@@ -1106,7 +1106,7 @@ class Checkout {
$user = $customer->get_user();
- $user_meta_repository = array();
+ $user_meta_repository = [];
foreach ($user_meta_fields as $user_meta_field) {
/*
@@ -1239,7 +1239,7 @@ class Checkout {
if ($auto_generate_url === 'username') {
$site_url = $this->customer->get_username();
- $site_title = $site_title ? $site_title : $site_url;
+ $site_title = $site_title ?: $site_url;
} else {
$site_url = strtolower(str_replace(' ', '', preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities(trim((string) $site_title)))));
}
@@ -1278,7 +1278,7 @@ class Checkout {
* that way we can use it when actually registering
* the site on WordPress.
*/
- $transient = array();
+ $transient = [];
if ($this->checkout_form) {
$site_meta_fields = $this->checkout_form->get_all_fields();
@@ -1289,7 +1289,7 @@ class Checkout {
* to make sure plain passwords do not get stored
* on the database.
*/
- if (strpos((string) $site_meta_field['id'], 'password') !== false ) {
+ if (str_contains((string) $site_meta_field['id'], 'password') ) {
continue;
}
@@ -1310,7 +1310,7 @@ class Checkout {
*/
$template_id = apply_filters('wu_checkout_template_id', (int) $this->request_or_session('template_id'), $this->membership, $this);
- $site_data = array(
+ $site_data = [
'domain' => $d->domain,
'path' => $d->path,
'title' => $site_title,
@@ -1321,7 +1321,7 @@ class Checkout {
'signup_options' => $this->get_site_meta_fields($form_slug, 'site_option'),
'signup_meta' => $this->get_site_meta_fields($form_slug, 'site_meta'),
'type' => Site_Type::CUSTOMER_OWNED,
- );
+ ];
$pending_site = $this->membership->create_pending_site($site_data);
@@ -1340,12 +1340,12 @@ class Checkout {
protected function get_site_meta_fields($form_slug, $meta_type = 'site_meta') {
if (empty($form_slug) || $form_slug === 'none') {
- return array();
+ return [];
}
$checkout_form = wu_get_checkout_form_by_slug($form_slug);
- $list = array();
+ $list = [];
if ($checkout_form) {
$site_meta_fields = $checkout_form->get_all_meta_fields($meta_type);
@@ -1389,11 +1389,11 @@ class Checkout {
*/
$previous_payment = $this->membership->get_last_pending_payment();
- $cancel_types = array(
+ $cancel_types = [
'upgrade',
'downgrade',
'addon',
- );
+ ];
if ($previous_payment && in_array($this->type, $cancel_types, true)) {
$previous_payment->set_status(Payment_Status::CANCELLED);
@@ -1444,12 +1444,12 @@ class Checkout {
*/
if ($this->order->has_trial()) {
$payment->attributes(
- array(
+ [
'tax_total' => 0,
'subtotal' => 0,
'refund_total' => 0,
'total' => 0,
- )
+ ]
);
$payment->save();
@@ -1464,7 +1464,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function validate_form() {
+ public function validate_form(): void {
$validation = $this->validate();
@@ -1481,7 +1481,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function create_order() {
+ public function create_order(): void {
$this->setup_checkout();
@@ -1493,8 +1493,8 @@ class Checkout {
$cart = new Cart(
apply_filters(
'wu_cart_parameters',
- array(
- 'products' => $this->request_or_session('products', array()),
+ [
+ 'products' => $this->request_or_session('products', []),
'discount_code' => $this->request_or_session('discount_code'),
'country' => $country,
'state' => $state,
@@ -1505,7 +1505,7 @@ class Checkout {
'duration' => $this->request_or_session('duration'),
'duration_unit' => $this->request_or_session('duration_unit'),
'cart_type' => $this->request_or_session('cart_type', 'new'),
- ),
+ ],
$this
)
);
@@ -1518,15 +1518,15 @@ class Checkout {
$country_data = wu_get_country($cart->get_country());
wp_send_json_success(
- array(
+ [
'order' => $cart->done(),
'states' => wu_key_map_to_array($country_data->get_states_as_options(), 'code', 'name'),
'cities' => wu_key_map_to_array($country_data->get_cities_as_options($state), 'code', 'name'),
- 'labels' => array(
+ 'labels' => [
'state_field' => $country_data->get_administrative_division_name(null, true),
'city_field' => $country_data->get_municipality_name(null, true),
- ),
- )
+ ],
+ ]
);
}
@@ -1543,11 +1543,11 @@ class Checkout {
/*
* Localized strings.
*/
- $i18n = array(
+ $i18n = [
'loading' => __('Loading...', 'wp-ultimo'),
'added_to_order' => __('The item was added!', 'wp-ultimo'),
'weak_password' => __('The Password entered is too weak.', 'wp-ultimo'),
- );
+ ];
/*
* Get the default gateway.
@@ -1579,14 +1579,14 @@ class Checkout {
}
}
- $products = array_merge($this->request_or_session('products', array()), wu_request('products', array()));
+ $products = array_merge($this->request_or_session('products', []), wu_request('products', []));
$geolocation = \WP_Ultimo\Geolocation::geolocate_ip('', true);
/*
* Set the default variables.
*/
- $variables = array(
+ $variables = [
'i18n' => $i18n,
'ajaxurl' => wu_ajax_url(),
'late_ajaxurl' => wu_ajax_url('init'),
@@ -1603,7 +1603,7 @@ class Checkout {
'needs_billing_info' => true,
'auto_renew' => true,
'products' => array_unique($products),
- );
+ ];
/*
* There's a couple of things we need to determine.
@@ -1651,7 +1651,7 @@ class Checkout {
$variables['membership_id'] = $membership_id;
}
- list($plan, $other_products) = wu_segregate_products($variables['products']);
+ [$plan, $other_products] = wu_segregate_products($variables['products']);
$variables['plan'] = $plan ? $plan->get_id() : 0;
@@ -1700,7 +1700,7 @@ class Checkout {
*
* First, let's set upm the general rules:
*/
- $rules = array(
+ $rules = [
'email_address' => 'required_without:user_id|email|unique:\WP_User,email',
'username' => 'required_without:user_id|alpha_dash|min:4|lowercase|unique:\WP_User,login',
'password' => 'required_without:user_id|min:6',
@@ -1713,7 +1713,7 @@ class Checkout {
'billing_zip_code' => 'required_with:billing_zip_code',
'billing_state' => 'state',
'billing_city' => 'city',
- );
+ ];
/*
* Add rules for site when creating a new account.
@@ -1745,7 +1745,7 @@ class Checkout {
$validation_rules = $this->validation_rules();
if (wu_request('pre-flight') || wu_request('checkout_form') === 'wu-finish-checkout') {
- $validation_rules = array();
+ $validation_rules = [];
return $validation_rules;
}
@@ -1764,10 +1764,10 @@ class Checkout {
}
// We'll use this to validate product fields
- $product_fields = array(
+ $product_fields = [
'pricing_table',
'products',
- );
+ ];
/**
* Add the additional required fields.
@@ -1825,9 +1825,9 @@ class Checkout {
$rules = $this->get_validation_rules();
}
- $base_aliases = array();
+ $base_aliases = [];
- $checkout_form_fields = $this->checkout_form ? $this->checkout_form->get_all_fields() : array();
+ $checkout_form_fields = $this->checkout_form ? $this->checkout_form->get_all_fields() : [];
// Add current form fields
foreach ($checkout_form_fields as $field) {
@@ -1841,13 +1841,13 @@ class Checkout {
// Add some hidden or compound fields ids
$validation_aliases = array_merge(
- array(
+ [
'password_conf' => __('Password confirmation', 'wp-ultimo'),
'template_id' => __('Template ID', 'wp-ultimo'),
'valid_password' => __('Valid password', 'wp-ultimo'),
'products' => __('Products', 'wp-ultimo'),
'gateway' => __('Payment Gateway', 'wp-ultimo'),
- ),
+ ],
$base_aliases
);
@@ -1885,7 +1885,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function maybe_process_checkout() {
+ public function maybe_process_checkout(): void {
/*
* Sets up the checkout
* environment.
@@ -1944,10 +1944,10 @@ class Checkout {
*/
if ($payment) {
$redirect_url = add_query_arg(
- array(
+ [
'payment' => $payment->get_hash(),
'status' => 'error',
- ),
+ ],
$redirect_url
);
}
@@ -1973,11 +1973,11 @@ class Checkout {
* have checkout_ on their name, or start
* with a underscore.
*/
- $to_save = array_filter($_POST, fn($item) => strncmp((string) $item, 'checkout_', strlen('checkout_')) !== 0 && strncmp((string) $item, '_', strlen('_')) !== 0, ARRAY_FILTER_USE_KEY);
+ $to_save = array_filter($_POST, fn($item) => ! str_starts_with((string) $item, 'checkout_') && ! str_starts_with((string) $item, '_'), ARRAY_FILTER_USE_KEY);
if (isset($to_save['pre-flight'])) {
unset($to_save['pre-flight']);
- $this->session->add_values('signup', array('pre_selected' => $to_save));
+ $this->session->add_values('signup', ['pre_selected' => $to_save]);
}
/*
@@ -2119,12 +2119,12 @@ class Checkout {
if (has_action('wp_ultimo_registration')) {
$_payment = wu_get_payment($payment->get_id());
- $args = array(
+ $args = [
0, // Site ID is not yet available at this point
$customer->get_user_id(),
$this->session->get('signup'),
$_payment && $_payment->get_membership() ? new \WU_Plan($_payment->get_membership()->get_plan()) : false,
- );
+ ];
ob_start();
@@ -2152,10 +2152,10 @@ class Checkout {
$redirect_url = apply_filters('wp_ultimo_redirect_url_after_signup', $redirect_url, 0, get_current_user_id(), $_POST);
$redirect_url = add_query_arg(
- array(
+ [
'payment' => $payment ? $payment->get_hash() : 'none',
'status' => 'done',
- ),
+ ],
$redirect_url
);
}
@@ -2174,10 +2174,10 @@ class Checkout {
return new \WP_Error(
'error',
$e->getMessage(),
- array(
+ [
'trace' => $e->getTrace(),
'payment' => $payment,
- )
+ ]
);
}
}
@@ -2254,7 +2254,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
$custom_css = apply_filters('wu_checkout_custom_css', '');
@@ -2264,7 +2264,7 @@ class Checkout {
wp_enqueue_style('wu-admin');
- wp_register_script('wu-checkout', wu_get_asset('checkout.js', 'js'), array('jquery-core', 'wu-vue', 'moment', 'wu-block-ui', 'wu-functions', 'password-strength-meter', 'underscore', 'wp-polyfill', 'wp-hooks', 'wu-cookie-helpers'), wu_get_version(), true);
+ wp_register_script('wu-checkout', wu_get_asset('checkout.js', 'js'), ['jquery-core', 'wu-vue', 'moment', 'wu-block-ui', 'wu-functions', 'password-strength-meter', 'underscore', 'wp-polyfill', 'wp-hooks', 'wu-cookie-helpers'], wu_get_version(), true);
wp_localize_script('wu-checkout', 'wu_checkout', $this->get_checkout_variables());
@@ -2326,7 +2326,7 @@ class Checkout {
$index = $current_step_index + 1;
- return isset($keys[ $index ]) ? $keys[ $index ] : $keys[ $current_step_index ];
+ return $keys[ $index ] ?? $keys[ $current_step_index ];
}
/**
@@ -2390,7 +2390,7 @@ class Checkout {
* @since 2.0.0
* @return void
*/
- public function maybe_display_checkout_errors() {
+ public function maybe_display_checkout_errors(): void {
if (wu_request('status') !== 'error') {
return;
diff --git a/inc/checkout/class-legacy-checkout.php b/inc/checkout/class-legacy-checkout.php
index 20f48c8..affa119 100644
--- a/inc/checkout/class-legacy-checkout.php
+++ b/inc/checkout/class-legacy-checkout.php
@@ -90,26 +90,26 @@ class Legacy_Checkout {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
$this->session = wu_get_session('signup');
- $this->templates = array(
+ $this->templates = [
'signup-main.php' => __('WP Multisite WaaS Legacy Signup', 'wp-ultimo'),
- );
+ ];
// add_filter('request', array($this, 'maybe_render_legacy_signup'));
- add_action('wu_signup_enqueue_scripts', array($this, 'register_scripts'));
+ add_action('wu_signup_enqueue_scripts', [$this, 'register_scripts']);
- add_filter('theme_page_templates', array($this, 'add_new_template'));
+ add_filter('theme_page_templates', [$this, 'add_new_template']);
// Add a filter to the save post to inject out template into the page cache
- add_filter('wp_insert_post_data', array($this, 'register_legacy_templates'));
+ add_filter('wp_insert_post_data', [$this, 'register_legacy_templates']);
// Add a filter to the template include to determine if the page has our
// template assigned and return it's path
- add_filter('template_include', array($this, 'view_legacy_template'));
+ add_filter('template_include', [$this, 'view_legacy_template']);
}
@@ -153,7 +153,7 @@ class Legacy_Checkout {
if (empty($templates)) {
- $templates = array();
+ $templates = [];
}
@@ -228,21 +228,21 @@ class Legacy_Checkout {
* @since 2.0.0
* @return void
*/
- public function register_scripts() {
+ public function register_scripts(): void {
wp_enqueue_script('wu-block-ui');
- wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'));
+ wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), ['wu-functions']);
- wp_localize_script('wu-legacy-signup', 'wpu', array(
+ wp_localize_script('wu-legacy-signup', 'wpu', [
'default_pricing_option' => 1,
- ));
+ ]);
wp_enqueue_script('wu-legacy-signup');
- wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'), array('dashicons', 'install', 'admin-bar'));
+ wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'), ['dashicons', 'install', 'admin-bar']);
- wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons', 'install'));
+ wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons', 'install']);
wp_add_inline_style('legacy-signup', $this->get_legacy_dynamic_styles());
@@ -315,9 +315,9 @@ class Legacy_Checkout {
$checkout_page_slug = 'register';
- $page_name = isset($request['pagename']) ? $request['pagename'] : '';
+ $page_name = $request['pagename'] ?? '';
- if (strncmp((string) $page_name, $checkout_page_slug, strlen($checkout_page_slug)) === 0) {
+ if (str_starts_with((string) $page_name, $checkout_page_slug)) {
$page = explode('/', (string) $page_name);
/**
@@ -347,13 +347,13 @@ class Legacy_Checkout {
* @since 2.0.0
* @return void
*/
- public function legacy_signup() {
+ public function legacy_signup(): void {
status_header(200);
$this->session = wu_get_session('signup');
- $this->session->set('form', array('not-empty'));
+ $this->session->set('form', ['not-empty']);
// Apply a filter so we can add steps in the future
$this->steps = $this->get_steps();
@@ -365,9 +365,9 @@ class Legacy_Checkout {
wu_get_template(
'legacy/signup/signup-main',
- array(
+ [
'signup' => $this,
- )
+ ]
);
exit;
@@ -378,7 +378,7 @@ class Legacy_Checkout {
*
* @return void
*/
- public function check_geolocation() {
+ public function check_geolocation(): void {
$location = \WP_Ultimo\Geolocation::geolocate_ip();
@@ -425,7 +425,7 @@ class Legacy_Checkout {
if (isset($current_step['handler']) && $current_step['handler']) {
$handler_function = $current_step['handler'];
} else {
- $handler_function = array($this, 'default_save');
+ $handler_function = [$this, 'default_save'];
}
/** Allows for handler rewrite */
@@ -441,7 +441,7 @@ class Legacy_Checkout {
* @since 1.4.0
* @return void
*/
- public function begin_signup() {
+ public function begin_signup(): void {
/**
* Check Geo-location
@@ -452,9 +452,9 @@ class Legacy_Checkout {
$uniqid = uniqid('', true);
/** Initializes the content holder with the honeypot unique id */
- $content = array(
+ $content = [
'honeypot_id' => uniqid(''),
- );
+ ];
/**
* Saves the coupon code in the request, only if that option is available
@@ -519,7 +519,7 @@ class Legacy_Checkout {
*/
public static function is_customizer(): bool {
- $exclude_list = apply_filters('wu_replace_signup_urls_exclude', array('wu-signup-customizer-preview'));
+ $exclude_list = apply_filters('wu_replace_signup_urls_exclude', ['wu-signup-customizer-preview']);
foreach ($exclude_list as $replace_word) {
if (isset($_GET[ $replace_word ])) {
@@ -556,7 +556,7 @@ class Legacy_Checkout {
$current_step = wu_request('step', current(array_keys($this->steps)));
// Always get the first step for the customizer //
- if ($this->is_customizer()) {
+ if (static::is_customizer()) {
$current_step = $this->get_first_step();
}
@@ -569,7 +569,7 @@ class Legacy_Checkout {
* @param string $step The current step.
* @return void
*/
- public function get_step_view($step) {
+ public function get_step_view($step): void {
$transient = $this->session->get('form');
$geo = $this->session->get('geolocation');
@@ -578,7 +578,7 @@ class Legacy_Checkout {
* Set the errors
*/
if ($this->results === null) {
- $this->results = array('errors' => new \WP_Error());
+ $this->results = ['errors' => new \WP_Error()];
}
if (empty($_POST)) {
@@ -588,12 +588,12 @@ class Legacy_Checkout {
/**
* Builds the array containing the available elements inside the template
*/
- $args = array(
+ $args = [
'signup' => $this,
'transient' => $transient,
- 'fields' => isset($this->steps[ $step ]['fields']) ? $this->steps[ $step ]['fields'] : array(),
+ 'fields' => $this->steps[ $step ]['fields'] ?? [],
'results' => $this->results,
- );
+ ];
/**
* Checks if anything is passed to the view element
@@ -626,47 +626,47 @@ class Legacy_Checkout {
public function get_steps($include_hidden = true, $filtered = true) {
// Set the Steps
- $steps = array();
+ $steps = [];
// Plan Selector
- $steps['plan'] = array(
+ $steps['plan'] = [
'name' => __('Pick a Plan', 'wp-ultimo'),
'desc' => __('Which one of our amazing plans you want to get?', 'wp-ultimo'),
'view' => 'step-plans',
- 'handler' => array($this, 'plans_save'),
+ 'handler' => [$this, 'plans_save'],
'order' => 10,
'fields' => false,
'core' => true,
- );
+ ];
- $site_templates = array(
+ $site_templates = [
2,
- );
+ ];
// We add template selection if this has template
if ($site_templates) {
- $steps['template'] = array(
+ $steps['template'] = [
'name' => __('Template Selection', 'wp-ultimo'),
'desc' => __('Select the base template of your new site.', 'wp-ultimo'),
'view' => 'step-template',
'order' => 20,
'handler' => false,
'core' => true,
- );
+ ];
}
// Domain registering
- $steps['domain'] = array(
+ $steps['domain'] = [
'name' => __('Site Details', 'wp-ultimo'),
'desc' => __('Ok, now it\'s time to pick your site url and title!', 'wp-ultimo'),
- 'handler' => array($this, 'domain_save'),
+ 'handler' => [$this, 'domain_save'],
'view' => false,
'order' => 30,
'core' => true,
'fields' => apply_filters(
'wu_signup_fields_domain',
- array(
- 'blog_title' => array(
+ [
+ 'blog_title' => [
'order' => 10,
'name' => apply_filters('wu_signup_site_title_label', __('Site Title', 'wp-ultimo')),
'type' => 'text',
@@ -675,8 +675,8 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_site_title_tooltip', __('Select the title your site is going to have.', 'wp-ultimo')),
'required' => true,
'core' => true,
- ),
- 'blogname' => array(
+ ],
+ 'blogname' => [
'order' => 20,
'name' => apply_filters('wu_signup_site_url_label', __('URL', 'wp-ultimo')),
'type' => 'text',
@@ -685,30 +685,30 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_site_url_tooltip', __('Site urls can only contain lowercase letters (a-z) and numbers and must be at least 4 characters. .', 'wp-ultimo')),
'required' => true,
'core' => true,
- ),
- 'url_preview' => array(
+ ],
+ 'url_preview' => [
'order' => 30,
'name' => __('Site URL Preview', 'wp-ultimo'),
'type' => 'html',
'content' => wu_get_template_contents('legacy/signup/steps/step-domain-url-preview'),
- ),
- 'submit' => array(
+ ],
+ 'submit' => [
'order' => 100,
'type' => 'submit',
'name' => __('Continue to the next step', 'wp-ultimo'),
'core' => true,
- ),
- )
+ ],
+ ]
),
- );
+ ];
/**
* Since there are some conditional fields on the accounts step, we need to declare the variable before
* so we can append items and filter it later
*/
- $account_fields = array(
+ $account_fields = [
- 'user_name' => array(
+ 'user_name' => [
'order' => 10,
'name' => apply_filters('wu_signup_username_label', __('Username', 'wp-ultimo')),
'type' => 'text',
@@ -717,9 +717,9 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_username_tooltip', __('Username must be at least 4 characters.', 'wp-ultimo')),
'required' => true,
'core' => true,
- ),
+ ],
- 'user_email' => array(
+ 'user_email' => [
'order' => 20,
'name' => apply_filters('wu_signup_email_label', __('Email', 'wp-ultimo')),
'type' => 'email',
@@ -728,9 +728,9 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_email_tooltip', ''),
'required' => true,
'core' => true,
- ),
+ ],
- 'user_pass' => array(
+ 'user_pass' => [
'order' => 30,
'name' => apply_filters('wu_signup_password_label', __('Password', 'wp-ultimo')),
'type' => 'password',
@@ -739,9 +739,9 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_password_tooltip', __('Your password should be at least 6 characters long.', 'wp-ultimo')),
'required' => true,
'core' => true,
- ),
+ ],
- 'user_pass_conf' => array(
+ 'user_pass_conf' => [
'order' => 40,
'name' => apply_filters('wu_signup_password_conf_label', __('Confirm Password', 'wp-ultimo')),
'type' => 'password',
@@ -750,28 +750,28 @@ class Legacy_Checkout {
'tooltip' => apply_filters('wu_signup_password_conf_tooltip', ''),
'required' => true,
'core' => true,
- ),
+ ],
/**
* HoneyPot Field
*/
- 'site_url' => array(
- 'order' => rand(1, 59), // Use random order for Honeypot
+ 'site_url' => [
+ 'order' => random_int(1, 59), // Use random order for Honeypot
'name' => __('Site URL', 'wp-ultimo'),
'type' => 'text',
'default' => '',
'placeholder' => '',
'tooltip' => '',
'core' => true,
- 'wrapper_attributes' => array(
+ 'wrapper_attributes' => [
'style' => 'display: none;',
- ),
- 'attributes' => array(
+ ],
+ 'attributes' => [
'autocomplete' => 'nope',
- ),
- ),
+ ],
+ ],
- );
+ ];
/**
* Check and Add Coupon Code Fields
@@ -819,22 +819,22 @@ class Legacy_Checkout {
/**
* Submit Field
*/
- $account_fields['submit'] = array(
+ $account_fields['submit'] = [
'order' => 100,
'type' => 'submit',
'name' => __('Create Account', 'wp-ultimo'),
'core' => true,
- );
+ ];
// Account registering
- $steps['account'] = array(
+ $steps['account'] = [
'name' => __('Account Details', 'wp-ultimo'),
'view' => false,
- 'handler' => array($this, 'account_save'),
+ 'handler' => [$this, 'account_save'],
'order' => 40,
'core' => true,
'fields' => apply_filters('wu_signup_fields_account', $account_fields),
- );
+ ];
/**
* Add additional steps via filters
@@ -842,21 +842,21 @@ class Legacy_Checkout {
$steps = $filtered ? apply_filters('wp_ultimo_registration_steps', $steps) : $steps;
// Sort elements based on their order
- uasort($steps, array($this, 'sort_steps_and_fields'));
+ uasort($steps, [$this, 'sort_steps_and_fields']);
// Sorts each of the fields block
foreach ($steps as &$step) {
$step = wp_parse_args(
$step,
- array(
+ [
'hidden' => false,
- )
+ ]
);
if (isset($step['fields']) && is_array($step['fields'])) {
// Sort elements based on their order
- uasort($step['fields'], array($this, 'sort_steps_and_fields'));
+ uasort($step['fields'], [$this, 'sort_steps_and_fields']);
}
}
@@ -865,32 +865,32 @@ class Legacy_Checkout {
*
* @since 1.4.0
*/
- $begin_signup = array(
- 'begin-signup' => array(
+ $begin_signup = [
+ 'begin-signup' => [
'name' => __('Begin Signup Process', 'wp-ultimo'),
- 'handler' => array($this, 'begin_signup'),
+ 'handler' => [$this, 'begin_signup'],
'view' => false,
'hidden' => true,
'order' => 0,
'core' => true,
- ),
- );
+ ],
+ ];
/**
* Adds the hidden step now responsible for validating data entry and the actual account creation
*
* @since 1.4.0
*/
- $create_account = array(
- 'create-account' => array(
+ $create_account = [
+ 'create-account' => [
'name' => __('Creating Account', 'wp-ultimo'),
- 'handler' => array($this, 'create_account'),
+ 'handler' => [$this, 'create_account'],
'view' => false,
'hidden' => true,
'core' => true,
'order' => 1_000_000_000,
- ),
- );
+ ],
+ ];
/**
* Glue the required steps together with the filterable ones
@@ -923,9 +923,9 @@ class Legacy_Checkout {
public static function get_transient($die = true) {
if (self::is_customizer()) {
- $transient = array(
+ $transient = [
'not-empty' => '',
- );
+ ];
} else {
$transient = wu_get_session('signup')->get('form');
}
@@ -936,7 +936,7 @@ class Legacy_Checkout {
}
if (is_null($transient)) {
- return array();
+ return [];
}
return $transient;
@@ -947,7 +947,7 @@ class Legacy_Checkout {
*
* @param array $transient Array containing the transient data.
*/
- public function update_transient($transient) {
+ public function update_transient($transient): void {
$this->session->set('form', $transient);
@@ -958,7 +958,7 @@ class Legacy_Checkout {
*/
public function has_plan_step(): bool {
- $transient = $this->get_transient();
+ $transient = static::get_transient();
if (isset($transient['skip_plan']) && isset($transient['plan_id']) && isset($transient['plan_freq'])) {
return false;
@@ -973,7 +973,7 @@ class Legacy_Checkout {
* @param array $params The params.
* @return string The link for the next step
*/
- public function get_next_step_link($params = array()) {
+ public function get_next_step_link($params = []) {
// Add CS
if (isset($_GET['cs'])) {
@@ -1020,7 +1020,7 @@ class Legacy_Checkout {
* @param array $args Arguments to build the URL.
* @return void
*/
- public function next_step($args = array()) {
+ public function next_step($args = []): void {
/** Redirect the user to the next step */
wp_redirect(esc_url_raw($this->get_next_step_link($args)));
@@ -1035,7 +1035,7 @@ class Legacy_Checkout {
* @param array $params The params.
* @return string The link for the previous step
*/
- public function get_prev_step_link($params = array()) {
+ public function get_prev_step_link($params = []) {
// Add CS
if (isset($_GET['cs'])) {
@@ -1089,10 +1089,10 @@ class Legacy_Checkout {
* @param integer $freq The freq.
* @return void
*/
- public function form_fields($current_plan = false, $step = 'plan', $freq = false) {
+ public function form_fields($current_plan = false, $step = 'plan', $freq = false): void {
/** Select the default frequency */
- $freq = $freq ? $freq : wu_get_setting('default_pricing_option');
+ $freq = $freq ?: wu_get_setting('default_pricing_option');
?>
@@ -1127,7 +1127,7 @@ class Legacy_Checkout {
*/
public function get_site_url_for_previewer() {
- $domain_options = array();
+ $domain_options = [];
$site = get_current_site();
@@ -1153,10 +1153,10 @@ class Legacy_Checkout {
/**
* We pass the following info
*/
- public function plans_save() {
+ public function plans_save(): void {
// Get transient
- $transient = $this->get_transient();
+ $transient = static::get_transient();
// Check referer
check_admin_referer('signup_form_1', '_signup_form');
@@ -1200,10 +1200,10 @@ class Legacy_Checkout {
/**
* Personal Info Settings.
*/
- public function domain_save() {
+ public function domain_save(): void {
// Get transient
- $transient = $this->get_transient();
+ $transient = static::get_transient();
// Check referer
check_admin_referer('signup_form_1', '_signup_form');
@@ -1247,7 +1247,7 @@ class Legacy_Checkout {
*/
public function filter_post_array($post, $exclude_list = false) {
- $exclude_list = $exclude_list ? $exclude_list : array('_signup_form', '_wp_http_referer');
+ $exclude_list = $exclude_list ?: ['_signup_form', '_wp_http_referer'];
/** Filter Array */
$post = $this->array_filter_key($post, fn($element_key) => ! in_array($element_key, $exclude_list, true));
@@ -1267,7 +1267,7 @@ class Legacy_Checkout {
*/
public function array_filter_key(array $array, $callback): array {
- $matched_keys = array_filter(array_keys($array), $callback === null ? fn($v, $k): bool => ! empty($v) : $callback, $callback === null ? ARRAY_FILTER_USE_BOTH : 0);
+ $matched_keys = array_filter(array_keys($array), $callback ?? fn($v, $k): bool => ! empty($v), $callback === null ? ARRAY_FILTER_USE_BOTH : 0);
return array_intersect_key($array, array_flip($matched_keys));
}
@@ -1296,7 +1296,7 @@ class Legacy_Checkout {
* @param array $step The step info.
* @return void
*/
- public function add_signup_step($id, $order, $step) {
+ public function add_signup_step($id, $order, $step): void {
add_filter(
'wp_ultimo_registration_steps',
@@ -1325,7 +1325,7 @@ class Legacy_Checkout {
* @param array $field The field.
* @return void
*/
- public function add_signup_field($step, $id, $order, $field) {
+ public function add_signup_field($step, $id, $order, $field): void {
add_filter(
'wp_ultimo_registration_steps',
diff --git a/inc/checkout/class-line-item.php b/inc/checkout/class-line-item.php
index e7487f4..ec26c78 100644
--- a/inc/checkout/class-line-item.php
+++ b/inc/checkout/class-line-item.php
@@ -305,7 +305,7 @@ class Line_Item implements \JsonSerializable {
* @param array $data Array of key => values billing address fields.
* @return void
*/
- public function attributes($data) {
+ public function attributes($data): void {
/*
* Set type first to allow for overriding the other parameters.
*/
@@ -368,7 +368,7 @@ class Line_Item implements \JsonSerializable {
* @param string $type The line item type.
* @return void
*/
- public function set_type($type) {
+ public function set_type($type): void {
$this->type = $type;
}
@@ -407,7 +407,7 @@ class Line_Item implements \JsonSerializable {
* @param Product $product Product associated with this line item.
* @return void
*/
- public function set_product($product) {
+ public function set_product($product): void {
$this->product_id = $product->get_id();
@@ -491,12 +491,12 @@ class Line_Item implements \JsonSerializable {
$taxes = 0;
}
- $totals = array(
+ $totals = [
'subtotal' => $sub_total,
'discount_total' => $discounts,
'tax_total' => $taxes,
'total' => $total,
- );
+ ];
$this->attributes($totals);
@@ -521,7 +521,7 @@ class Line_Item implements \JsonSerializable {
* @param float $quantity Quantity of the given product.
* @return void
*/
- public function set_quantity($quantity) {
+ public function set_quantity($quantity): void {
$this->quantity = $quantity;
}
@@ -544,7 +544,7 @@ class Line_Item implements \JsonSerializable {
* @param integer $unit_price Unit price of the product.
* @return void
*/
- public function set_unit_price($unit_price) {
+ public function set_unit_price($unit_price): void {
$this->unit_price = $unit_price;
}
@@ -567,7 +567,7 @@ class Line_Item implements \JsonSerializable {
* @param float $tax_rate Tax amount, absolute or percentage.
* @return void
*/
- public function set_tax_rate($tax_rate) {
+ public function set_tax_rate($tax_rate): void {
$this->tax_rate = $tax_rate;
}
@@ -590,7 +590,7 @@ class Line_Item implements \JsonSerializable {
* @param string $tax_type Type of the tax, percentage or absolute.
* @return void
*/
- public function set_tax_type($tax_type) {
+ public function set_tax_type($tax_type): void {
$this->tax_type = $tax_type;
}
@@ -613,7 +613,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $tax_inclusive If tax are included in the price or not.
* @return void
*/
- public function set_tax_inclusive($tax_inclusive) {
+ public function set_tax_inclusive($tax_inclusive): void {
$this->tax_inclusive = $tax_inclusive;
}
@@ -636,7 +636,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $tax_exempt If the line item is tax exempt ot not.
* @return void
*/
- public function set_tax_exempt($tax_exempt) {
+ public function set_tax_exempt($tax_exempt): void {
$this->tax_exempt = $tax_exempt;
}
@@ -659,7 +659,7 @@ class Line_Item implements \JsonSerializable {
* @param float $tax_total The amount, in currency, of the tax.
* @return void
*/
- public function set_tax_total($tax_total) {
+ public function set_tax_total($tax_total): void {
$this->tax_total = $tax_total;
}
@@ -682,7 +682,7 @@ class Line_Item implements \JsonSerializable {
* @param float $total The total value of the line.
* @return void
*/
- public function set_total($total) {
+ public function set_total($total): void {
$this->total = $total;
}
@@ -705,7 +705,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $recurring If this item is recurring or not.
* @return void
*/
- public function set_recurring($recurring) {
+ public function set_recurring($recurring): void {
$this->recurring = $recurring;
}
@@ -728,7 +728,7 @@ class Line_Item implements \JsonSerializable {
* @param float $subtotal Value before taxes, discounts, fees and etc.
* @return void
*/
- public function set_subtotal($subtotal) {
+ public function set_subtotal($subtotal): void {
$this->subtotal = $subtotal;
}
@@ -751,7 +751,7 @@ class Line_Item implements \JsonSerializable {
* @param int $duration The billing cycle duration.
* @return void
*/
- public function set_duration($duration) {
+ public function set_duration($duration): void {
$this->duration = $duration;
}
@@ -774,7 +774,7 @@ class Line_Item implements \JsonSerializable {
* @param string $duration_unit The duration unit.
* @return void
*/
- public function set_duration_unit($duration_unit) {
+ public function set_duration_unit($duration_unit): void {
$this->duration_unit = $duration_unit;
}
@@ -797,7 +797,7 @@ class Line_Item implements \JsonSerializable {
* @param int $billing_cycles The number of billing cycles.
* @return void
*/
- public function set_billing_cycles($billing_cycles) {
+ public function set_billing_cycles($billing_cycles): void {
$this->billing_cycles = $billing_cycles;
}
@@ -820,7 +820,7 @@ class Line_Item implements \JsonSerializable {
* @param float $discount_total The total value of discounts.
* @return void
*/
- public function set_discount_total($discount_total) {
+ public function set_discount_total($discount_total): void {
$this->discount_total = $discount_total;
}
@@ -843,7 +843,7 @@ class Line_Item implements \JsonSerializable {
* @param string $tax_category The tax category.
* @return void
*/
- public function set_tax_category($tax_category) {
+ public function set_tax_category($tax_category): void {
$this->tax_category = $tax_category;
}
@@ -866,7 +866,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $discountable If the line is discountable.
* @return void
*/
- public function set_discountable($discountable) {
+ public function set_discountable($discountable): void {
$this->discountable = $discountable;
}
@@ -889,7 +889,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $taxable If the item is taxable or not.
* @return void
*/
- public function set_taxable($taxable) {
+ public function set_taxable($taxable): void {
$this->taxable = $taxable;
}
@@ -912,7 +912,7 @@ class Line_Item implements \JsonSerializable {
* @param float $discount_rate The discount amount (flat or percentage).
* @return void
*/
- public function set_discount_rate($discount_rate) {
+ public function set_discount_rate($discount_rate): void {
$this->discount_rate = $discount_rate;
}
@@ -935,7 +935,7 @@ class Line_Item implements \JsonSerializable {
* @param string $discount_type The type of discount, percentage or absolute.
* @return void
*/
- public function set_discount_type($discount_type) {
+ public function set_discount_type($discount_type): void {
$this->discount_type = $discount_type;
}
@@ -958,7 +958,7 @@ class Line_Item implements \JsonSerializable {
* @param string $discount_label Discount Label.
* @return void
*/
- public function set_discount_label($discount_label) {
+ public function set_discount_label($discount_label): void {
$this->discount_label = $discount_label;
}
@@ -981,7 +981,7 @@ class Line_Item implements \JsonSerializable {
* @param boolean $apply_discount_to_renewals If we should apply discount to renewals.
* @return void
*/
- public function set_apply_discount_to_renewals($apply_discount_to_renewals) {
+ public function set_apply_discount_to_renewals($apply_discount_to_renewals): void {
$this->apply_discount_to_renewals = $apply_discount_to_renewals;
}
@@ -1004,7 +1004,7 @@ class Line_Item implements \JsonSerializable {
* @param int $product_id The product id.
* @return void
*/
- public function set_product_id($product_id) {
+ public function set_product_id($product_id): void {
$this->product_id = $product_id;
}
@@ -1027,7 +1027,7 @@ class Line_Item implements \JsonSerializable {
* @param string $title The line item title.
* @return void
*/
- public function set_title($title) {
+ public function set_title($title): void {
$this->title = $title;
}
@@ -1050,7 +1050,7 @@ class Line_Item implements \JsonSerializable {
* @param string $description The line item description.
* @return void
*/
- public function set_description($description) {
+ public function set_description($description): void {
$this->description = $description;
}
@@ -1073,7 +1073,7 @@ class Line_Item implements \JsonSerializable {
* @param string $tax_label Label of the tax applied.
* @return void
*/
- public function set_tax_label($tax_label) {
+ public function set_tax_label($tax_label): void {
$this->tax_label = $tax_label;
}
@@ -1135,17 +1135,17 @@ class Line_Item implements \JsonSerializable {
* @param array $query Query arguments.
* @return array
*/
- public static function get_line_items($query = array()) {
+ public static function get_line_items($query = []) {
global $wpdb;
$query = wp_parse_args(
$query,
- array(
+ [
'number' => 100,
- 'date_query' => array(),
+ 'date_query' => [],
'payment_status' => false,
- )
+ ]
);
$query['date_query']['column'] = 'p.date_created';
@@ -1154,7 +1154,7 @@ class Line_Item implements \JsonSerializable {
$date_query_sql = $date_query->get_sql();
- $taxes_paid_list = array();
+ $taxes_paid_list = [];
$status_query_sql = '';
@@ -1219,7 +1219,7 @@ class Line_Item implements \JsonSerializable {
* @param null|string $product_slug The product slug.
* @return void
*/
- public function set_product_slug($product_slug) {
+ public function set_product_slug($product_slug): void {
$this->product_slug = $product_slug;
}
diff --git a/inc/checkout/signup-fields/class-base-signup-field.php b/inc/checkout/signup-fields/class-base-signup-field.php
index 738d2f5..d9112b2 100644
--- a/inc/checkout/signup-fields/class-base-signup-field.php
+++ b/inc/checkout/signup-fields/class-base-signup-field.php
@@ -144,7 +144,7 @@ abstract class Base_Signup_Field {
*/
public function get_field_as_type_option() {
- return array(
+ return [
'title' => $this->get_title(),
'desc' => $this->get_description(),
'tooltip' => $this->get_tooltip(),
@@ -154,8 +154,8 @@ abstract class Base_Signup_Field {
'default_fields' => $this->default_fields(),
'force_attributes' => $this->force_attributes(),
'all_attributes' => $this->get_all_attributes(),
- 'fields' => array($this, 'get_editor_fields'),
- );
+ 'fields' => [$this, 'get_editor_fields'],
+ ];
}
/**
@@ -180,10 +180,10 @@ abstract class Base_Signup_Field {
*/
public function get_tabs() {
- return array(
+ return [
'content',
'style',
- );
+ ];
}
/**
@@ -219,7 +219,7 @@ abstract class Base_Signup_Field {
*/
public function calculate_style_attr() {
- $styles = array();
+ $styles = [];
$width = (int) wu_get_isset($this->attributes, 'width');
@@ -244,7 +244,7 @@ abstract class Base_Signup_Field {
* @param array $attributes Array containing settings for the field.
* @return void
*/
- public function set_attributes($attributes) {
+ public function set_attributes($attributes): void {
$this->attributes = $attributes;
}
@@ -257,7 +257,7 @@ abstract class Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -268,7 +268,7 @@ abstract class Base_Signup_Field {
*/
public function defaults() {
- return array();
+ return [];
}
/**
@@ -279,14 +279,14 @@ abstract class Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
'placeholder',
'tooltip',
'default',
'required',
- );
+ ];
}
/**
@@ -297,7 +297,7 @@ abstract class Base_Signup_Field {
* @param array $attributes The list of attributes of the field.
* @return array
*/
- public function get_editor_fields($attributes = array()) {
+ public function get_editor_fields($attributes = []) {
$final_field_list = $this->get_fields();
@@ -305,28 +305,28 @@ abstract class Base_Signup_Field {
* Checks if this is a site field
*/
if ($this->is_site_field()) {
- $final_field_list[ '_site_notice_field_' . uniqid() ] = array(
+ $final_field_list[ '_site_notice_field_' . uniqid() ] = [
'type' => 'note',
'classes' => 'wu--mt-px',
'desc' => sprintf('
%s
', __('This is a site-related field. For that reason, this field will not show up when no plans are present on the shopping cart.', 'wp-ultimo')),
'order' => 98.5,
- );
+ ];
}
/*
* Checks if this is a user field
*/
if ($this->is_user_field()) {
- $final_field_list[ '_user_notice_field_' . uniqid() ] = array(
+ $final_field_list[ '_user_notice_field_' . uniqid() ] = [
'type' => 'note',
'classes' => 'wu--mt-px',
'desc' => sprintf('
%s
', __('This is a customer-related field. For that reason, this field will not show up when the user is logged and already has a customer on file.', 'wp-ultimo')),
'order' => 98.5,
- );
+ ];
}
foreach ($final_field_list as $key => &$field) {
- $field['html_attr'] = wu_get_isset($field, 'html_attr', array());
+ $field['html_attr'] = wu_get_isset($field, 'html_attr', []);
$value = wu_get_isset($attributes, $key, null);
@@ -382,11 +382,11 @@ abstract class Base_Signup_Field {
$tab = wu_get_isset($field, 'tab', 'content');
$field['wrapper_html_attr'] = array_merge(
- wu_get_isset($field, 'wrapper_html_attr', array()),
- array(
+ wu_get_isset($field, 'wrapper_html_attr', []),
+ [
'v-cloak' => 1,
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
- )
+ ]
);
}
@@ -401,14 +401,14 @@ abstract class Base_Signup_Field {
*/
public function get_all_attributes() {
- $styles = array(
+ $styles = [
'wrapper_element_classes',
'element_classes',
'element_id',
'from_request',
'width',
'logged',
- );
+ ];
$field_keys = array_keys($this->get_fields());
@@ -436,34 +436,34 @@ abstract class Base_Signup_Field {
*/
public static function fields_list() {
- $fields = array();
+ $fields = [];
- $fields['id'] = array(
+ $fields['id'] = [
'type' => 'text',
'title' => __('Field ID', 'wp-ultimo'),
'placeholder' => __('e.g. info-name', 'wp-ultimo'),
'tooltip' => __('Only alpha-numeric and hyphens allowed.', 'wp-ultimo'),
'desc' => __('The ID of the field. This is used to reference the field.', 'wp-ultimo'),
'value' => wu_request('id', ''),
- 'html_attr' => array(
+ 'html_attr' => [
'v-on:input' => 'id = $event.target.value.toLowerCase().replace(/[^a-z0-9-_]+/g, "")',
'v-bind:value' => 'id',
- ),
- );
+ ],
+ ];
- $fields['name'] = array(
+ $fields['name'] = [
'type' => 'text',
'title' => __('Field Label', 'wp-ultimo'),
'placeholder' => __('e.g. Your Name', 'wp-ultimo'),
'desc' => __('This is what your customer see as the field title.', 'wp-ultimo'),
'tooltip' => __('Leave blank to hide the field label. You can also set a placeholder value and tip in the "Additional Settings" tab.', 'wp-ultimo'),
'value' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'name',
- ),
- );
+ ],
+ ];
- $fields['placeholder'] = array(
+ $fields['placeholder'] = [
'type' => 'text',
'title' => __('Field Placeholder', 'wp-ultimo'),
'placeholder' => __('e.g. Placeholder value', 'wp-ultimo'),
@@ -471,12 +471,12 @@ abstract class Base_Signup_Field {
'tooltip' => '',
'value' => '',
'tab' => 'advanced',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'placeholder',
- ),
- );
+ ],
+ ];
- $fields['tooltip'] = array(
+ $fields['tooltip'] = [
'type' => 'textarea',
'title' => __('Field Tooltip', 'wp-ultimo'),
'placeholder' => __('e.g. This field is great, be sure to fill it.', 'wp-ultimo'),
@@ -485,60 +485,60 @@ abstract class Base_Signup_Field {
'tooltip' => '',
'value' => '',
'tab' => 'advanced',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'tooltip',
'rows' => 4,
- ),
- );
+ ],
+ ];
- $fields['default_value'] = array(
+ $fields['default_value'] = [
'type' => 'text',
'title' => __('Default Value', 'wp-ultimo'),
'placeholder' => __('e.g. None', 'wp-ultimo'),
'value' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'default_value',
- ),
- );
+ ],
+ ];
- $fields['note'] = array(
+ $fields['note'] = [
'type' => 'textarea',
'title' => __('Content', 'wp-ultimo'),
'placeholder' => '',
'tooltip' => '',
'value' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'content',
- ),
- );
+ ],
+ ];
- $fields['limits'] = array(
+ $fields['limits'] = [
'type' => 'group',
'title' => __('Field Length', 'wp-ultimo'),
'tooltip' => '',
- 'fields' => array(
- 'min' => array(
+ 'fields' => [
+ 'min' => [
'type' => 'number',
'value' => '',
'placeholder' => __('Min', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-1/2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'min',
- ),
- ),
- 'max' => array(
+ ],
+ ],
+ 'max' => [
'type' => 'number',
'value' => '',
'placeholder' => __('Max', 'wp-ultimo'),
'wrapper_classes' => 'wu-ml-2 wu-w-1/2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'max',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $fields['save_as'] = array(
+ $fields['save_as'] = [
'type' => 'select',
'title' => __('Save As', 'wp-ultimo'),
'desc' => __('Select how you want to save this piece of meta data. You can attach it to the customer or the site as site meta or as site option.', 'wp-ultimo'),
@@ -546,28 +546,28 @@ abstract class Base_Signup_Field {
'tooltip' => '',
'value' => 'customer_meta',
'order' => 99.5,
- 'options' => array(
+ 'options' => [
'customer_meta' => __('Customer Meta', 'wp-ultimo'),
'user_meta' => __('User Meta', 'wp-ultimo'),
'site_meta' => __('Site Meta', 'wp-ultimo'),
'site_option' => __('Site Option', 'wp-ultimo'),
'nothing' => __('Do not save', 'wp-ultimo'),
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'save_as',
- ),
- );
+ ],
+ ];
- $fields['required'] = array(
+ $fields['required'] = [
'type' => 'toggle',
'title' => __('Required', 'wp-ultimo'),
'desc' => __('Mark this field as required. The checkout will not proceed unless this field is filled.', 'wp-ultimo'),
'value' => 0,
'order' => 98,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'required',
- ),
- );
+ ],
+ ];
return $fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-billing-address.php b/inc/checkout/signup-fields/class-signup-field-billing-address.php
index c80c161..cf0e5d5 100644
--- a/inc/checkout/signup-fields/class-signup-field-billing-address.php
+++ b/inc/checkout/signup-fields/class-signup-field-billing-address.php
@@ -122,9 +122,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'zip_and_country' => true,
- );
+ ];
}
/**
@@ -135,9 +135,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
- );
+ ];
}
/**
@@ -148,10 +148,10 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'billing_address',
'required' => true,
- );
+ ];
}
/**
@@ -162,14 +162,14 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'zip_and_country' => array(
+ return [
+ 'zip_and_country' => [
'type' => 'toggle',
'title' => __('Display only ZIP and Country?', 'wp-ultimo'),
'desc' => __('Checking this option will only add the ZIP and country fields, instead of all the normal billing address fields.', 'wp-ultimo'),
'value' => true,
- ),
- );
+ ],
+ ];
}
/**
@@ -197,7 +197,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
$field['type'] = 'select';
$field['options_template'] = $option_template;
- $field['options'] = array();
+ $field['options'] = [];
$field['required'] = true;
$field['wrapper_html_attr']['v-if'] = "{$data_key_name}.length";
$field['html_attr']['required'] = 'required';
@@ -234,16 +234,16 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
}
if (isset($fields['billing_country'])) {
- $fields['billing_country']['html_attr'] = array(
+ $fields['billing_country']['html_attr'] = [
'v-model' => 'country',
- );
+ ];
}
if ( ! $zip_only) {
if (isset($fields['billing_state'])) {
- $fields['billing_state']['html_attr'] = array(
+ $fields['billing_state']['html_attr'] = [
'v-model.lazy' => 'state',
- );
+ ];
/**
* Format the state field accordingly.
@@ -254,9 +254,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
}
if (isset($fields['billing_city'])) {
- $fields['billing_city']['html_attr'] = array(
+ $fields['billing_city']['html_attr'] = [
'v-model.lazy' => 'city',
- );
+ ];
/**
* Format the city field accordingly.
diff --git a/inc/checkout/signup-fields/class-signup-field-checkbox.php b/inc/checkout/signup-fields/class-signup-field-checkbox.php
index ef12f82..b6ad748 100644
--- a/inc/checkout/signup-fields/class-signup-field-checkbox.php
+++ b/inc/checkout/signup-fields/class-signup-field-checkbox.php
@@ -122,9 +122,9 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -135,13 +135,13 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
'tooltip',
'save_as',
'required',
- );
+ ];
}
/**
@@ -152,7 +152,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -163,15 +163,15 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'default_state' => array(
+ return [
+ 'default_state' => [
'type' => 'toggle',
'title' => __('Default State', 'wp-ultimo'),
'desc' => __('Use the toggle to the set the default state of the checkbox.', 'wp-ultimo'),
'value' => 0,
'order' => 12,
- ),
- );
+ ],
+ ];
}
/**
@@ -184,16 +184,16 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields[ $attributes['id'] ] = array(
+ $checkout_fields[ $attributes['id'] ] = [
'type' => 'checkbox',
'id' => $attributes['id'],
'name' => $attributes['name'],
'tooltip' => $attributes['tooltip'],
'required' => $attributes['required'],
'wrapper_classes' => $attributes['element_classes'],
- );
+ ];
if ($attributes['default_state']) {
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
diff --git a/inc/checkout/signup-fields/class-signup-field-color.php b/inc/checkout/signup-fields/class-signup-field-color.php
index d2e4ffb..3a129a0 100644
--- a/inc/checkout/signup-fields/class-signup-field-color.php
+++ b/inc/checkout/signup-fields/class-signup-field-color.php
@@ -108,9 +108,9 @@ class Signup_Field_Color extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -121,14 +121,14 @@ class Signup_Field_Color extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
'placeholder',
'tooltip',
'required',
'save_as',
- );
+ ];
}
/**
@@ -139,7 +139,7 @@ class Signup_Field_Color extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -150,14 +150,14 @@ class Signup_Field_Color extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'default_value' => array(
+ return [
+ 'default_value' => [
'type' => 'color-picker',
'order' => 12,
'title' => __('Default Color', 'wp-ultimo'),
'desc' => __('Set the default value for this color field.', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
}
/**
@@ -170,8 +170,8 @@ class Signup_Field_Color extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'color',
'id' => $attributes['id'],
'name' => $attributes['name'],
@@ -182,10 +182,10 @@ class Signup_Field_Color extends Base_Signup_Field {
'wrapper_classes' => $attributes['element_classes'],
'classes' => 'wu-rounded',
'value' => $this->get_value(),
- 'html_attr' => array(
+ 'html_attr' => [
'style' => 'width: 50px !important',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-discount-code.php b/inc/checkout/signup-fields/class-signup-field-discount-code.php
index 1e7a623..0accc39 100644
--- a/inc/checkout/signup-fields/class-signup-field-discount-code.php
+++ b/inc/checkout/signup-fields/class-signup-field-discount-code.php
@@ -108,10 +108,10 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'placeholder' => '',
'default' => '',
- );
+ ];
}
/**
@@ -122,11 +122,11 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -137,9 +137,9 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'discount_code',
- );
+ ];
}
/**
@@ -150,7 +150,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
*/
public function get_fields() {
- return array();
+ return [];
}
/**
@@ -163,19 +163,19 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields['discount_code_checkbox'] = array(
+ $checkout_fields['discount_code_checkbox'] = [
'id' => 'discount_code',
'type' => 'toggle',
'name' => __('Have a coupon code?', 'wp-ultimo'),
'class' => 'wu-w-auto',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'toggle_discount_code',
- ),
- );
+ ],
+ ];
- $checkout_fields['discount_code'] = array(
+ $checkout_fields['discount_code'] = [
'type' => 'text',
'id' => 'discount_code',
'name' => $attributes['name'],
@@ -184,16 +184,16 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
'default' => $attributes['default'],
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-show' => 'toggle_discount_code',
'style' => $this->calculate_style_attr(),
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model.lazy' => 'discount_code',
'v-init:discount_code' => "'{$this->get_value()}'",
'v-init:toggle_discount_code' => ! empty($this->get_value()),
- ),
- );
+ ],
+ ];
return $checkout_fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-email.php b/inc/checkout/signup-fields/class-signup-field-email.php
index 59d01b1..6824382 100644
--- a/inc/checkout/signup-fields/class-signup-field-email.php
+++ b/inc/checkout/signup-fields/class-signup-field-email.php
@@ -115,9 +115,9 @@ class Signup_Field_Email extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'display_notices' => true,
- );
+ ];
}
/**
@@ -128,11 +128,11 @@ class Signup_Field_Email extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -143,10 +143,10 @@ class Signup_Field_Email extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'email_address',
'required' => true,
- );
+ ];
}
/**
@@ -157,18 +157,18 @@ class Signup_Field_Email extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'display_notices' => array(
+ return [
+ 'display_notices' => [
'type' => 'toggle',
'title' => __('Display Notices', 'wp-ultimo'),
'desc' => __('When the customer is already logged in, a box with the customer\'s username and a link to logout is displayed instead of the email field. Disable this option if you do not want that box to show up.', 'wp-ultimo'),
'tooltip' => '',
'value' => 1,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'display_notices',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -181,34 +181,34 @@ class Signup_Field_Email extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
if (is_user_logged_in()) {
if ($attributes['display_notices']) {
- $checkout_fields['login_note'] = array(
+ $checkout_fields['login_note'] = [
'type' => 'note',
'title' => __('Not you?', 'wp-ultimo'),
- 'desc' => array($this, 'render_not_you_customer_message'),
+ 'desc' => [$this, 'render_not_you_customer_message'],
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
} else {
if ($attributes['display_notices']) {
- $checkout_fields['login_note'] = array(
+ $checkout_fields['login_note'] = [
'type' => 'note',
'title' => __('Existing customer?', 'wp-ultimo'),
- 'desc' => array($this, 'render_existing_customer_message'),
+ 'desc' => [$this, 'render_existing_customer_message'],
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
- $checkout_fields['email_address'] = array(
+ $checkout_fields['email_address'] = [
'type' => 'text',
'id' => 'email_address',
'name' => $attributes['name'],
@@ -218,10 +218,10 @@ class Signup_Field_Email extends Base_Signup_Field {
'required' => true,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
return $checkout_fields;
diff --git a/inc/checkout/signup-fields/class-signup-field-hidden.php b/inc/checkout/signup-fields/class-signup-field-hidden.php
index 50c4df3..03bf559 100644
--- a/inc/checkout/signup-fields/class-signup-field-hidden.php
+++ b/inc/checkout/signup-fields/class-signup-field-hidden.php
@@ -108,9 +108,9 @@ class Signup_Field_Hidden extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'from_request' => true,
- );
+ ];
}
/**
@@ -121,10 +121,10 @@ class Signup_Field_Hidden extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'save_as',
- );
+ ];
}
/**
@@ -135,7 +135,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -146,8 +146,8 @@ class Signup_Field_Hidden extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'fixed_value' => array(
+ return [
+ 'fixed_value' => [
'order' => 12,
'type' => 'text',
'title' => __('Pre-filled Value', 'wp-ultimo'),
@@ -155,8 +155,8 @@ class Signup_Field_Hidden extends Base_Signup_Field {
'placeholder' => __('e.g. blue', 'wp-ultimo'),
'tooltip' => '',
'value' => '',
- ),
- );
+ ],
+ ];
}
/**
@@ -186,13 +186,13 @@ class Signup_Field_Hidden extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'hidden',
'id' => $attributes['id'],
'wrapper_classes' => $attributes['element_classes'],
'value' => $this->get_value(),
- ),
- );
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-order-bump.php b/inc/checkout/signup-fields/class-signup-field-order-bump.php
index 44ef87a..5134fb7 100644
--- a/inc/checkout/signup-fields/class-signup-field-order-bump.php
+++ b/inc/checkout/signup-fields/class-signup-field-order-bump.php
@@ -109,10 +109,10 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'order_bump_template' => 'simple',
'display_product_description' => 0,
- );
+ ];
}
/**
@@ -123,10 +123,10 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
// 'id',
'name',
- );
+ ];
}
/**
@@ -137,9 +137,9 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'order_bump_template' => 'simple',
- );
+ ];
}
/**
@@ -163,37 +163,37 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array(
- 'product' => array(
+ $editor_fields = [
+ 'product' => [
'type' => 'model',
'title' => __('Product', 'wp-ultimo'),
'placeholder' => __('e.g. Premium', 'wp-ultimo'),
'desc' => __('Select the product that will be presented to the customer as an add-on option.', 'wp-ultimo'),
'tooltip' => '',
'order' => 12,
- 'html_attr' => array(
+ 'html_attr' => [
'data-model' => 'product',
'data-value-field' => 'id',
'data-label-field' => 'name',
'data-search-field' => 'name',
'data-max-items' => 1,
- ),
- ),
- 'display_product_description' => array(
+ ],
+ ],
+ 'display_product_description' => [
'order' => 13,
'type' => 'toggle',
'title' => __('Display Product Description', 'wp-ultimo'),
'desc' => __('Toggle to display the product description as well, if one is available.', 'wp-ultimo'),
'value' => 0,
- ),
- 'display_product_image' => array(
+ ],
+ 'display_product_image' => [
'order' => 14,
'type' => 'toggle',
'title' => __('Display Product Image', 'wp-ultimo'),
'desc' => __('Toggle to display the product image as well, if one is available.', 'wp-ultimo'),
'value' => 1,
- ),
- );
+ ],
+ ];
// $editor_fields['order_bump_template'] = array(
// 'type' => 'group',
@@ -240,7 +240,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
$product = is_numeric($product_id) ? wu_get_product($product_id) : wu_get_product_by_slug($product_id);
if ( ! $product) {
- return array();
+ return [];
}
$attributes['product'] = $product;
@@ -249,12 +249,12 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'note',
'desc' => $content,
'wrapper_classes' => $attributes['element_classes'],
- ),
- );
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-order-summary.php b/inc/checkout/signup-fields/class-signup-field-order-summary.php
index dc16bc8..846dd31 100644
--- a/inc/checkout/signup-fields/class-signup-field-order-summary.php
+++ b/inc/checkout/signup-fields/class-signup-field-order-summary.php
@@ -104,10 +104,10 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'order_summary_template' => 'clean',
'table_columns' => 'simple',
- );
+ ];
}
/**
@@ -118,9 +118,9 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
- );
+ ];
}
/**
@@ -131,9 +131,9 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'order_summary',
- );
+ ];
}
/**
@@ -157,34 +157,34 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array();
+ $editor_fields = [];
- $editor_fields['table_columns'] = array(
+ $editor_fields['table_columns'] = [
'type' => 'select',
'title' => __('Table Columns', 'wp-ultimo'),
'desc' => __('"Simplified" will condense all discount and tax info into separate rows to keep the table with only two columns. "Display All" adds a discounts and taxes column to each product row.', 'wp-ultimo'),
- 'options' => array(
+ 'options' => [
'simple' => __('Simplified', 'wp-ultimo'),
'full' => __('Display All', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
- $editor_fields['order_summary_template'] = array(
+ $editor_fields['order_summary_template'] = [
'type' => 'group',
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('order_summary'),
- 'fields' => array(
- 'order_summary_template' => array(
+ 'fields' => [
+ 'order_summary_template' => [
'type' => 'select',
'title' => __('Layout', 'wp-ultimo'),
'placeholder' => __('Select your Layout', 'wp-ultimo'),
- 'options' => array($this, 'get_templates'),
+ 'options' => [$this, 'get_templates'],
'wrapper_classes' => 'wu-flex-grow',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'order_summary_template',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
// @todo: re-add developer notes.
// $editor_fields['_dev_note_develop_your_own_template_order_summary'] = array(
@@ -208,7 +208,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
/*
* Backwards compatibility with previous betas
@@ -221,15 +221,15 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
- $checkout_fields[ $attributes['id'] ] = array(
+ $checkout_fields[ $attributes['id'] ] = [
'type' => 'note',
'desc' => $content,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
return $checkout_fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-password.php b/inc/checkout/signup-fields/class-signup-field-password.php
index f3d0c87..f356192 100644
--- a/inc/checkout/signup-fields/class-signup-field-password.php
+++ b/inc/checkout/signup-fields/class-signup-field-password.php
@@ -122,10 +122,10 @@ class Signup_Field_Password extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'password_confirm_field' => false,
'password_confirm_label' => __('Confirm Password', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -136,11 +136,11 @@ class Signup_Field_Password extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -151,10 +151,10 @@ class Signup_Field_Password extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'password',
'required' => true,
- );
+ ];
}
/**
@@ -165,20 +165,20 @@ class Signup_Field_Password extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'password_strength_meter' => array(
+ return [
+ 'password_strength_meter' => [
'type' => 'toggle',
'title' => __('Display Password Strength Meter', 'wp-ultimo'),
'desc' => __('Adds a password strength meter below the password field. Enabling this option also enforces passwords to be strong.', 'wp-ultimo'),
'value' => 1,
- ),
- 'password_confirm_field' => array(
+ ],
+ 'password_confirm_field' => [
'type' => 'toggle',
'title' => __('Display Password Confirm Field', 'wp-ultimo'),
'desc' => __('Adds a "Confirm your Password" field below the default password field to reduce the chance or making a mistake.', 'wp-ultimo'),
'value' => 1,
- ),
- );
+ ],
+ ];
}
/**
@@ -194,12 +194,12 @@ class Signup_Field_Password extends Base_Signup_Field {
* Logged in user, bail.
*/
if (is_user_logged_in()) {
- return array();
+ return [];
}
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields['password'] = array(
+ $checkout_fields['password'] = [
'type' => 'password',
'id' => 'password',
'name' => $attributes['name'],
@@ -209,16 +209,16 @@ class Signup_Field_Password extends Base_Signup_Field {
'required' => true,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'html_attr' => array(
+ 'html_attr' => [
'autocomplete' => 'new-password',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
if ($attributes['password_confirm_field']) {
- $checkout_fields['password_conf'] = array(
+ $checkout_fields['password_conf'] = [
'type' => 'password',
'id' => 'password_conf',
'name' => $attributes['password_confirm_label'],
@@ -228,13 +228,13 @@ class Signup_Field_Password extends Base_Signup_Field {
'required' => true,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'html_attr' => array(
+ 'html_attr' => [
'autocomplete' => 'new-password',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
return $checkout_fields;
diff --git a/inc/checkout/signup-fields/class-signup-field-payment.php b/inc/checkout/signup-fields/class-signup-field-payment.php
index 9f6fb48..ea46890 100644
--- a/inc/checkout/signup-fields/class-signup-field-payment.php
+++ b/inc/checkout/signup-fields/class-signup-field-payment.php
@@ -109,9 +109,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -122,9 +122,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
- );
+ ];
}
/**
@@ -135,9 +135,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'payment',
- );
+ ];
}
/**
@@ -148,7 +148,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
*/
public function get_fields() {
- return array();
+ return [];
}
/**
@@ -161,24 +161,24 @@ class Signup_Field_Payment extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $fields = array(
- 'payment_template' => array(
+ $fields = [
+ 'payment_template' => [
'type' => 'text',
'id' => 'payment_template',
'name' => '',
'classes' => 'wu-hidden',
- ),
- 'payment' => array(
+ ],
+ 'payment' => [
'type' => 'payment-methods',
'id' => 'payment',
'name' => $attributes['name'],
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- ),
- );
+ ],
+ ],
+ ];
/*
* Checks if we need to add the
@@ -187,22 +187,22 @@ class Signup_Field_Payment extends Base_Signup_Field {
if ( ! wu_get_setting('force_auto_renew', 1)) {
$auto_renewable_gateways = Gateway_Manager::get_instance()->get_auto_renewable_gateways();
- $fields['auto_renew'] = array(
+ $fields['auto_renew'] = [
'type' => 'toggle',
'id' => 'auto_renew',
'name' => __('Auto-renew', 'wp-ultimo'),
'tooltip' => '',
'value' => '1',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'auto_renew',
'true-value' => '1',
'false-value' => '0',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'v-cloak' => 1,
'v-show' => sprintf('%s.includes(gateway) && order.should_collect_payment && order.has_recurring', json_encode($auto_renewable_gateways)),
- ),
- );
+ ],
+ ];
}
return $fields;
diff --git a/inc/checkout/signup-fields/class-signup-field-period-selection.php b/inc/checkout/signup-fields/class-signup-field-period-selection.php
index 7ea5cca..25a6d5e 100644
--- a/inc/checkout/signup-fields/class-signup-field-period-selection.php
+++ b/inc/checkout/signup-fields/class-signup-field-period-selection.php
@@ -104,9 +104,9 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'period_selection_template' => 'clean',
- );
+ ];
}
/**
@@ -117,9 +117,9 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
// 'name',
- );
+ ];
}
/**
@@ -130,11 +130,11 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'period_selection',
'name' => __('Plan Duration Switch', 'wp-ultimo'),
'required' => true,
- );
+ ];
}
/**
@@ -158,119 +158,119 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array();
+ $editor_fields = [];
- $editor_fields['period_selection_template'] = array(
+ $editor_fields['period_selection_template'] = [
'type' => 'group',
'order' => 98.4,
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('period_selection'),
- 'fields' => array(
- 'period_selection_template' => array(
+ 'fields' => [
+ 'period_selection_template' => [
'type' => 'select',
'title' => __('Period Selector Template', 'wp-ultimo'),
'placeholder' => __('Select your Template', 'wp-ultimo'),
- 'options' => array($this, 'get_template_options'),
+ 'options' => [$this, 'get_template_options'],
'wrapper_classes' => 'wu-flex-grow',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'period_selection_template',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $editor_fields['period_options_header'] = array(
+ $editor_fields['period_options_header'] = [
'type' => 'small-header',
'title' => __('Options', 'wp-ultimo'),
'desc' => __('Add different options below. These need to match your product price variations.', 'wp-ultimo'),
'order' => 90,
- );
+ ];
- $editor_fields['period_options_empty'] = array(
+ $editor_fields['period_options_empty'] = [
'type' => 'note',
'desc' => __('Add the first option using the button below.', 'wp-ultimo'),
'classes' => 'wu-text-gray-600 wu-text-xs wu-text-center wu-w-full',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
'order' => 90.5,
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'period_options.length === 0',
'v-cloak' => '1',
- ),
- );
+ ],
+ ];
- $editor_fields['period_options'] = array(
+ $editor_fields['period_options'] = [
'type' => 'group',
'tooltip' => '',
'order' => 91,
'wrapper_classes' => 'wu-relative wu-bg-gray-100 wu-pb-2',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'period_options.length',
'v-for' => '(period_option, index) in period_options',
'v-cloak' => '1',
- ),
- 'fields' => array(
- 'period_options_remove' => array(
+ ],
+ 'fields' => [
+ 'period_options_remove' => [
'type' => 'note',
'desc' => sprintf(' period_options.splice(index, 1)">', __('Remove', 'wp-ultimo')),
'wrapper_classes' => 'wu-absolute wu-top-0 wu-right-0',
- ),
- 'period_options_duration' => array(
+ ],
+ 'period_options_duration' => [
'type' => 'number',
'title' => __('Duration', 'wp-ultimo'),
'placeholder' => '',
'wrapper_classes' => 'wu-w-2/12',
'min' => 1,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'period_option.duration',
'steps' => 1,
'v-bind:name' => '"period_options[" + index + "][duration]"',
- ),
- ),
- 'period_options_duration_unit' => array(
+ ],
+ ],
+ 'period_options_duration_unit' => [
'type' => 'select',
'title' => ' ',
'placeholder' => '',
'wrapper_classes' => 'wu-w-5/12 wu-mx-2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'period_option.duration_unit',
'v-bind:name' => '"period_options[" + index + "][duration_unit]"',
- ),
- 'options' => array(
+ ],
+ 'options' => [
'day' => __('Days', 'wp-ultimo'),
'week' => __('Weeks', 'wp-ultimo'),
'month' => __('Months', 'wp-ultimo'),
'year' => __('Years', 'wp-ultimo'),
- ),
- ),
- 'period_options_label' => array(
+ ],
+ ],
+ 'period_options_label' => [
'type' => 'text',
'title' => __('Label', 'wp-ultimo'),
'placeholder' => __('e.g. Monthly', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-5/12',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'period_option.label',
'v-bind:name' => '"period_options[" + index + "][label]"',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $editor_fields['repeat'] = array(
+ $editor_fields['repeat'] = [
'order' => 92,
'type' => 'submit',
'title' => __('+ Add option', 'wp-ultimo'),
'classes' => 'wu-uppercase wu-text-2xs wu-text-blue-700 wu-border-none wu-bg-transparent wu-font-bold wu-text-right wu-w-full wu-cursor-pointer',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-on:click.prevent' => '() => period_options.push({
duration: 1,
duration_unit: "month",
label: "",
})',
- ),
- );
+ ],
+ ];
return $editor_fields;
}
@@ -286,39 +286,39 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
public function to_fields_array($attributes) {
if (wu_get_isset($attributes, 'period_selection_template') === 'legacy') {
- wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'), wu_get_version());
+ wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), ['wu-functions'], wu_get_version());
wp_enqueue_script('wu-legacy-signup');
- wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
+ wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons'], wu_get_version());
}
$template_class = Field_Templates_Manager::get_instance()->get_template_class('period_selection', $attributes['period_selection_template']);
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields[ $attributes['id'] ] = array(
+ $checkout_fields[ $attributes['id'] ] = [
'type' => 'note',
'id' => $attributes['id'],
'wrapper_classes' => $attributes['element_classes'],
'desc' => $content,
- );
+ ];
- $checkout_fields['duration'] = array(
+ $checkout_fields['duration'] = [
'type' => 'hidden',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'duration',
- ),
- );
+ ],
+ ];
- $checkout_fields['duration_unit'] = array(
+ $checkout_fields['duration_unit'] = [
'type' => 'hidden',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'duration_unit',
- ),
- );
+ ],
+ ];
return $checkout_fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-pricing-table.php b/inc/checkout/signup-fields/class-signup-field-pricing-table.php
index e4c6817..23fe975 100644
--- a/inc/checkout/signup-fields/class-signup-field-pricing-table.php
+++ b/inc/checkout/signup-fields/class-signup-field-pricing-table.php
@@ -104,12 +104,12 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'pricing_table_products' => implode(',', array_keys(wu_get_plans_as_options())),
'pricing_table_template' => 'list',
'force_different_durations' => false,
'hide_pricing_table_when_pre_selected' => false,
- );
+ ];
}
/**
@@ -120,9 +120,9 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
// 'name',
- );
+ ];
}
/**
@@ -133,11 +133,11 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'pricing_table',
'name' => __('Plan Selection', 'wp-ultimo'),
'required' => true,
- );
+ ];
}
/**
@@ -161,66 +161,66 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array();
+ $editor_fields = [];
- $editor_fields['pricing_table_products'] = array(
+ $editor_fields['pricing_table_products'] = [
'type' => 'model',
'title' => __('Products', 'wp-ultimo'),
'placeholder' => __('e.g. Premium', 'wp-ultimo'),
'desc' => __('Be sure to add the products in the order you want them to show up.', 'wp-ultimo'),
'tooltip' => '',
'order' => 20,
- 'html_attr' => array(
+ 'html_attr' => [
'data-model' => 'product',
'data-value-field' => 'id',
'data-label-field' => 'name',
'data-search-field' => 'name',
'data-include' => implode(',', array_keys(wu_get_plans_as_options())),
'data-max-items' => 999,
- ),
- );
+ ],
+ ];
- $editor_fields['force_different_durations'] = array(
+ $editor_fields['force_different_durations'] = [
'type' => 'toggle',
'title' => __('Force Different Durations', 'wp-ultimo'),
'desc' => __('Check this option to force the display of plans with different recurring durations.', 'wp-ultimo'),
'tooltip' => '',
'value' => 0,
'order' => 22,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'force_different_durations',
- ),
- );
+ ],
+ ];
- $editor_fields['hide_pricing_table_when_pre_selected'] = array(
+ $editor_fields['hide_pricing_table_when_pre_selected'] = [
'type' => 'toggle',
'title' => __('Hide when Pre-Selected', 'wp-ultimo'),
'desc' => __('Prevent customers from seeing this field when a plan was already selected via the URL.', 'wp-ultimo'),
'tooltip' => __('If the pricing table field is the only field in the current step, the step will be skipped.', 'wp-ultimo'),
'value' => 0,
'order' => 24,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'hide_pricing_table_when_pre_selected',
- ),
- );
+ ],
+ ];
- $editor_fields['pricing_table_template'] = array(
+ $editor_fields['pricing_table_template'] = [
'type' => 'group',
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('pricing_table'),
'order' => 26,
- 'fields' => array(
- 'pricing_table_template' => array(
+ 'fields' => [
+ 'pricing_table_template' => [
'type' => 'select',
'title' => __('Pricing Table Template', 'wp-ultimo'),
'placeholder' => __('Select your Template', 'wp-ultimo'),
- 'options' => array($this, 'get_pricing_table_templates'),
+ 'options' => [$this, 'get_pricing_table_templates'],
'wrapper_classes' => 'wu-flex-grow',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'pricing_table_template',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
// @todo: re-add developer notes.
// $editor_fields['_dev_note_develop_your_own_template_2'] = array(
@@ -245,7 +245,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
public function to_fields_array($attributes) {
if (wu_get_isset($attributes, 'pricing_table_template') === 'legacy') {
- wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
+ wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons'], wu_get_version());
wp_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
}
@@ -263,32 +263,32 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
* Hide when pre-selected.
*/
if (wu_should_hide_form_field($attributes)) {
- return array();
+ return [];
}
- $template_attributes = array(
+ $template_attributes = [
'products' => $products,
'name' => $attributes['name'],
'force_different_durations' => $attributes['force_different_durations'],
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- );
+ ];
$template_class = Field_Templates_Manager::get_instance()->get_template_class('pricing_table', $attributes['pricing_table_template']);
$content = $template_class ? $template_class->render_container($template_attributes) : __('Template does not exist.', 'wp-ultimo');
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields[ $attributes['id'] ] = array(
+ $checkout_fields[ $attributes['id'] ] = [
'type' => 'note',
'id' => $attributes['id'],
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
'desc' => $content,
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
return $checkout_fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-products.php b/inc/checkout/signup-fields/class-signup-field-products.php
index d4177ac..8c9261b 100644
--- a/inc/checkout/signup-fields/class-signup-field-products.php
+++ b/inc/checkout/signup-fields/class-signup-field-products.php
@@ -103,9 +103,9 @@ class Signup_Field_Products extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -116,7 +116,7 @@ class Signup_Field_Products extends Base_Signup_Field {
*/
public function default_fields() {
- return array();
+ return [];
}
/**
@@ -127,10 +127,10 @@ class Signup_Field_Products extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'name' => __('Pre-selected Products', 'wp-ultimo'),
'id' => 'products',
- );
+ ];
}
/**
@@ -141,22 +141,22 @@ class Signup_Field_Products extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'products' => array(
+ return [
+ 'products' => [
'type' => 'model',
'title' => __('Products', 'wp-ultimo'),
'placeholder' => __('Products', 'wp-ultimo'),
'desc' => __('Use this field to pre-select products. This is useful when you have a signup page for specific offering/bundles and do not want your customers to be able to choose plans and other products manually.', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-model' => 'product',
'data-value-field' => 'id',
'data-label-field' => 'name',
'data-search-field' => 'name',
'data-max-items' => 10,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -169,18 +169,18 @@ class Signup_Field_Products extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
$products = explode(',', (string) $attributes['products']);
foreach ($products as $product_id) {
- $checkout_fields[ "products[{$product_id}]" ] = array(
+ $checkout_fields[ "products[{$product_id}]" ] = [
'type' => 'hidden',
'value' => $product_id,
- 'html_attr' => array(
+ 'html_attr' => [
'v-bind:name' => "'products[]'",
- ),
- );
+ ],
+ ];
}
$this->insert_products_in_form($products);
diff --git a/inc/checkout/signup-fields/class-signup-field-select.php b/inc/checkout/signup-fields/class-signup-field-select.php
index 29fd1de..959069f 100644
--- a/inc/checkout/signup-fields/class-signup-field-select.php
+++ b/inc/checkout/signup-fields/class-signup-field-select.php
@@ -108,9 +108,9 @@ class Signup_Field_Select extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -121,7 +121,7 @@ class Signup_Field_Select extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
'placeholder',
@@ -129,7 +129,7 @@ class Signup_Field_Select extends Base_Signup_Field {
'tooltip',
'required',
'save_as',
- );
+ ];
}
/**
@@ -140,7 +140,7 @@ class Signup_Field_Select extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -151,81 +151,81 @@ class Signup_Field_Select extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array();
+ $editor_fields = [];
- $editor_fields['options_header'] = array(
+ $editor_fields['options_header'] = [
'order' => 12,
'type' => 'small-header',
'title' => __('Options', 'wp-ultimo'),
'desc' => __('Add different options below. The first option is used as the default.', 'wp-ultimo'),
- );
+ ];
- $editor_fields['options_empty'] = array(
+ $editor_fields['options_empty'] = [
'type' => 'note',
'desc' => __('Add the first option using the button below.', 'wp-ultimo'),
'classes' => 'wu-text-gray-600 wu-text-xs wu-text-center wu-w-full',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
'order' => 13,
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'options.length === 0',
'v-cloak' => '1',
- ),
- );
+ ],
+ ];
- $editor_fields['options'] = array(
+ $editor_fields['options'] = [
'order' => 14,
'type' => 'group',
'tooltip' => '',
'wrapper_classes' => 'wu-relative wu-bg-gray-100',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'options.length',
'v-for' => '(option, index) in options',
'v-cloak' => '1',
- ),
- 'fields' => array(
- 'options_remove' => array(
+ ],
+ 'fields' => [
+ 'options_remove' => [
'type' => 'note',
'desc' => sprintf(' options.splice(index, 1)">', __('Remove', 'wp-ultimo')),
'wrapper_classes' => 'wu-absolute wu-top-0 wu-right-0',
- ),
- 'options_key' => array(
+ ],
+ 'options_key' => [
'type' => 'text',
'title' => __('Option Value', 'wp-ultimo'),
'placeholder' => __('e.g. option1', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-1/2 wu-mr-2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'option.key',
'steps' => 1,
'v-bind:name' => '"options[" + index + "][key]"',
- ),
- ),
- 'options_label' => array(
+ ],
+ ],
+ 'options_label' => [
'type' => 'text',
'title' => __('Label', 'wp-ultimo'),
'placeholder' => __('e.g. Option 1', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-1/2 wu-ml-2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'option.label',
'v-bind:name' => '"options[" + index + "][label]"',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
- $editor_fields['repeat_select_option'] = array(
+ $editor_fields['repeat_select_option'] = [
'order' => 16,
'type' => 'submit',
'title' => __('+ Add option', 'wp-ultimo'),
'classes' => 'wu-uppercase wu-text-2xs wu-text-blue-700 wu-border-none wu-bg-transparent wu-font-bold wu-text-right wu-w-full wu-cursor-pointer',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'type' => 'button',
'v-on:click.prevent' => '() => options.push({})',
- ),
- );
+ ],
+ ];
return $editor_fields;
}
@@ -240,14 +240,14 @@ class Signup_Field_Select extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $options = array();
+ $options = [];
foreach ($attributes['options'] as $_option) {
$options[ $_option['key'] ] = $_option['label'];
}
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'select',
'id' => $attributes['id'],
'name' => $attributes['name'],
@@ -258,7 +258,7 @@ class Signup_Field_Select extends Base_Signup_Field {
'wrapper_classes' => $attributes['element_classes'],
'options' => $options,
'value' => $this->get_value(),
- ),
- );
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-shortcode.php b/inc/checkout/signup-fields/class-signup-field-shortcode.php
index 49e497d..71a8310 100644
--- a/inc/checkout/signup-fields/class-signup-field-shortcode.php
+++ b/inc/checkout/signup-fields/class-signup-field-shortcode.php
@@ -103,9 +103,9 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -116,10 +116,10 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
// 'id',
// 'name',
- );
+ ];
}
/**
@@ -130,9 +130,9 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'name' => __('Shortcode', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -143,14 +143,14 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'shortcode_code' => array(
+ return [
+ 'shortcode_code' => [
'type' => 'text',
'title' => __('Shortcode', 'wp-ultimo'),
'placeholder' => __('e.g. [shortcode]', 'wp-ultimo'),
'desc' => __('Please, enter the full shortcode, including [].', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
}
/**
@@ -163,16 +163,16 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'note',
'desc' => fn() => do_shortcode($attributes['shortcode_code']),
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-site-title.php b/inc/checkout/signup-fields/class-signup-field-site-title.php
index 528f655..4bfa42a 100644
--- a/inc/checkout/signup-fields/class-signup-field-site-title.php
+++ b/inc/checkout/signup-fields/class-signup-field-site-title.php
@@ -119,9 +119,9 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'auto_generate_site_title' => false,
- );
+ ];
}
/**
@@ -132,11 +132,11 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -147,10 +147,10 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'site_title',
'required' => true,
- );
+ ];
}
/**
@@ -161,18 +161,18 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'auto_generate_site_title' => array(
+ return [
+ 'auto_generate_site_title' => [
'type' => 'toggle',
'title' => __('Auto-generate?', 'wp-ultimo'),
'desc' => __('Check this option to auto-generate this field based on the username of the customer.', 'wp-ultimo'),
'tooltip' => '',
'value' => 0,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'auto_generate_site_title',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -188,24 +188,24 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
* If we should auto-generate, add as hidden.
*/
if (isset($attributes['auto_generate_site_title']) && $attributes['auto_generate_site_title']) {
- return array(
- 'auto_generate_site_title' => array(
+ return [
+ 'auto_generate_site_title' => [
'type' => 'hidden',
'id' => 'auto_generate_site_title',
'value' => 'username',
- ),
- 'site_title' => array(
+ ],
+ 'site_title' => [
'type' => 'hidden',
'id' => 'site_title',
- 'html_attr' => array(
+ 'html_attr' => [
'v-bind:value' => 'username',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
- return array(
- 'site_title' => array(
+ return [
+ 'site_title' => [
'type' => 'text',
'id' => 'site_title',
'required' => true,
@@ -215,10 +215,10 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
'value' => $this->get_value(),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-site-url.php b/inc/checkout/signup-fields/class-signup-field-site-url.php
index a059668..0beaa36 100644
--- a/inc/checkout/signup-fields/class-signup-field-site-url.php
+++ b/inc/checkout/signup-fields/class-signup-field-site-url.php
@@ -114,13 +114,13 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
global $current_site;
- return array(
+ return [
'auto_generate_site_url' => false,
'display_url_preview' => true,
'enable_domain_selection' => false,
'display_field_attachments' => true,
'available_domains' => $current_site->domain . PHP_EOL,
- );
+ ];
}
/**
@@ -131,11 +131,11 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -146,10 +146,10 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'site_url',
'required' => true,
- );
+ ];
}
/**
@@ -162,19 +162,19 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
global $current_site;
- return array(
- 'auto_generate_site_url' => array(
+ return [
+ 'auto_generate_site_url' => [
'order' => 12,
'type' => 'toggle',
'title' => __('Auto-generate', 'wp-ultimo'),
'desc' => __('Check this option to auto-generate this field based on the username of the customer.', 'wp-ultimo'),
'tooltip' => '',
'value' => 0,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'auto_generate_site_url',
- ),
- ),
- 'display_field_attachments' => array(
+ ],
+ ],
+ 'display_field_attachments' => [
'order' => 18,
'type' => 'toggle',
'title' => __('Display URL field attachments', 'wp-ultimo'),
@@ -182,14 +182,14 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'tooltip' => '',
'value' => 1,
'tab' => 'content',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-show' => '!auto_generate_site_url',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'display_field_attachments',
- ),
- ),
- 'display_url_preview' => array(
+ ],
+ ],
+ 'display_url_preview' => [
'order' => 19,
'type' => 'toggle',
'title' => __('Display URL preview block', 'wp-ultimo'),
@@ -197,14 +197,14 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'tooltip' => '',
'value' => 1,
'tab' => 'content',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-show' => '!auto_generate_site_url',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'display_url_preview',
- ),
- ),
- 'enable_domain_selection' => array(
+ ],
+ ],
+ 'enable_domain_selection' => [
'order' => 20,
'type' => 'toggle',
'title' => __('Enable Domain Selection', 'wp-ultimo'),
@@ -212,15 +212,15 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'tooltip' => '',
'value' => 0,
'tab' => 'content',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-show' => '!auto_generate_site_url',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'enable_domain_selection',
'rows' => 5,
- ),
- ),
- 'available_domains' => array(
+ ],
+ ],
+ 'available_domains' => [
'order' => 30,
'type' => 'textarea',
'title' => __('Available Domains', 'wp-ultimo'),
@@ -228,14 +228,14 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'desc' => __('Enter one domain option per line.', 'wp-ultimo'),
'value' => $current_site->domain . PHP_EOL,
'tab' => 'content',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-show' => '!auto_generate_site_url && enable_domain_selection',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'rows' => 4,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -246,10 +246,10 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
*/
public function get_url_preview_templates() {
- $templates = array(
+ $templates = [
'legacy/signup/steps/step-domain-url-preview' => __('New URL Preview', 'wp-ultimo'),
// 'legacy/signup/steps/step-domain-url-preview' => __('Legacy Template', 'wp-ultimo'),
- );
+ ];
return apply_filters('wu_get_pricing_table_templates', $templates);
}
@@ -267,23 +267,23 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
* If we should auto-generate, add as hidden.
*/
if ($attributes['auto_generate_site_url']) {
- return array(
- 'auto_generate_site_url' => array(
+ return [
+ 'auto_generate_site_url' => [
'type' => 'hidden',
'id' => 'auto_generate_site_url',
'value' => 'username',
- ),
- 'site_url' => array(
+ ],
+ 'site_url' => [
'type' => 'hidden',
'id' => 'site_url',
'value' => uniqid(),
- ),
- );
+ ],
+ ];
}
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields['site_url'] = array(
+ $checkout_fields['site_url'] = [
'type' => 'text',
'id' => 'site_url',
'wrapper_classes' => 'wu-flex-grow wu-my-0',
@@ -294,40 +294,40 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'required' => true,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', 'wu-my-1'),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'html_attr' => array(
+ 'html_attr' => [
'autocomplete' => 'off',
'v-on:input' => 'site_url = $event.target.value.toLowerCase().replace(/[^a-z0-9-]+/g, "")',
'v-bind:value' => 'site_url',
- ),
- );
+ ],
+ ];
if ($attributes['display_field_attachments']) {
$checkout_fields['site_url']['classes'] .= ' xs:wu-rounded-none';
$checkout_fields['site_url']['prefix'] = ' ';
- $checkout_fields['site_url']['prefix_html_attr'] = array(
+ $checkout_fields['site_url']['prefix_html_attr'] = [
'class' => 'wu-flex wu-items-center wu-px-3 wu-mt-1 sm:wu-mb-1 wu-border-box wu-font-mono wu-justify-center sm:wu-border-r-0',
'style' => 'background-color: rgba(0, 0, 0, 0.008); border: 1px solid #eee; margin-right: -1px; font-size: 90%;',
'v-html' => 'is_subdomain ? "https://" : "https://" + site_domain + "/"',
'v-cloak' => 1,
- );
+ ];
$checkout_fields['site_url']['suffix'] = ' ';
- $checkout_fields['site_url']['suffix_html_attr'] = array(
+ $checkout_fields['site_url']['suffix_html_attr'] = [
'class' => 'wu-flex wu-items-center wu-px-3 sm:wu-mt-1 wu-mb-1 wu-border-box wu-font-mono wu-justify-center sm:wu-border-l-0',
'style' => 'background-color: rgba(0, 0, 0, 0.008); border: 1px solid #eee; margin-left: -1px; font-size: 90%;',
'v-html' => '"." + site_domain',
'v-cloak' => 1,
'v-show' => 'is_subdomain',
- );
+ ];
}
if ($attributes['available_domains'] && $attributes['enable_domain_selection']) {
$options = $this->get_domain_options($attributes['available_domains']);
- $checkout_fields['site_domain'] = array(
+ $checkout_fields['site_domain'] = [
'name' => __('Domain', 'wp-ultimo'),
'options' => $options,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
@@ -337,27 +337,27 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
'id' => 'site_domain',
'type' => 'select',
'classes' => 'input',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'site_domain',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
if ($attributes['display_url_preview']) {
$content = wu_get_template_contents('legacy/signup/steps/step-domain-url-preview');
- $checkout_fields['site_url_preview'] = array(
+ $checkout_fields['site_url_preview'] = [
'type' => 'note',
'desc' => $content,
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
'classes' => wu_get_isset($attributes, 'element_classes', ''),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- );
+ ],
+ ];
}
return $checkout_fields;
diff --git a/inc/checkout/signup-fields/class-signup-field-steps.php b/inc/checkout/signup-fields/class-signup-field-steps.php
index 374ce08..e4a93d3 100644
--- a/inc/checkout/signup-fields/class-signup-field-steps.php
+++ b/inc/checkout/signup-fields/class-signup-field-steps.php
@@ -104,9 +104,9 @@ class Signup_Field_Steps extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'steps_template' => 'clean',
- );
+ ];
}
/**
@@ -117,7 +117,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
*/
public function default_fields() {
- return array();
+ return [];
}
/**
@@ -128,9 +128,9 @@ class Signup_Field_Steps extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'steps',
- );
+ ];
}
/**
@@ -154,23 +154,23 @@ class Signup_Field_Steps extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields['steps_template'] = array(
+ $editor_fields['steps_template'] = [
'type' => 'group',
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('steps'),
'order' => 98,
- 'fields' => array(
- 'steps_template' => array(
+ 'fields' => [
+ 'steps_template' => [
'type' => 'select',
'title' => __('Layout', 'wp-ultimo'),
'placeholder' => __('Select your Layout', 'wp-ultimo'),
- 'options' => array($this, 'get_templates'),
+ 'options' => [$this, 'get_templates'],
'wrapper_classes' => 'wu-flex-grow',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'steps_template',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
// @todo: re-add developer notes.
// $editor_fields['_dev_note_develop_your_own_template_steps'] = array(
@@ -195,7 +195,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
public function to_fields_array($attributes) {
if (wu_get_isset($attributes, 'steps_template') === 'legacy') {
- wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
+ wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons'], wu_get_version());
wp_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
}
@@ -207,12 +207,12 @@ class Signup_Field_Steps extends Base_Signup_Field {
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
- return array(
- $attributes['id'] => array(
+ return [
+ $attributes['id'] => [
'type' => 'note',
'desc' => $content,
'wrapper_classes' => $attributes['element_classes'],
- ),
- );
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/class-signup-field-submit-button.php b/inc/checkout/signup-fields/class-signup-field-submit-button.php
index f4214c6..a14ceb8 100644
--- a/inc/checkout/signup-fields/class-signup-field-submit-button.php
+++ b/inc/checkout/signup-fields/class-signup-field-submit-button.php
@@ -108,10 +108,10 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'enable_go_back_button' => false,
'back_button_label' => __('← Go Back', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -122,10 +122,10 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
- );
+ ];
}
/**
@@ -136,7 +136,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -147,29 +147,29 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'enable_go_back_button' => array(
+ return [
+ 'enable_go_back_button' => [
'type' => 'toggle',
'title' => __('Add "Go Back" button', 'wp-ultimo'),
'desc' => __('Enable this option to add a "Go Back" button. Useful for multi-step checkout forms.', 'wp-ultimo'),
'tooltip' => '',
'value' => 0,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'enable_go_back_button',
- ),
- ),
- 'back_button_label' => array(
+ ],
+ ],
+ 'back_button_label' => [
'type' => 'text',
'title' => __('"Go Back" Button Label', 'wp-ultimo'),
'desc' => __('Value to be used as the "Go Back" label.', 'wp-ultimo'),
'placeholder' => __('e.g. ← Go Back', 'wp-ultimo'),
'value' => __('← Go Back', 'wp-ultimo'),
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
'v-show' => 'enable_go_back_button',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -184,24 +184,24 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
$uniqid = uniqid();
- $fields = array();
+ $fields = [];
- $fields[ $attributes['id'] . '_errors' ] = array(
+ $fields[ $attributes['id'] . '_errors' ] = [
'type' => 'html',
'wrapper_classes' => 'wu_submit_button_errors wu-clear-both',
'content' => '',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'get_errors()',
- ),
- );
+ ],
+ ];
- $fields[ $attributes['id'] . '_group' ] = array(
+ $fields[ $attributes['id'] . '_group' ] = [
'type' => 'group',
'raw' => true,
- 'default' => array(),
+ 'default' => [],
'wrapper_classes' => '',
- 'fields' => array(),
- );
+ 'fields' => [],
+ ];
$button_wrapper_classes = 'wu_submit_button';
@@ -211,29 +211,29 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
$is_first_step = isset($steps[0]) && $steps[0]['id'] === $attributes['step'];
if ( ! $is_first_step) {
- $fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] . '_go_back' ] = array(
+ $fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] . '_go_back' ] = [
'type' => 'html',
'wrapper_classes' => 'md:wu-w-1/2 wu-box-border wu-float-left wu--mt-4',
'id' => $attributes['id'] . '_go_back',
'content' => sprintf('%s', $attributes['back_button_label']),
- );
+ ];
$button_wrapper_classes .= ' md:wu-w-1/2 wu-box-border wu-float-left wu-text-right';
}
}
- $fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] ] = array(
+ $fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] ] = [
'type' => 'submit',
'wrapper_classes' => trim($button_wrapper_classes . ' ' . wu_get_isset($attributes, 'wrapper_element_classes', '')),
'classes' => trim('button button-primary btn-primary' . ' ' . wu_get_isset($attributes, 'element_classes', '')),
'id' => $attributes['id'],
'name' => $attributes['name'],
- );
+ ];
if ($attributes['enable_go_back_button']) {
- $fields[ $attributes['id'] . '_clear' ] = array(
+ $fields[ $attributes['id'] . '_clear' ] = [
'type' => 'clear',
- );
+ ];
}
return $fields;
diff --git a/inc/checkout/signup-fields/class-signup-field-template-selection.php b/inc/checkout/signup-fields/class-signup-field-template-selection.php
index 0b2b054..7115eae 100644
--- a/inc/checkout/signup-fields/class-signup-field-template-selection.php
+++ b/inc/checkout/signup-fields/class-signup-field-template-selection.php
@@ -105,13 +105,13 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
*/
public function defaults() {
- return array(
- 'template_selection_sites' => implode(',', wu_get_site_templates(array('fields' => 'ids'))),
+ return [
+ 'template_selection_sites' => implode(',', wu_get_site_templates(['fields' => 'ids'])),
'template_selection_type' => 'name',
'template_selection_template' => 'clean',
'cols' => 3,
'hide_template_selection_when_pre_selected' => false,
- );
+ ];
}
/**
@@ -122,9 +122,9 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
// 'name',
- );
+ ];
}
/**
@@ -135,11 +135,11 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'template_selection',
'name' => __('Template Selection', 'wp-ultimo'),
'required' => true,
- );
+ ];
}
/**
@@ -163,50 +163,50 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
*/
public function get_fields() {
- $editor_fields = array();
+ $editor_fields = [];
- $editor_fields['cols'] = array(
+ $editor_fields['cols'] = [
'type' => 'hidden',
- );
+ ];
- $editor_fields['template_selection_type'] = array(
+ $editor_fields['template_selection_type'] = [
'type' => 'select',
'title' => __('Available templates', 'wp-ultimo'),
'desc' => __('How do you want to choose available which templates will be available.', 'wp-ultimo'),
'order' => 20,
- 'options' => array(
+ 'options' => [
'name' => __('Select by names'),
'categories' => __('Select by categories'),
'all' => __('All templates'),
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-model' => 'template_selection_type',
- ),
- );
+ ],
+ ];
- $editor_fields['template_selection_categories'] = array(
+ $editor_fields['template_selection_categories'] = [
'type' => 'select',
'title' => __('Template Categories', 'wp-ultimo'),
'placeholder' => __('e.g.: Landing Page, Health...', 'wp-ultimo'),
'desc' => __('Customers will be able to filter by categories during signup.', 'wp-ultimo'),
'order' => 21,
'options' => Site::get_all_categories(),
- 'html_attr' => array(
+ 'html_attr' => [
'data-selectize-categories' => 1,
'multiple' => 1,
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'v-show' => 'template_selection_type === "categories"',
- ),
- );
+ ],
+ ];
- $editor_fields['template_selection_sites'] = array(
+ $editor_fields['template_selection_sites'] = [
'type' => 'model',
'title' => __('Template Sites', 'wp-ultimo'),
'placeholder' => __('e.g. Template Site 1, My Agency', 'wp-ultimo'),
'desc' => __('Be sure to add the templates in the order you want them to show up.', 'wp-ultimo'),
'order' => 22,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'template_selection_sites',
'data-model' => 'site',
'data-value-field' => 'blog_id',
@@ -216,46 +216,46 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
'data-include' => implode(
',',
wu_get_site_templates(
- array(
+ [
'fields' => 'blog_id',
- )
+ ]
)
),
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'v-show' => 'template_selection_type === \'name\'',
- ),
- );
+ ],
+ ];
- $editor_fields['hide_template_selection_when_pre_selected'] = array(
+ $editor_fields['hide_template_selection_when_pre_selected'] = [
'type' => 'toggle',
'title' => __('Hide when Pre-Selected', 'wp-ultimo'),
'desc' => __('Prevent customers from seeing this field when a template was already selected via the URL.', 'wp-ultimo'),
'tooltip' => __('If the template selection field is the only field in the current step, the step will be skipped.', 'wp-ultimo'),
'value' => 0,
'order' => 23,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'hide_template_selection_when_pre_selected',
- ),
- );
+ ],
+ ];
- $editor_fields['template_selection_template'] = array(
+ $editor_fields['template_selection_template'] = [
'type' => 'group',
'order' => 24,
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('template_selection'),
- 'fields' => array(
- 'template_selection_template' => array(
+ 'fields' => [
+ 'template_selection_template' => [
'type' => 'select',
'title' => __('Template Selector Template', 'wp-ultimo'),
'placeholder' => __('Select your Template', 'wp-ultimo'),
- 'options' => array($this, 'get_template_selection_templates'),
+ 'options' => [$this, 'get_template_selection_templates'],
'wrapper_classes' => 'wu-flex-grow',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'template_selection_template',
- ),
- ),
- ),
- );
+ ],
+ ],
+ ],
+ ];
// @todo: re-add developer notes.
// $editor_fields['_dev_note_develop_your_own_template_1'] = array(
@@ -296,14 +296,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
- $checkout_fields['template_id'] = array(
+ $checkout_fields['template_id'] = [
'type' => 'hidden',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'template_id',
- ),
- );
+ ],
+ ];
/**
* Hide when pre-selected.
@@ -313,22 +313,22 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
}
if (wu_get_isset($attributes, 'template_selection_template') === 'legacy') {
- wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'), wu_get_version());
+ wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), ['wu-functions'], wu_get_version());
wp_enqueue_script('wu-legacy-signup');
- wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
+ wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons'], wu_get_version());
}
$site_list = $this->site_list($attributes);
- $customer_sites = array();
+ $customer_sites = [];
if (wu_get_setting('allow_own_site_as_template')) {
$customer = wu_get_current_customer();
if ($customer) {
- $customer_sites = $customer->get_sites(array('fields' => 'ids'));
+ $customer_sites = $customer->get_sites(['fields' => 'ids']);
$site_list = array_merge(
$customer_sites,
@@ -344,23 +344,23 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
// Remove inactive sites
$sites = array_filter($sites, fn($site) => $site->is_active());
- $template_attributes = array(
+ $template_attributes = [
'sites' => $sites,
'name' => $attributes['name'],
'cols' => $attributes['cols'],
'categories' => $attributes['template_selection_categories'] ?? \WP_Ultimo\Models\Site::get_all_categories($sites),
'customer_sites' => $customer_sites,
- );
+ ];
$template_class = Field_Templates_Manager::get_instance()->get_template_class('template_selection', $attributes['template_selection_template']);
$content = $template_class ? $template_class->render_container($template_attributes, $this) : __('Template does not exist.', 'wp-ultimo');
- $checkout_fields[ $attributes['id'] ] = array(
+ $checkout_fields[ $attributes['id'] ] = [
'type' => 'note',
'desc' => $content,
'wrapper_classes' => $attributes['element_classes'],
- );
+ ];
return $checkout_fields;
}
@@ -380,16 +380,16 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
}
if ($selection_type === 'all') {
- return wu_get_site_templates(array('fields' => 'blog_id'));
+ return wu_get_site_templates(['fields' => 'blog_id']);
}
if ($selection_type === 'categories') {
return array_column(
\WP_Ultimo\Models\Site::get_all_by_categories(
$attributes['template_selection_categories'],
- array(
- 'fields' => array('blog_id'),
- ),
+ [
+ 'fields' => ['blog_id'],
+ ],
),
'blog_id'
);
diff --git a/inc/checkout/signup-fields/class-signup-field-terms-of-use.php b/inc/checkout/signup-fields/class-signup-field-terms-of-use.php
index c0204e5..7746cbb 100644
--- a/inc/checkout/signup-fields/class-signup-field-terms-of-use.php
+++ b/inc/checkout/signup-fields/class-signup-field-terms-of-use.php
@@ -122,9 +122,9 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'tou_name' => __('I agree with the terms of use.', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -135,7 +135,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
*/
public function default_fields() {
- return array();
+ return [];
}
/**
@@ -146,10 +146,10 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'terms_of_use',
'name' => __('Terms of Use', 'wp-ultimo'),
- );
+ ];
}
/**
@@ -160,21 +160,21 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'tou_name' => array(
+ return [
+ 'tou_name' => [
'order' => 10,
'type' => 'text',
'title' => __('Terms Checkbox Label', 'wp-ultimo'),
'placeholder' => __('e.g. I agree with the terms of use.', 'wp-ultimo'),
- ),
- 'tou_url' => array(
+ ],
+ 'tou_url' => [
'order' => 20,
'type' => 'url',
'title' => __('Link to the Terms Page', 'wp-ultimo'),
'desc' => __('Enter the link to the terms of use content.', 'wp-ultimo'),
'placeholder' => __('e.g. https://yoursite.com/terms', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
}
/**
@@ -187,18 +187,18 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $checkout_fields = array();
+ $checkout_fields = [];
$tou_link = sprintf('%s', $attributes['tou_url'], __('Read here', 'wp-ultimo'));
- $checkout_fields['terms_of_use'] = array(
+ $checkout_fields['terms_of_use'] = [
'type' => 'checkbox',
'id' => 'terms_of_use',
'name' => $attributes['tou_name'] . ' - ',
'desc' => $tou_link,
'wrapper_classes' => $attributes['element_classes'],
'required' => true,
- );
+ ];
return $checkout_fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-text.php b/inc/checkout/signup-fields/class-signup-field-text.php
index 1ce3760..686a816 100644
--- a/inc/checkout/signup-fields/class-signup-field-text.php
+++ b/inc/checkout/signup-fields/class-signup-field-text.php
@@ -108,9 +108,9 @@ class Signup_Field_Text extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'',
- );
+ ];
}
/**
@@ -121,7 +121,7 @@ class Signup_Field_Text extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'id',
'name',
'placeholder',
@@ -129,7 +129,7 @@ class Signup_Field_Text extends Base_Signup_Field {
'tooltip',
'required',
'save_as',
- );
+ ];
}
/**
@@ -140,7 +140,7 @@ class Signup_Field_Text extends Base_Signup_Field {
*/
public function force_attributes() {
- return array();
+ return [];
}
/**
@@ -151,7 +151,7 @@ class Signup_Field_Text extends Base_Signup_Field {
*/
public function get_fields() {
- return array();
+ return [];
}
/**
@@ -164,8 +164,8 @@ class Signup_Field_Text extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
- $fields = array(
- $attributes['id'] => array(
+ $fields = [
+ $attributes['id'] => [
'type' => 'text',
'id' => $attributes['id'],
'name' => $attributes['name'],
@@ -174,8 +174,8 @@ class Signup_Field_Text extends Base_Signup_Field {
'required' => $attributes['required'],
'wrapper_classes' => $attributes['element_classes'],
'value' => $this->get_value(),
- ),
- );
+ ],
+ ];
return $fields;
}
diff --git a/inc/checkout/signup-fields/class-signup-field-username.php b/inc/checkout/signup-fields/class-signup-field-username.php
index ac0e4cc..5241773 100644
--- a/inc/checkout/signup-fields/class-signup-field-username.php
+++ b/inc/checkout/signup-fields/class-signup-field-username.php
@@ -122,9 +122,9 @@ class Signup_Field_Username extends Base_Signup_Field {
*/
public function defaults() {
- return array(
+ return [
'auto_generate_username' => false,
- );
+ ];
}
/**
@@ -135,11 +135,11 @@ class Signup_Field_Username extends Base_Signup_Field {
*/
public function default_fields() {
- return array(
+ return [
'name',
'placeholder',
'tooltip',
- );
+ ];
}
/**
@@ -150,10 +150,10 @@ class Signup_Field_Username extends Base_Signup_Field {
*/
public function force_attributes() {
- return array(
+ return [
'id' => 'username',
'required' => true,
- );
+ ];
}
/**
@@ -164,18 +164,18 @@ class Signup_Field_Username extends Base_Signup_Field {
*/
public function get_fields() {
- return array(
- 'auto_generate_username' => array(
+ return [
+ 'auto_generate_username' => [
'type' => 'toggle',
'title' => __('Auto-generate', 'wp-ultimo'),
'desc' => __('Check this option to auto-generate this field based on the email address of the customer.', 'wp-ultimo'),
'tooltip' => '',
'value' => 0,
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'auto_generate_username',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
/**
@@ -191,26 +191,26 @@ class Signup_Field_Username extends Base_Signup_Field {
* Logged in user, bail.
*/
if (is_user_logged_in()) {
- return array();
+ return [];
}
if (isset($attributes['auto_generate_username']) && $attributes['auto_generate_username']) {
- return array(
- 'auto_generate_username' => array(
+ return [
+ 'auto_generate_username' => [
'type' => 'hidden',
'id' => 'auto_generate_username',
'value' => 'email',
- ),
- 'username' => array(
+ ],
+ 'username' => [
'type' => 'hidden',
'id' => 'username',
'value' => uniqid(),
- ),
- );
+ ],
+ ];
}
- return array(
- 'username' => array(
+ return [
+ 'username' => [
'type' => 'text',
'id' => 'username',
'name' => $attributes['name'],
@@ -220,15 +220,15 @@ class Signup_Field_Username extends Base_Signup_Field {
'classes' => wu_get_isset($attributes, 'element_classes', ''),
'required' => true,
'value' => $this->get_value(),
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'username',
'v-init:username' => "'{$this->get_value()}'",
'autocomplete' => 'username',
- ),
- 'wrapper_html_attr' => array(
+ ],
+ 'wrapper_html_attr' => [
'style' => $this->calculate_style_attr(),
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
diff --git a/inc/checkout/signup-fields/field-templates/class-base-field-template.php b/inc/checkout/signup-fields/field-templates/class-base-field-template.php
index eb8207b..acfe9c6 100644
--- a/inc/checkout/signup-fields/field-templates/class-base-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/class-base-field-template.php
@@ -32,7 +32,7 @@ class Base_Field_Template {
/**
* @var array
*/
- protected $attributes = array();
+ protected $attributes = [];
/**
* Field Template Constructor
@@ -41,7 +41,7 @@ class Base_Field_Template {
*
* @param array $attributes The attributes passed to the field.
*/
- public function __construct($attributes = array()) {
+ public function __construct($attributes = []) {
$this->attributes = $attributes;
}
diff --git a/inc/checkout/signup-fields/field-templates/order-bump/class-simple-order-bump-field-template.php b/inc/checkout/signup-fields/field-templates/order-bump/class-simple-order-bump-field-template.php
index 80d8590..56eb491 100644
--- a/inc/checkout/signup-fields/field-templates/order-bump/class-simple-order-bump-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/order-bump/class-simple-order-bump-field-template.php
@@ -88,7 +88,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/clean-template-selection.png');
+ return wu_get_asset('checkout-forms/clean-template-selection.webp');
}
/**
@@ -99,7 +99,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
/**
* Loads the actual order-bump template
diff --git a/inc/checkout/signup-fields/field-templates/order-summary/class-clean-order-summary-field-template.php b/inc/checkout/signup-fields/field-templates/order-summary/class-clean-order-summary-field-template.php
index 34e411d..f3fe23f 100644
--- a/inc/checkout/signup-fields/field-templates/order-summary/class-clean-order-summary-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/order-summary/class-clean-order-summary-field-template.php
@@ -88,7 +88,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/clean-order-summary.png');
+ return wu_get_asset('checkout-forms/clean-order-summary.webp');
}
/**
@@ -99,7 +99,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
/**
* Loads the actual order-summary template
diff --git a/inc/checkout/signup-fields/field-templates/period-selection/class-clean-period-selection-field-template.php b/inc/checkout/signup-fields/field-templates/period-selection/class-clean-period-selection-field-template.php
index b2ec553..475e752 100644
--- a/inc/checkout/signup-fields/field-templates/period-selection/class-clean-period-selection-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/period-selection/class-clean-period-selection-field-template.php
@@ -90,7 +90,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/clean-period-selection.png');
+ return wu_get_asset('checkout-forms/clean-period-selection.webp');
}
/**
@@ -101,7 +101,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/period-selection/clean', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/period-selection/class-legacy-period-selection-field-template.php b/inc/checkout/signup-fields/field-templates/period-selection/class-legacy-period-selection-field-template.php
index 77441b9..5cc182e 100644
--- a/inc/checkout/signup-fields/field-templates/period-selection/class-legacy-period-selection-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/period-selection/class-legacy-period-selection-field-template.php
@@ -90,7 +90,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/legacy-period-selection.png');
+ return wu_get_asset('checkout-forms/legacy-period-selection.webp');
}
/**
@@ -101,7 +101,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/period-selection/legacy', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/pricing-table/class-legacy-pricing-table-field-template.php b/inc/checkout/signup-fields/field-templates/pricing-table/class-legacy-pricing-table-field-template.php
index 3fddec6..0fdd83e 100644
--- a/inc/checkout/signup-fields/field-templates/pricing-table/class-legacy-pricing-table-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/pricing-table/class-legacy-pricing-table-field-template.php
@@ -90,7 +90,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/legacy-pricing-table.png');
+ return wu_get_asset('checkout-forms/legacy-pricing-table.webp');
}
/**
@@ -101,7 +101,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/pricing-table/legacy', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php b/inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php
index af5a121..dac11a5 100644
--- a/inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php
@@ -68,7 +68,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/list-pricing-table.png');
+ return wu_get_asset('checkout-forms/list-pricing-table.webp');
}
/**
@@ -79,7 +79,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/pricing-table/list', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/steps/class-clean-steps-field-template.php b/inc/checkout/signup-fields/field-templates/steps/class-clean-steps-field-template.php
index 5eb2beb..6c2d49e 100644
--- a/inc/checkout/signup-fields/field-templates/steps/class-clean-steps-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/steps/class-clean-steps-field-template.php
@@ -88,7 +88,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/clean-steps.png');
+ return wu_get_asset('checkout-forms/clean-steps.webp');
}
/**
@@ -99,7 +99,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/steps/clean', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/steps/class-legacy-steps-field-template.php b/inc/checkout/signup-fields/field-templates/steps/class-legacy-steps-field-template.php
index fddfaf5..55107ce 100644
--- a/inc/checkout/signup-fields/field-templates/steps/class-legacy-steps-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/steps/class-legacy-steps-field-template.php
@@ -88,7 +88,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/legacy-steps.png');
+ return wu_get_asset('checkout-forms/legacy-steps.webp');
}
/**
@@ -99,7 +99,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/steps/legacy', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/steps/class-minimal-steps-field-template.php b/inc/checkout/signup-fields/field-templates/steps/class-minimal-steps-field-template.php
index 939b7cd..da84848 100644
--- a/inc/checkout/signup-fields/field-templates/steps/class-minimal-steps-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/steps/class-minimal-steps-field-template.php
@@ -88,7 +88,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/minimal-steps.png');
+ return wu_get_asset('checkout-forms/minimal-steps.webp');
}
/**
@@ -99,7 +99,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/steps/minimal', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/template-selection/class-clean-template-selection-field-template.php b/inc/checkout/signup-fields/field-templates/template-selection/class-clean-template-selection-field-template.php
index d882a61..8b5b899 100644
--- a/inc/checkout/signup-fields/field-templates/template-selection/class-clean-template-selection-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/template-selection/class-clean-template-selection-field-template.php
@@ -88,7 +88,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/clean-template-selection.png');
+ return wu_get_asset('checkout-forms/clean-template-selection.webp');
}
/**
@@ -99,7 +99,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/template-selection/clean', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/template-selection/class-legacy-template-selection-field-template.php b/inc/checkout/signup-fields/field-templates/template-selection/class-legacy-template-selection-field-template.php
index 3623c2f..c02ed84 100644
--- a/inc/checkout/signup-fields/field-templates/template-selection/class-legacy-template-selection-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/template-selection/class-legacy-template-selection-field-template.php
@@ -79,7 +79,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/legacy-template-selection.png');
+ return wu_get_asset('checkout-forms/legacy-template-selection.webp');
}
/**
@@ -90,7 +90,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/template-selection/legacy', $attributes);
}
diff --git a/inc/checkout/signup-fields/field-templates/template-selection/class-minimal-template-selection-field-template.php b/inc/checkout/signup-fields/field-templates/template-selection/class-minimal-template-selection-field-template.php
index bf47de5..df52a75 100644
--- a/inc/checkout/signup-fields/field-templates/template-selection/class-minimal-template-selection-field-template.php
+++ b/inc/checkout/signup-fields/field-templates/template-selection/class-minimal-template-selection-field-template.php
@@ -77,7 +77,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
*/
public function get_preview(): string {
- return wu_get_asset('checkout-forms/minimal-template-selection.png');
+ return wu_get_asset('checkout-forms/minimal-template-selection.webp');
}
/**
@@ -88,7 +88,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
* @param array $attributes The field template attributes.
* @return void
*/
- public function output($attributes) {
+ public function output($attributes): void {
wu_get_template('checkout/templates/template-selection/minimal', $attributes);
}
diff --git a/inc/class-admin-notices.php b/inc/class-admin-notices.php
index bbdccae..bbe2a55 100644
--- a/inc/class-admin-notices.php
+++ b/inc/class-admin-notices.php
@@ -27,24 +27,24 @@ class Admin_Notices {
* @since 2.0.0
* @var array
*/
- protected $notices = array(
- 'admin' => array(),
- 'network-admin' => array(),
- 'user' => array(),
- );
+ protected $notices = [
+ 'admin' => [],
+ 'network-admin' => [],
+ 'user' => [],
+ ];
/**
* Loads the hooks we need for dismissing notices
*
* @since 2.0.0
*/
- public function init() {
+ public function init(): void {
- add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
+ add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts']);
- add_action('in_admin_header', array($this, 'display_notices'));
+ add_action('in_admin_header', [$this, 'display_notices']);
- add_action('wp_ajax_wu_dismiss_admin_notice', array($this, 'ajax_dismiss_admin_notices'));
+ add_action('wp_ajax_wu_dismiss_admin_notice', [$this, 'ajax_dismiss_admin_notices']);
}
/**
@@ -57,7 +57,7 @@ class Admin_Notices {
$dismissed = get_user_meta(get_current_user_id(), 'wu_dismissed_admin_notices', true);
- $dismissed = $dismissed ? $dismissed : array();
+ $dismissed = $dismissed ?: [];
return $dismissed;
}
@@ -77,16 +77,16 @@ class Admin_Notices {
* @param array $actions List of buttons to add to the notification block.
* @return void
*/
- public function add($notice, $type = 'success', $panel = 'admin', $dismissible_key = false, $actions = array()) {
+ public function add($notice, $type = 'success', $panel = 'admin', $dismissible_key = false, $actions = []): void {
- $id = $dismissible_key ? $dismissible_key : md5($notice);
+ $id = $dismissible_key ?: md5($notice);
- $this->notices[ $panel ][ $id ] = array(
+ $this->notices[ $panel ][ $id ] = [
'type' => $type,
'message' => $notice,
'dismissible_key' => is_string($dismissible_key) ? $dismissible_key : false,
'actions' => $actions,
- );
+ ];
}
/**
@@ -100,7 +100,7 @@ class Admin_Notices {
*/
public function get_notices($panel = 'admin', $filter = true) {
- $notices = isset($this->notices[ $panel ]) ? $this->notices[ $panel ] : array();
+ $notices = $this->notices[ $panel ] ?? [];
$dismissed_messages = $this->get_dismissed_notices();
@@ -129,9 +129,9 @@ class Admin_Notices {
* @since 2.0.0
* @return void
*/
- public function enqueue_scripts() {
+ public function enqueue_scripts(): void {
- wp_enqueue_script('wu-admin-notices', wu_get_asset('admin-notices.js', 'js'), array('jquery'), wu_get_version());
+ wp_enqueue_script('wu-admin-notices', wu_get_asset('admin-notices.js', 'js'), ['jquery'], wu_get_version());
}
/**
@@ -161,7 +161,7 @@ class Admin_Notices {
* @since 2.0.0
* @return void
*/
- public function display_notices() {
+ public function display_notices(): void {
$panel = $this->get_current_panel();
@@ -169,10 +169,10 @@ class Admin_Notices {
wu_get_template(
'admin-notices',
- array(
+ [
'notices' => $notices,
'nonce' => wp_create_nonce('wu-dismiss-admin-notice'),
- )
+ ]
);
}
@@ -182,7 +182,7 @@ class Admin_Notices {
* @since 2.0.0
* @return void
*/
- public function ajax_dismiss_admin_notices() {
+ public function ajax_dismiss_admin_notices(): void {
if ( ! wp_verify_nonce($_POST['nonce'], 'wu-dismiss-admin-notice')) {
die('-1');
diff --git a/inc/class-admin-themes-compatibility.php b/inc/class-admin-themes-compatibility.php
index c683bdb..6777da4 100644
--- a/inc/class-admin-themes-compatibility.php
+++ b/inc/class-admin-themes-compatibility.php
@@ -28,7 +28,7 @@ class Admin_Themes_Compatibility {
*/
public function __construct() {
- add_filter('admin_body_class', array($this, 'add_body_classes'));
+ add_filter('admin_body_class', [$this, 'add_body_classes']);
}
/**
@@ -62,26 +62,26 @@ class Admin_Themes_Compatibility {
return apply_filters(
'wu_admin_themes_compatibility',
- array(
- 'material-wp' => array(
+ [
+ 'material-wp' => [
'activated' => class_exists('MaterialWP'),
- ),
- 'pro-theme' => array(
+ ],
+ 'pro-theme' => [
'activated' => class_exists('PROTheme'),
- ),
- 'admin-2020' => array(
+ ],
+ 'admin-2020' => [
'activated' => function_exists('run_admin_2020'),
- ),
- 'clientside' => array(
+ ],
+ 'clientside' => [
'activated' => class_exists('Clientside'),
- ),
- 'wphave' => array(
+ ],
+ 'wphave' => [
'activated' => class_exists('wphave_admin'),
- ),
- 'waaspro' => array(
+ ],
+ 'waaspro' => [
'activated' => class_exists('AdminUIPRO') || class_exists('AdminUIPROflat'),
- ),
- )
+ ],
+ ]
);
}
}
diff --git a/inc/class-ajax.php b/inc/class-ajax.php
index 4b58f6e..71354e5 100644
--- a/inc/class-ajax.php
+++ b/inc/class-ajax.php
@@ -30,17 +30,17 @@ class Ajax {
/*
* Load search endpoints.
*/
- add_action('wu_ajax_wu_search', array($this, 'search_models'));
+ add_action('wu_ajax_wu_search', [$this, 'search_models']);
/*
* Adds the Selectize templates to the admin_footer.
*/
- add_action('in_admin_footer', array($this, 'render_selectize_templates'));
+ add_action('in_admin_footer', [$this, 'render_selectize_templates']);
/*
* Load search endpoints.
*/
- add_action('wp_ajax_wu_list_table_fetch_ajax_results', array($this, 'refresh_list_table'));
+ add_action('wp_ajax_wu_list_table_fetch_ajax_results', [$this, 'refresh_list_table']);
}
/**
* Reverts the name of the table being processed.
@@ -60,7 +60,7 @@ class Ajax {
* @since 2.0.0
* @return void
*/
- public function refresh_list_table() {
+ public function refresh_list_table(): void {
$table_id = wu_request('table_id');
@@ -83,7 +83,7 @@ class Ajax {
* @since 2.0.0
* @return void
*/
- public function search_models() {
+ public function search_models(): void {
/**
* Fires before the processing of the search request.
@@ -100,18 +100,18 @@ class Ajax {
$args = wp_parse_args(
$_REQUEST,
- array(
+ [
'model' => 'membership',
- 'query' => array(),
- 'exclude' => array(),
- )
+ 'query' => [],
+ 'exclude' => [],
+ ]
);
$query = array_merge(
$args['query'],
- array(
+ [
'number' => -1,
- )
+ ]
);
if ($args['exclude']) {
@@ -151,18 +151,18 @@ class Ajax {
}
}
- $results = array();
+ $results = [];
if ($args['model'] === 'user') {
$results = $this->search_wordpress_users($query);
} elseif ($args['model'] === 'page') {
$results = get_posts(
- array(
+ [
'post_type' => 'page',
'post_status' => 'publish',
'numberposts' => -1,
- 'exclude' => isset($query['id__not_in']) ? $query['id__not_in'] : '',
- )
+ 'exclude' => $query['id__not_in'] ?? '',
+ ]
);
} elseif ($args['model'] === 'setting') {
$results = $this->search_wp_ultimo_setting($query);
@@ -181,7 +181,7 @@ class Ajax {
if (function_exists($model_func)) {
$result = $model_func(trim((string) $query['search'], '*'));
- $results = $result ? array($result) : array();
+ $results = $result ? [$result] : [];
}
}
@@ -196,13 +196,13 @@ class Ajax {
* @since 2.0.0
* @return void
*/
- public function search_all_models() {
+ public function search_all_models(): void {
$query = array_merge(
- wu_request('query', array()),
- array(
+ wu_request('query', []),
+ [
'number' => 10000,
- )
+ ]
);
$results_user = array_map(
@@ -242,7 +242,7 @@ class Ajax {
*/
$data_sources = apply_filters(
'wu_search_models_functions',
- array(
+ [
'wu_get_customers',
'wu_get_products',
'wu_get_plans',
@@ -252,7 +252,7 @@ class Ajax {
'wu_get_payments',
'wu_get_broadcasts',
'wu_get_checkout_forms',
- )
+ ]
);
foreach ($data_sources as $function) {
@@ -265,9 +265,9 @@ class Ajax {
$item->value = wu_network_admin_url(
"wp-ultimo-edit-{$url}",
- array(
+ [
'id' => $item->get_id(),
- )
+ ]
);
$item->group = ucwords((string) $item->model) . 's';
@@ -284,9 +284,9 @@ class Ajax {
$discount['value'] = wu_network_admin_url(
'wp-ultimo-edit-discount-code',
- array(
+ [
'id' => $discount['id'],
- )
+ ]
);
$discount['group'] = 'Discount Codes';
@@ -312,7 +312,7 @@ class Ajax {
$sections = \WP_Ultimo\Settings::get_instance()->get_sections();
- $all_fields = array();
+ $all_fields = [];
foreach ($sections as $section_slug => $section) {
$section['fields'] = array_map(
@@ -324,9 +324,9 @@ class Ajax {
$item['url'] = wu_network_admin_url(
'wp-ultimo-settings',
- array(
+ [
'tab' => $section_slug,
- )
+ ]
) . '#' . $item['setting_id'];
return $item;
@@ -339,13 +339,13 @@ class Ajax {
$_settings = \Arrch\Arrch::find(
$all_fields,
- array(
+ [
'sort_key' => 'title',
- 'where' => array(
- array('setting_id', '~', trim((string) $query['search'], '*')),
- array('type', '!=', 'header'),
- ),
- )
+ 'where' => [
+ ['setting_id', '~', trim((string) $query['search'], '*')],
+ ['type', '!=', 'header'],
+ ],
+ ]
);
return array_values($_settings);
@@ -362,18 +362,18 @@ class Ajax {
public function search_wordpress_users($query) {
$results = get_users(
- array(
+ [
'blog_id' => 0,
'search' => '*' . $query['search'] . '*',
- 'search_columns' => array(
+ 'search_columns' => [
'ID',
'user_login',
'user_email',
'user_url',
'user_nicename',
'display_name',
- ),
- )
+ ],
+ ]
);
$results = array_map(
@@ -386,10 +386,10 @@ class Ajax {
40,
'identicon',
'',
- array(
+ [
'force_display' => true,
'class' => 'wu-rounded-full wu-mr-3',
- )
+ ]
);
return $item->data;
@@ -406,7 +406,7 @@ class Ajax {
* @since 2.0.0
* @return void
*/
- public function render_selectize_templates() {
+ public function render_selectize_templates(): void {
if (current_user_can('manage_network')) {
wu_get_template('ui/selectize-templates');
diff --git a/inc/class-api.php b/inc/class-api.php
index 9a16487..e249be7 100644
--- a/inc/class-api.php
+++ b/inc/class-api.php
@@ -50,35 +50,35 @@ class API {
*
* @since 1.7.4
*/
- add_action('init', array($this, 'add_settings'));
+ add_action('init', [$this, 'add_settings']);
/**
* Refreshing API credentials
*
* @since 1.7.4
*/
- add_action('wu_before_save_settings', array($this, 'refresh_API_credentials'), 10);
+ add_action('wu_before_save_settings', [$this, 'refresh_API_credentials'], 10);
/**
* Register the routes
*
* @since 1.7.4
*/
- add_action('rest_api_init', array($this, 'register_routes'));
+ add_action('rest_api_init', [$this, 'register_routes']);
/**
* Log API errors
*
* @since 2.0.0
*/
- add_action('rest_request_after_callbacks', array($this, 'log_api_errors'), 10, 3);
+ add_action('rest_request_after_callbacks', [$this, 'log_api_errors'], 10, 3);
/**
* We need to bypass the WP Core auth errors in our routes so we can use our api keys
*
* @since 2.1.2
*/
- add_filter('rest_authentication_errors', array($this, 'maybe_bypass_wp_auth'), 1);
+ add_filter('rest_authentication_errors', [$this, 'maybe_bypass_wp_auth'], 1);
}
/**
@@ -101,7 +101,7 @@ class API {
$rest_url = rest_url();
$rest_path = rtrim(parse_url($rest_url, PHP_URL_PATH), '/');
- if (strncmp((string) $current_route, $rest_path . '/' . $this->get_namespace(), strlen($rest_path . '/' . $this->get_namespace())) !== 0) {
+ if (! str_starts_with((string) $current_route, $rest_path . '/' . $this->get_namespace())) {
return $result;
}
@@ -114,7 +114,7 @@ class API {
* @since 1.7.4
* @return void
*/
- public function refresh_API_credentials() { // phpcs:ignore
+ public function refresh_API_credentials(): void { // phpcs:ignore
if (wu_request('submit_button') === 'refresh_api_credentials') {
wu_save_setting('api_url', network_site_url());
@@ -134,40 +134,40 @@ class API {
*
* @since 1.7.4
*/
- public function add_settings() {
+ public function add_settings(): void {
/*
* API & Webhooks
* This section holds the API settings of the WP Multisite WaaS Plugin.
*/
wu_register_settings_section(
'api',
- array(
+ [
'title' => __('API & Webhooks', 'wp-ultimo'),
'desc' => __('API & Webhooks', 'wp-ultimo'),
'icon' => 'dashicons-wu-paper-plane',
'order' => 95,
- )
+ ]
);
wu_register_settings_field(
'api',
'api_header',
- array(
+ [
'title' => __('API Settings', 'wp-ultimo'),
'desc' => __('Options related to WP Multisite WaaS API endpoints.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
wu_register_settings_field(
'api',
'enable_api',
- array(
+ [
'title' => __('Enable API', 'wp-ultimo'),
'desc' => __('Tick this box if you want WP Multisite WaaS to add its own endpoints to the WordPress REST API. This is required for some integrations to work, most notabily, Zapier.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$refreshed_tag = '';
@@ -179,23 +179,23 @@ class API {
wu_register_settings_field(
'api',
'api_url',
- array(
+ [
'title' => __('API URL', 'wp-ultimo'),
'desc' => '',
'tooltip' => '',
'copy' => true,
'type' => 'text-display',
'default' => network_site_url(),
- 'require' => array(
+ 'require' => [
'enable_api' => true,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'api_key',
- array(
+ [
'title' => __('API Key', 'wp-ultimo') . $refreshed_tag,
'desc' => '',
'tooltip' => '',
@@ -203,89 +203,89 @@ class API {
'copy' => true,
'default' => wp_generate_password(24, false),
'wrapper_classes' => 'sm:wu-w-1/2 wu-float-left',
- 'require' => array(
+ 'require' => [
'enable_api' => true,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'api_secret',
- array(
+ [
'title' => __('API Secret', 'wp-ultimo') . $refreshed_tag,
'tooltip' => '',
'type' => 'text-display',
'copy' => true,
'default' => wp_generate_password(24, false),
'wrapper_classes' => 'sm:wu-border-l-0 sm:wu-w-1/2 wu-float-left',
- 'require' => array(
+ 'require' => [
'enable_api' => 1,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'api_note',
- array(
+ [
'desc' => __('This is your API Key. You cannot change it directly. To reset the API key and secret, use the button "Refresh API credentials" below.', 'wp-ultimo'),
'type' => 'note',
'classes' => 'wu-text-gray-700 wu-text-xs',
'wrapper_classes' => 'wu-bg-white sm:wu-border-t-0 sm:wu-mt-0 sm:wu-pt-0',
- 'require' => array(
+ 'require' => [
'enable_api' => 1,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'refresh_api_credentials',
- array(
+ [
'title' => __('Refresh API Credentials', 'wp-ultimo'),
'type' => 'submit',
'classes' => 'button wu-ml-auto',
'wrapper_classes' => 'wu-bg-white sm:wu-border-t-0 sm:wu-mt-0 sm:wu-pt-0',
- 'require' => array(
+ 'require' => [
'enable_api' => 1,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'api_log_calls',
- array(
+ [
'title' => __('Log API calls (Advanced)', 'wp-ultimo'),
'desc' => __('Tick this box if you want to log all calls received via WP Multisite WaaS API endpoints. You can access the logs on WP Multisite WaaS → System Info → Logs.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- 'require' => array(
+ 'require' => [
'enable_api' => 1,
- ),
- )
+ ],
+ ]
);
wu_register_settings_field(
'api',
'webhook_header',
- array(
+ [
'title' => __('Webhook Settings', 'wp-ultimo'),
'desc' => __('Options related to WP Multisite WaaS API webhooks.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
wu_register_settings_field(
'api',
'webhook_calls_blocking',
- array(
+ [
'title' => __('Wait for Response (Advanced)', 'wp-ultimo'),
'desc' => __('Tick this box if you want the WP Multisite WaaS\'s webhook calls to wait for the remote server to respond. Keeping this option enabled can have huge effects on your network\'s performance, only enable it if you know what you are doing and need to debug webhook calls.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
}
@@ -308,10 +308,10 @@ class API {
*/
public function get_auth() {
- return array(
+ return [
'api_key' => wu_get_setting('api_key', 'prevent'),
'api_secret' => wu_get_setting('api_secret', 'prevent'),
- );
+ ];
}
/**
@@ -345,15 +345,15 @@ class API {
*
* @param WP_REST_Request $request The request sent.
*/
- public function maybe_log_api_call($request) {
+ public function maybe_log_api_call($request): void {
if ($this->should_log_api_calls()) {
- $payload = array(
+ $payload = [
'route' => $request->get_route(),
'method' => $request->get_method(),
'url_params' => $request->get_url_params(),
'body_params' => $request->get_body(),
- );
+ ];
wu_log_add('api-calls', json_encode($payload, JSON_PRETTY_PRINT));
}
@@ -371,17 +371,17 @@ class API {
*/
public function log_api_errors($result, $handler, $request) {
- if (is_wp_error($result) && strncmp($request->get_route(), '/wu', strlen('/wu')) === 0) {
+ if (is_wp_error($result) && str_starts_with($request->get_route(), '/wu')) {
/*
* Log API call here if we didn't log it before.
*/
if ( ! $this->should_log_api_calls()) {
- $payload = array(
+ $payload = [
'route' => $request->get_route(),
'method' => $request->get_method(),
'url_params' => $request->get_url_params(),
'body_params' => $request->get_body(),
- );
+ ];
wu_log_add('api-errors', json_encode($payload, JSON_PRETTY_PRINT));
}
@@ -441,7 +441,7 @@ class API {
* @since 1.7.4
* @return void
*/
- public function register_routes() {
+ public function register_routes(): void {
if ( ! $this->is_api_enabled()) {
return;
@@ -452,11 +452,11 @@ class API {
register_rest_route(
$namespace,
'/auth',
- array(
+ [
'methods' => 'GET',
- 'callback' => array($this, 'auth'),
- 'permission_callback' => array($this, 'check_authorization'),
- )
+ 'callback' => [$this, 'auth'],
+ 'permission_callback' => [$this, 'check_authorization'],
+ ]
);
/**
@@ -478,16 +478,16 @@ class API {
* @param \WP_REST_Request $request WP Request Object.
* @return void
*/
- public function auth($request) {
+ public function auth($request): void {
$current_site = get_current_site();
wp_send_json(
- array(
+ [
'success' => true,
'label' => $current_site->site_name,
'message' => __('Welcome to our API', 'wp-ultimo'),
- )
+ ]
);
}
}
diff --git a/inc/class-async-calls.php b/inc/class-async-calls.php
index 1bc3e28..2c5de4c 100644
--- a/inc/class-async-calls.php
+++ b/inc/class-async-calls.php
@@ -33,7 +33,7 @@ class Async_Calls {
*
* @var array
*/
- static $registry = array();
+ static $registry = [];
/**
* Registers a new listener.
@@ -45,12 +45,12 @@ class Async_Calls {
* @param mixed ...$args Arguments to be passed to the callback.
* @return void
*/
- public static function register_listener($id, $callable, ...$args) {
+ public static function register_listener($id, $callable, ...$args): void {
- self::$registry[ $id ] = array(
+ self::$registry[ $id ] = [
'callable' => $callable,
'args' => $args,
- );
+ ];
}
/**
@@ -59,7 +59,7 @@ class Async_Calls {
* @since 2.0.7
* @return void
*/
- public static function install_listeners() {
+ public static function install_listeners(): void {
foreach (self::$registry as $id => $listener) {
add_action(
@@ -105,23 +105,23 @@ class Async_Calls {
* @param array $args Additional arguments to be passed.
* @return array The list of paginates URLs to call.
*/
- public static function build_url_list($id, $total, $chunk_size, $args = array()) {
+ public static function build_url_list($id, $total, $chunk_size, $args = []) {
$pages = ceil($total / $chunk_size);
- $urls = array();
+ $urls = [];
for ($i = 1; $i <= $pages; $i++) {
$urls[] = self::build_base_url(
$id,
array_merge(
$args,
- array(
+ [
'action' => "wu_async_call_listener_$id",
'parallel' => 1,
'page' => $i,
'per_page' => $chunk_size,
- )
+ ]
)
);
}
@@ -162,7 +162,7 @@ class Async_Calls {
* @param integer $parallel_threads The number of parallel threads to be run.
* @return true|\WP_Error
*/
- public static function run($id, $args, $total, $chunk_size = 10, $parallel_threads = 3) {
+ public static function run($id, $args, $total, $chunk_size = 10, $parallel_threads = 3): void {
$client = self::get_client();
@@ -171,7 +171,7 @@ class Async_Calls {
$coroutine = \Amp\call(
static function () use ($id, $total, $chunk_size, $parallel_threads, $client, $urls) {
- $results = array();
+ $results = [];
$chunker = new LocalSemaphore($parallel_threads);
diff --git a/inc/class-autoloader.php b/inc/class-autoloader.php
index 8210b75..64653b7 100644
--- a/inc/class-autoloader.php
+++ b/inc/class-autoloader.php
@@ -40,7 +40,7 @@ class Autoloader {
* @deprecated 2.3.5
* @return void
*/
- public static function init() {
+ public static function init(): void {
// do nothing now. Composer autoloader does the work.
}
diff --git a/inc/class-cron.php b/inc/class-cron.php
index 436b75d..632434a 100644
--- a/inc/class-cron.php
+++ b/inc/class-cron.php
@@ -36,11 +36,11 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
/*
* Creates general schedules for general uses.
*/
- add_action('init', array($this, 'create_schedules'));
+ add_action('init', [$this, 'create_schedules']);
/*
* Deals with renewals for non-auto-renewing
@@ -50,22 +50,22 @@ class Cron {
* The second hook adds the handler to be called on that schedule.
* The third one deals with each membership that needs to be manually renewed.
*/
- add_action('init', array($this, 'schedule_membership_check'));
+ add_action('init', [$this, 'schedule_membership_check']);
- add_action('wu_membership_check', array($this, 'membership_renewal_check'), 10);
+ add_action('wu_membership_check', [$this, 'membership_renewal_check'], 10);
- add_action('wu_membership_check', array($this, 'membership_trial_check'), 10);
+ add_action('wu_membership_check', [$this, 'membership_trial_check'], 10);
- add_action('wu_async_create_renewal_payment', array($this, 'async_create_renewal_payment'), 10, 2);
+ add_action('wu_async_create_renewal_payment', [$this, 'async_create_renewal_payment'], 10, 2);
/*
* On that same check, we'll
* search for expired memberships
* and mark them as such.
*/
- add_action('wu_membership_check', array($this, 'membership_expired_check'), 20);
+ add_action('wu_membership_check', [$this, 'membership_expired_check'], 20);
- add_action('wu_async_mark_membership_as_expired', array($this, 'async_mark_membership_as_expired'), 10);
+ add_action('wu_async_mark_membership_as_expired', [$this, 'async_mark_membership_as_expired'], 10);
}
/**
@@ -76,21 +76,21 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function create_schedules() {
+ public function create_schedules(): void {
/*
* Hourly check
*/
if (wu_next_scheduled_action('wu_hourly') === false) {
$next_hour = strtotime(gmdate('Y-m-d H:00:00', strtotime('+1 hour')));
- wu_schedule_recurring_action($next_hour, HOUR_IN_SECONDS, 'wu_hourly', array(), 'wu_cron');
+ wu_schedule_recurring_action($next_hour, HOUR_IN_SECONDS, 'wu_hourly', [], 'wu_cron');
}
/*
* Daily check
*/
if (wu_next_scheduled_action('wu_daily') === false) {
- wu_schedule_recurring_action(strtotime('tomorrow'), DAY_IN_SECONDS, 'wu_daily', array(), 'wu_cron');
+ wu_schedule_recurring_action(strtotime('tomorrow'), DAY_IN_SECONDS, 'wu_daily', [], 'wu_cron');
}
/*
@@ -99,7 +99,7 @@ class Cron {
if (wu_next_scheduled_action('wu_monthly') === false) {
$next_month = strtotime(gmdate('Y-m-01 00:00:00', strtotime('+1 month')));
- wu_schedule_recurring_action($next_month, MONTH_IN_SECONDS, 'wu_monthly', array(), 'wu_cron');
+ wu_schedule_recurring_action($next_month, MONTH_IN_SECONDS, 'wu_monthly', [], 'wu_cron');
}
}
@@ -113,12 +113,12 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function schedule_membership_check() {
+ public function schedule_membership_check(): void {
$interval = apply_filters('wu_schedule_membership_check_interval', 1 * HOUR_IN_SECONDS);
if (wu_next_scheduled_action('wu_membership_check') === false) {
- wu_schedule_recurring_action(time(), $interval, 'wu_membership_check', array(), 'wu_cron');
+ wu_schedule_recurring_action(time(), $interval, 'wu_membership_check', [], 'wu_cron');
}
}
@@ -131,7 +131,7 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function membership_renewal_check() {
+ public function membership_renewal_check(): void {
/*
* Define how many days before we need to
* create pending payments.
@@ -140,18 +140,18 @@ class Cron {
$query_params = apply_filters(
'wu_membership_renewal_check_query_params',
- array(
+ [
'auto_renew' => false,
- 'status__in' => array(
+ 'status__in' => [
Membership_Status::ACTIVE,
- ),
- 'date_query' => array(
+ ],
+ 'date_query' => [
'column' => 'date_expiration',
'before' => "+{$days_before_expiring} days",
'after' => 'yesterday',
'inclusive' => true,
- ),
- ),
+ ],
+ ],
$days_before_expiring
);
@@ -164,9 +164,9 @@ class Cron {
foreach ($memberships as $membership) {
wu_enqueue_async_action(
'wu_async_create_renewal_payment',
- array(
+ [
'membership_id' => $membership->get_id(),
- ),
+ ],
'wu_cron_check'
);
}
@@ -181,21 +181,21 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function membership_trial_check() {
+ public function membership_trial_check(): void {
$query_params = apply_filters(
'wu_membership_trial_check_query_params',
- array(
+ [
'auto_renew' => false,
- 'status__in' => array(
+ 'status__in' => [
Membership_Status::TRIALING,
- ),
- 'date_query' => array(
+ ],
+ 'date_query' => [
'column' => 'date_trial_end',
'before' => '-3 hours',
'inclusive' => true,
- ),
- )
+ ],
+ ]
);
$memberships = wu_get_memberships($query_params);
@@ -207,10 +207,10 @@ class Cron {
foreach ($memberships as $membership) {
wu_enqueue_async_action(
'wu_async_create_renewal_payment',
- array(
+ [
'membership_id' => $membership->get_id(),
'trial' => true,
- ),
+ ],
'wu_cron_check'
);
}
@@ -255,16 +255,16 @@ class Cron {
$saved = $membership->save();
$payment_url = add_query_arg(
- array(
+ [
'payment' => $new_payment->get_hash(),
- ),
+ ],
wu_get_registration_url()
);
$payload = array_merge(
- array(
+ [
'default_payment_url' => $payment_url,
- ),
+ ],
wu_generate_event_payload('payment', $new_payment),
wu_generate_event_payload('membership', $membership),
wu_generate_event_payload('customer', $membership->get_customer())
@@ -284,7 +284,7 @@ class Cron {
* @since 2.0.0
* @return void
*/
- public function membership_expired_check() {
+ public function membership_expired_check(): void {
/*
* Define how many grace period
* days we allow for our customers.
@@ -293,19 +293,19 @@ class Cron {
$query_params = apply_filters(
'wu_membership_expired_check_query_params',
- array(
+ [
'auto_renew' => false,
- 'status__in' => array(
+ 'status__in' => [
Membership_Status::ACTIVE,
Membership_Status::ON_HOLD,
- ),
- 'date_expiration__not_in' => array(null, '0000-00-00 00:00:00'),
- 'date_query' => array(
+ ],
+ 'date_expiration__not_in' => [null, '0000-00-00 00:00:00'],
+ 'date_query' => [
'column' => 'date_expiration',
'before' => "-{$grace_period_days} days",
'inclusive' => true,
- ),
- ),
+ ],
+ ],
$grace_period_days
);
@@ -318,9 +318,9 @@ class Cron {
foreach ($memberships as $membership) {
wu_enqueue_async_action(
'wu_async_mark_membership_as_expired',
- array(
+ [
'membership_id' => $membership->get_id(),
- ),
+ ],
'wu_cron_check'
);
}
diff --git a/inc/class-current.php b/inc/class-current.php
index b9cc46d..c177039 100644
--- a/inc/class-current.php
+++ b/inc/class-current.php
@@ -75,21 +75,21 @@ class Current {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
/*
* Add rewrite rules
*/
- add_action('init', array($this, 'add_rewrite_rules'));
- add_filter('query_vars', array($this, 'add_query_vars'));
+ add_action('init', [$this, 'add_rewrite_rules']);
+ add_filter('query_vars', [$this, 'add_query_vars']);
- add_action('wu_after_save_settings', array($this, 'flush_rewrite_rules_on_update'));
- add_action('wu_core_update', array($this, 'flush_rewrite_rules_on_update'));
+ add_action('wu_after_save_settings', [$this, 'flush_rewrite_rules_on_update']);
+ add_action('wu_core_update', [$this, 'flush_rewrite_rules_on_update']);
/*
* Instantiate the currents.
*/
- add_action('init', array($this, 'load_currents'));
- add_action('wp', array($this, 'load_currents'));
+ add_action('init', [$this, 'load_currents']);
+ add_action('wp', [$this, 'load_currents']);
}
/**
@@ -98,7 +98,7 @@ class Current {
* @since 2.0.0
* @return void
*/
- public function flush_rewrite_rules_on_update() {
+ public function flush_rewrite_rules_on_update(): void {
flush_rewrite_rules();
}
@@ -111,7 +111,7 @@ class Current {
* @since 2.0.0
* @return void
*/
- public function add_rewrite_rules() {
+ public function add_rewrite_rules(): void {
$site_url_param = self::param_key('site');
@@ -159,11 +159,11 @@ class Current {
*/
public static function param_key($type = 'site') {
- $params = array(
+ $params = [
'site' => apply_filters('wu_current_get_site_param', 'site'),
'customer' => apply_filters('wu_current_get_customer_param', 'customer'),
'membership' => apply_filters('wu_current_get_membership_param', 'membership'),
- );
+ ];
return wu_get_isset($params, $type, $type);
}
@@ -190,7 +190,7 @@ class Current {
/*
* Check if the current URL already has a site parameter and remove it.
*/
- if (strpos($current_url, '/' . $url_param . '/') !== false) {
+ if (str_contains($current_url, '/' . $url_param . '/')) {
$current_url = preg_replace('/\/' . $url_param . '\/(.+)/', '/', $current_url);
}
@@ -220,7 +220,7 @@ class Current {
* @since 2.0.0
* @return void
*/
- public function load_currents() {
+ public function load_currents(): void {
$site = false;
@@ -316,7 +316,7 @@ class Current {
* @param \WP_Ultimo\Models\Site $site The current site instance.
* @return void
*/
- public function set_site($site) {
+ public function set_site($site): void {
/**
* Allow developers to modify the default behavior and set
@@ -362,7 +362,7 @@ class Current {
* @param \WP_Ultimo\Models\Customer $customer The current customer instance.
* @return void
*/
- public function set_customer($customer) {
+ public function set_customer($customer): void {
/**
* Allow developers to modify the default behavior and set
@@ -397,7 +397,7 @@ class Current {
* @param \WP_Ultimo\Models\Membership $membership The current membership instance.
* @return void
*/
- public function set_membership($membership) {
+ public function set_membership($membership): void {
/**
* Allow developers to modify the default behavior and set
diff --git a/inc/class-dashboard-statistics.php b/inc/class-dashboard-statistics.php
index 289bc5b..97cd397 100644
--- a/inc/class-dashboard-statistics.php
+++ b/inc/class-dashboard-statistics.php
@@ -46,7 +46,7 @@ class Dashboard_Statistics {
*
* @var array
*/
- protected $types = array();
+ protected $types = [];
/**
* Loads the hooks we need for dismissing notices
@@ -56,7 +56,7 @@ class Dashboard_Statistics {
* @param array $args With the start_date, end_date and the data type functions.
* @return void.
*/
- public function __construct($args = array()) {
+ public function __construct($args = []) {
if ($args) {
$this->start_date = $args['start_date'];
@@ -83,7 +83,7 @@ class Dashboard_Statistics {
*/
public function statistics_data() {
- $data = array();
+ $data = [];
foreach ($this->types as $key => $type) {
$data_function = 'get_data_' . $type;
@@ -102,80 +102,80 @@ class Dashboard_Statistics {
*/
public function get_data_mrr_growth() {
- $payments_per_month = array(
- 'january' => array(
+ $payments_per_month = [
+ 'january' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'february' => array(
+ ],
+ 'february' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'march' => array(
+ ],
+ 'march' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'april' => array(
+ ],
+ 'april' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'may' => array(
+ ],
+ 'may' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'june' => array(
+ ],
+ 'june' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'july' => array(
+ ],
+ 'july' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'august' => array(
+ ],
+ 'august' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'september' => array(
+ ],
+ 'september' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'october' => array(
+ ],
+ 'october' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'november' => array(
+ ],
+ 'november' => [
'total' => 0,
'cancelled' => 0,
- ),
- 'december' => array(
+ ],
+ 'december' => [
'total' => 0,
'cancelled' => 0,
- ),
- );
+ ],
+ ];
$memberships = wu_get_memberships(
- array(
- 'date_query' => array(
+ [
+ 'date_query' => [
'column' => 'date_created',
'compare' => 'BETWEEN',
'relation' => '',
- array(
+ [
'year' => current_time('Y', true),
- ),
- ),
- )
+ ],
+ ],
+ ]
);
- $mrr_status = array(
+ $mrr_status = [
'active',
'cancelled',
'expired',
- );
+ ];
- $churn_status = array(
+ $churn_status = [
'cancelled',
'expired',
- );
+ ];
foreach ($memberships as $membership) {
if ( ! $membership->is_recurring()) {
diff --git a/inc/class-dashboard-widgets.php b/inc/class-dashboard-widgets.php
index 096d159..ae75df9 100644
--- a/inc/class-dashboard-widgets.php
+++ b/inc/class-dashboard-widgets.php
@@ -37,7 +37,7 @@ class Dashboard_Widgets {
* @since 2.0.0
* @var array
*/
- public $core_metaboxes = array();
+ public $core_metaboxes = [];
/**
* Runs on singleton instantiation.
@@ -45,19 +45,19 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
+ add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts']);
- add_action('wp_network_dashboard_setup', array($this, 'register_network_widgets'));
+ add_action('wp_network_dashboard_setup', [$this, 'register_network_widgets']);
- add_action('wp_dashboard_setup', array($this, 'register_widgets'));
+ add_action('wp_dashboard_setup', [$this, 'register_widgets']);
- add_action('wp_ajax_wu_fetch_rss', array($this, 'process_ajax_fetch_rss'));
+ add_action('wp_ajax_wu_fetch_rss', [$this, 'process_ajax_fetch_rss']);
- add_action('wp_ajax_wu_fetch_activity', array($this, 'process_ajax_fetch_events'));
+ add_action('wp_ajax_wu_fetch_activity', [$this, 'process_ajax_fetch_events']);
- add_action('wp_ajax_wu_generate_csv', array($this, 'handle_table_csv'));
+ add_action('wp_ajax_wu_generate_csv', [$this, 'handle_table_csv']);
}
/**
@@ -66,7 +66,7 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function enqueue_scripts() {
+ public function enqueue_scripts(): void {
global $pagenow;
@@ -85,48 +85,48 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function register_network_widgets() {
+ public function register_network_widgets(): void {
- add_meta_box('wp-ultimo-setup', __('WP Multisite WaaS - First Steps', 'wp-ultimo'), array($this, 'output_widget_first_steps'), $this->screen_id, 'normal', 'high');
+ add_meta_box('wp-ultimo-setup', __('WP Multisite WaaS - First Steps', 'wp-ultimo'), [$this, 'output_widget_first_steps'], $this->screen_id, 'normal', 'high');
- add_meta_box('wp-ultimo-summary', __('WP Multisite WaaS - Summary', 'wp-ultimo'), array($this, 'output_widget_summary'), $this->screen_id, 'normal', 'high');
+ add_meta_box('wp-ultimo-summary', __('WP Multisite WaaS - Summary', 'wp-ultimo'), [$this, 'output_widget_summary'], $this->screen_id, 'normal', 'high');
- add_meta_box('wp-ultimo-activity-stream', __('WP Multisite WaaS - Activity Stream', 'wp-ultimo'), array($this, 'output_widget_activity_stream'), $this->screen_id, 'normal', 'high');
+ add_meta_box('wp-ultimo-activity-stream', __('WP Multisite WaaS - Activity Stream', 'wp-ultimo'), [$this, 'output_widget_activity_stream'], $this->screen_id, 'normal', 'high');
\WP_Ultimo\UI\Tours::get_instance()->create_tour(
'dashboard',
- array(
- array(
+ [
+ [
'id' => 'welcome',
'title' => __('Welcome!', 'wp-ultimo'),
- 'text' => array(
+ 'text' => [
__('Welcome to your new network dashboard!', 'wp-ultimo'),
__('You will notice that WP Multisite WaaS adds a couple of useful widgets here so you can keep an eye on how your network is doing.', 'wp-ultimo'),
- ),
- ),
- array(
+ ],
+ ],
+ [
'id' => 'finish-your-setup',
'title' => __('Finish your setup', 'wp-ultimo'),
- 'text' => array(
+ 'text' => [
__('You still have a couple of things to do configuration-wise. Check the steps on this list and make sure you complete them all.', 'wp-ultimo'),
- ),
- 'attachTo' => array(
+ ],
+ 'attachTo' => [
'element' => '#wp-ultimo-setup',
'on' => 'left',
- ),
- ),
- array(
+ ],
+ ],
+ [
'id' => 'wp-ultimo-menu',
'title' => __('Our home', 'wp-ultimo'),
- 'text' => array(
+ 'text' => [
__('You can always find WP Multisite WaaS settings and other pages under our menu item, here on the Network-level dashboard. 😃', 'wp-ultimo'),
- ),
- 'attachTo' => array(
+ ],
+ 'attachTo' => [
'element' => '.toplevel_page_wp-ultimo',
'on' => 'left',
- ),
- ),
- )
+ ],
+ ],
+ ]
);
}
@@ -136,7 +136,7 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function register_widgets() {
+ public function register_widgets(): void {
$screen = get_current_screen();
@@ -176,55 +176,55 @@ class Dashboard_Widgets {
*
* @return void
*/
- public function output_widget_first_steps() {
+ public function output_widget_first_steps(): void {
$initial_setup_done = get_network_option(null, 'wu_setup_finished', false);
- $steps = array(
- 'inital-setup' => array(
+ $steps = [
+ 'inital-setup' => [
'title' => __('Initial Setup', 'wp-ultimo'),
'desc' => __('Go through the initial Setup Wizard to configure the basic settings of your network.', 'wp-ultimo'),
'action_label' => __('Finish the Setup Wizard', 'wp-ultimo'),
'action_link' => wu_network_admin_url('wp-ultimo-setup'),
'done' => wu_string_to_bool($initial_setup_done),
- ),
- 'payment-method' => array(
+ ],
+ 'payment-method' => [
'title' => __('Payment Method', 'wp-ultimo'),
'desc' => __('You will need to configure at least one payment gateway to be able to receive money from your customers.', 'wp-ultimo'),
'action_label' => __('Add a Payment Method', 'wp-ultimo'),
'action_link' => wu_network_admin_url(
'wp-ultimo-settings',
- array(
+ [
'tab' => 'payment-gateways',
- )
+ ]
),
'done' => ! empty(wu_get_active_gateways()),
- ),
- 'your-first-customer' => array(
+ ],
+ 'your-first-customer' => [
'done' => ! empty(wu_get_customers()),
'title' => __('Your First Customer', 'wp-ultimo'),
'desc' => __('Open the link below in an incognito tab and go through your newly created signup form.', 'wp-ultimo'),
'action_link' => wp_registration_url(),
'action_label' => __('Create a test Account', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
$done = \Arrch\Arrch::find(
$steps,
- array(
- 'where' => array(
- array('done', true),
- ),
- )
+ [
+ 'where' => [
+ ['done', true],
+ ],
+ ]
);
wu_get_template(
'dashboard-widgets/first-steps',
- array(
+ [
'steps' => $steps,
'percentage' => round(count($done) / count($steps) * 100),
'all_done' => count($done) === count($steps),
- )
+ ]
);
}
@@ -235,7 +235,7 @@ class Dashboard_Widgets {
*
* @return void
*/
- public function output_widget_activity_stream() {
+ public function output_widget_activity_stream(): void {
wu_get_template('dashboard-widgets/activity-stream');
}
@@ -247,28 +247,28 @@ class Dashboard_Widgets {
*
* @return void
*/
- public function output_widget_summary() {
+ public function output_widget_summary(): void {
/*
* Get today's signups.
*/
$signups = wu_get_customers(
- array(
+ [
'count' => true,
- 'date_query' => array(
+ 'date_query' => [
'column' => 'date_registered',
'after' => 'today',
'inclusive' => true,
- ),
- )
+ ],
+ ]
);
wu_get_template(
'dashboard-widgets/summary',
- array(
+ [
'signups' => $signups,
'mrr' => wu_calculate_mrr(),
'gross_revenue' => wu_calculate_revenue('today'),
- )
+ ]
);
}
@@ -278,18 +278,18 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function process_ajax_fetch_rss() {
+ public function process_ajax_fetch_rss(): void {
$atts = wp_parse_args(
$_GET,
- array(
+ [
'url' => 'https://community.wpultimo.com/topics/feed',
'title' => __('Forum Discussions', 'wp-ultimo'),
'items' => 3,
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1,
- )
+ ]
);
wp_widget_rss_output($atts);
@@ -303,29 +303,29 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function process_ajax_fetch_events() {
+ public function process_ajax_fetch_events(): void {
check_ajax_referer('wu_activity_stream');
$count = wu_get_events(
- array(
+ [
'count' => true,
'number' => -1,
- )
+ ]
);
$data = wu_get_events(
- array(
+ [
'offset' => (wu_request('page', 1) - 1) * 5,
'number' => 5,
- )
+ ]
);
wp_send_json_success(
- array(
+ [
'events' => $data,
'count' => $count,
- )
+ ]
);
}
@@ -335,7 +335,7 @@ class Dashboard_Widgets {
* @since 2.0.0
* @return void
*/
- public function handle_table_csv() {
+ public function handle_table_csv(): void {
$date_range = wu_request('date_range');
$headers = json_decode(stripslashes((string) wu_request('headers')));
@@ -343,7 +343,7 @@ class Dashboard_Widgets {
$file_name = sprintf('wp-ultimo-%s_%s_(%s)', wu_request('slug'), $date_range, gmdate('Y-m-d', wu_get_current_time('timestamp')));
- $data = array_merge(array($headers), $data);
+ $data = array_merge([$headers], $data);
wu_generate_csv($file_name, $data);
@@ -370,14 +370,14 @@ class Dashboard_Widgets {
ob_clean(); // Prevent eventual echos.
- $dashboard_widgets = wu_get_isset($wp_meta_boxes, 'dashboard-network', array());
+ $dashboard_widgets = wu_get_isset($wp_meta_boxes, 'dashboard-network', []);
- $options = array(
+ $options = [
'normal:core:dashboard_right_now' => __('At a Glance'),
'normal:core:network_dashboard_right_now' => __('Right Now'),
'normal:core:dashboard_activity' => __('Activity'),
'normal:core:dashboard_primary' => __('WordPress Events and News'),
- );
+ ];
foreach ($dashboard_widgets as $position => $priorities) {
foreach ($priorities as $priority => $widgets) {
@@ -388,11 +388,11 @@ class Dashboard_Widgets {
$key = implode(
':',
- array(
+ [
$position,
$priority,
$widget_key,
- )
+ ]
);
/**
@@ -402,7 +402,7 @@ class Dashboard_Widgets {
* I don't know why $options would ever be a boolean here, though.
*/
if ( ! is_array($options)) {
- $options = array();
+ $options = [];
}
$options[ $key ] = $widget['title'];
diff --git a/inc/class-documentation.php b/inc/class-documentation.php
index c4a5ac0..48563a7 100644
--- a/inc/class-documentation.php
+++ b/inc/class-documentation.php
@@ -43,9 +43,9 @@ class Documentation {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- $links = array();
+ $links = [];
// WP Multisite WaaS Dashboard
$links['wp-ultimo'] = 'https://help.wpultimo.com/en/articles/4803213-understanding-the-wp-ultimo-dashboard';
@@ -133,7 +133,7 @@ class Documentation {
* @param string $link The documentation link.
* @return void
*/
- public function register_link($slug, $link) {
+ public function register_link($slug, $link): void {
$this->links[ $slug ] = $link;
}
diff --git a/inc/class-domain-mapping.php b/inc/class-domain-mapping.php
index e580c73..bf6ef34 100644
--- a/inc/class-domain-mapping.php
+++ b/inc/class-domain-mapping.php
@@ -45,9 +45,9 @@ class Domain_Mapping {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- if ($this->should_skip_checks()) {
+ if (static::should_skip_checks()) {
$this->startup();
} else {
$this->maybe_startup();
@@ -71,7 +71,7 @@ class Domain_Mapping {
* @since 2.0.0
* @return void
*/
- public function maybe_startup() {
+ public function maybe_startup(): void {
/*
* Don't run during installation...
*/
@@ -104,7 +104,7 @@ class Domain_Mapping {
* @since 2.0.0
* @return void
*/
- public function startup() {
+ public function startup(): void {
/*
* Adds the necessary tables to the $wpdb global.
*/
@@ -115,22 +115,22 @@ class Domain_Mapping {
}
// Ensure cache is shared
- wp_cache_add_global_groups(array('domain_mappings', 'network_mappings'));
+ wp_cache_add_global_groups(['domain_mappings', 'network_mappings']);
/*
* Check if the URL being accessed right now is a mapped domain
*/
- add_filter('pre_get_site_by_path', array($this, 'check_domain_mapping'), 10, 2);
+ add_filter('pre_get_site_by_path', [$this, 'check_domain_mapping'], 10, 2);
/*
* When a site gets delete, clean up the mapped domains
*/
- add_action('wp_delete_site', array($this, 'clear_mappings_on_delete'));
+ add_action('wp_delete_site', [$this, 'clear_mappings_on_delete']);
/*
* Adds the filters that will change the URLs when a mapped domains is in use
*/
- add_action('ms_loaded', array($this, 'register_mapped_filters'), 11);
+ add_action('ms_loaded', [$this, 'register_mapped_filters'], 11);
// add_action('allowed_http_origin', array($this, 'add_mapped_domains_as_allowed_origins'));
@@ -138,7 +138,7 @@ class Domain_Mapping {
* On WP Multisite WaaS 1.X builds we used Mercator. The Mercator actions and filters are now deprecated.
*/
if (has_action('mercator_load')) {
- do_action_deprecated('mercator_load', array(), '2.0.0', 'wu_domain_mapping_load');
+ do_action_deprecated('mercator_load', [], '2.0.0', 'wu_domain_mapping_load');
}
add_action(
@@ -146,12 +146,12 @@ class Domain_Mapping {
function ($list, $site_id): array {
$domains = wu_get_domains(
- array(
+ [
'active' => true,
'blog_id' => $site_id,
'stage__not_in' => \WP_Ultimo\Models\Domain::INACTIVE_STAGES,
'fields' => 'domain',
- )
+ ]
);
return array_merge($list, $domains);
@@ -231,7 +231,7 @@ class Domain_Mapping {
*/
public function get_www_and_nowww_versions($domain) {
- if (strncmp($domain, 'www.', strlen('www.')) === 0) {
+ if (str_starts_with($domain, 'www.')) {
$www = $domain;
$nowww = substr($domain, 4);
} else {
@@ -239,7 +239,7 @@ class Domain_Mapping {
$www = 'www.' . $domain;
}
- return array($nowww, $www);
+ return [$nowww, $www];
}
/**
* Checks if we have a site associated with the domain being accessed
@@ -269,11 +269,11 @@ class Domain_Mapping {
}
if (has_filter('mercator.use_mapping')) {
- $deprecated_args = array(
+ $deprecated_args = [
$mapping->is_active(),
$mapping,
$domain,
- );
+ ];
$is_active = apply_filters_deprecated('mercator.use_mapping', $deprecated_args, '2.0.0', 'wu_use_domain_mapping');
}
@@ -339,7 +339,7 @@ class Domain_Mapping {
*
* @param WP_Site $site Site being deleted.
*/
- public function clear_mappings_on_delete($site) {
+ public function clear_mappings_on_delete($site): void {
$mappings = Domain::get_by_site($site->blog_id);
@@ -366,7 +366,7 @@ class Domain_Mapping {
* @since 2.0.0
* @return void
*/
- public function register_mapped_filters() {
+ public function register_mapped_filters(): void {
$current_site = $GLOBALS['current_blog'];
@@ -393,27 +393,27 @@ class Domain_Mapping {
$this->current_mapping = $mapping;
- add_filter('site_url', array($this, 'mangle_url'), -10, 4);
- add_filter('home_url', array($this, 'mangle_url'), -10, 4);
+ add_filter('site_url', [$this, 'mangle_url'], -10, 4);
+ add_filter('home_url', [$this, 'mangle_url'], -10, 4);
- add_filter('theme_file_uri', array($this, 'mangle_url'));
- add_filter('stylesheet_directory_uri', array($this, 'mangle_url'));
- add_filter('template_directory_uri', array($this, 'mangle_url'));
- add_filter('plugins_url', array($this, 'mangle_url'), -10, 3);
+ add_filter('theme_file_uri', [$this, 'mangle_url']);
+ add_filter('stylesheet_directory_uri', [$this, 'mangle_url']);
+ add_filter('template_directory_uri', [$this, 'mangle_url']);
+ add_filter('plugins_url', [$this, 'mangle_url'], -10, 3);
- add_filter('autoptimize_filter_base_replace_cdn', array($this, 'mangle_url'), 8); // @since 1.8.2 - Fix for Autoptimizer
+ add_filter('autoptimize_filter_base_replace_cdn', [$this, 'mangle_url'], 8); // @since 1.8.2 - Fix for Autoptimizer
// Fix srcset
- add_filter('wp_calculate_image_srcset', array($this, 'fix_srcset')); // @since 1.5.5
+ add_filter('wp_calculate_image_srcset', [$this, 'fix_srcset']); // @since 1.5.5
// If on network site, also filter network urls
if (is_main_site()) {
- add_filter('network_site_url', array($this, 'mangle_url'), -10, 3);
- add_filter('network_home_url', array($this, 'mangle_url'), -10, 3);
+ add_filter('network_site_url', [$this, 'mangle_url'], -10, 3);
+ add_filter('network_home_url', [$this, 'mangle_url'], -10, 3);
}
- add_filter('jetpack_sync_home_url', array($this, 'mangle_url'));
- add_filter('jetpack_sync_site_url', array($this, 'mangle_url'));
+ add_filter('jetpack_sync_home_url', [$this, 'mangle_url']);
+ add_filter('jetpack_sync_site_url', [$this, 'mangle_url']);
/**
* Some plugins will save URL before the mapping was active
@@ -431,7 +431,7 @@ class Domain_Mapping {
* @param self This object.
* @return void
*/
- do_action('wu_domain_mapping_register_filters', array($this, 'mangle_url'), $this);
+ do_action('wu_domain_mapping_register_filters', [$this, 'mangle_url'], $this);
}
/**
@@ -442,7 +442,7 @@ class Domain_Mapping {
* @param string|array $hooks List of hooks to apply the callback to.
* @return void
*/
- public static function apply_mapping_to_url($hooks) {
+ public static function apply_mapping_to_url($hooks): void {
add_action(
'wu_domain_mapping_register_filters',
diff --git a/inc/class-faker.php b/inc/class-faker.php
index e897d67..0ed26b6 100644
--- a/inc/class-faker.php
+++ b/inc/class-faker.php
@@ -79,20 +79,20 @@ class Faker {
public function get_fake_data_generated($model = '') {
if (empty($this->fake_data_generated)) {
- $this->fake_data_generated = array(
- 'customers' => array(),
- 'products' => array(),
- 'memberships' => array(),
- 'domains' => array(),
- 'events' => array(),
- 'discount_codes' => array(),
- 'checkout_forms' => array(),
- 'emails' => array(),
- 'broadcasts' => array(),
- 'webhooks' => array(),
- 'payments' => array(),
- 'sites' => array(),
- );
+ $this->fake_data_generated = [
+ 'customers' => [],
+ 'products' => [],
+ 'memberships' => [],
+ 'domains' => [],
+ 'events' => [],
+ 'discount_codes' => [],
+ 'checkout_forms' => [],
+ 'emails' => [],
+ 'broadcasts' => [],
+ 'webhooks' => [],
+ 'payments' => [],
+ 'sites' => [],
+ ];
}
if (empty($model)) {
@@ -102,7 +102,7 @@ class Faker {
if (isset($this->fake_data_generated[ $model ])) {
return $this->fake_data_generated[ $model ];
} else {
- return array();
+ return [];
}
}
@@ -113,7 +113,7 @@ class Faker {
* @param string $model The model name.
* @param string $value The value to identify the fake data generated.
*/
- public function set_fake_data_generated($model, $value) {
+ public function set_fake_data_generated($model, $value): void {
$this->get_fake_data_generated();
@@ -130,20 +130,20 @@ class Faker {
return wu_get_option(
'debug_faker',
- array(
- 'customers' => array(),
- 'products' => array(),
- 'memberships' => array(),
- 'domains' => array(),
- 'events' => array(),
- 'discount_codes' => array(),
- 'checkout_forms' => array(),
- 'emails' => array(),
- 'broadcasts' => array(),
- 'webhooks' => array(),
- 'payments' => array(),
- 'sites' => array(),
- )
+ [
+ 'customers' => [],
+ 'products' => [],
+ 'memberships' => [],
+ 'domains' => [],
+ 'events' => [],
+ 'discount_codes' => [],
+ 'checkout_forms' => [],
+ 'emails' => [],
+ 'broadcasts' => [],
+ 'webhooks' => [],
+ 'payments' => [],
+ 'sites' => [],
+ ]
);
}
@@ -159,12 +159,12 @@ class Faker {
if ($model) {
$faker = $this->get_faker();
- $data_saved = wu_get_isset($this->get_option_debug_faker(), $model, array());
+ $data_saved = wu_get_isset($this->get_option_debug_faker(), $model, []);
$data_in_memory = $this->get_fake_data_generated($model);
if ( ! empty($data_saved) && ! empty($data_in_memory)) {
- $data_saved_or_in_memory = $faker->randomElement(array('data_saved', 'data_in_memory'));
+ $data_saved_or_in_memory = $faker->randomElement(['data_saved', 'data_in_memory']);
$data_index = $faker->numberBetween(0, count(${$data_saved_or_in_memory}) - 1);
@@ -319,7 +319,7 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_customers($number = 1) {
+ public function generate_fake_customers($number = 1): void {
for ($i = 0; $i < $number; $i++) {
$user_name = $this->get_faker()->userName;
@@ -333,21 +333,21 @@ class Faker {
remove_user_from_blog($user_id);
$customer = wu_create_customer(
- array(
+ [
'user_id' => $user_id,
'vip' => $this->get_faker()->boolean,
'date_registered' => $this->get_faker()->dateTimeThisYear()->format('Y-m-d H:i:s'),
'email_verification' => $this->get_faker()->randomElement(
- array(
+ [
'none',
'pending',
'verified',
- )
+ ]
),
- 'meta' => array(
+ 'meta' => [
'ip_country' => $this->get_faker()->countryCode,
- ),
- )
+ ],
+ ]
);
if (is_wp_error($customer)) {
@@ -366,28 +366,28 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_products($number = 1) {
+ public function generate_fake_products($number = 1): void {
$faker = $this->get_faker();
- $product_type_options = array(
+ $product_type_options = [
'plan',
'package',
'service',
- );
- $pricing_type_options = array(
+ ];
+ $pricing_type_options = [
'paid',
'free',
'contact_us',
- );
- $duration_unit_options = array(
+ ];
+ $duration_unit_options = [
'day',
'week',
'month',
'year',
- );
+ ];
for ($i = 0; $i < $number; $i++) {
- $product_data = array();
+ $product_data = [];
$type = $faker->optional(0.5, $product_type_options[0])->randomElement($product_type_options);
$pricing_type = $faker->optional(0.2, $pricing_type_options[0])->randomElement($pricing_type_options);
@@ -425,7 +425,7 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_memberships($number = 1) {
+ public function generate_fake_memberships($number = 1): void {
$faker = $this->get_faker();
@@ -433,15 +433,15 @@ class Faker {
$customer = $this->get_random_customer(true);
$product = $this->get_random_product(true);
- $status_options = array(
+ $status_options = [
'pending',
'active',
'on-hold',
'expired',
'cancelled',
- );
+ ];
- $membership_data = array();
+ $membership_data = [];
$membership_data['customer_id'] = $customer ? $customer->get_id() : 0;
$membership_data['plan_id'] = $product ? $product->get_id() : 0;
@@ -453,8 +453,8 @@ class Faker {
$membership_data = array_merge(
$membership_data,
- $product ? $product->to_array() : array(),
- $customer ? $customer->to_array() : array()
+ $product ? $product->to_array() : [],
+ $customer ? $customer->to_array() : []
);
$membership = wu_create_membership($membership_data);
@@ -474,14 +474,14 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_domain($number = 1) {
+ public function generate_fake_domain($number = 1): void {
$faker = $this->get_faker();
- $stage_options = array(
+ $stage_options = [
'checking-dns',
'checking-ssl-cert',
'done',
- );
+ ];
$stage_checking_dns = $stage_options[0];
@@ -491,14 +491,14 @@ class Faker {
$site = $this->get_random_site();
$domain = wu_create_domain(
- array(
+ [
'domain' => $faker->domainName, // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
'stage' => $stage,
'blog_id' => $site ? $site->get_blog_id() : 0,
'primary_domain' => $faker->boolean(25),
'active' => $faker->boolean(75),
'secure' => $faker->boolean(25),
- )
+ ]
);
if (is_wp_error($domain)) {
@@ -516,27 +516,27 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_events($number = 1) {
+ public function generate_fake_events($number = 1): void {
$faker = $this->get_faker();
- $initiator_options = array(
+ $initiator_options = [
'system',
'manual',
- );
+ ];
- $payload = array(
+ $payload = [
'key' => '1234',
'old_value' => 'None',
'new_value' => 'created',
- );
+ ];
for ($i = 0; $i < $number; $i++) {
- $membership = $this->get_random_membership(true);
+ $membership = $this->get_random_membership();
$author_id = $membership->get_id();
- $event_data = array(
+ $event_data = [
'severity' => 3,
'initiator' => $faker->randomElement($initiator_options),
'author_id' => $author_id > 0 ? $author_id : 1,
@@ -545,7 +545,7 @@ class Faker {
'slug' => 'created',
'payload' => $payload,
'date_created' => $faker->dateTimeThisYear()->format('Y-m-d H:i:s'),
- );
+ ];
$event_data = wu_create_event($event_data);
@@ -564,13 +564,13 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_discount_code($number = 1) {
+ public function generate_fake_discount_code($number = 1): void {
$faker = $this->get_faker();
- $type_options = array(
+ $type_options = [
'percentage',
'absolute',
- );
+ ];
$type_options_percentage = $type_options[0];
for ($i = 0; $i < $number; $i++) {
@@ -583,7 +583,7 @@ class Faker {
$expiration_date = $faker->dateTimeBetween('now', '+4 weeks', 'UTC');
$discount_code = wu_create_discount_code(
- array(
+ [
'name' => $name,
'description' => $faker->sentence(),
'code' => $code,
@@ -595,7 +595,7 @@ class Faker {
'date_start' => $start_date->format('Y-m-d H:i:s'),
'date_expiration' => $expiration_date->format('Y-m-d H:i:s'),
'active' => true,
- )
+ ]
);
if (is_wp_error($discount_code)) {
@@ -613,7 +613,7 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_checkout_form($number = 1) {
+ public function generate_fake_checkout_form($number = 1): void {
$faker = $this->get_faker();
@@ -621,16 +621,16 @@ class Faker {
$checkout_form_slug = str_replace(' ', '-', $checkout_form_name);
for ($i = 0; $i < $number; $i++) {
- $checkout_form_data = array(
+ $checkout_form_data = [
'name' => $checkout_form_name,
'slug' => strtolower($checkout_form_slug),
'active' => true,
- 'settings' => array(),
+ 'settings' => [],
'custom_css' => '',
'allowed_countries' => '',
'date_created' => $faker->dateTimeThisYear()->format('Y-m-d H:i:s'),
'date_modified' => $faker->dateTimeThisYear()->format('Y-m-d H:i:s'),
- );
+ ];
$checkout_form = wu_create_checkout_form($checkout_form_data);
@@ -649,19 +649,19 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_email($number = 1) {
+ public function generate_fake_email($number = 1): void {
$faker = $this->get_faker();
- $schedule_type_options = array(
+ $schedule_type_options = [
'days',
'hours',
- );
+ ];
- $target_options = array(
+ $target_options = [
'customer',
'admin',
- );
+ ];
for ($i = 0; $i < $number; $i++) {
$email_title = rtrim((string) $faker->sentence(2), '.');
@@ -669,7 +669,7 @@ class Faker {
$user_name = $this->get_faker()->userName;
$user_email = $this->get_faker()->safeEmail;
- $email_data = array(
+ $email_data = [
'schedule' => 0,
'type' => 'system_email',
'event' => $faker->sentence(2),
@@ -686,7 +686,7 @@ class Faker {
'send_copy_to_admin' => 0,
'active' => 1,
'legacy' => 0,
- );
+ ];
$email = wu_create_email($email_data);
@@ -705,31 +705,31 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_broadcast($number = 1) {
+ public function generate_fake_broadcast($number = 1): void {
$faker = $this->get_faker();
- $notice_type_optinos = array(
+ $notice_type_optinos = [
'info',
'success',
'warning',
'error',
- );
+ ];
- $type_optinos = array(
+ $type_optinos = [
'broadcast_email',
'broadcast_notice',
- );
+ ];
for ($i = 0; $i < $number; $i++) {
- $broadcast_data = array(
+ $broadcast_data = [
'notice_type' => $faker->randomElement($notice_type_optinos),
'status' => 'publish',
'name' => rtrim((string) $faker->sentence(3), '.'),
'title' => rtrim((string) $faker->sentence(3), '.'),
'content' => rtrim((string) $faker->sentence(8), '.'),
'type' => $faker->randomElement($type_optinos),
- );
+ ];
$broadcast = wu_create_broadcast($broadcast_data);
@@ -748,10 +748,10 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_webhook($number = 1) {
+ public function generate_fake_webhook($number = 1): void {
$faker = $this->get_faker();
- $event_options = array(
+ $event_options = [
'account_created',
'account_deleted',
'new_domain_mapping',
@@ -760,10 +760,10 @@ class Faker {
'payment_failed',
'refund_issued',
'plan_change',
- );
+ ];
for ($i = 0; $i < $number; $i++) {
- $webhook_data = array(
+ $webhook_data = [
'name' => rtrim((string) $faker->sentence(2), '.'),
'webhook_url' => 'https://' . $faker->domainName,
'event' => $faker->randomElement($event_options),
@@ -772,7 +772,7 @@ class Faker {
'hidden' => 0,
'integration' => rtrim((string) $faker->sentence(3), '.'),
'date_last_failed' => '',
- );
+ ];
$webhook = wu_create_webhook($webhook_data);
@@ -791,14 +791,14 @@ class Faker {
* @param int $number The number of fake data that will be generated.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_payment($number = 1) {
+ public function generate_fake_payment($number = 1): void {
$faker = $this->get_faker();
- $type_options = array(
+ $type_options = [
'percentage',
'absolute',
- );
- $status_options = array(
+ ];
+ $status_options = [
'pending',
'completed',
'refunded',
@@ -806,7 +806,7 @@ class Faker {
'partially-paid',
'failed',
'cancelled',
- );
+ ];
$type_options_percentage = $type_options[0];
$status_options_pending = $status_options[0];
@@ -815,7 +815,7 @@ class Faker {
for ($i = 0; $i < $number; $i++) {
$membership = $this->get_random_membership();
- $payment_data = array(
+ $payment_data = [
'description' => $faker->sentence(),
'parent_id' => 0,
'status' => $faker->randomElement($status_options),
@@ -834,7 +834,7 @@ class Faker {
'gateway' => '',
'gateway_payment_id' => '',
'date_created' => $faker->dateTimeThisYear()->format('Y-m-d H:i:s'),
- );
+ ];
$payment = wu_create_payment($payment_data);
@@ -856,20 +856,20 @@ class Faker {
* @param string $type The type of site to favor.
* @throws \Exception In case of failures, an exception is thrown.
*/
- public function generate_fake_site($number = 1, $type = 'customer_owned') {
+ public function generate_fake_site($number = 1, $type = 'customer_owned'): void {
$faker = $this->get_faker();
- $type_options = array(
+ $type_options = [
'default',
'site_template',
'customer_owned',
- );
+ ];
$type_customer_owned = $type_options[2];
for ($i = 0; $i < $number; $i++) {
- $site_data = array();
+ $site_data = [];
$title = rtrim((string) $faker->sentence(2), '.');
$path = strtolower(implode('-', explode(' ', $title)));
diff --git a/inc/class-geolocation.php b/inc/class-geolocation.php
index a08df71..1a8196d 100644
--- a/inc/class-geolocation.php
+++ b/inc/class-geolocation.php
@@ -45,20 +45,20 @@ class Geolocation {
/**
* API endpoints for looking up user IP address.
*/
- private static array $ip_lookup_apis = array(
+ private static array $ip_lookup_apis = [
'ipify' => 'http://api.ipify.org/',
'ipecho' => 'http://ipecho.net/plain',
'ident' => 'http://ident.me',
'whatismyipaddress' => 'http://bot.whatismyipaddress.com',
- );
+ ];
/**
* API endpoints for geolocating an IP address
*/
- private static array $geoip_apis = array(
+ private static array $geoip_apis = [
'ipinfo.io' => 'https://ipinfo.io/%s/json',
'ip-api.com' => 'http://ip-api.com/json/%s',
- );
+ ];
/**
* Check if server supports MaxMind GeoLite2 Reader.
@@ -76,7 +76,7 @@ class Geolocation {
* @param string $current_settings Current geolocation settings.
*/
private static function is_geolocation_enabled($current_settings ): bool {
- return in_array( $current_settings, array( 'geolocation', 'geolocation_ajax' ), true );
+ return in_array( $current_settings, [ 'geolocation', 'geolocation_ajax' ], true );
}
@@ -99,17 +99,17 @@ class Geolocation {
/**
* Hook in geolocation functionality.
*/
- public static function init() {
+ public static function init(): void {
if ( self::supports_geolite2() ) {
// Only download the database from MaxMind if the geolocation function is enabled, or a plugin specifically requests it.
if ( self::is_geolocation_enabled( get_option( 'wu_default_customer_address' ) ) || apply_filters( 'wu_geolocation_update_database_periodically', false ) ) {
- add_action( 'wu_geoip_updater', array( __CLASS__, 'update_database' ) );
+ add_action( 'wu_geoip_updater', [ self::class, 'update_database' ] );
}
// Trigger database update when settings are changed to enable geolocation.
- add_filter( 'pre_update_option_wu_default_customer_address', array( __CLASS__, 'maybe_update_database' ), 10, 2 );
+ add_filter( 'pre_update_option_wu_default_customer_address', [ self::class, 'maybe_update_database' ], 10, 2 );
} else {
- add_filter( 'pre_option_wu_default_customer_address', array( __CLASS__, 'disable_geolocation_on_legacy_php' ) );
+ add_filter( 'pre_option_wu_default_customer_address', [ self::class, 'disable_geolocation_on_legacy_php' ] );
}
}
@@ -171,7 +171,7 @@ class Geolocation {
foreach ( $ip_lookup_services_keys as $service_name ) {
$service_endpoint = $ip_lookup_services[ $service_name ];
- $response = wp_safe_remote_get( $service_endpoint, array( 'timeout' => 2 ) );
+ $response = wp_safe_remote_get( $service_endpoint, [ 'timeout' => 2 ] );
if ( !is_wp_error( $response ) && rest_is_ip_address( $response['body'] ) ) {
$external_ip_address = apply_filters( 'wu_geolocation_ip_lookup_api_response', ( $response['body'] ), $service_name );
@@ -209,7 +209,7 @@ class Geolocation {
// VIP Go has a variable available also.
$country_code = strtoupper( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_COUNTRY_CODE'] ) ) ); // WPCS: input var ok, CSRF ok.
} else {
- $ip_address = $ip_address ? $ip_address : self::get_ip_address();
+ $ip_address = $ip_address ?: self::get_ip_address();
$database = self::get_local_database_path();
if ( self::supports_geolite2() && file_exists( $database ) ) {
@@ -227,11 +227,11 @@ class Geolocation {
}
}
- return array(
+ return [
'ip' => $ip_address,
'country' => $country_code,
'state' => '',
- );
+ ];
}
@@ -251,11 +251,11 @@ class Geolocation {
*
* Extract files with PharData. Tool built into PHP since 5.3.
*/
- public static function update_database() {
+ public static function update_database(): void {
$logger = wc_get_logger();
if ( !self::supports_geolite2() ) {
- $logger->notice( 'Requires PHP 5.4 to be able to download MaxMind GeoLite2 database', array( 'source' => 'geolocation' ) );
+ $logger->notice( 'Requires PHP 5.4 to be able to download MaxMind GeoLite2 database', [ 'source' => 'geolocation' ] );
return;
}
@@ -283,7 +283,7 @@ class Geolocation {
$wp_filesystem->move( trailingslashit( dirname( $tmp_database_path ) ) . $file_path, $target_database_path, true );
$wp_filesystem->delete( trailingslashit( dirname( $tmp_database_path ) ) . $file->current()->getFileName() );
} catch ( Exception $e ) {
- $logger->notice( $e->getMessage(), array( 'source' => 'geolocation' ) );
+ $logger->notice( $e->getMessage(), [ 'source' => 'geolocation' ] );
// Reschedule download of DB.
wp_clear_scheduled_hook( 'wu_geoip_updater' );
@@ -294,7 +294,7 @@ class Geolocation {
} else {
$logger->notice(
'Unable to download GeoIP Database: ' . $tmp_database_path->get_error_message(),
- array( 'source' => 'geolocation' )
+ [ 'source' => 'geolocation' ]
);
}
}
@@ -346,17 +346,17 @@ class Geolocation {
foreach ( $geoip_services_keys as $service_name ) {
$service_endpoint = $geoip_services[ $service_name ];
- $response = wp_safe_remote_get( sprintf( $service_endpoint, $ip_address ), array( 'timeout' => 2 ) );
+ $response = wp_safe_remote_get( sprintf( $service_endpoint, $ip_address ), [ 'timeout' => 2 ] );
if ( !is_wp_error( $response ) && $response['body'] ) {
switch ( $service_name ) {
case 'ipinfo.io':
$data = json_decode( $response['body'] );
- $country_code = isset( $data->country ) ? $data->country : '';
+ $country_code = $data->country ?? '';
break;
case 'ip-api.com':
$data = json_decode( $response['body'] );
- $country_code = isset( $data->countryCode ) ? $data->countryCode : ''; // @codingStandardsIgnoreLine
+ $country_code = $data->countryCode ?? ''; // @codingStandardsIgnoreLine
break;
default:
$country_code = apply_filters( 'wu_geolocation_geoip_response_' . $service_name, '', $response['body'] );
diff --git a/inc/class-helper.php b/inc/class-helper.php
index de86a16..e6f867a 100644
--- a/inc/class-helper.php
+++ b/inc/class-helper.php
@@ -74,7 +74,7 @@ class Helper {
* @param string|false $default_view View to be used if the view passed is not found. Used as fallback.
* @return void
*/
- public function render($view, $vars = false, $default_view = false) {
+ public function render($view, $vars = false, $default_view = false): void {
_deprecated_function(__METHOD__, '2.0.11', 'wu_get_template');
@@ -105,7 +105,7 @@ class Helper {
* @param mixed $default The default value.
* @return mixed
*/
- public function get_option($option_name = 'settings', $default = array()) {
+ public function get_option($option_name = 'settings', $default = []) {
_deprecated_function(__METHOD__, '2.0.11', 'wu_get_option');
@@ -181,7 +181,7 @@ class Helper {
*
* @return void
*/
- public function drop_tables() {
+ public function drop_tables(): void {
_deprecated_function(__METHOD__, '2.0.11', 'wu_drop_tables');
diff --git a/inc/class-hooks.php b/inc/class-hooks.php
index 5f56eb5..5bf09ab 100644
--- a/inc/class-hooks.php
+++ b/inc/class-hooks.php
@@ -30,22 +30,22 @@ class Hooks {
* @since 2.0.0
* @return void
*/
- public static function init() {
+ public static function init(): void {
/**
* Runs on WP Multisite WaaS activation
*/
- register_activation_hook(WP_ULTIMO_PLUGIN_FILE, array('WP_Ultimo\Hooks', 'on_activation'));
+ register_activation_hook(WP_ULTIMO_PLUGIN_FILE, [self::class, 'on_activation']);
/**
* Runs on WP Multisite WaaS deactivation
*/
- register_deactivation_hook(WP_ULTIMO_PLUGIN_FILE, array('WP_Ultimo\Hooks', 'on_deactivation'));
+ register_deactivation_hook(WP_ULTIMO_PLUGIN_FILE, [self::class, 'on_deactivation']);
/**
* Runs the activation hook.
*/
- add_action('plugins_loaded', array('WP_Ultimo\Hooks', 'on_activation_do'), 1);
+ add_action('plugins_loaded', [self::class, 'on_activation_do'], 1);
}
/**
@@ -54,7 +54,7 @@ class Hooks {
* @since 1.9.6 It now uses hook-based approach, it is up to each sub-class to attach their own routines.
* @since 1.2.0
*/
- public static function on_activation() {
+ public static function on_activation(): void {
wu_log_add('wp-ultimo-core', __('Activating WP Multisite WaaS...', 'wp-ultimo'));
@@ -70,7 +70,7 @@ class Hooks {
* @since 2.0.0
* @return void
*/
- public static function on_activation_do() {
+ public static function on_activation_do(): void {
if (get_network_option(null, 'wu_activation') === 'yes' && wu_request('activate')) {
@@ -98,7 +98,7 @@ class Hooks {
* @since 1.9.6 It now uses hook-based approach, it is up to each sub-class to attach their own routines.
* @since 1.2.0
*/
- public static function on_deactivation() {
+ public static function on_deactivation(): void {
wu_log_add('wp-ultimo-core', __('Deactivating WP Multisite WaaS...', 'wp-ultimo'));
diff --git a/inc/class-light-ajax.php b/inc/class-light-ajax.php
index 025afe5..ae3c763 100644
--- a/inc/class-light-ajax.php
+++ b/inc/class-light-ajax.php
@@ -36,7 +36,7 @@ class Light_Ajax {
wu_x_header("X-Ultimo-Ajax-When: $action");
- add_action($action, array($this, 'process_light_ajax'), 20);
+ add_action($action, [$this, 'process_light_ajax'], 20);
}
}
@@ -50,7 +50,7 @@ class Light_Ajax {
$allowed_actions = apply_filters(
'wu_light_ajax_should_skip_referer_check',
- array(
+ [
/**
* Checkout Form Actions
@@ -64,7 +64,7 @@ class Light_Ajax {
'wu_create_order',
'wu_validate_form',
- )
+ ]
);
return in_array(wu_request('action', 'no-action'), $allowed_actions, true);
@@ -93,12 +93,12 @@ class Light_Ajax {
*/
$allowed_list = apply_filters(
'wu_light_ajax_allowed_hooks',
- array(
+ [
'plugins_loaded',
'setup_theme',
'after_setup_theme',
'init',
- )
+ ]
);
$action = isset($_REQUEST['wu-when']) ? base64_decode((string) $_REQUEST['wu-when']) : 'plugins_loaded';
@@ -112,7 +112,7 @@ class Light_Ajax {
* @since 1.9.14
* @return void
*/
- public function process_light_ajax() {
+ public function process_light_ajax(): void {
// mimic the actual admin-ajax
define('DOING_AJAX', true); // phpcs:ignore
diff --git a/inc/class-logger.php b/inc/class-logger.php
index 8cf07d0..455e3cd 100644
--- a/inc/class-logger.php
+++ b/inc/class-logger.php
@@ -51,7 +51,7 @@ class Logger extends AbstractLogger {
* @param string|\WP_Error $message Log message to write.
* @param string $log_level Log level to write.
*/
- public static function add($handle, $message, $log_level = LogLevel::INFO) {
+ public static function add($handle, $message, $log_level = LogLevel::INFO): void {
$allowed_log_level = wu_get_setting('error_logging_level', 'default');
@@ -67,7 +67,7 @@ class Logger extends AbstractLogger {
*/
$reporting_level = error_reporting();
- $psr_log_levels = array(
+ $psr_log_levels = [
E_ERROR => LogLevel::ERROR,
E_WARNING => LogLevel::WARNING,
E_PARSE => LogLevel::ERROR,
@@ -83,9 +83,9 @@ class Logger extends AbstractLogger {
E_RECOVERABLE_ERROR => LogLevel::ERROR,
E_DEPRECATED => LogLevel::NOTICE,
E_USER_DEPRECATED => LogLevel::NOTICE,
- );
+ ];
- $current_log_levels = array();
+ $current_log_levels = [];
foreach ($psr_log_levels as $php_level => $psr_level) {
if ($reporting_level & $php_level) {
@@ -127,7 +127,7 @@ class Logger extends AbstractLogger {
$file = self::get_logs_folder() . "/$handle.log";
if ( ! file_exists($file)) {
- return array();
+ return [];
}
// read file
@@ -150,7 +150,7 @@ class Logger extends AbstractLogger {
*
* @param mixed $handle Name of the log file to clear.
*/
- public static function clear($handle) {
+ public static function clear($handle): void {
$file = self::get_logs_folder() . "/$handle.log";
@@ -195,7 +195,7 @@ class Logger extends AbstractLogger {
*
* @param string $log_file The log file path.
*/
- public function set_log_file($log_file) {
+ public function set_log_file($log_file): void {
$this->log_file = $log_file;
}
@@ -211,7 +211,7 @@ class Logger extends AbstractLogger {
*
* @return void
*/
- public function log($level, $message, array $context = array()) {
+ public function log($level, $message, array $context = []): void {
if ( ! $this->is_valid_log_level($level) ) {
return;
@@ -231,7 +231,7 @@ class Logger extends AbstractLogger {
*/
protected function is_valid_log_level($level): bool {
- $valid_log_levels = array(
+ $valid_log_levels = [
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL,
@@ -240,7 +240,7 @@ class Logger extends AbstractLogger {
LogLevel::NOTICE,
LogLevel::INFO,
LogLevel::DEBUG,
- );
+ ];
return in_array($level, $valid_log_levels, true);
}
@@ -255,7 +255,7 @@ class Logger extends AbstractLogger {
* @param array $context The context of the message.
* @return string
*/
- protected function format_message($level, $message, $context = array()) {
+ protected function format_message($level, $message, $context = []) {
$date = new \DateTime();
diff --git a/inc/class-maintenance-mode.php b/inc/class-maintenance-mode.php
index 9c464a6..07cb324 100644
--- a/inc/class-maintenance-mode.php
+++ b/inc/class-maintenance-mode.php
@@ -28,9 +28,9 @@ class Maintenance_Mode {
*
* @since 2.0.0
*/
- public function init() {
+ public function init(): void {
- add_action('wp_ultimo_load', array($this, 'add_settings'));
+ add_action('wp_ultimo_load', [$this, 'add_settings']);
if (wu_get_setting('maintenance_mode')) {
$this->hooks();
@@ -43,19 +43,19 @@ class Maintenance_Mode {
* @since 2.0.0
* @return void
*/
- public function hooks() {
+ public function hooks(): void {
- add_action('wu_ajax_toggle_maintenance_mode', array($this, 'toggle_maintenance_mode'));
+ add_action('wu_ajax_toggle_maintenance_mode', [$this, 'toggle_maintenance_mode']);
if ( ! is_main_site()) {
- add_action('admin_bar_menu', array($this, 'add_notice_to_admin_bar'), 15);
+ add_action('admin_bar_menu', [$this, 'add_notice_to_admin_bar'], 15);
}
if (self::check_maintenance_mode()) {
add_filter('pre_option_blog_public', '__return_true');
if ( ! is_admin()) {
- add_action('wp', array($this, 'render_page'));
+ add_action('wp', [$this, 'render_page']);
if (function_exists('wp_robots_no_robots')) {
add_filter('wp_robots', 'wp_robots_no_robots'); // WordPress 5.7+
@@ -74,23 +74,23 @@ class Maintenance_Mode {
* @param WP_Admin_Bar $wp_admin_bar The Admin Bar class.
* @return void
*/
- public function add_notice_to_admin_bar($wp_admin_bar) {
+ public function add_notice_to_admin_bar($wp_admin_bar): void {
if ( ! current_user_can('manage_options')) {
return;
}
if (is_admin() || self::check_maintenance_mode()) {
- $args = array(
+ $args = [
'id' => 'wu-maintenance-mode',
'parent' => 'top-secondary',
'title' => __('Maintenance Mode - Active', 'wp-ultimo'),
'href' => '#wp-ultimo-site-maintenance-element',
- 'meta' => array(
+ 'meta' => [
'class' => 'wu-maintenance-mode ' . (self::check_maintenance_mode() ? '' : 'hidden'),
'title' => __('This means that your site is not available for visitors at the moment. Only you and other logged users have access to it. Click here to toggle this option.', 'wp-ultimo'),
- ),
- );
+ ],
+ ];
$wp_admin_bar->add_node($args);
}
@@ -102,7 +102,7 @@ class Maintenance_Mode {
* @since 2.0.0
* @return void
*/
- public function render_page() {
+ public function render_page(): void {
if (is_main_site() || current_user_can('read')) {
return;
@@ -146,10 +146,10 @@ class Maintenance_Mode {
if ( ! current_user_can_for_blog($site_id, 'manage_options')) {
return wp_send_json_error(
- array(
+ [
'message' => __('You do not have the necessary permissions to perform this option.', 'wp-ultimo'),
'value' => false,
- )
+ ]
);
}
@@ -159,10 +159,10 @@ class Maintenance_Mode {
update_site_meta($site_id, 'wu_maintenance_mode', $value);
- $return = array(
+ $return = [
'message' => __('New maintenance settings saved.', 'wp-ultimo'),
'value' => $value,
- );
+ ];
// Flush the cache so the maintenance mode new status is applied immediately.
Cache_Manager::get_instance()->flush_known_caches();
@@ -176,18 +176,18 @@ class Maintenance_Mode {
* @since 2.0.0
* @return void
*/
- public function add_settings() {
+ public function add_settings(): void {
wu_register_settings_field(
'sites',
'maintenance_mode',
- array(
+ [
'title' => __('Site Maintenance Mode', 'wp-ultimo'),
'desc' => __('Allow your customers and super admins to quickly take sites offline via a toggle on the site dashboard.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
'order' => 23,
- )
+ ]
);
}
}
diff --git a/inc/class-newsletter.php b/inc/class-newsletter.php
index a5ad983..9893c61 100644
--- a/inc/class-newsletter.php
+++ b/inc/class-newsletter.php
@@ -7,21 +7,21 @@ class Newsletter {
const SETTING_FIELD_SLUG = 'newsletter_optin';
- public function init() {
- add_action('wu_settings_login', array($this, 'add_settings'), 20);
- add_filter('wu_pre_save_settings', array($this, 'maybe_update_newsletter_subscription'), 10, 3);
+ public function init(): void {
+ add_action('wu_settings_login', [$this, 'add_settings'], 20);
+ add_filter('wu_pre_save_settings', [$this, 'maybe_update_newsletter_subscription'], 10, 3);
}
- public function add_settings() {
+ public function add_settings(): void {
wu_register_settings_field(
'general',
self::SETTING_FIELD_SLUG,
- array(
+ [
'title' => __('Signup for WP Multisite WaaS Newsletter', 'wp-ultimo'),
'desc' => __('Be informed of new releases and all things related to running a WaaS Network.', 'wp-ultimo'),
'type' => 'toggle',
'value' => '1',
- ),
+ ],
45
);
}
@@ -42,40 +42,40 @@ class Newsletter {
if ( isset($settings_to_save[ self::SETTING_FIELD_SLUG ]) && $settings_to_save[ self::SETTING_FIELD_SLUG ] && $settings_to_save[ self::SETTING_FIELD_SLUG ] != $saved_settings[ self::SETTING_FIELD_SLUG ] ) {
$response = wp_remote_post(
'https://wpmultisitewaas.org/wp-json/newsletter/v2/subscribers',
- array(
+ [
'method' => 'PUT',
'body' => wp_json_encode(
- array(
+ [
'email' => $settings['company_email'],
'status' => 'confirmed',
'first_name' => $settings['company_name'],
'country' => $settings['company_country'],
- )
+ ]
),
- 'headers' => array(
+ 'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Basic ' . base64_encode('30220d7fb4ec49a7410b3a309b9346c18410bd56:0407cd731d6f074cd0b96f2643b7619e89af1ed2'),
- ),
- )
+ ],
+ ]
);
} elseif ( empty($settings_to_save[ self::SETTING_FIELD_SLUG ]) && ! empty($saved_settings[ self::SETTING_FIELD_SLUG ]) ) {
$response = wp_remote_post(
'https://wpmultisitewaas.org/wp-json/newsletter/v2/subscribers',
- array(
+ [
'method' => 'PUT',
'body' => wp_json_encode(
- array(
+ [
'email' => $settings['company_email'],
'status' => 'unsubscribed',
- )
+ ]
),
- 'headers' => array(
+ 'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Basic ' . base64_encode('30220d7fb4ec49a7410b3a309b9346c18410bd56:0407cd731d6f074cd0b96f2643b7619e89af1ed2'),
- ),
- )
+ ],
+ ]
);
}
diff --git a/inc/class-requirements.php b/inc/class-requirements.php
index 97a8ee8..13e7925 100644
--- a/inc/class-requirements.php
+++ b/inc/class-requirements.php
@@ -9,8 +9,8 @@
namespace WP_Ultimo;
-use \WP_Ultimo\Loaders\Table_Loader;
-use \WP_Ultimo\Installers\Core_Installer;
+use WP_Ultimo\Loaders\Table_Loader;
+use WP_Ultimo\Installers\Core_Installer;
// Exit if accessed directly
defined('ABSPATH') || exit;
@@ -136,7 +136,7 @@ class Requirements {
public static function check_php_version(): bool {
if (version_compare(phpversion(), self::$php_version, '<')) {
- add_action('network_admin_notices', array('WP_Ultimo\Requirements', 'notice_unsupported_php_version'));
+ add_action('network_admin_notices', [self::class, 'notice_unsupported_php_version']);
return false;
}
@@ -153,7 +153,7 @@ class Requirements {
global $wp_version;
if (version_compare($wp_version, self::$wp_version, '<')) {
- add_action('network_admin_notices', array('WP_Ultimo\Requirements', 'notice_unsupported_wp_version'));
+ add_action('network_admin_notices', [self::class, 'notice_unsupported_wp_version']);
return false;
}
@@ -197,14 +197,14 @@ class Requirements {
$cron_request = apply_filters(
'cron_request', // phpcs:ignore
- array(
+ [
'url' => site_url('wp-cron.php?doing_wp_cron=' . $doing_wp_cron),
- 'args' => array(
+ 'args' => [
'timeout' => 3,
'blocking' => true,
'sslverify' => apply_filters('https_local_ssl_verify', $sslverify), // phpcs:ignore
- ),
- )
+ ],
+ ]
);
$result = wp_remote_post($cron_request['url'], $cron_request['args']);
@@ -225,7 +225,7 @@ class Requirements {
public static function is_multisite(): bool {
if (! is_multisite()) {
- add_action('admin_notices', array('WP_Ultimo\Requirements', 'notice_not_multisite'));
+ add_action('admin_notices', [self::class, 'notice_not_multisite']);
return false;
}
@@ -260,7 +260,7 @@ class Requirements {
}
if (! is_plugin_active_for_network(WP_ULTIMO_PLUGIN_BASENAME) && ! self::is_unit_test()) {
- add_action('admin_notices', array('WP_Ultimo\Requirements', 'notice_not_network_active'));
+ add_action('admin_notices', [self::class, 'notice_not_network_active']);
return false;
}
@@ -274,7 +274,7 @@ class Requirements {
* @since 2.0.0
* @return void
*/
- public static function notice_unsupported_php_version() {
+ public static function notice_unsupported_php_version(): void {
// translators: the %1$s placeholder is the required PHP version, while the %2$s is the current PHP version.
$message = sprintf(__('WP Multisite WaaS requires at least PHP version %1$s to run. Your current PHP version is %2$s. Please, contact your hosting company support to upgrade your PHP version. If you want maximum performance consider upgrading your PHP to version 7.0 or later.', 'wp-ultimo'), self::$php_version, phpversion());
@@ -288,7 +288,7 @@ class Requirements {
* @since 2.0.0
* @return void
*/
- public static function notice_unsupported_wp_version() {
+ public static function notice_unsupported_wp_version(): void {
global $wp_version;
@@ -304,7 +304,7 @@ class Requirements {
* @since 2.0.0
* @return void
*/
- public static function notice_not_multisite() {
+ public static function notice_not_multisite(): void {
$message = __('WP Multisite WaaS requires a multisite install to run properly. To know more about WordPress Networks, visit this link: Create a Network →', 'wp-ultimo');
@@ -317,7 +317,7 @@ class Requirements {
* @since 2.0.0
* @return void
*/
- public static function notice_not_network_active() {
+ public static function notice_not_network_active(): void {
// translators: %s is a placeholder for the Network Admin plugins page URL.
$message = sprintf(__('WP Multisite WaaS needs to be network active to run properly. You can "Network Activate" it here', 'wp-ultimo'), network_admin_url('plugins.php'));
diff --git a/inc/class-scripts.php b/inc/class-scripts.php
index e6386c7..fc320cd 100644
--- a/inc/class-scripts.php
+++ b/inc/class-scripts.php
@@ -27,19 +27,19 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- add_action('init', array($this, 'register_default_scripts'));
+ add_action('init', [$this, 'register_default_scripts']);
- add_action('init', array($this, 'register_default_styles'));
+ add_action('init', [$this, 'register_default_styles']);
- add_action('admin_init', array($this, 'enqueue_default_admin_styles'));
+ add_action('admin_init', [$this, 'enqueue_default_admin_styles']);
- add_action('admin_init', array($this, 'enqueue_default_admin_scripts'));
+ add_action('admin_init', [$this, 'enqueue_default_admin_scripts']);
- add_action('wp_ajax_wu_toggle_container', array($this, 'update_use_container'));
+ add_action('wp_ajax_wu_toggle_container', [$this, 'update_use_container']);
- add_filter('admin_body_class', array($this, 'add_body_class_container_boxed'));
+ add_filter('admin_body_class', [$this, 'add_body_class_container_boxed']);
}
/**
@@ -52,7 +52,7 @@ class Scripts {
* @param array $deps List of dependency scripts.
* @return void
*/
- public function register_script($handle, $src, $deps = array()) {
+ public function register_script($handle, $src, $deps = []): void {
wp_register_script($handle, $src, $deps, wu_get_version());
}
@@ -67,7 +67,7 @@ class Scripts {
* @param array $deps List of dependency scripts.
* @return void
*/
- public function register_style($handle, $src, $deps = array()) {
+ public function register_style($handle, $src, $deps = []): void {
wp_register_style($handle, $src, $deps, wu_get_version());
}
@@ -78,7 +78,7 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function register_default_scripts() {
+ public function register_default_scripts(): void {
/*
* Adds Vue JS
*/
@@ -97,48 +97,48 @@ class Scripts {
/*
* Adds tipTip
*/
- $this->register_script('wu-tiptip', wu_get_asset('lib/tiptip.js', 'js'), array('jquery-core'));
+ $this->register_script('wu-tiptip', wu_get_asset('lib/tiptip.js', 'js'), ['jquery-core']);
/*
* Ajax list Table pagination
*/
- $this->register_script('wu-ajax-list-table', wu_get_asset('list-tables.js', 'js'), array('jquery', 'wu-vue', 'underscore', 'wu-flatpicker'));
+ $this->register_script('wu-ajax-list-table', wu_get_asset('list-tables.js', 'js'), ['jquery', 'wu-vue', 'underscore', 'wu-flatpicker']);
/*
* Adds jQueryBlockUI
*/
- $this->register_script('wu-block-ui', wu_get_asset('lib/jquery.blockUI.js', 'js'), array('jquery-core'));
+ $this->register_script('wu-block-ui', wu_get_asset('lib/jquery.blockUI.js', 'js'), ['jquery-core']);
/*
* Adds FontIconPicker
*/
- $this->register_script('wu-fonticonpicker', wu_get_asset('lib/jquery.fonticonpicker.js', 'js'), array('jquery'));
+ $this->register_script('wu-fonticonpicker', wu_get_asset('lib/jquery.fonticonpicker.js', 'js'), ['jquery']);
/*
* Adds Accounting.js
*/
- $this->register_script('wu-accounting', wu_get_asset('lib/accounting.js', 'js'), array('jquery-core'));
+ $this->register_script('wu-accounting', wu_get_asset('lib/accounting.js', 'js'), ['jquery-core']);
/*
* Adds Cookie Helpers
*/
- $this->register_script('wu-cookie-helpers', wu_get_asset('cookie-helpers.js', 'js'), array('jquery-core'));
+ $this->register_script('wu-cookie-helpers', wu_get_asset('cookie-helpers.js', 'js'), ['jquery-core']);
/*
* Adds Input Masking
*/
- $this->register_script('wu-money-mask', wu_get_asset('lib/v-money.js', 'js'), array('wu-vue'));
- $this->register_script('wu-input-mask', wu_get_asset('lib/vue-the-mask.js', 'js'), array('wu-vue'));
+ $this->register_script('wu-money-mask', wu_get_asset('lib/v-money.js', 'js'), ['wu-vue']);
+ $this->register_script('wu-input-mask', wu_get_asset('lib/vue-the-mask.js', 'js'), ['wu-vue']);
/*
* Adds General Functions
*/
- $this->register_script('wu-functions', wu_get_asset('functions.js', 'js'), array('jquery-core', 'wu-tiptip', 'wu-flatpicker', 'wu-block-ui', 'wu-accounting', 'clipboard', 'wp-hooks'));
+ $this->register_script('wu-functions', wu_get_asset('functions.js', 'js'), ['jquery-core', 'wu-tiptip', 'wu-flatpicker', 'wu-block-ui', 'wu-accounting', 'clipboard', 'wp-hooks']);
wp_localize_script(
'wu-functions',
'wu_settings',
- array(
+ [
'currency' => wu_get_setting('currency_symbol', 'USD'),
'currency_symbol' => wu_get_currency_symbol(),
'currency_position' => wu_get_setting('currency_position'),
@@ -147,13 +147,13 @@ class Scripts {
'precision' => wu_get_setting('precision', 2),
'use_container' => get_user_setting('wu_use_container', false),
'disable_image_zoom' => wu_get_setting('disable_image_zoom', false),
- )
+ ]
);
/*
* Adds Fields & Components
*/
- $this->register_script('wu-fields', wu_get_asset('fields.js', 'js'), array('jquery', 'wu-vue', 'wu-selectizer', 'wp-color-picker'));
+ $this->register_script('wu-fields', wu_get_asset('fields.js', 'js'), ['jquery', 'wu-vue', 'wu-selectizer', 'wp-color-picker']);
/*
* Localize components
@@ -161,29 +161,29 @@ class Scripts {
wp_localize_script(
'wu-fields',
'wu_fields',
- array(
- 'l10n' => array(
+ [
+ 'l10n' => [
'image_picker_title' => __('Select an Image.', 'wp-ultimo'),
'image_picker_button_text' => __('Use this image', 'wp-ultimo'),
- ),
- )
+ ],
+ ]
);
/*
* Adds Admin Script
*/
- $this->register_script('wu-admin', wu_get_asset('admin.js', 'js'), array('jquery', 'wu-functions'));
+ $this->register_script('wu-admin', wu_get_asset('admin.js', 'js'), ['jquery', 'wu-functions']);
/*
* Adds Vue Apps
*/
- $this->register_script('wu-vue-apps', wu_get_asset('vue-apps.js', 'js'), array('wu-functions', 'wu-vue', 'wu-money-mask', 'wu-input-mask', 'wp-hooks'));
+ $this->register_script('wu-vue-apps', wu_get_asset('vue-apps.js', 'js'), ['wu-functions', 'wu-vue', 'wu-money-mask', 'wu-input-mask', 'wp-hooks']);
/*
* Adds Selectizer
*/
- $this->register_script('wu-selectize', wu_get_asset('lib/selectize.js', 'js'), array('jquery'));
- $this->register_script('wu-selectizer', wu_get_asset('selectizer.js', 'js'), array('wu-selectize', 'underscore', 'wu-vue-apps'));
+ $this->register_script('wu-selectize', wu_get_asset('lib/selectize.js', 'js'), ['jquery']);
+ $this->register_script('wu-selectizer', wu_get_asset('selectizer.js', 'js'), ['wu-selectize', 'underscore', 'wu-vue-apps']);
/*
* Localize selectizer
@@ -191,9 +191,9 @@ class Scripts {
wp_localize_script(
'wu-functions',
'wu_selectizer',
- array(
+ [
'ajaxurl' => wu_ajax_url(),
- )
+ ]
);
/*
@@ -202,22 +202,22 @@ class Scripts {
wp_localize_script(
'wu-functions',
'wu_ticker',
- array(
+ [
'server_clock_offset' => (wu_get_current_time('timestamp') - time()) / 60 / 60, // phpcs:ignore
'moment_clock_timezone_name' => wp_date('e'),
'moment_clock_timezone_offset' => wp_date('Z'),
- )
+ ]
);
/*
* Adds our thickbox fork.
*/
- $this->register_script('wubox', wu_get_asset('wubox.js', 'js'), array('wu-vue-apps'));
+ $this->register_script('wubox', wu_get_asset('wubox.js', 'js'), ['wu-vue-apps']);
wp_localize_script(
'wubox',
'wuboxL10n',
- array(
+ [
'next' => __('Next >'),
'prev' => __('< Prev'),
'image' => __('Image'),
@@ -225,7 +225,7 @@ class Scripts {
'close' => __('Close'),
'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
- )
+ ]
);
/*
@@ -249,7 +249,7 @@ class Scripts {
$long_date_formats = array_map(
'wu_convert_php_date_format_to_moment_js_format',
- array(
+ [
'LT' => $time_format,
'LTS' => str_replace(':i', ':i:s', (string) $time_format),
/* translators: the day/month/year date format used by WP Multisite WaaS. You can changed it to localize this date format to your language. the default value is d/m/Y, which is the format 31/12/2021. */
@@ -257,12 +257,12 @@ class Scripts {
'LL' => $date_format,
'LLL' => sprintf('%s %s', $date_format, $time_format),
'LLLL' => sprintf('%s %s', $date_format, $time_format),
- )
+ ]
);
// phpcs:disable
- $strings = array(
- 'relativeTime' => array(
+ $strings = [
+ 'relativeTime' => [
'future' => __('in %s', 'wp-ultimo'),
'past' => __('%s ago', 'wp-ultimo'),
's' => __('a few seconds', 'wp-ultimo'),
@@ -279,9 +279,9 @@ class Scripts {
'MM' => __('%d months', 'wp-ultimo'),
'y' => __('a year', 'wp-ultimo'),
'yy' => __('%d years', 'wp-ultimo'),
- ),
+ ],
'longDateFormat' => $long_date_formats,
- );
+ ];
// phpcs:enable
$inline_script = sprintf("moment.updateLocale( '%s', %s );", get_user_locale(), wp_json_encode($strings));
@@ -295,15 +295,15 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function register_default_styles() {
+ public function register_default_styles(): void {
- $this->register_style('wu-styling', wu_get_asset('framework.css', 'css'), array(), wu_get_version());
+ $this->register_style('wu-styling', wu_get_asset('framework.css', 'css'), []);
- $this->register_style('wu-admin', wu_get_asset('admin.css', 'css'), array('wu-styling'), wu_get_version());
+ $this->register_style('wu-admin', wu_get_asset('admin.css', 'css'), ['wu-styling']);
- $this->register_style('wu-checkout', wu_get_asset('checkout.css', 'css'), array(), wu_get_version());
+ $this->register_style('wu-checkout', wu_get_asset('checkout.css', 'css'), []);
- $this->register_style('wu-flags', wu_get_asset('flags.css', 'css'), array(), wu_get_version());
+ $this->register_style('wu-flags', wu_get_asset('flags.css', 'css'), []);
}
/**
@@ -312,7 +312,7 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function enqueue_default_admin_styles() {
+ public function enqueue_default_admin_styles(): void {
wp_enqueue_style('wu-admin');
}
@@ -323,7 +323,7 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function enqueue_default_admin_scripts() {
+ public function enqueue_default_admin_scripts(): void {
wp_enqueue_script('wu-admin');
}
@@ -334,7 +334,7 @@ class Scripts {
* @since 2.0.0
* @return void
*/
- public function update_use_container() {
+ public function update_use_container(): void {
check_ajax_referer('wu_toggle_container', 'nonce');
diff --git a/inc/class-session-cookie.php b/inc/class-session-cookie.php
index a3bd4e3..2bd6bbc 100644
--- a/inc/class-session-cookie.php
+++ b/inc/class-session-cookie.php
@@ -27,7 +27,7 @@ class Session_Cookie implements Session {
*
* @var array
*/
- protected $data = array();
+ protected $data = [];
/**
* If the session has already loaded
@@ -115,7 +115,7 @@ class Session_Cookie implements Session {
*/
public function add_values($key, $values): bool {
- $old_values = isset($this->data[ $key ]) ? $this->data[ $key ] : array();
+ $old_values = $this->data[ $key ] ?? [];
$this->data[ $key ] = array_merge($old_values, $values);
@@ -157,9 +157,9 @@ class Session_Cookie implements Session {
*
* @since 2.0.18
*/
- public function clear() {
+ public function clear(): void {
- $this->data = array();
+ $this->data = [];
}
/**
diff --git a/inc/class-settings.php b/inc/class-settings.php
index 0f42040..05bc11d 100644
--- a/inc/class-settings.php
+++ b/inc/class-settings.php
@@ -60,17 +60,17 @@ class Settings {
* @since 2.0.0
* @return void
*/
- public function init() {
+ public function init(): void {
- add_action('init', array($this, 'handle_legacy_filters'), 2);
+ add_action('init', [$this, 'handle_legacy_filters'], 2);
- add_action('wu_render_settings', array($this, 'handle_legacy_scripts'));
+ add_action('wu_render_settings', [$this, 'handle_legacy_scripts']);
- add_filter('pre_site_option_registration', array($this, 'force_registration_status'), 10, 3);
+ add_filter('pre_site_option_registration', [$this, 'force_registration_status'], 10, 3);
- add_filter('pre_site_option_add_new_users', array($this, 'force_add_new_users'), 10, 3);
+ add_filter('pre_site_option_add_new_users', [$this, 'force_add_new_users'], 10, 3);
- add_filter('pre_site_option_menu_items', array($this, 'force_plugins_menu'), 10, 3);
+ add_filter('pre_site_option_menu_items', [$this, 'force_plugins_menu'], 10, 3);
}
/**
@@ -156,9 +156,9 @@ class Settings {
if ($this->settings === false || empty($this->settings)) {
if ( ! $this->saving) {
$this->saving = true;
- $this->settings = $this->save_settings(array(), true);
+ $this->settings = $this->save_settings([], true);
} else {
- return array();
+ return [];
}
}
@@ -181,11 +181,11 @@ class Settings {
$settings = $this->get_all();
- if (strpos($setting, '-') !== false) {
+ if (str_contains($setting, '-')) {
_doing_it_wrong($setting, __('Dashes are no longer supported when registering a setting. You should change it to underscores in later versions.', 'wp-ultimo'), '2.0.0');
}
- $setting_value = isset($settings[ $setting ]) ? $settings[ $setting ] : $default;
+ $setting_value = $settings[ $setting ] ?? $default;
return apply_filters('wu_get_setting', $setting_value, $setting, $default, $settings);
}
@@ -228,23 +228,23 @@ class Settings {
* @param boolean $reset If true, WP Multisite WaaS will override the saved settings with the default values.
* @return array
*/
- public function save_settings($settings_to_save = array(), $reset = false) {
+ public function save_settings($settings_to_save = [], $reset = false) {
- $settings = array();
+ $settings = [];
$sections = $this->get_sections();
- $saved_settings = ! $reset ? $this->get_all() : array();
+ $saved_settings = ! $reset ? $this->get_all() : [];
do_action('wu_before_save_settings', $settings_to_save);
foreach ($sections as $section_slug => $section) {
foreach ($section['fields'] as $field_slug => $field_atts) {
- $existing_value = isset($saved_settings[ $field_slug ]) ? $saved_settings[ $field_slug ] : false;
+ $existing_value = $saved_settings[ $field_slug ] ?? false;
$field = new Field($field_slug, $field_atts);
- $new_value = isset($settings_to_save[ $field_slug ]) ? $settings_to_save[ $field_slug ] : $existing_value;
+ $new_value = $settings_to_save[ $field_slug ] ?? $existing_value;
/**
* For the current tab, we need to assume toggle fields.
@@ -301,18 +301,18 @@ class Settings {
$this->default_sections();
$this->sections = apply_filters(
'wu_settings_get_sections',
- array(
+ [
/*
* Add a default invisible section that we can use
* to register settings that will not have a control.
*/
- 'core' => array(
+ 'core' => [
'invisible' => true,
'order' => 1_000_000,
- 'fields' => apply_filters('wu_settings_section_core_fields', array()),
- ),
- )
+ 'fields' => apply_filters('wu_settings_section_core_fields', []),
+ ],
+ ]
);
uasort($this->sections, 'wu_sort_by_order');
@@ -335,9 +335,9 @@ class Settings {
return wu_get_isset(
$sections,
$section_name,
- array(
- 'fields' => array(),
- )
+ [
+ 'fields' => [],
+ ]
);
}
@@ -354,7 +354,7 @@ class Settings {
* @param array $atts Section attributes such as title, description and so on.
* @return void
*/
- public function add_section($section_slug, $atts) {
+ public function add_section($section_slug, $atts): void {
add_filter(
'wu_settings_get_sections',
@@ -364,14 +364,14 @@ class Settings {
$atts = wp_parse_args(
$atts,
- array(
+ [
'icon' => 'dashicons-wu-cog',
'order' => $default_order,
'capability' => 'manage_network',
- )
+ ]
);
- $atts['fields'] = apply_filters("wu_settings_section_{$section_slug}_fields", array());
+ $atts['fields'] = apply_filters("wu_settings_section_{$section_slug}_fields", []);
$sections[ $section_slug ] = $atts;
@@ -393,7 +393,7 @@ class Settings {
* @param array $atts Field attributes such as title, description, tooltip, default value, etc.
* @return void
*/
- public function add_field($section_slug, $field_slug, $atts, $priority = 10) {
+ public function add_field($section_slug, $field_slug, $atts, $priority = 10): void {
/*
* Adds the field to the desired fields array.
*/
@@ -403,7 +403,7 @@ class Settings {
/*
* We no longer support settings with hyphens.
*/
- if (strpos($field_slug, '-') !== false) {
+ if (str_contains($field_slug, '-')) {
_doing_it_wrong($field_slug, __('Dashes are no longer supported when registering a setting. You should change it to underscores in later versions.', 'wp-ultimo'), '2.0.0');
}
@@ -411,16 +411,16 @@ class Settings {
$atts = wp_parse_args(
$atts,
- array(
+ [
'setting_id' => $field_slug,
'title' => '',
'desc' => '',
'order' => $default_order,
'default' => null,
'capability' => 'manage_network',
- 'wrapper_html_attr' => array(),
- 'require' => array(),
- 'html_attr' => array(),
+ 'wrapper_html_attr' => [],
+ 'require' => [],
+ 'html_attr' => [],
'value' => fn() => wu_get_setting($field_slug),
'display_value' => fn() => wu_get_setting($field_slug),
'img' => function () use ($field_slug) {
@@ -435,7 +435,7 @@ class Settings {
return $custom_logo_args ? $custom_logo_args[0] : '';
},
- )
+ ]
);
/**
@@ -477,7 +477,7 @@ class Settings {
}
if ( ! empty($atts['require'])) {
- $require_rules = array();
+ $require_rules = [];
foreach ($atts['require'] as $attr => $value) {
$attr = str_replace('-', '_', $attr);
@@ -513,7 +513,7 @@ class Settings {
* @since 2.0.0
* @return void
*/
- public function default_sections() {
+ public function default_sections(): void {
/*
* General Settings
* This section holds the General settings of the WP Multisite WaaS Plugin.
@@ -524,166 +524,166 @@ class Settings {
$this->add_section(
'general',
- array(
+ [
'title' => __('General', 'wp-ultimo'),
'desc' => __('General', 'wp-ultimo'),
- )
+ ]
);
$this->add_field(
'general',
'company_header',
- array(
+ [
'title' => __('Your Business', 'wp-ultimo'),
'desc' => __('General information about your business..', 'wp-ultimo'),
'type' => 'header',
- ),
+ ],
10
);
$this->add_field(
'general',
'company_name',
- array(
+ [
'title' => __('Company Name', 'wp-ultimo'),
'desc' => __('This name is used when generating invoices, for example.', 'wp-ultimo'),
'type' => 'text',
'default' => get_network_option(null, 'site_name'),
- ),
+ ],
20
);
$this->add_field(
'general',
'company_logo',
- array(
+ [
'title' => __('Upload Company Logo', 'wp-ultimo'),
'desc' => __('Add your company logo to be used on the login page and other places.', 'wp-ultimo'),
'type' => 'image',
'default' => '',
- ),
+ ],
30
);
$this->add_field(
'general',
'company_email',
- array(
+ [
'title' => __('Company Email Address', 'wp-ultimo'),
'desc' => __('This email is used when generating invoices, for example.', 'wp-ultimo'),
'type' => 'text',
'default' => get_network_option(null, 'admin_email'),
- ),
+ ],
40
);
$this->add_field(
'general',
'company_address',
- array(
+ [
'title' => __('Company Address', 'wp-ultimo'),
'desc' => __('This address is used when generating invoices.', 'wp-ultimo'),
'type' => 'textarea',
'placeholder' => "350 Fifth Avenue\nManhattan, \nNew York City, NY \n10118",
'default' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'rows' => 5,
- ),
- ),
+ ],
+ ],
50
);
$this->add_field(
'general',
'company_country',
- array(
+ [
'title' => __('Company Country', 'wp-ultimo'),
'desc' => __('This info is used when generating invoices, as well as for calculating when taxes apply in some contexts.', 'wp-ultimo'),
'type' => 'select',
'options' => 'wu_get_countries',
- 'default' => array($this, 'get_default_company_country'),
- ),
+ 'default' => [$this, 'get_default_company_country'],
+ ],
60
);
$this->add_field(
'general',
'currency_header',
- array(
+ [
'title' => __('Currency Options', 'wp-ultimo'),
'desc' => __('The following options affect how prices are displayed on the frontend, the backend and in reports.', 'wp-ultimo'),
'type' => 'header',
- ),
+ ],
70
);
$this->add_field(
'general',
'currency_symbol',
- array(
+ [
'title' => __('Currency', 'wp-ultimo'),
'desc' => __('Select the currency to be used in WP Multisite WaaS.', 'wp-ultimo'),
'type' => 'select',
'default' => 'USD',
'options' => 'wu_get_currencies',
- ),
+ ],
80
);
$this->add_field(
'general',
'currency_position',
- array(
+ [
'title' => __('Currency Position', 'wp-ultimo'),
'desc' => __('This setting affects all prices displayed across the plugin elements.', 'wp-ultimo'),
'desc' => '',
'type' => 'select',
'default' => '%s %v',
- 'options' => array(
+ 'options' => [
'%s%v' => __('Left ($99.99)', 'wp-ultimo'),
'%v%s' => __('Right (99.99$)', 'wp-ultimo'),
'%s %v' => __('Left with space ($ 99.99)', 'wp-ultimo'),
'%v %s' => __('Right with space (99.99 $)', 'wp-ultimo'),
- ),
- ),
+ ],
+ ],
90
);
$this->add_field(
'general',
'decimal_separator',
- array(
+ [
'title' => __('Decimal Separator', 'wp-ultimo'),
'desc' => __('This setting affects all prices displayed across the plugin elements.', 'wp-ultimo'),
'type' => 'text',
'default' => '.',
- ),
+ ],
100
);
$this->add_field(
'general',
'thousand_separator',
- array(
+ [
'title' => __('Thousand Separator', 'wp-ultimo'),
'desc' => __('This setting affects all prices displayed across the plugin elements.', 'wp-ultimo'),
'type' => 'text',
'default' => ',',
'raw' => true,
- ),
+ ],
110
);
$this->add_field(
'general',
'precision',
- array(
+ [
'title' => __('Number of Decimals', 'wp-ultimo'),
'desc' => __('This setting affects all prices displayed across the plugin elements.', 'wp-ultimo'),
'type' => 'number',
'default' => '2',
'min' => 0,
- ),
+ ],
120
);
@@ -694,55 +694,55 @@ class Settings {
$this->add_section(
'login-and-registration',
- array(
+ [
'title' => __('Login & Registration', 'wp-ultimo'),
'desc' => __('Login & Registration', 'wp-ultimo'),
'icon' => 'dashicons-wu-key',
- )
+ ]
);
$this->add_field(
'login-and-registration',
'registration_header',
- array(
+ [
'title' => __('Login and Registration Options', 'wp-ultimo'),
'desc' => __('Options related to registration and login behavior.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'login-and-registration',
'enable_registration',
- array(
+ [
'title' => __('Enable Registration', 'wp-ultimo'),
'desc' => __('Turning this toggle off will disable registration in all checkout forms across the network.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'login-and-registration',
'enable_email_verification',
- array(
+ [
'title' => __('Enable email verification', 'wp-ultimo'),
'desc' => __('Enabling this option will require the customer to verify their email address when subscribing to a free plan or a plan with a trial period. Sites will not be created until the customer email verification status is changed to verified.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'login-and-registration',
'default_registration_page',
- array(
+ [
'type' => 'model',
'title' => __('Default Registration Page', 'wp-ultimo'),
'placeholder' => __('Search pages on the main site...', 'wp-ultimo'),
'desc' => __('Only published pages on the main site are available for selection, and you need to make sure they contain a [wu_checkout] shortcode.', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-base-link' => get_admin_url(wu_get_main_site_id(), 'post.php?action=edit&post'),
'data-model' => 'page',
'data-value-field' => 'ID',
@@ -750,129 +750,129 @@ class Settings {
'data-search-field' => 'post_title',
'data-max-items' => 1,
'data-exclude' => $filter_default_signup_pages,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'login-and-registration',
'enable_custom_login_page',
- array(
+ [
'title' => __('Use Custom Login Page', 'wp-ultimo'),
'desc' => __('Turn this toggle on to select a custom page to be used as the login page.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'login-and-registration',
'default_login_page',
- array(
+ [
'type' => 'model',
'title' => __('Default Login Page', 'wp-ultimo'),
'placeholder' => __('Search pages on the main site...', 'wp-ultimo'),
'desc' => __('Only published pages on the main site are available for selection, and you need to make sure they contain a [wu_login_form] shortcode.', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-base-link' => get_admin_url(wu_get_main_site_id(), 'post.php?action=edit&post'),
'data-model' => 'page',
'data-value-field' => 'ID',
'data-label-field' => 'post_title',
'data-search-field' => 'post_title',
'data-max-items' => 1,
- ),
- 'require' => array(
+ ],
+ 'require' => [
'enable_custom_login_page' => true,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'login-and-registration',
'obfuscate_original_login_url',
- array(
+ [
'title' => __('Obfuscate the Original Login URL (wp-login.php)', 'wp-ultimo'),
'desc' => __('If this option is enabled, we will display a 404 error when a user tries to access the original wp-login.php link. This is useful to prevent brute-force attacks.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- 'require' => array(
+ 'require' => [
'enable_custom_login_page' => 1,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'login-and-registration',
'subsite_custom_login_logo',
- array(
+ [
'title' => __('Use Sub-site logo on Login Page', 'wp-ultimo'),
'desc' => __('Toggle this option to replace the WordPress logo on the sub-site login page with the logo set for that sub-site. If unchecked, the network logo will be used instead.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- 'require' => array(
+ 'require' => [
'enable_custom_login_page' => 0,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'login-and-registration',
'force_publish_sites_sync',
- array(
+ [
'title' => __('Force Synchronous Site Publication ', 'wp-ultimo'),
'desc' => __('By default, when a new pending site needs to be converted into a real network site, the publishing process happens via Job Queue, asynchronously. Enable this option to force the publication to happen in the same request as the signup. Be careful, as this can cause timeouts depending on the size of the site templates being copied.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'login-and-registration',
'other_header',
- array(
+ [
'title' => __('Other Options', 'wp-ultimo'),
'desc' => __('Other registration-related options.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'login-and-registration',
'default_role',
- array(
+ [
'title' => __('Default Role', 'wp-ultimo'),
'desc' => __('Set the role to be applied to the user during the signup process.', 'wp-ultimo'),
'type' => 'select',
'default' => 'administrator',
'options' => 'wu_get_roles_as_options',
- )
+ ]
);
$this->add_field(
'login-and-registration',
'add_users_to_main_site',
- array(
+ [
'title' => __('Add Users to the Main Site as well?', 'wp-ultimo'),
'desc' => __('Enabling this option will also add the user to the main site of your network.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'login-and-registration',
'main_site_default_role',
- array(
+ [
'title' => __('Add to Main Site with Role...', 'wp-ultimo'),
'desc' => __('Select the role WP Multisite WaaS should use when adding the user to the main site of your network. Be careful.', 'wp-ultimo'),
'type' => 'select',
'default' => 'subscriber',
'options' => 'wu_get_roles_as_options',
- 'require' => array(
+ 'require' => [
'add_users_to_main_site' => 1,
- ),
- )
+ ],
+ ]
);
do_action('wu_settings_login');
@@ -884,23 +884,23 @@ class Settings {
$this->add_section(
'memberships',
- array(
+ [
'title' => __('Memberships', 'wp-ultimo'),
'desc' => __('Memberships', 'wp-ultimo'),
'icon' => 'dashicons-wu-infinity',
- )
+ ]
);
$this->add_field(
'memberships',
'default_update_page',
- array(
+ [
'type' => 'model',
'title' => __('Default Membership Update Page', 'wp-ultimo'),
'placeholder' => __('Search pages on the main site...', 'wp-ultimo'),
'desc' => __('Only published pages on the main site are available for selection, and you need to make sure they contain a [wu_checkout] shortcode.', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-base-link' => get_admin_url(wu_get_main_site_id(), 'post.php?action=edit&post'),
'data-model' => 'page',
'data-value-field' => 'ID',
@@ -908,216 +908,216 @@ class Settings {
'data-search-field' => 'post_title',
'data-max-items' => 1,
'data-exclude' => $filter_default_signup_pages,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'block_frontend',
- array(
+ [
'title' => __('Block Frontend Access', 'wp-ultimo'),
'desc' => __('Block the frontend access of network sites after a membership is no longer active.', 'wp-ultimo'),
'tooltip' => __('By default, if a user does not pay and the account goes inactive, only the admin panel will be blocked, but the user\'s site will still be accessible on the frontend. If enabled, this option will also block frontend access in those cases.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'memberships',
'block_frontend_grace_period',
- array(
+ [
'title' => __('Frontend Block Grace Period', 'wp-ultimo'),
'desc' => __('Select the number of days WP Multisite WaaS should wait after the membership goes inactive before blocking the frontend access. Leave 0 to block immediately after the membership becomes inactive.', 'wp-ultimo'),
'type' => 'number',
'default' => 0,
'min' => 0,
- 'require' => array(
+ 'require' => [
'block_frontend' => 1,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'default_block_frontend_page',
- array(
+ [
'title' => __('Frontend Block Page', 'wp-ultimo'),
'desc' => __('Select a page on the main site to redirect user if access is blocked', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-base-link' => get_admin_url(wu_get_main_site_id(), 'post.php?action=edit&post'),
'data-model' => 'page',
'data-value-field' => 'ID',
'data-label-field' => 'post_title',
'data-search-field' => 'post_title',
'data-max-items' => 1,
- ),
- 'require' => array(
+ ],
+ 'require' => [
'block_frontend' => 1,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'enable_multiple_memberships',
- array(
+ [
'title' => __('Enable Multiple Memberships per Customer', 'wp-ultimo'),
'desc' => __('Enabling this option will allow your users to create more than one membership.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'memberships',
'enable_multiple_sites',
- array(
+ [
'title' => __('Enable Multiple Sites per Membership', 'wp-ultimo'),
'desc' => __('Enabling this option will allow your customers to create more than one site. You can limit how many sites your users can create in a per plan basis.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'memberships',
'block_sites_on_downgrade',
- array(
+ [
'title' => __('Block Sites on Downgrade', 'wp-ultimo'),
'desc' => __('Choose how WP Multisite WaaS should handle client sites above their plan quota on downgrade.', 'wp-ultimo'),
'type' => 'select',
'default' => 'none',
- 'options' => array(
+ 'options' => [
'none' => __('Keep sites as is (do nothing)', 'wp-ultimo'),
'block-frontend' => __('Block only frontend access', 'wp-ultimo'),
'block-backend' => __('Block only backend access', 'wp-ultimo'),
'block-both' => __('Block both frontend and backend access', 'wp-ultimo'),
- ),
- 'require' => array(
+ ],
+ 'require' => [
'enable_multiple_sites' => true,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'move_posts_on_downgrade',
- array(
+ [
'title' => __('Move Posts on Downgrade', 'wp-ultimo'),
'desc' => __('Select how you want to handle the posts above the quota on downgrade. This will apply to all post types with quotas set.', 'wp-ultimo'),
'type' => 'select',
'default' => 'none',
- 'options' => array(
+ 'options' => [
'none' => __('Keep posts as is (do nothing)', 'wp-ultimo'),
'trash' => __('Move posts above the new quota to the Trash', 'wp-ultimo'),
'draft' => __('Mark posts above the new quota as Drafts', 'wp-ultimo'),
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'emulated_post_types_header',
- array(
+ [
'type' => 'header',
'title' => __('Emulated Post Types', 'wp-ultimo'),
'desc' => __('Emulates the registering of a custom post type to be able to create limits for it without having to activate plugins on the main site.', 'wp-ultimo'),
- )
+ ]
);
$this->add_field(
'memberships',
'emulated_post_types_explanation',
- array(
+ [
'type' => 'note',
'desc' => __('By default, WP Multisite WaaS only allows super admins to limit post types that are registered on the main site. This makes sense from a technical stand-point but it also forces you to have plugins network-activated in order to be able to set limitations for their custom post types. Using this option, you can emulate the registering of a post type. This will register them on the main site and allow you to create limits for them on your products.', 'wp-ultimo'),
'classes' => '',
'wrapper_classes' => '',
- )
+ ]
);
$this->add_field(
'memberships',
'emulated_post_types_empty',
- array(
+ [
'type' => 'note',
'desc' => __('Add the first post type using the button below.', 'wp-ultimo'),
'classes' => 'wu-text-gray-600 wu-text-xs wu-text-center wu-w-full',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'emulated_post_types.length === 0',
'v-cloak' => '1',
- ),
- )
+ ],
+ ]
);
$this->add_field(
'memberships',
'emulated_post_types',
- array(
+ [
'type' => 'group',
'tooltip' => '',
'raw' => true,
- 'default' => array(),
+ 'default' => [],
'wrapper_classes' => 'wu-relative wu-bg-gray-100 wu-pb-2',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-if' => 'emulated_post_types.length',
'v-for' => '(emulated_post_type, index) in emulated_post_types',
'v-cloak' => '1',
- ),
- 'fields' => array(
- 'emulated_post_types_remove' => array(
+ ],
+ 'fields' => [
+ 'emulated_post_types_remove' => [
'type' => 'note',
'desc' => sprintf(' emulated_post_types.splice(index, 1)">', __('Remove', 'wp-ultimo')),
'wrapper_classes' => 'wu-absolute wu-top-0 wu-right-0',
- ),
- 'emulated_post_types_slug' => array(
+ ],
+ 'emulated_post_types_slug' => [
'type' => 'text',
'title' => __('Post Type Slug', 'wp-ultimo'),
'placeholder' => __('e.g. product', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-5/12',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'emulated_post_type.post_type',
'v-bind:name' => '"emulated_post_types[" + index + "][post_type]"',
- ),
- ),
- 'emulated_post_types_label' => array(
+ ],
+ ],
+ 'emulated_post_types_label' => [
'type' => 'text',
'title' => __('Post Type Label', 'wp-ultimo'),
'placeholder' => __('e.g. Products', 'wp-ultimo'),
'wrapper_classes' => 'wu-w-7/12 wu-ml-2',
- 'html_attr' => array(
+ 'html_attr' => [
'v-model' => 'emulated_post_type.label',
'v-bind:name' => '"emulated_post_types[" + index + "][label]"',
- ),
- ),
- ),
- )
+ ],
+ ],
+ ],
+ ]
);
$this->add_field(
'memberships',
'emulated_post_types_repeat',
- array(
+ [
'type' => 'submit',
'title' => __('+ Add Post Type', 'wp-ultimo'),
'classes' => 'wu-uppercase wu-text-2xs wu-text-blue-700 wu-border-none wu-bg-transparent wu-font-bold wu-text-right wu-w-full wu-cursor-pointer',
'wrapper_classes' => 'wu-bg-gray-100 wu-items-end',
- 'wrapper_html_attr' => array(
+ 'wrapper_html_attr' => [
'v-cloak' => '1',
- ),
- 'html_attr' => array(
+ ],
+ 'html_attr' => [
'v-on:click.prevent' => '() => {
emulated_post_types = Array.isArray(emulated_post_types) ? emulated_post_types : []; emulated_post_types.push({
post_type: "",
label: "",
})
}',
- ),
- )
+ ],
+ ]
);
do_action('wu_settings_memberships');
@@ -1129,33 +1129,33 @@ class Settings {
$this->add_section(
'sites',
- array(
+ [
'title' => __('Sites', 'wp-ultimo'),
'desc' => __('Sites', 'wp-ultimo'),
'icon' => 'dashicons-wu-browser',
- )
+ ]
);
$this->add_field(
'sites',
'sites_features_heading',
- array(
+ [
'title' => __('Site Options', 'wp-ultimo'),
'desc' => __('Configure certain aspects of how network Sites behave.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'sites',
'default_new_site_page',
- array(
+ [
'type' => 'model',
'title' => __('Default New Site Page', 'wp-ultimo'),
'placeholder' => __('Search pages on the main site...', 'wp-ultimo'),
'desc' => __('Only published pages on the main site are available for selection, and you need to make sure they contain a [wu_checkout] shortcode.', 'wp-ultimo'),
'tooltip' => '',
- 'html_attr' => array(
+ 'html_attr' => [
'data-base-link' => get_admin_url(wu_get_main_site_id(), 'post.php?action=edit&post'),
'data-model' => 'page',
'data-value-field' => 'ID',
@@ -1163,121 +1163,121 @@ class Settings {
'data-search-field' => 'post_title',
'data-max-items' => 1,
'data-exclude' => $filter_default_signup_pages,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'sites',
'enable_visits_limiting',
- array(
+ [
'title' => __('Enable Visits Limitation & Counting', 'wp-ultimo'),
'desc' => __('Enabling this option will add visits limitation settings to the plans and add the functionality necessary to count site visits on the front-end.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'enable_screenshot_generator',
- array(
+ [
'title' => __('Enable Screenshot Generator', 'wp-ultimo'),
'desc' => __('With this option is enabled, WP Multisite WaaS will take a screenshot for every newly created site on your network and set the resulting image as that site\'s featured image. This features requires a valid license key to work and it is not supported for local sites.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'wordpress_features_heading',
- array(
+ [
'title' => __('WordPress Features', 'wp-ultimo'),
'desc' => __('Override default WordPress settings for network Sites.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'sites',
'menu_items_plugin',
- array(
+ [
'title' => __('Enable Plugins Menu', 'wp-ultimo'),
'desc' => __('Do you want to let users on the network to have access to the Plugins page, activating plugins for their sites? If this option is disabled, the customer will not be able to manage the site plugins.', 'wp-ultimo'),
'tooltip' => __('You can select which plugins the user will be able to use for each plan.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'add_new_users',
- array(
+ [
'title' => __('Add New Users', 'wp-ultimo'),
'desc' => __('Allow site administrators to add new users to their site via the "Users → Add New" page.', 'wp-ultimo'),
'tooltip' => __('You can limit the number of users allowed for each plan.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'site_template_features_heading',
- array(
+ [
'title' => __('Site Template Options', 'wp-ultimo'),
'desc' => __('Configure certain aspects of how Site Templates behave.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'sites',
'allow_template_switching',
- array(
+ [
'title' => __('Allow Template Switching', 'wp-ultimo'),
'desc' => __("Enabling this option will add an option on your client's dashboard to switch their site template to another one available on the catalog of available templates. The data is lost after a switch as the data from the new template is copied over.", 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'allow_own_site_as_template',
- array(
+ [
'title' => __('Allow Users to use their own Sites as Templates', 'wp-ultimo'),
'desc' => __('Enabling this option will add the user own sites to the template screen, allowing them to create a new site based on the content and customizations they made previously.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- 'require' => array(
+ 'require' => [
'allow_template_switching' => true,
- ),
- )
+ ],
+ ]
);
$this->add_field(
'sites',
'copy_media',
- array(
+ [
'title' => __('Copy Media on Template Duplication?', 'wp-ultimo'),
'desc' => __('Checking this option will copy the media uploaded on the template site to the newly created site. This can be overridden on each of the plans.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'sites',
'stop_template_indexing',
- array(
+ [
'title' => __('Prevent Search Engines from indexing Site Templates', 'wp-ultimo'),
'desc' => __('Checking this option will discourage search engines from indexing all the Site Templates on your network.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
do_action('wu_settings_site_templates');
@@ -1289,116 +1289,116 @@ class Settings {
$this->add_section(
'payment-gateways',
- array(
+ [
'title' => __('Payments', 'wp-ultimo'),
'desc' => __('Payments', 'wp-ultimo'),
'icon' => 'dashicons-wu-credit-card',
- )
+ ]
);
$this->add_field(
'payment-gateways',
'main_header',
- array(
+ [
'title' => __('Payment Settings', 'wp-ultimo'),
'desc' => __('The following options affect how prices are displayed on the frontend, the backend and in reports.', 'wp-ultimo'),
'type' => 'header',
'show_as_submenu' => true,
- )
+ ]
);
$this->add_field(
'payment-gateways',
'force_auto_renew',
- array(
+ [
'title' => __('Force Auto-Renew', 'wp-ultimo'),
'desc' => __('Enable this option if you want to make sure memberships are created with auto-renew activated whenever the selected gateway supports it. Disabling this option will show an auto-renew option during checkout.', 'wp-ultimo'),
'tooltip' => '',
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'payment-gateways',
'allow_trial_without_payment_method',
- array(
+ [
'title' => __('Allow Trials without Payment Method', 'wp-ultimo'),
'desc' => __('By default, WP Multisite WaaS asks customers to add a payment method on sign-up even if a trial period is present. Enable this option to only ask for a payment method when the trial period is over.', 'wp-ultimo'),
'tooltip' => '',
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'payment-gateways',
'attach_invoice_pdf',
- array(
+ [
'title' => __('Send Invoice on Payment Confirmation', 'wp-ultimo'),
'desc' => __('Enabling this option will attach a PDF invoice (marked paid) with the payment confirmation email. This option does not apply to the Manual Gateway, which sends invoices regardless of this option.', 'wp-ultimo'),
'tooltip' => __('The invoice files will be saved on the wp-content/uploads/wu-invoices folder.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'payment-gateways',
'invoice_numbering_scheme',
- array(
+ [
'title' => __('Invoice Numbering Scheme', 'wp-ultimo'),
'desc' => __('What should WP Multisite WaaS use as the invoice number?', 'wp-ultimo'),
'type' => 'select',
'default' => 'reference_code',
'tooltip' => '',
- 'options' => array(
+ 'options' => [
'reference_code' => __('Payment Reference Code', 'wp-ultimo'),
'sequential_number' => __('Sequential Number', 'wp-ultimo'),
- ),
- )
+ ],
+ ]
);
$this->add_field(
'payment-gateways',
'next_invoice_number',
- array(
+ [
'title' => __('Next Invoice Number', 'wp-ultimo'),
'desc' => __('This number will be used as the invoice number for the next invoice generated on the system. It is incremented by one every time a new invoice is created. You can change it and save it to reset the invoice sequential number to a specific value.', 'wp-ultimo'),
'type' => 'number',
'default' => '1',
'min' => 0,
- 'require' => array(
+ 'require' => [
'invoice_numbering_scheme' => 'sequential_number',
- ),
- )
+ ],
+ ]
);
$this->add_field(
'payment-gateways',
'invoice_prefix',
- array(
+ [
'title' => __('Invoice Number Prefix', 'wp-ultimo'),
'placeholder' => __('INV00', 'wp-ultimo'),
'desc' => sprintf(__('Use %%YEAR%%, %%MONTH%%, and %%DAY%% to create a dynamic placeholder. E.g. %%YEAR%%-%%MONTH%%-INV will become %s.', 'wp-ultimo'), date('Y') . '-' . date('m') . '-INV'), // phpcs:ignore
'default' => '',
'type' => 'text',
'raw' => true, // Necessary to prevent the removal of the %% tags.
- 'require' => array(
+ 'require' => [
'invoice_numbering_scheme' => 'sequential_number',
- ),
- )
+ ],
+ ]
);
$this->add_field(
'payment-gateways',
'gateways_header',
- array(
+ [
'title' => __('Payment Gateways', 'wp-ultimo'),
'desc' => __('Activate and configure the installed payment gateways in this section.', 'wp-ultimo'),
'type' => 'header',
'show_as_submenu' => true,
- )
+ ]
);
do_action('wu_settings_payment_gateways');
@@ -1409,11 +1409,11 @@ class Settings {
*/
$this->add_section(
'emails',
- array(
+ [
'title' => __('Emails', 'wp-ultimo'),
'desc' => __('Emails', 'wp-ultimo'),
'icon' => 'dashicons-wu-email',
- )
+ ]
);
do_action('wu_settings_emails');
@@ -1425,11 +1425,11 @@ class Settings {
$this->add_section(
'domain-mapping',
- array(
+ [
'title' => __('Domain Mapping', 'wp-ultimo'),
'desc' => __('Domain Mapping', 'wp-ultimo'),
'icon' => 'dashicons-wu-link',
- )
+ ]
);
do_action('wu_settings_domain_mapping');
@@ -1441,11 +1441,11 @@ class Settings {
$this->add_section(
'sso',
- array(
+ [
'title' => __('Single Sign-On', 'wp-ultimo'),
'desc' => __('Single Sign-On', 'wp-ultimo'),
'icon' => 'dashicons-wu-add-user',
- )
+ ]
);
do_action('wu_settings_sso');
@@ -1457,22 +1457,22 @@ class Settings {
$this->add_section(
'integrations',
- array(
+ [
'title' => __('Integrations', 'wp-ultimo'),
'desc' => __('Integrations', 'wp-ultimo'),
'icon' => 'dashicons-wu-power-plug',
- )
+ ]
);
$this->add_field(
'integrations',
'hosting_providers_header',
- array(
+ [
'title' => __('Hosting or Panel Providers', 'wp-ultimo'),
'desc' => __('Configure and manage the integration with your Hosting or Panel Provider.', 'wp-ultimo'),
'type' => 'header',
'show_as_submenu' => true,
- )
+ ]
);
do_action('wu_settings_integrations');
@@ -1484,103 +1484,103 @@ class Settings {
$this->add_section(
'other',
- array(
+ [
'title' => __('Other Options', 'wp-ultimo'),
'desc' => __('Other Options', 'wp-ultimo'),
'icon' => 'dashicons-wu-switch',
'order' => 1000,
- )
+ ]
);
$this->add_field(
'other',
'Other_header',
- array(
+ [
'title' => __('Miscellaneous', 'wp-ultimo'),
'desc' => __('Other options that do not fit anywhere else.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
- $preview_image = wu_preview_image(wu_get_asset('settings/settings-hide-ui-tours.png'));
+ $preview_image = wu_preview_image(wu_get_asset('settings/settings-hide-ui-tours.webp'));
$this->add_field(
'other',
'hide_tours',
- array(
+ [
'title' => __('Hide UI Tours', 'wp-ultimo') . $preview_image,
'desc' => __('The UI tours showed by WP Multisite WaaS should permanently hide themselves after being seen but if they persist for whatever reason, toggle this option to force them into their viewed state - which will prevent them from showing up again.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
- $preview_image_2 = wu_preview_image(wu_get_asset('settings/settings-disable-hover-to-zoom.png'));
+ $preview_image_2 = wu_preview_image(wu_get_asset('settings/settings-disable-hover-to-zoom.webp'));
$this->add_field(
'other',
'disable_image_zoom',
- array(
+ [
'title' => __('Disable "Hover to Zoom"', 'wp-ultimo') . $preview_image_2,
'desc' => __('By default, WP Multisite WaaS adds a "hover to zoom" feature, allowing network admins to see larger version of site screenshots and other images across the UI in full-size when hovering over them. You can disable that feature here. Preview tags like the above are not affected.', 'wp-ultimo'),
'type' => 'toggle',
'default' => 0,
- )
+ ]
);
$this->add_field(
'other',
'error_reporting_header',
- array(
+ [
'title' => __('Logging', 'wp-ultimo'),
'desc' => __('Log WP Multisite WaaS data. This is useful for debugging purposes.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$this->add_field(
'other',
'error_logging_level',
- array(
+ [
'title' => __('Logging Level', 'wp-ultimo'),
'desc' => __('Select the level of logging you want to use.', 'wp-ultimo'),
'type' => 'select',
'default' => 'default',
- 'options' => array(
+ 'options' => [
'default' => __('PHP Default', 'wp-ultimo'),
'disabled' => __('Disabled', 'wp-ultimo'),
'errors' => __('Errors Only', 'wp-ultimo'),
'all' => __('Everything', 'wp-ultimo'),
- ),
- )
+ ],
+ ]
);
$this->add_field(
'other',
'enable_error_reporting',
- array(
+ [
'title' => __('Send Error Data to WP Multisite WaaS Developers', 'wp-ultimo'),
'desc' => __('With this option enabled, every time your installation runs into an error related to WP Multisite WaaS, that error data will be sent to us. No sensitive data gets collected, only environmental stuff (e.g. if this is this is a subdomain network, etc).', 'wp-ultimo'),
'type' => 'toggle',
'default' => 1,
- )
+ ]
);
$this->add_field(
'other',
'advanced_header',
- array(
+ [
'title' => __('Advanced Options', 'wp-ultimo'),
'desc' => __('Change the plugin and wordpress behavior.', 'wp-ultimo'),
'type' => 'header',
- )
+ ]
);
$plans = get_posts(
- array(
+ [
'post_type' => 'wpultimo_plan',
'numberposts' => 1,
- )
+ ]
);
if ( ! empty($plans)) {
@@ -1599,11 +1599,11 @@ class Settings {
$this->add_field(
'other',
'run_migration',
- array(
+ [
'title' => $title,
'type' => 'note',
'desc' => $html,
- )
+ ]
);
}
@@ -1616,25 +1616,25 @@ class Settings {
$this->add_field(
'other',
'security_mode',
- array(
+ [
'title' => __('Security Mode', 'wp-ultimo'),
// Translators: Placeholder adds the security mode key and current site url with query string
'desc' => sprintf(__('Only WP Multisite WaaS and other must-use plugins will run on your WordPress install while this option is enabled.
Important: Copy the following URL to disable security mode if something goes wrong and this page becomes unavailable:%2$s