Use new code style
This commit is contained in:
.phpcs.xml.distcomposer.jsonconstants.phpsunrise.phpuninstall.php
inc
admin-pages
class-about-admin-page.phpclass-base-admin-page.phpclass-base-customer-facing-admin-page.phpclass-broadcast-edit-admin-page.phpclass-broadcast-list-admin-page.phpclass-checkout-form-edit-admin-page.phpclass-checkout-form-list-admin-page.phpclass-customer-edit-admin-page.phpclass-customer-list-admin-page.phpclass-customizer-admin-page.phpclass-dashboard-admin-page.phpclass-discount-code-edit-admin-page.phpclass-discount-code-list-admin-page.phpclass-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-list-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-list-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-jobs-list-admin-page.phpclass-list-admin-page.phpclass-membership-edit-admin-page.phpclass-membership-list-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-payment-list-admin-page.phpclass-placeholders-admin-page.phpclass-product-edit-admin-page.phpclass-product-list-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-shortcodes-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-admin-page.phpclass-system-info-admin-page.phpclass-tax-rates-admin-page.phpclass-template-previewer-customize-admin-page.phpclass-top-admin-nav-menu.phpclass-view-logs-admin-page.phpclass-webhook-edit-admin-page.phpclass-webhook-list-admin-page.phpclass-wizard-admin-page.php
customer-panel
class-account-admin-page.phpclass-add-new-site-admin-page.phpclass-checkout-admin-page.phpclass-my-sites-admin-page.phpclass-template-switching-admin-page.php
debug
api
builders
block-editor
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
class-admin-notices.phpclass-admin-themes-compatibility.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-autoloader.phpclass-cron.phpclass-current.phpclass-dashboard-statistics.phpclass-dashboard-widgets.phpclass-documentation.phpclass-domain-mapping.phpclass-faker.phpclass-geolocation.phpclass-helper.phpclass-hooks.phpclass-license.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-newsletter.phpclass-requirements.phpclass-scripts.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-user-switching.phpclass-views.phpclass-whitelabel.phpclass-wp-ultimo.phpsignup-fields
class-base-signup-field.phpclass-signup-field-billing-address.phpclass-signup-field-checkbox.phpclass-signup-field-color.phpclass-signup-field-discount-code.phpclass-signup-field-email.phpclass-signup-field-hidden.phpclass-signup-field-order-bump.phpclass-signup-field-order-summary.phpclass-signup-field-password.phpclass-signup-field-payment.phpclass-signup-field-period-selection.phpclass-signup-field-pricing-table.phpclass-signup-field-products.phpclass-signup-field-select.phpclass-signup-field-shortcode.phpclass-signup-field-site-title.phpclass-signup-field-site-url.phpclass-signup-field-steps.phpclass-signup-field-submit-button.phpclass-signup-field-template-selection.phpclass-signup-field-terms-of-use.phpclass-signup-field-text.phpclass-signup-field-username.php
field-templates
class-base-field-template.php
order-bump
order-summary
period-selection
pricing-table
steps
class-clean-steps-field-template.phpclass-legacy-steps-field-template.phpclass-minimal-steps-field-template.php
template-selection
compat
class-as-admin-view.phpclass-discount-code-compat.phpclass-domain-mapping-compat.phpclass-elementor-compat.phpclass-general-compat.phpclass-gutenberg-support.phpclass-legacy-shortcodes.phpclass-multiple-accounts-compat.phpclass-product-compat.php
contracts
country
class-country-br.phpclass-country-ca.phpclass-country-cn.phpclass-country-de.phpclass-country-default.phpclass-country-es.phpclass-country-fr.phpclass-country-gb.phpclass-country-in.phpclass-country-jp.phpclass-country-mx.phpclass-country-my.phpclass-country-ne.phpclass-country-nl.phpclass-country-ru.phpclass-country-sg.phpclass-country-tr.phpclass-country-us.phpclass-country-za.phpclass-country.php
database
broadcasts
checkout-forms
class-checkout-form-query.phpclass-checkout-forms-meta-table.phpclass-checkout-forms-schema.phpclass-checkout-forms-table.php
customers
class-customer-query.phpclass-customers-meta-table.phpclass-customers-schema.phpclass-customers-table.php
discount-codes
class-discount-code-query.phpclass-discount-codes-meta-table.phpclass-discount-codes-schema.phpclass-discount-codes-table.php
domains
emails
engine
class-base.phpclass-column.phpclass-compare.phpclass-date.phpclass-enum.phpclass-meta.phpclass-query.phpclass-row.phpclass-schema.phpclass-table.php
events
memberships
class-membership-query.phpclass-membership-status.phpclass-memberships-meta-table.phpclass-memberships-schema.phpclass-memberships-table.php
payments
class-payment-query.phpclass-payment-status.phpclass-payments-meta-table.phpclass-payments-schema.phpclass-payments-table.php
posts
products
class-product-query.phpclass-product-type.phpclass-products-meta-table.phpclass-products-schema.phpclass-products-table.php
sites
class-site-query.phpclass-site-type.phpclass-sites-meta-table.phpclass-sites-schema.phpclass-sites-table.php
webhooks
debug
deprecated
development
domain-mapping
duplication
exception
functions
admin.phparray-helpers.phpassets.phpbroadcast.phpcheckout-form.phpcheckout.phpcolor.phpcountries.phpcurrency.phpcustomer.phpdanger.phpdate.phpdebug.phpdiscount-code.phpdocumentation.phpdomain.phpelement.phpemail.phpenv.phpevent.phpfinancial.phpform.phpfs.phpgateway.phpgenerator.phpgeolocation.phphelper.phphttp.phpinvoice.phplegacy.phplimitations.phpmarkup-helpers.phpmembership.phpmock.phpmodel.phpnumber-helpers.phpoptions.phppages.phppayment.phpproduct.phpreflection.phprest.phpscheduler.phpsession.phpsettings.phpsite-context.phpsite.phpsort.phpstring-helpers.phpsunrise.phptax.phptemplate.phptranslation.phpurl.phpuser.phpwebhook.php
gateways
class-base-gateway.phpclass-base-stripe-gateway.phpclass-free-gateway.phpclass-ignorable-exception.phpclass-manual-gateway.phpclass-paypal-gateway.phpclass-stripe-checkout-gateway.phpclass-stripe-gateway.php
helpers
class-arr.phpclass-hash.phpclass-screenshot.phpclass-sender.phpclass-site-duplicator.phpclass-validator.phpclass-wp-config.php
validation-rules
installers
class-base-installer.phpclass-core-installer.phpclass-default-content-installer.phpclass-migrator.php
integrations
host-providers
class-base-host-provider.phpclass-closte-host-provider.phpclass-cloudflare-host-provider.phpclass-cloudways-host-provider.phpclass-cpanel-host-provider.phpclass-gridpane-host-provider.phpclass-runcloud-host-provider.phpclass-serverpilot-host-provider.phpclass-wpengine-host-provider.phpclass-wpmudev-host-provider.php
cpanel-api
internal
invoices
limitations
class-limit-customer-user-role.phpclass-limit-disk-space.phpclass-limit-domain-mapping.phpclass-limit-plugins.phpclass-limit-post-types.phpclass-limit-site-templates.phpclass-limit-sites.phpclass-limit-subtype.phpclass-limit-themes.phpclass-limit-users.phpclass-limit-visits.phpclass-limit.php
limits
class-customer-user-role-limits.phpclass-disk-space-limits.phpclass-plugin-limits.phpclass-post-type-limits.phpclass-site-template-limits.phpclass-theme-limits.phpclass-trial-limits.php
list-tables
class-base-list-table.phpclass-broadcast-list-table.phpclass-checkout-form-list-table.phpclass-customer-list-table.phpclass-customers-membership-list-table.phpclass-customers-payment-list-table.phpclass-customers-site-list-table.phpclass-discount-code-list-table.phpclass-domain-list-table.phpclass-email-list-table.phpclass-event-list-table.phpclass-inside-events-list-table.phpclass-line-item-list-table.phpclass-membership-line-item-list-table.phpclass-membership-list-table-widget.phpclass-membership-list-table.phpclass-memberships-site-list-table.phpclass-payment-line-item-list-table.phpclass-payment-list-table-widget.phpclass-payment-list-table.phpclass-product-list-table.phpclass-site-customer-list-table.phpclass-site-list-table.phpclass-sites-domain-list-table.phpclass-webhook-list-table.php
customer-panel
loaders
managers
class-base-manager.phpclass-block-manager.phpclass-broadcast-manager.phpclass-cache-manager.phpclass-checkout-form-manager.phpclass-customer-manager.phpclass-discount-code-manager.phpclass-domain-manager.phpclass-email-manager.phpclass-event-manager.phpclass-field-templates-manager.phpclass-form-manager.phpclass-gateway-manager.phpclass-job-manager.phpclass-limitation-manager.phpclass-membership-manager.phpclass-notes-manager.phpclass-notification-manager.phpclass-payment-manager.phpclass-product-manager.phpclass-signup-fields-manager.phpclass-site-manager.phpclass-visits-manager.phpclass-webhook-manager.php
models
class-base-model.phpclass-broadcast.phpclass-checkout-form.phpclass-customer.phpclass-discount-code.phpclass-domain.phpclass-email.phpclass-event.phpclass-membership.phpclass-payment.phpclass-post-base-model.phpclass-product.phpclass-site.phpclass-webhook.php
traits
objects
site-templates
sso
tax
traits
trait-singleton.phptrait-wp-ultimo-coupon-deprecated.phptrait-wp-ultimo-deprecated.phptrait-wp-ultimo-plan-deprecated.phptrait-wp-ultimo-settings-deprecated.phptrait-wp-ultimo-site-deprecated.phptrait-wp-ultimo-subscription-deprecated.php
ui
class-account-summary-element.phpclass-base-element.phpclass-billing-info-element.phpclass-checkout-element.phpclass-current-membership-element.phpclass-current-site-element.phpclass-domain-mapping-element.phpclass-field.phpclass-form.phpclass-invoices-element.phpclass-jumper.phpclass-limits-element.phpclass-login-form-element.phpclass-my-sites-element.phpclass-payment-methods-element.phpclass-simple-text-element.phpclass-site-actions-element.phpclass-site-maintenance-element.phpclass-template-previewer.phpclass-template-switching-element.phpclass-thank-you-element.phpclass-toolbox.phpclass-tours.php
updater
tests
Admin_Pages
Gateway_Functions_Test.phpWP_Ultimo
WP_Ultimo_Test.phpbootstrap.phpviews
about.phpadmin-notices.php
wp-multisite-waas.phpadmin-pages
fields
field-code-editor.phpfield-color-picker.phpfield-dashicon.phpfield-group.phpfield-header.phpfield-hidden.phpfield-html.phpfield-image.phpfield-link.phpfield-multiselect.phpfield-note.phpfield-repeater.phpfield-select-icon.phpfield-select.phpfield-small-header.phpfield-submit.phpfield-tab-select.phpfield-text-display.phpfield-text-edit.phpfield-text.phpfield-textarea.phpfield-toggle.phpfield-wp-editor.phpform.php
partials
base
centered.php
checkout-forms
customers
dash.phpedit.phpedit
empty-state.phpfilter.phpgrid.phplist.phpproducts
responsive-table-row.phpsettings.phpsites
wizard.phpwizard
broadcast
checkout
confirmation.php
fields
field-checkbox-multi.phpfield-checkbox.phpfield-group.phpfield-hidden.phpfield-html.phpfield-note.phpfield-password.phpfield-payment-methods.phpfield-products.phpfield-radio.phpfield-select.phpfield-submit.phpfield-text.phpfield-toggle.phpform.php
form.phppartials
partials
paypal
register.phptemplates
order-bump
order-summary
period-selection
pricing-table
steps
template-selection
customers
dashboard-statistics
filter.phpwidget-countries.phpwidget-forms.phpwidget-most-visited-sites.phpwidget-mrr-growth.phpwidget-new-accounts.phpwidget-revenue.phpwidget-tax-by-code.phpwidget-tax-by-day.phpwidget-tax-graph.phpwidget-taxes.php
dashboard-widgets
account-summary.phpactivity-stream.phpbilling-info.phpcurrent-membership-product-details.phpcurrent-membership.phpcurrent-site.phpdomain-mapping.phpfirst-steps.phpinvoices.phplimits-and-quotas.phplogin-additional-forms.phplogin-form.phpmy-sites.phpsimple-text.phpsite-actions.phpsite-maintenance.phpsummary.phpthank-you.php
domain
dynamic-styles
emails
admin
customer
events
invoice
legacy
signup
limitations
memberships
payments
settings
fields
shortcodes
sites
system-info
taxes
ui
branding
container-toggle.phpjumper-trigger.phpjumper.phpselectize-templates.phptemplate-previewer.phptoolbox.phpwizards
File diff suppressed because it is too large
Load Diff
@@ -38,16 +38,13 @@ class Checkout_Pages {
|
||||
add_filter('lostpassword_redirect', array($this, 'filter_lost_password_redirect'));
|
||||
|
||||
if (is_main_site()) {
|
||||
|
||||
add_action('before_signup_header', array($this, 'redirect_to_registration_page'));
|
||||
|
||||
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
|
||||
|
||||
if (!$use_custom_login) {
|
||||
|
||||
if ( ! $use_custom_login) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
add_filter('login_url', array($this, 'filter_login_url'), 10, 3);
|
||||
|
||||
@@ -73,10 +70,8 @@ class Checkout_Pages {
|
||||
add_action('post_submitbox_misc_actions', array($this, 'render_compat_mode_setting'));
|
||||
|
||||
add_action('save_post', array($this, 'handle_compat_mode_setting'));
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end init;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the lost password redirect URL.
|
||||
@@ -85,17 +80,14 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function filter_lost_password_redirect(string $redirect_to): string {
|
||||
|
||||
if (!empty($redirect_to)) {
|
||||
|
||||
if ( ! empty($redirect_to)) {
|
||||
return $redirect_to;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$redirect_to = add_query_arg('checkemail', 'confirm', wp_login_url());
|
||||
|
||||
return $redirect_to;
|
||||
|
||||
} // end filter_lost_password_redirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the compat mode option for pages and posts.
|
||||
@@ -127,8 +119,7 @@ class Checkout_Pages {
|
||||
<?php
|
||||
|
||||
// phpcs:enable
|
||||
|
||||
} // end render_compat_mode_setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles saving the compat mode switch on posts.
|
||||
@@ -141,34 +132,23 @@ class Checkout_Pages {
|
||||
public function handle_compat_mode_setting($post_id) {
|
||||
|
||||
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!isset($_POST['_wu_force_compat']) || !wp_verify_nonce($_POST['_wu_force_compat'], '_wu_force_compat_' . $post_id)) {
|
||||
|
||||
if ( ! isset($_POST['_wu_force_compat']) || ! wp_verify_nonce($_POST['_wu_force_compat'], '_wu_force_compat_' . $post_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!current_user_can('edit_post', $post_id)) {
|
||||
|
||||
if ( ! current_user_can('edit_post', $post_id)) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($_POST['_wu_force_elements_loading'])) {
|
||||
|
||||
update_post_meta($post_id, '_wu_force_elements_loading', $_POST['_wu_force_elements_loading']);
|
||||
|
||||
} else {
|
||||
|
||||
delete_post_meta($post_id, '_wu_force_elements_loading');
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end handle_compat_mode_setting;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace wp-login.php in email URLs.
|
||||
@@ -184,24 +164,19 @@ class Checkout_Pages {
|
||||
* wp-login.php in it to begin with.
|
||||
*/
|
||||
if (strpos($url, 'wp-login.php') === false) {
|
||||
|
||||
return $url;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$post_id = wu_get_setting('default_login_page', 0);
|
||||
|
||||
$post = get_post($post_id);
|
||||
|
||||
if ($post) {
|
||||
|
||||
$url = str_replace('wp-login.php', $post->post_name, $url);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
||||
} // end maybe_change_wp_login_on_urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an error message.
|
||||
@@ -215,11 +190,11 @@ class Checkout_Pages {
|
||||
public function get_error_message($error_code, $username = '') {
|
||||
|
||||
$messages = array(
|
||||
'incorrect_password' => sprintf(__( '<strong>Error:</strong> The password you entered is incorrect.', 'wp-ultimo')),
|
||||
'incorrect_password' => sprintf(__('<strong>Error:</strong> 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.'),
|
||||
'confirm' => sprintf(__('Check your email for the confirmation link, then visit the <a href="%s">login page</a>.'), wp_login_url()),
|
||||
'registered' => sprintf(__( 'Registration complete. Please check your email, then visit the <a href="%s">login page</a>.' ), wp_login_url()),
|
||||
'registered' => sprintf(__('Registration complete. Please check your email, then visit the <a href="%s">login page</a>.'), wp_login_url()),
|
||||
'loggedout' => __('You are now logged out.'),
|
||||
'registerdisabled' => __('<strong>Error:</strong> User registration is currently not allowed.'),
|
||||
'empty_username' => __('<strong>Error:</strong> The username field is empty.'),
|
||||
@@ -243,8 +218,7 @@ class Checkout_Pages {
|
||||
$messages = apply_filters('wu_checkout_pages_error_messages', $messages);
|
||||
|
||||
return wu_get_isset($messages, $error_code, __('Something went wrong', 'wp-ultimo'));
|
||||
|
||||
} // end get_error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle password reset errors.
|
||||
@@ -260,20 +234,20 @@ class Checkout_Pages {
|
||||
public function maybe_handle_password_reset_errors($errors) {
|
||||
|
||||
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());
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'action' => wu_request('action', ''),
|
||||
'user_login' => wu_request('user_login', ''),
|
||||
'error' => $errors->get_error_code(),
|
||||
),
|
||||
wp_login_url()
|
||||
);
|
||||
|
||||
wp_redirect($url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end maybe_handle_password_reset_errors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe redirects users to the confirm screen.
|
||||
@@ -289,14 +263,11 @@ class Checkout_Pages {
|
||||
public function maybe_redirect_to_confirm_screen() {
|
||||
|
||||
if (wu_request('redirect_to')) {
|
||||
|
||||
wp_redirect(wu_request('redirect_to'));
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end maybe_redirect_to_confirm_screen;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the reset password link, if necessary.
|
||||
@@ -311,11 +282,9 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function replace_reset_password_link($message, $key, $user_login, $user_data) {
|
||||
|
||||
if (!is_main_site()) {
|
||||
|
||||
if ( ! is_main_site()) {
|
||||
return $message;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
@@ -330,28 +299,27 @@ 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());
|
||||
$new_url = add_query_arg(
|
||||
array(
|
||||
'action' => 'rp',
|
||||
'key' => $key,
|
||||
'login' => rawurlencode($user_login),
|
||||
'wp_lang' => $locale,
|
||||
),
|
||||
wp_login_url()
|
||||
);
|
||||
|
||||
$new_url = set_url_scheme($new_url, null);
|
||||
|
||||
$message = str_replace($results[0], $new_url, $message);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($switched_locale) {
|
||||
|
||||
restore_previous_locale();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
||||
} // end replace_reset_password_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect logged users when they reach the login page.
|
||||
@@ -363,25 +331,19 @@ class Checkout_Pages {
|
||||
|
||||
global $post;
|
||||
|
||||
if (!is_user_logged_in()) {
|
||||
|
||||
if ( ! is_user_logged_in()) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$custom_login_page = $this->get_signup_page('login');
|
||||
|
||||
if (empty($custom_login_page) || empty($post)) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($custom_login_page->ID !== $post->ID) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an exclusion list of parameters that prevent the auto-redirect.
|
||||
@@ -392,24 +354,26 @@ class Checkout_Pages {
|
||||
* @since 2.0.4
|
||||
* @return array
|
||||
*/
|
||||
$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);
|
||||
$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
|
||||
);
|
||||
|
||||
foreach ($exclusion_list as $exclusion_param) {
|
||||
|
||||
if (wu_request($exclusion_param, null) !== null) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
$user = wp_get_current_user();
|
||||
|
||||
@@ -418,34 +382,23 @@ class Checkout_Pages {
|
||||
$redirect_to = $active_blog ? get_admin_url($active_blog->blog_id) : false;
|
||||
|
||||
if (isset($_GET['redirect_to'])) {
|
||||
|
||||
$redirect_to = $_GET['redirect_to'];
|
||||
|
||||
} elseif (is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin($user->ID)) {
|
||||
|
||||
} elseif (is_multisite() && ! get_active_blog_for_user($user->ID) && ! is_super_admin($user->ID)) {
|
||||
$redirect_to = user_admin_url();
|
||||
|
||||
} elseif (is_multisite() && !$user->has_cap('read')) {
|
||||
|
||||
} elseif (is_multisite() && ! $user->has_cap('read')) {
|
||||
$redirect_to = get_dashboard_url($user->ID);
|
||||
|
||||
} elseif (!$user->has_cap('edit_posts')) {
|
||||
|
||||
} elseif ( ! $user->has_cap('edit_posts')) {
|
||||
$redirect_to = $user->has_cap('read') ? admin_url('profile.php') : home_url();
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!$redirect_to) {
|
||||
|
||||
if ( ! $redirect_to) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
wp_redirect($redirect_to);
|
||||
|
||||
exit;
|
||||
|
||||
} // end maybe_redirect_to_admin_panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the unverified email account error message.
|
||||
@@ -460,7 +413,6 @@ class Checkout_Pages {
|
||||
public function add_verify_email_notice($payment, $membership, $customer) {
|
||||
|
||||
if ($payment->get_total() == 0 && $customer->get_email_verification() === 'pending') {
|
||||
|
||||
$html = '<div class="wu-p-4 wu-bg-yellow-200 wu-mb-2 wu-text-yellow-700 wu-rounded">%s</div>';
|
||||
|
||||
$message = __('Your email address is not yet verified. Your site <strong>will only be activated</strong> after your email address is verified. Check your inbox and verify your email address.', 'wp-ultimo');
|
||||
@@ -468,10 +420,8 @@ class Checkout_Pages {
|
||||
$message .= sprintf('<br><a href="#" class="wu-resend-verification-email wu-text-gray-700">%s</a>', __('Resend verification email →', 'wp-ultimo'));
|
||||
|
||||
printf($html, $message);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end add_verify_email_notice;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should obfuscate the login URL.
|
||||
@@ -483,44 +433,33 @@ class Checkout_Pages {
|
||||
|
||||
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
|
||||
|
||||
if (!$use_custom_login) {
|
||||
|
||||
if ( ! $use_custom_login) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_request('interim-login')) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_request('action') === 'logout') {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$new_login_url = $this->get_page_url('login');
|
||||
|
||||
if (!$new_login_url) {
|
||||
|
||||
if ( ! $new_login_url) {
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$should_obfuscate = wu_get_setting('obfuscate_original_login_url', 1);
|
||||
|
||||
$bypass_obfuscation = wu_request('wu_bypass_obfuscation');
|
||||
|
||||
if ($should_obfuscate && !$bypass_obfuscation) {
|
||||
|
||||
if ($should_obfuscate && ! $bypass_obfuscation) {
|
||||
status_header(404);
|
||||
|
||||
nocache_headers();
|
||||
@@ -529,19 +468,15 @@ class Checkout_Pages {
|
||||
|
||||
$wp_query->set_404();
|
||||
|
||||
include(get_404_template());
|
||||
include get_404_template();
|
||||
|
||||
die;
|
||||
|
||||
} else {
|
||||
|
||||
wp_redirect($new_login_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end maybe_obfuscate_login_url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects the customers to the registration page, when one is used.
|
||||
@@ -554,14 +489,11 @@ class Checkout_Pages {
|
||||
$registration_url = $this->get_page_url('register');
|
||||
|
||||
if ($registration_url) {
|
||||
|
||||
wp_redirect($registration_url);
|
||||
|
||||
exit;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end redirect_to_registration_page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the login URL if necessary.
|
||||
@@ -578,19 +510,15 @@ class Checkout_Pages {
|
||||
/**
|
||||
* Fix incompatibility with UIPress, making sure we only filter after wp_loaded ran.
|
||||
*/
|
||||
if (!did_action('wp_loaded')) {
|
||||
|
||||
if ( ! did_action('wp_loaded')) {
|
||||
return $login_url;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$function_caller = wu_get_function_caller(5);
|
||||
|
||||
if ($function_caller === 'wp_auth_check_html') {
|
||||
|
||||
return $login_url;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$params = array();
|
||||
|
||||
@@ -600,33 +528,24 @@ class Checkout_Pages {
|
||||
|
||||
$new_login_url = $this->get_page_url('login');
|
||||
|
||||
if (!$new_login_url) {
|
||||
|
||||
if ( ! $new_login_url) {
|
||||
return $login_url;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($params) {
|
||||
|
||||
$new_login_url = add_query_arg($params, $new_login_url);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($redirect) {
|
||||
|
||||
$new_login_url = add_query_arg('redirect_to', urlencode( $redirect ), $new_login_url);
|
||||
|
||||
} // end if;
|
||||
$new_login_url = add_query_arg('redirect_to', urlencode($redirect), $new_login_url);
|
||||
}
|
||||
|
||||
if ($force_reauth) {
|
||||
|
||||
$new_login_url = add_query_arg('reauth', 1, $new_login_url);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $new_login_url;
|
||||
|
||||
} // end filter_login_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the pages being used for each WP Multisite WaaS purpose.
|
||||
@@ -643,52 +562,45 @@ class Checkout_Pages {
|
||||
'block_frontend' => wu_get_setting('default_block_frontend_page', false),
|
||||
'new_site' => wu_get_setting('default_new_site_page', false),
|
||||
);
|
||||
|
||||
} // end get_signup_pages;
|
||||
/**
|
||||
* Returns the WP_Post object for one of the pages.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $page The slug of the page to retrieve.
|
||||
* @return \WP_Post|false
|
||||
*/
|
||||
public function get_signup_page($page) {
|
||||
}
|
||||
/**
|
||||
* Returns the WP_Post object for one of the pages.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $page The slug of the page to retrieve.
|
||||
* @return \WP_Post|false
|
||||
*/
|
||||
public function get_signup_page($page) {
|
||||
|
||||
$pages = $this->get_signup_pages();
|
||||
|
||||
$page_id = wu_get_isset($pages, $page);
|
||||
|
||||
if (!$page_id) {
|
||||
|
||||
if ( ! $page_id) {
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return get_blog_post(wu_get_main_site_id(), $page_id);
|
||||
|
||||
} // end get_signup_page;
|
||||
/**
|
||||
* Returns the URL for a particular page type.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $page_slug The signup page to get.
|
||||
* @return string|false
|
||||
*/
|
||||
public function get_page_url($page_slug = 'login') {
|
||||
}
|
||||
/**
|
||||
* Returns the URL for a particular page type.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $page_slug The signup page to get.
|
||||
* @return string|false
|
||||
*/
|
||||
public function get_page_url($page_slug = 'login') {
|
||||
|
||||
$page = $this->get_signup_page($page_slug);
|
||||
|
||||
if (!$page) {
|
||||
|
||||
if ( ! $page) {
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return wu_switch_blog_and_run(fn() => get_the_permalink($page));
|
||||
|
||||
} // end get_page_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tags the WP Multisite WaaS pages on the main site.
|
||||
@@ -701,11 +613,9 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function add_wp_ultimo_status_annotation($states, $post) {
|
||||
|
||||
if (!is_main_site()) {
|
||||
|
||||
if ( ! is_main_site()) {
|
||||
return $states;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$labels = array(
|
||||
'register' => __('WP Multisite WaaS - Register Page', 'wp-ultimo'),
|
||||
@@ -718,16 +628,13 @@ class Checkout_Pages {
|
||||
$pages = array_map('absint', $this->get_signup_pages());
|
||||
|
||||
if (in_array($post->ID, $pages, true)) {
|
||||
|
||||
$key = array_search($post->ID, $pages, true);
|
||||
|
||||
$states['wp_ultimo_page'] = wu_get_isset($labels, $key);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $states;
|
||||
|
||||
} // end add_wp_ultimo_status_annotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the confirmation page.
|
||||
@@ -740,11 +647,12 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function render_confirmation_page($atts, $content = null) {
|
||||
|
||||
return wu_get_template_contents('checkout/confirmation', array(
|
||||
'errors' => Checkout::get_instance()->errors,
|
||||
'membership' => wu_get_membership_by_hash(wu_request('membership')),
|
||||
));
|
||||
|
||||
} // end render_confirmation_page;
|
||||
|
||||
} // end 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')),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -12,8 +12,8 @@ namespace WP_Ultimo\Checkout;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Database\Payments\Payment_Status;
|
||||
use \WP_Ultimo\Models\Product;
|
||||
use WP_Ultimo\Database\Payments\Payment_Status;
|
||||
use WP_Ultimo\Models\Product;
|
||||
|
||||
/**
|
||||
* Creates an cart with the parameters of the purchase being placed.
|
||||
@@ -291,12 +291,11 @@ class Line_Item implements \JsonSerializable {
|
||||
|
||||
$this->attributes($atts);
|
||||
|
||||
/*
|
||||
* Refresh totals.
|
||||
*/
|
||||
/*
|
||||
* Refresh totals.
|
||||
*/
|
||||
$this->recalculate_totals();
|
||||
|
||||
} // end __construct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through allowed fields and loads them.
|
||||
@@ -308,44 +307,35 @@ class Line_Item implements \JsonSerializable {
|
||||
*/
|
||||
public function attributes($data) {
|
||||
/*
|
||||
* Set type first to allow for overriding the other parameters.
|
||||
*/
|
||||
* Set type first to allow for overriding the other parameters.
|
||||
*/
|
||||
$type = wu_get_isset($data, 'type');
|
||||
|
||||
if ($type) {
|
||||
|
||||
$this->set_type($data['type']);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
/*
|
||||
* Set product first to allow for overriding the other parameters.
|
||||
*/
|
||||
/*
|
||||
* Set product first to allow for overriding the other parameters.
|
||||
*/
|
||||
$product = wu_get_isset($data, 'product');
|
||||
|
||||
if ($product) {
|
||||
|
||||
$this->set_product($data['product']);
|
||||
|
||||
unset($data['product']);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$allowed_attributes = array_keys(get_object_vars($this));
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
if (in_array($key, $allowed_attributes, true)) {
|
||||
|
||||
$this->{$key} = $value;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
$this->id = 'LN_' . strtoupper($this->type) . '_' . $this->hash;
|
||||
|
||||
} // end attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of id
|
||||
@@ -356,8 +346,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_id() {
|
||||
|
||||
return $this->id;
|
||||
|
||||
} // end get_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of type
|
||||
@@ -368,8 +357,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_type() {
|
||||
|
||||
return $this->type;
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of type.
|
||||
@@ -383,42 +371,34 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_type($type) {
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
} // end set_type;
|
||||
/**
|
||||
* Get product associated with this line item.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return \WP_Ultimo\Models\Product|false
|
||||
*/
|
||||
public function get_product() {
|
||||
}
|
||||
/**
|
||||
* Get product associated with this line item.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return \WP_Ultimo\Models\Product|false
|
||||
*/
|
||||
public function get_product() {
|
||||
|
||||
$product = wu_get_product($this->product_id);
|
||||
|
||||
if (!$product) {
|
||||
|
||||
if ( ! $product) {
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($product->is_recurring() && ($this->duration_unit !== $product->get_duration_unit() || $this->duration !== $product->get_duration())) {
|
||||
|
||||
$product_variation = $product->get_as_variation($this->duration, $this->duration_unit);
|
||||
|
||||
/*
|
||||
* Checks if the variation exists before re-setting the product.
|
||||
*/
|
||||
if ($product_variation) {
|
||||
|
||||
$product = $product_variation;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
return $product;
|
||||
|
||||
} // end get_product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set product associated with this line item.
|
||||
@@ -452,8 +432,7 @@ class Line_Item implements \JsonSerializable {
|
||||
$this->tax_category = $product->get_tax_category();
|
||||
|
||||
$this->discountable = true;
|
||||
|
||||
} // end set_product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the taxes value based on the tax_amount and tax_type.
|
||||
@@ -465,8 +444,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function calculate_taxes($sub_total) {
|
||||
|
||||
return wu_get_tax_amount($sub_total, $this->get_tax_rate(), $this->get_tax_type(), false, $this->get_tax_inclusive());
|
||||
|
||||
} // end calculate_taxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the discounts value based on the discount_amount and discount_type.
|
||||
@@ -478,8 +456,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function calculate_discounts($sub_total) {
|
||||
|
||||
return wu_get_tax_amount($sub_total, $this->get_discount_rate(), $this->get_discount_type(), false);
|
||||
|
||||
} // end calculate_discounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate payment totals.
|
||||
@@ -496,30 +473,23 @@ class Line_Item implements \JsonSerializable {
|
||||
$discounted_subtotal = $sub_total - $discounts;
|
||||
|
||||
if ($sub_total > 0 && $discounted_subtotal < 0) {
|
||||
|
||||
$discounted_subtotal = 0;
|
||||
|
||||
$discounts = $sub_total;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$taxes = $this->calculate_taxes($discounted_subtotal);
|
||||
|
||||
if ($this->get_tax_inclusive()) {
|
||||
|
||||
$total = $this->is_tax_exempt() ? $discounted_subtotal - $taxes : $discounted_subtotal;
|
||||
|
||||
} else {
|
||||
|
||||
$total = $this->is_tax_exempt() ? $discounted_subtotal : $discounted_subtotal + $taxes; // tax exclusive
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($this->is_tax_exempt()) {
|
||||
|
||||
$taxes = 0;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$totals = array(
|
||||
'subtotal' => $sub_total,
|
||||
@@ -531,8 +501,7 @@ class Line_Item implements \JsonSerializable {
|
||||
$this->attributes($totals);
|
||||
|
||||
return $this;
|
||||
|
||||
} // end recalculate_totals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quantity of the given product.
|
||||
@@ -543,8 +512,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_quantity() {
|
||||
|
||||
return $this->quantity;
|
||||
|
||||
} // end get_quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set quantity of the given product.
|
||||
@@ -556,8 +524,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_quantity($quantity) {
|
||||
|
||||
$this->quantity = $quantity;
|
||||
|
||||
} // end set_quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit price of the product.
|
||||
@@ -568,8 +535,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_unit_price() {
|
||||
|
||||
return $this->unit_price;
|
||||
|
||||
} // end get_unit_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unit price of the product.
|
||||
@@ -581,8 +547,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_unit_price($unit_price) {
|
||||
|
||||
$this->unit_price = $unit_price;
|
||||
|
||||
} // end set_unit_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tax amount, absolute or percentage.
|
||||
@@ -593,8 +558,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_rate() {
|
||||
|
||||
return $this->tax_rate;
|
||||
|
||||
} // end get_tax_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tax amount, absolute or percentage.
|
||||
@@ -606,8 +570,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_rate($tax_rate) {
|
||||
|
||||
$this->tax_rate = $tax_rate;
|
||||
|
||||
} // end set_tax_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type of the tax, percentage or absolute.
|
||||
@@ -618,8 +581,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_type() {
|
||||
|
||||
return $this->tax_type;
|
||||
|
||||
} // end get_tax_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type of the tax, percentage or absolute.
|
||||
@@ -631,8 +593,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_type($tax_type) {
|
||||
|
||||
$this->tax_type = $tax_type;
|
||||
|
||||
} // end set_tax_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if tax are included in the price or not.
|
||||
@@ -643,8 +604,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_inclusive() {
|
||||
|
||||
return (bool) $this->tax_inclusive;
|
||||
|
||||
} // end get_tax_inclusive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if tax are included in the price or not.
|
||||
@@ -656,8 +616,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_inclusive($tax_inclusive) {
|
||||
|
||||
$this->tax_inclusive = $tax_inclusive;
|
||||
|
||||
} // end set_tax_inclusive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if the line item is tax exempt ot not.
|
||||
@@ -668,8 +627,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function is_tax_exempt() {
|
||||
|
||||
return $this->tax_exempt;
|
||||
|
||||
} // end is_tax_exempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the line item is tax exempt ot not.
|
||||
@@ -681,8 +639,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_exempt($tax_exempt) {
|
||||
|
||||
$this->tax_exempt = $tax_exempt;
|
||||
|
||||
} // end set_tax_exempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount, in currency, of the tax.
|
||||
@@ -693,8 +650,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_total() {
|
||||
|
||||
return $this->tax_total;
|
||||
|
||||
} // end get_tax_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount, in currency, of the tax.
|
||||
@@ -706,8 +662,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_total($tax_total) {
|
||||
|
||||
$this->tax_total = $tax_total;
|
||||
|
||||
} // end set_tax_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of total
|
||||
@@ -718,8 +673,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_total() {
|
||||
|
||||
return $this->total;
|
||||
|
||||
} // end get_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of total.
|
||||
@@ -731,8 +685,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_total($total) {
|
||||
|
||||
$this->total = $total;
|
||||
|
||||
} // end set_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of recurring.
|
||||
@@ -743,8 +696,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function is_recurring() {
|
||||
|
||||
return $this->recurring;
|
||||
|
||||
} // end is_recurring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of recurring.
|
||||
@@ -756,8 +708,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_recurring($recurring) {
|
||||
|
||||
$this->recurring = $recurring;
|
||||
|
||||
} // end set_recurring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value before taxes, discounts, fees and etc.
|
||||
@@ -768,8 +719,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_subtotal() {
|
||||
|
||||
return $this->subtotal;
|
||||
|
||||
} // end get_subtotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value before taxes, discounts, fees and etc.
|
||||
@@ -781,8 +731,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_subtotal($subtotal) {
|
||||
|
||||
$this->subtotal = $subtotal;
|
||||
|
||||
} // end set_subtotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of duration
|
||||
@@ -793,8 +742,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_duration() {
|
||||
|
||||
return $this->duration;
|
||||
|
||||
} // end get_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of duration.
|
||||
@@ -806,8 +754,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_duration($duration) {
|
||||
|
||||
$this->duration = $duration;
|
||||
|
||||
} // end set_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of duration_unit.
|
||||
@@ -818,8 +765,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_duration_unit() {
|
||||
|
||||
return $this->duration_unit;
|
||||
|
||||
} // end get_duration_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of duration_unit.
|
||||
@@ -831,8 +777,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_duration_unit($duration_unit) {
|
||||
|
||||
$this->duration_unit = $duration_unit;
|
||||
|
||||
} // end set_duration_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of billing_cycles.
|
||||
@@ -843,8 +788,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_billing_cycles() {
|
||||
|
||||
return $this->billing_cycles;
|
||||
|
||||
} // end get_billing_cycles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of billing_cycles.
|
||||
@@ -856,8 +800,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_billing_cycles($billing_cycles) {
|
||||
|
||||
$this->billing_cycles = $billing_cycles;
|
||||
|
||||
} // end set_billing_cycles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of discount_total.
|
||||
@@ -868,8 +811,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_discount_total() {
|
||||
|
||||
return $this->discount_total;
|
||||
|
||||
} // end get_discount_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of discount_total.
|
||||
@@ -881,8 +823,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_discount_total($discount_total) {
|
||||
|
||||
$this->discount_total = $discount_total;
|
||||
|
||||
} // end set_discount_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of tax_category.
|
||||
@@ -893,8 +834,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_category() {
|
||||
|
||||
return $this->tax_category;
|
||||
|
||||
} // end get_tax_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of tax_category.
|
||||
@@ -906,8 +846,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_category($tax_category) {
|
||||
|
||||
$this->tax_category = $tax_category;
|
||||
|
||||
} // end set_tax_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of discountable.
|
||||
@@ -918,8 +857,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function is_discountable() {
|
||||
|
||||
return $this->discountable;
|
||||
|
||||
} // end is_discountable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of discountable.
|
||||
@@ -931,8 +869,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_discountable($discountable) {
|
||||
|
||||
$this->discountable = $discountable;
|
||||
|
||||
} // end set_discountable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of taxable.
|
||||
@@ -943,8 +880,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function is_taxable() {
|
||||
|
||||
return $this->taxable;
|
||||
|
||||
} // end is_taxable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of taxable.
|
||||
@@ -956,8 +892,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_taxable($taxable) {
|
||||
|
||||
$this->taxable = $taxable;
|
||||
|
||||
} // end set_taxable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of discount_rate.
|
||||
@@ -968,8 +903,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_discount_rate() {
|
||||
|
||||
return $this->discount_rate;
|
||||
|
||||
} // end get_discount_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of discount_rate.
|
||||
@@ -981,8 +915,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_discount_rate($discount_rate) {
|
||||
|
||||
$this->discount_rate = $discount_rate;
|
||||
|
||||
} // end set_discount_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of discount_type.
|
||||
@@ -993,8 +926,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_discount_type() {
|
||||
|
||||
return $this->discount_type;
|
||||
|
||||
} // end get_discount_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of discount_type.
|
||||
@@ -1006,8 +938,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_discount_type($discount_type) {
|
||||
|
||||
$this->discount_type = $discount_type;
|
||||
|
||||
} // end set_discount_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get discount Label.
|
||||
@@ -1018,8 +949,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_discount_label() {
|
||||
|
||||
return $this->discount_label;
|
||||
|
||||
} // end get_discount_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set discount Label.
|
||||
@@ -1031,8 +961,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_discount_label($discount_label) {
|
||||
|
||||
$this->discount_label = $discount_label;
|
||||
|
||||
} // end set_discount_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if we should apply discount to renewals.
|
||||
@@ -1043,8 +972,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function should_apply_discount_to_renewals() {
|
||||
|
||||
return $this->apply_discount_to_renewals;
|
||||
|
||||
} // end should_apply_discount_to_renewals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if we should apply discount to renewals.
|
||||
@@ -1056,8 +984,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_apply_discount_to_renewals($apply_discount_to_renewals) {
|
||||
|
||||
$this->apply_discount_to_renewals = $apply_discount_to_renewals;
|
||||
|
||||
} // end set_apply_discount_to_renewals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of product_id.
|
||||
@@ -1068,8 +995,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_product_id() {
|
||||
|
||||
return $this->product_id;
|
||||
|
||||
} // end get_product_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of product_id.
|
||||
@@ -1081,8 +1007,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_product_id($product_id) {
|
||||
|
||||
$this->product_id = $product_id;
|
||||
|
||||
} // end set_product_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of title
|
||||
@@ -1093,8 +1018,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_title() {
|
||||
|
||||
return $this->title;
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of title.
|
||||
@@ -1106,8 +1030,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_title($title) {
|
||||
|
||||
$this->title = $title;
|
||||
|
||||
} // end set_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of description.
|
||||
@@ -1118,8 +1041,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_description() {
|
||||
|
||||
return $this->description;
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of description.
|
||||
@@ -1131,8 +1053,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_description($description) {
|
||||
|
||||
$this->description = $description;
|
||||
|
||||
} // end set_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get label of the tax applied.
|
||||
@@ -1143,8 +1064,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_tax_label() {
|
||||
|
||||
return $this->tax_label;
|
||||
|
||||
} // end get_tax_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set label of the tax applied.
|
||||
@@ -1156,8 +1076,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_tax_label($tax_label) {
|
||||
|
||||
$this->tax_label = $tax_label;
|
||||
|
||||
} // end set_tax_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount recurring in a human-friendly way.
|
||||
@@ -1167,11 +1086,9 @@ class Line_Item implements \JsonSerializable {
|
||||
*/
|
||||
public function get_recurring_description() {
|
||||
|
||||
if (!$this->is_recurring()) {
|
||||
|
||||
if ( ! $this->is_recurring()) {
|
||||
return '';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$description = sprintf(
|
||||
// translators: %1$s the duration, and %2$s the duration unit (day, week, month, etc)
|
||||
@@ -1181,8 +1098,7 @@ class Line_Item implements \JsonSerializable {
|
||||
);
|
||||
|
||||
return $description;
|
||||
|
||||
} // end get_recurring_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the line item to an array.
|
||||
@@ -1197,8 +1113,7 @@ class Line_Item implements \JsonSerializable {
|
||||
$array['recurring_description'] = $this->get_recurring_description();
|
||||
|
||||
return $array;
|
||||
|
||||
} // end to_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements our on json_decode version of this object. Useful for use in vue.js.
|
||||
@@ -1210,8 +1125,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function jsonSerialize() {
|
||||
|
||||
return $this->to_array();
|
||||
|
||||
} // end jsonSerialize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the database for Line Items across payments.
|
||||
@@ -1225,11 +1139,14 @@ class Line_Item implements \JsonSerializable {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$query = wp_parse_args($query, array(
|
||||
'number' => 100,
|
||||
'date_query' => array(),
|
||||
'payment_status' => false,
|
||||
));
|
||||
$query = wp_parse_args(
|
||||
$query,
|
||||
array(
|
||||
'number' => 100,
|
||||
'date_query' => array(),
|
||||
'payment_status' => false,
|
||||
)
|
||||
);
|
||||
|
||||
$query['date_query']['column'] = 'p.date_created';
|
||||
|
||||
@@ -1241,11 +1158,9 @@ class Line_Item implements \JsonSerializable {
|
||||
|
||||
$status_query_sql = '';
|
||||
|
||||
if ($query['payment_status'] && (new Payment_Status)->is_valid($query['payment_status'])) {
|
||||
|
||||
if ($query['payment_status'] && (new Payment_Status())->is_valid($query['payment_status'])) {
|
||||
$status_query_sql = "AND p.status = '{$query['payment_status']}'";
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// phpcs:disable;
|
||||
$query = $wpdb->prepare("
|
||||
@@ -1266,26 +1181,25 @@ class Line_Item implements \JsonSerializable {
|
||||
$results = $wpdb->get_results($query); // phpcs:ignore
|
||||
|
||||
foreach ($results as &$ln) {
|
||||
|
||||
$copy = $ln;
|
||||
|
||||
$line_items = $ln->line_items;
|
||||
|
||||
$ln = maybe_unserialize($line_items);
|
||||
|
||||
$ln = array_map(function($_ln) use ($copy) {
|
||||
$ln = array_map(
|
||||
function ($_ln) use ($copy) {
|
||||
|
||||
$_ln->date_created = $copy->date_created;
|
||||
$_ln->date_created = $copy->date_created;
|
||||
|
||||
return $_ln;
|
||||
|
||||
}, $ln);
|
||||
|
||||
} // end foreach;
|
||||
return $_ln;
|
||||
},
|
||||
$ln
|
||||
);
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // end get_line_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product slug, if any.
|
||||
@@ -1296,8 +1210,7 @@ class Line_Item implements \JsonSerializable {
|
||||
public function get_product_slug() {
|
||||
|
||||
return $this->product_slug;
|
||||
|
||||
} // end get_product_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the product slug.
|
||||
@@ -1309,7 +1222,5 @@ class Line_Item implements \JsonSerializable {
|
||||
public function set_product_slug($product_slug) {
|
||||
|
||||
$this->product_slug = $product_slug;
|
||||
|
||||
} // end set_product_slug;
|
||||
|
||||
} // end class Line_Item;
|
||||
}
|
||||
}
|
||||
|
@@ -112,8 +112,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_hidden() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
@@ -124,8 +123,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_site_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to user/customer creation or not.
|
||||
@@ -136,8 +134,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field as an array that the form builder can understand.
|
||||
@@ -159,8 +156,7 @@ abstract class Base_Signup_Field {
|
||||
'all_attributes' => $this->get_all_attributes(),
|
||||
'fields' => array($this, 'get_editor_fields'),
|
||||
);
|
||||
|
||||
} // end get_field_as_type_option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the HTML attr array before sending it over to the form.
|
||||
@@ -174,8 +170,7 @@ abstract class Base_Signup_Field {
|
||||
public function get_editor_fields_html_attr($html_attr, $field_name) {
|
||||
|
||||
return $html_attr;
|
||||
|
||||
} // end get_editor_fields_html_attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tabs available for this field.
|
||||
@@ -189,8 +184,7 @@ abstract class Base_Signup_Field {
|
||||
'content',
|
||||
'style',
|
||||
);
|
||||
|
||||
} // end get_tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pre-filled value for the field.
|
||||
@@ -207,20 +201,15 @@ abstract class Base_Signup_Field {
|
||||
$value_session = wu_get_isset($session->get('signup'), $this->attributes['id']);
|
||||
|
||||
if ($value_session) {
|
||||
|
||||
$value = $value_session;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_get_isset($this->attributes, 'from_request') && wu_get_isset($this->attributes, 'id')) {
|
||||
|
||||
$value = wu_request($this->attributes['id'], '');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
} // end get_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the style attributes for the field.
|
||||
@@ -235,24 +224,17 @@ abstract class Base_Signup_Field {
|
||||
$width = (int) wu_get_isset($this->attributes, 'width');
|
||||
|
||||
if ($width) {
|
||||
|
||||
if ($width !== 100) {
|
||||
|
||||
$styles[] = 'float: left';
|
||||
|
||||
$styles[] = sprintf('width: %s%%', $width);
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$styles[] = 'clear: both';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return implode('; ', $styles);
|
||||
|
||||
} // end calculate_style_attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the config values for the current field.
|
||||
@@ -265,8 +247,7 @@ abstract class Base_Signup_Field {
|
||||
public function set_attributes($attributes) {
|
||||
|
||||
$this->attributes = $attributes;
|
||||
|
||||
} // end set_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -277,8 +258,7 @@ abstract class Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default values for the editor fields.
|
||||
@@ -289,8 +269,7 @@ abstract class Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -308,8 +287,7 @@ abstract class Base_Signup_Field {
|
||||
'default',
|
||||
'required',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the editor fields.
|
||||
@@ -327,32 +305,27 @@ 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() ] = array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('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,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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() ] = array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('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,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
foreach ($final_field_list as $key => &$field) {
|
||||
|
||||
$field['html_attr'] = wu_get_isset($field, 'html_attr', array());
|
||||
|
||||
$value = wu_get_isset($attributes, $key, null);
|
||||
@@ -360,13 +333,10 @@ abstract class Base_Signup_Field {
|
||||
$field['default'] = wu_get_isset($this->defaults(), $key, '');
|
||||
|
||||
if ($value === null) {
|
||||
|
||||
$value = $field['default'];
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_get_isset($field['html_attr'], 'data-model')) {
|
||||
|
||||
$model_name = wu_get_isset($field['html_attr'], 'data-model', 'product');
|
||||
|
||||
$models = explode(',', (string) $value);
|
||||
@@ -374,34 +344,29 @@ abstract class Base_Signup_Field {
|
||||
$func_name = "wu_get_{$model_name}";
|
||||
|
||||
if (function_exists($func_name)) {
|
||||
$selected = array_map(
|
||||
function ($id) use ($func_name) {
|
||||
|
||||
$selected = array_map(function($id) use ($func_name) {
|
||||
$model = call_user_func($func_name, absint($id));
|
||||
|
||||
$model = call_user_func($func_name, absint($id));
|
||||
if ( ! $model) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$model) {
|
||||
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
|
||||
return $model->to_search_results();
|
||||
|
||||
}, $models);
|
||||
return $model->to_search_results();
|
||||
},
|
||||
$models
|
||||
);
|
||||
|
||||
$selected = array_filter($selected);
|
||||
|
||||
$field['html_attr']['data-selected'] = json_encode($selected);
|
||||
}
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!is_null($value)) {
|
||||
|
||||
if ( ! is_null($value)) {
|
||||
$field['value'] = $value;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$field['html_attr'] = $this->get_editor_fields_html_attr($field['html_attr'], $field['type']);
|
||||
|
||||
@@ -411,23 +376,22 @@ abstract class Base_Signup_Field {
|
||||
$show_reqs = false;
|
||||
|
||||
if (isset($field['wrapper_html_attr'])) {
|
||||
|
||||
$show_reqs = wu_get_isset($field['wrapper_html_attr'], 'v-show');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tab = wu_get_isset($field, 'tab', 'content');
|
||||
|
||||
$field['wrapper_html_attr'] = array_merge(wu_get_isset($field, 'wrapper_html_attr', array()), array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
|
||||
));
|
||||
|
||||
} // end foreach;
|
||||
$field['wrapper_html_attr'] = array_merge(
|
||||
wu_get_isset($field, 'wrapper_html_attr', array()),
|
||||
array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $final_field_list;
|
||||
|
||||
} // end get_editor_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all the attributes.
|
||||
@@ -449,8 +413,7 @@ abstract class Base_Signup_Field {
|
||||
$field_keys = array_keys($this->get_fields());
|
||||
|
||||
return array_merge($this->default_fields(), $field_keys, $styles);
|
||||
|
||||
} // end get_all_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat the attributes array to avoid reaching the input var limits.
|
||||
@@ -463,8 +426,7 @@ abstract class Base_Signup_Field {
|
||||
public function reduce_attributes($attributes) {
|
||||
|
||||
return $attributes;
|
||||
|
||||
} // end reduce_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of all the default fields available.
|
||||
@@ -608,7 +570,5 @@ abstract class Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end fields_list;
|
||||
|
||||
} // end class Base_Signup_Field;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'billing_address';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Address', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds billing address fields such as country, zip code.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds billing address fields such as country, zip code.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -115,8 +109,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-map1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
return array(
|
||||
'zip_and_country' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -146,8 +138,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -161,8 +152,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
'id' => 'billing_address',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -180,8 +170,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
'value' => true,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a filed alternative.
|
||||
@@ -199,9 +188,12 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
|
||||
$field = $base_field;
|
||||
|
||||
$option_template = sprintf('<option v-for="item in %s" :value="item.code">
|
||||
$option_template = sprintf(
|
||||
'<option v-for="item in %s" :value="item.code">
|
||||
{{ item.name }}
|
||||
</option>', $data_key_name);
|
||||
</option>',
|
||||
$data_key_name
|
||||
);
|
||||
|
||||
$field['type'] = 'select';
|
||||
$field['options_template'] = $option_template;
|
||||
@@ -214,8 +206,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
$field['title'] = sprintf('<span v-html="%s">%s</span>', "labels.$label_key_field", $field['title']);
|
||||
|
||||
return $field;
|
||||
|
||||
} // end build_select_alternative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -235,29 +226,21 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* Checks for an existing customer
|
||||
*/
|
||||
if ($customer) {
|
||||
|
||||
$fields = $customer->get_billing_address()->get_fields($zip_only);
|
||||
|
||||
} else {
|
||||
|
||||
$checkout_form = \WP_Ultimo\Checkout\Checkout::get_instance()->checkout_form;
|
||||
|
||||
$fields = \WP_Ultimo\Objects\Billing_Address::fields($zip_only, $checkout_form);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($fields['billing_country'])) {
|
||||
|
||||
$fields['billing_country']['html_attr'] = array(
|
||||
'v-model' => 'country',
|
||||
);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!$zip_only) {
|
||||
|
||||
if ( ! $zip_only) {
|
||||
if (isset($fields['billing_state'])) {
|
||||
|
||||
$fields['billing_state']['html_attr'] = array(
|
||||
'v-model.lazy' => 'state',
|
||||
);
|
||||
@@ -268,11 +251,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* @since 2.0.11
|
||||
*/
|
||||
$fields['billing_state_select'] = $this->build_select_alternative($fields['billing_state'], 'state_list', 'state_field');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($fields['billing_city'])) {
|
||||
|
||||
$fields['billing_city']['html_attr'] = array(
|
||||
'v-model.lazy' => 'city',
|
||||
);
|
||||
@@ -283,21 +264,15 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* @since 2.0.11
|
||||
*/
|
||||
$fields['billing_city_select'] = $this->build_select_alternative($fields['billing_city'], 'city_list', 'city_field');
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fields as &$field) {
|
||||
|
||||
$field['wrapper_classes'] = trim(wu_get_isset($field, 'wrapper_classes', '') . ' ' . $attributes['element_classes']);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
uasort($fields, 'wu_sort_by_order');
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Billing_Address;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'checkbox';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Checkbox', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a checkout box that can be checked by the customer.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a checkout box that can be checked by the customer.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -115,8 +109,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-check-square';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -130,10 +123,9 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -150,8 +142,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
'save_as',
|
||||
'required',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -162,8 +153,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -182,8 +172,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
'order' => 12,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -197,7 +186,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'checkbox',
|
||||
'id' => $attributes['id'],
|
||||
'name' => $attributes['name'],
|
||||
@@ -207,21 +196,15 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['default_state']) {
|
||||
|
||||
$checkout_fields[$attributes['id']]['html_attr']['checked'] = 'checked';
|
||||
|
||||
} // end if;
|
||||
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$value = $this->get_value();
|
||||
|
||||
if ($value !== '' && (bool) $value === true) {
|
||||
|
||||
$checkout_fields[$attributes['id']]['html_attr']['checked'] = 'checked';
|
||||
|
||||
} // end if;
|
||||
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Checkbox;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'color_picker';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Color', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a color picker field.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a color picker field.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-droplet';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -115,10 +109,9 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -136,8 +129,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -148,8 +140,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -167,8 +158,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
'desc' => __('Set the default value for this color field.', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -197,7 +187,5 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Color;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'discount_code';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Coupon Code', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds an additional field to apply a discount code.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds an additional field to apply a discount code.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-tag1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -118,8 +112,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'placeholder' => '',
|
||||
'default' => '',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -134,8 +127,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -148,8 +140,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'discount_code',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -160,8 +151,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -201,12 +191,10 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'html_attr' => array(
|
||||
'v-model.lazy' => 'discount_code',
|
||||
'v-init:discount_code' => "'{$this->get_value()}'",
|
||||
'v-init:toggle_discount_code' => !empty($this->get_value()),
|
||||
'v-init:toggle_discount_code' => ! empty($this->get_value()),
|
||||
),
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Discount_Code;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Email extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'email';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -41,8 +40,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
*
|
||||
@@ -54,8 +52,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function is_user_field(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -68,8 +65,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Email', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -82,8 +78,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a email address field. This email address will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -96,8 +91,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a email address field. This email address will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -108,8 +102,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-at-sign';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -125,8 +118,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
return array(
|
||||
'display_notices' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -141,8 +133,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -156,8 +147,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'id' => 'email_address',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -179,8 +169,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -195,9 +184,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
$checkout_fields = array();
|
||||
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
if ($attributes['display_notices']) {
|
||||
|
||||
$checkout_fields['login_note'] = array(
|
||||
'type' => 'note',
|
||||
'title' => __('Not you?', 'wp-ultimo'),
|
||||
@@ -207,13 +194,9 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($attributes['display_notices']) {
|
||||
|
||||
$checkout_fields['login_note'] = array(
|
||||
'type' => 'note',
|
||||
'title' => __('Existing customer?', 'wp-ultimo'),
|
||||
@@ -223,8 +206,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields['email_address'] = array(
|
||||
'type' => 'text',
|
||||
@@ -240,12 +222,10 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the login message for users that are not logged in.
|
||||
@@ -273,8 +253,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
<?php // phpcs:enable
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render_existing_customer_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the login message for users that are not logged in.
|
||||
@@ -302,7 +281,5 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render_not_you_customer_message;
|
||||
|
||||
} // end class Signup_Field_Email;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'hidden';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Hidden Field', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a hidden field. This is useful when coupled with the "Fill from the Request" option, to load values from the URL, for example.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a hidden field. This is useful when coupled with the "Fill from the Request" option, to load values from the URL, for example.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-eye-off';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -117,8 +111,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
return array(
|
||||
'from_request' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'id',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -144,8 +136,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -166,8 +157,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'value' => '',
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pre-filled value for the field.
|
||||
@@ -180,14 +170,11 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
$value = parent::get_value();
|
||||
|
||||
if (empty($value)) {
|
||||
|
||||
$value = $this->attributes['fixed_value'];
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
} // end get_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -207,7 +194,5 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'value' => $this->get_value(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Hidden;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -33,8 +33,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'order_bump';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -45,8 +44,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Order Bump', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a product offer that the customer can click to add to the current cart.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a product offer that the customer can click to add to the current cart.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-gift';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -119,8 +113,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
'order_bump_template' => 'simple',
|
||||
'display_product_description' => 0,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -134,8 +127,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
// 'id',
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -148,8 +140,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
return array(
|
||||
'order_bump_template' => 'simple',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -162,8 +153,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('order_bump');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -233,8 +223,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -250,11 +239,9 @@ 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) {
|
||||
|
||||
if ( ! $product) {
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$attributes['product'] = $product;
|
||||
|
||||
@@ -269,7 +256,5 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Order_Bump;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'order_summary';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -42,8 +41,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -56,8 +54,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Order Summary', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -70,8 +67,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a summary table with prices, key subscription dates, discounts, and taxes.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -84,8 +80,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a summary table with prices, key subscription dates, discounts, and taxes.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -96,8 +91,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-dollar-sign';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -114,8 +108,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
'order_summary_template' => 'clean',
|
||||
'table_columns' => 'simple',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -128,8 +121,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -142,8 +134,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'order_summary',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -156,8 +147,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('order_summary');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -176,7 +166,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
'options' => array(
|
||||
'simple' => __('Simplified', 'wp-ultimo'),
|
||||
'full' => __('Display All', 'wp-ultimo'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$editor_fields['order_summary_template'] = array(
|
||||
@@ -206,8 +196,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -225,16 +214,14 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
* Backwards compatibility with previous betas
|
||||
*/
|
||||
if ($attributes['order_summary_template'] === 'simple') {
|
||||
|
||||
$attributes['order_summary_template'] = 'clean';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_class = Field_Templates_Manager::get_instance()->get_template_class('order_summary', $attributes['order_summary_template']);
|
||||
|
||||
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
@@ -245,7 +232,5 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Order_Summary;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'password';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Password', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a password field, with options for enforcing password strength and adding password confirmation field. This password is then used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a password field, with options for enforcing password strength and adding password confirmation field. This password is then used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -115,8 +109,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-lock1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -133,8 +126,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'password_confirm_field' => false,
|
||||
'password_confirm_label' => __('Confirm Password', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -149,8 +141,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -164,8 +155,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'id' => 'password',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -189,8 +179,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'value' => 1,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -205,10 +194,8 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
* Logged in user, bail.
|
||||
*/
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
@@ -231,7 +218,6 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['password_confirm_field']) {
|
||||
|
||||
$checkout_fields['password_conf'] = array(
|
||||
'type' => 'password',
|
||||
'id' => 'password_conf',
|
||||
@@ -249,11 +235,8 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Password;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Gateway_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Gateway_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -33,8 +33,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'payment';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -45,8 +44,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Payment', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds the payment options and the additional fields required to complete a purchase (e.g. credit card field).', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds the payment options and the additional fields required to complete a purchase (e.g. credit card field).', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-credit-card2';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -116,10 +110,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -146,8 +138,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'payment',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -158,8 +149,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -194,8 +184,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
* Checks if we need to add the
|
||||
* auto renew field.
|
||||
*/
|
||||
if (!wu_get_setting('force_auto_renew', 1)) {
|
||||
|
||||
if ( ! wu_get_setting('force_auto_renew', 1)) {
|
||||
$auto_renewable_gateways = Gateway_Manager::get_instance()->get_auto_renewable_gateways();
|
||||
|
||||
$fields['auto_renew'] = array(
|
||||
@@ -212,13 +201,10 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
'wrapper_html_attr' => array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('%s.includes(gateway) && order.should_collect_payment && order.has_recurring', json_encode($auto_renewable_gateways)),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Payment;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'period_selection';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -42,8 +41,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -56,8 +54,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Period Select', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -70,8 +67,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a period selector, that allows customers to switch between different billing periods.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -84,8 +80,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a period selector, that allows customers to switch between different billing periods.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -96,8 +91,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-toggle-right';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -113,8 +107,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
'period_selection_template' => 'clean',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -127,8 +120,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -143,8 +135,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
'name' => __('Plan Duration Switch', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -157,8 +148,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('period_selection');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_template_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -283,8 +273,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -297,14 +286,12 @@ 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_enqueue_script('wu-legacy-signup');
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_class = Field_Templates_Manager::get_instance()->get_template_class('period_selection', $attributes['period_selection_template']);
|
||||
|
||||
@@ -312,7 +299,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'id' => $attributes['id'],
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
@@ -334,7 +321,5 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Period_Selection;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'pricing_table';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -42,8 +41,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -56,8 +54,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Pricing Table', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -70,8 +67,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a pricing table section that customers can use to choose a plan to subscribe to.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -84,8 +80,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a pricing table section that customers can use to choose a plan to subscribe to.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -96,8 +91,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-columns';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -116,8 +110,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
'force_different_durations' => false,
|
||||
'hide_pricing_table_when_pre_selected' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -130,8 +123,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -146,8 +138,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
'name' => __('Plan Selection', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -160,8 +151,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('pricing_table');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_pricing_table_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -242,8 +232,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -256,12 +245,10 @@ 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_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$product_list = explode(',', (string) $attributes['pricing_table_products']);
|
||||
|
||||
@@ -276,10 +263,8 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
* Hide when pre-selected.
|
||||
*/
|
||||
if (wu_should_hide_form_field($attributes)) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_attributes = array(
|
||||
'products' => $products,
|
||||
@@ -294,7 +279,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'id' => $attributes['id'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
@@ -306,7 +291,5 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Pricing_Table;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Products extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'products';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -41,8 +40,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -55,8 +53,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Product', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -69,8 +66,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Hidden field used 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 products manually.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -83,8 +79,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Hidden field used 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 products manually.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -95,8 +90,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-package';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -110,10 +104,9 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -124,8 +117,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -139,8 +131,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
'name' => __('Pre-selected Products', 'wp-ultimo'),
|
||||
'id' => 'products',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -166,8 +157,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -184,22 +174,19 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
$products = explode(',', (string) $attributes['products']);
|
||||
|
||||
foreach ($products as $product_id) {
|
||||
|
||||
$checkout_fields["products[{$product_id}]"] = array(
|
||||
$checkout_fields[ "products[{$product_id}]" ] = array(
|
||||
'type' => 'hidden',
|
||||
'value' => $product_id,
|
||||
'html_attr' => array(
|
||||
'v-bind:name' => "'products[]'",
|
||||
),
|
||||
);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$this->insert_products_in_form($products);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the products in the form.
|
||||
@@ -212,10 +199,8 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
static $added = false;
|
||||
|
||||
if ($added) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$added = true;
|
||||
|
||||
@@ -224,24 +209,23 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
data.products.push(...%s);
|
||||
data.products = data.products.map((value) => parseInt(value) || value);
|
||||
data.products = [...new Set(data.products)];
|
||||
} // end if;
|
||||
}
|
||||
return data;
|
||||
});";
|
||||
|
||||
if (did_action('wu-checkout')) {
|
||||
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function () use ($script, $products) {
|
||||
|
||||
add_action('wp_enqueue_scripts', function() use ($script, $products) {
|
||||
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
|
||||
}, 11);
|
||||
|
||||
} // end insert_products_in_form;
|
||||
|
||||
} // end class Signup_Field_Products;
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
},
|
||||
11
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'select';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Select', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a select field.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a select field.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-list1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -115,10 +109,9 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -137,8 +130,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -149,8 +141,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -237,8 +228,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -253,10 +243,8 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
$options = array();
|
||||
|
||||
foreach ($attributes['options'] as $_option) {
|
||||
|
||||
$options[$_option['key']] = $_option['label'];
|
||||
|
||||
} // end foreach;
|
||||
$options[ $_option['key'] ] = $_option['label'];
|
||||
}
|
||||
|
||||
return array(
|
||||
$attributes['id'] => array(
|
||||
@@ -272,7 +260,5 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
'value' => $this->get_value(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Select;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'shortcode';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -41,8 +40,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -55,8 +53,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Shortcode', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -69,8 +66,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Displays the content of a given WordPress shortcode. Can be useful to inset content from other plugins inside a WP Multisite WaaS checkout form.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -83,8 +79,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Displays the content of a given WordPress shortcode. Can be useful to insert content from other plugins inside a WP Multisite WaaS checkout form.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -95,8 +90,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-terminal';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -110,10 +104,9 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -127,8 +120,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
// 'id',
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -141,8 +133,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
return array(
|
||||
'name' => __('Shortcode', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -160,8 +151,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
'desc' => __('Please, enter the full shortcode, including [].', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -184,7 +174,5 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Shortcode;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'site_title';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
@@ -56,8 +54,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function is_site_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -70,8 +67,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Site Title', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -84,8 +80,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a Site Title field. This value is used to set the site title for the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -98,8 +93,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a Site Title field. This value is used to set the site title for the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -112,8 +106,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-type';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -129,8 +122,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
return array(
|
||||
'auto_generate_site_title' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -145,8 +137,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -160,8 +151,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'id' => 'site_title',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -183,8 +173,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -199,7 +188,6 @@ 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(
|
||||
'type' => 'hidden',
|
||||
@@ -211,11 +199,10 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'id' => 'site_title',
|
||||
'html_attr' => array(
|
||||
'v-bind:value' => 'username',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array(
|
||||
'site_title' => array(
|
||||
@@ -233,7 +220,5 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Site_Title;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'site_url';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -41,8 +40,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
*
|
||||
@@ -51,8 +49,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function is_site_field(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -65,8 +62,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Site URL', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -79,8 +75,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a Site URL field. This is used to set the URL of the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -93,8 +88,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a Site URL field. This is used to set the URL of the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -105,8 +99,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-globe1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -128,8 +121,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'display_field_attachments' => true,
|
||||
'available_domains' => $current_site->domain . PHP_EOL,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -144,8 +136,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -159,8 +150,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'id' => 'site_url',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -246,8 +236,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -263,8 +252,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return apply_filters('wu_get_pricing_table_templates', $templates);
|
||||
|
||||
} // end get_url_preview_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -279,7 +267,6 @@ 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(
|
||||
'type' => 'hidden',
|
||||
@@ -292,8 +279,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'value' => uniqid(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
@@ -316,7 +302,6 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['display_field_attachments']) {
|
||||
|
||||
$checkout_fields['site_url']['classes'] .= ' xs:wu-rounded-none';
|
||||
|
||||
$checkout_fields['site_url']['prefix'] = ' ';
|
||||
@@ -337,11 +322,9 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'is_subdomain',
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($attributes['available_domains'] && $attributes['enable_domain_selection']) {
|
||||
|
||||
$options = $this->get_domain_options($attributes['available_domains']);
|
||||
|
||||
$checkout_fields['site_domain'] = array(
|
||||
@@ -361,11 +344,9 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($attributes['display_url_preview']) {
|
||||
|
||||
$content = wu_get_template_contents('legacy/signup/steps/step-domain-url-preview');
|
||||
|
||||
$checkout_fields['site_url_preview'] = array(
|
||||
@@ -377,12 +358,10 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
/**
|
||||
* Get the domain options.
|
||||
*
|
||||
@@ -397,7 +376,5 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
$domains = array_map(fn($item) => trim((string) $item), $domains);
|
||||
|
||||
return array_combine($domains, $domains);
|
||||
|
||||
} // end get_domain_options;
|
||||
|
||||
} // end class Signup_Field_Site_Url;
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Steps extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'steps';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -42,8 +41,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -56,8 +54,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Steps', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -70,8 +67,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a list of the steps.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -84,8 +80,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a list of the steps.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -96,8 +91,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-filter_1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -113,8 +107,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
return array(
|
||||
'steps_template' => 'clean',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -125,8 +118,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -139,8 +131,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'steps',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -153,8 +144,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('steps');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -192,8 +182,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -206,12 +195,10 @@ 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_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$attributes['steps'] = \WP_Ultimo\Checkout\Checkout::get_instance()->steps;
|
||||
$attributes['current_step'] = \WP_Ultimo\Checkout\Checkout::get_instance()->step_name;
|
||||
@@ -227,7 +214,5 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Steps;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'submit_button';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Submit Button', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a submit button. This is required to finalize single-step checkout forms or to navigate to the next step on multi-step checkout forms.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a submit button. This is required to finalize single-step checkout forms or to navigate to the next step on multi-step checkout forms.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-zap';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -118,8 +112,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
'enable_go_back_button' => false,
|
||||
'back_button_label' => __('← Go Back', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -133,8 +126,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
'id',
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -145,8 +137,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -179,8 +170,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -196,7 +186,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
|
||||
$fields = array();
|
||||
|
||||
$fields[$attributes['id'] . '_errors'] = array(
|
||||
$fields[ $attributes['id'] . '_errors' ] = array(
|
||||
'type' => 'html',
|
||||
'wrapper_classes' => 'wu_submit_button_errors wu-clear-both',
|
||||
'content' => '<span v-cloak class="wu-block wu-bg-red-100 wu-p-2 wu-mb-4" v-html="get_errors().join(' . esc_js(json_encode('<br>')) . ')"></span>',
|
||||
@@ -205,7 +195,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
),
|
||||
);
|
||||
|
||||
$fields[$attributes['id'] . '_group'] = array(
|
||||
$fields[ $attributes['id'] . '_group' ] = array(
|
||||
'type' => 'group',
|
||||
'raw' => true,
|
||||
'default' => array(),
|
||||
@@ -216,14 +206,12 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
$button_wrapper_classes = 'wu_submit_button';
|
||||
|
||||
if ($attributes['enable_go_back_button']) {
|
||||
|
||||
$steps = \WP_Ultimo\Checkout\Checkout::get_instance()->steps;
|
||||
|
||||
$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(
|
||||
if ( ! $is_first_step) {
|
||||
$fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] . '_go_back' ] = array(
|
||||
'type' => 'html',
|
||||
'wrapper_classes' => 'md:wu-w-1/2 wu-box-border wu-float-left wu--mt-4',
|
||||
'id' => $attributes['id'] . '_go_back',
|
||||
@@ -231,12 +219,10 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
$button_wrapper_classes .= ' md:wu-w-1/2 wu-box-border wu-float-left wu-text-right';
|
||||
}
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
$fields[$attributes['id'] . '_group']['fields'][$attributes['id']] = array(
|
||||
$fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] ] = array(
|
||||
'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', '')),
|
||||
@@ -245,15 +231,11 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['enable_go_back_button']) {
|
||||
|
||||
$fields[$attributes['id'] . '_clear'] = array(
|
||||
$fields[ $attributes['id'] . '_clear' ] = array(
|
||||
'type' => 'clear',
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Submit_Button;
|
||||
}
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use \WP_Ultimo\Models\Site;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Models\Site;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -26,15 +26,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'template_selection';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@@ -43,8 +42,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -57,8 +55,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Templates', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -71,8 +68,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a template selection section. This allows the customer to choose a pre-built site to be used as a template for the site being currently created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -85,8 +81,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a template selection section. This allows the customer to choose a pre-built site to be used as a template for the site being currently created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@@ -97,8 +92,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-layout';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -118,8 +112,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'cols' => 3,
|
||||
'hide_template_selection_when_pre_selected' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -148,8 +140,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'name' => __('Template Selection', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@@ -162,8 +153,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('template_selection');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_template_selection_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -223,9 +213,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
'data-max-items' => 999,
|
||||
'data-include' => implode(',', wu_get_site_templates(array(
|
||||
'fields' => 'blog_id',
|
||||
))),
|
||||
'data-include' => implode(
|
||||
',',
|
||||
wu_get_site_templates(
|
||||
array(
|
||||
'fields' => 'blog_id',
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
'v-show' => 'template_selection_type === \'name\'',
|
||||
@@ -272,8 +267,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat the attributes array to avoid reaching the input var limits.
|
||||
@@ -290,8 +284,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$attributes['sites'] = array_values(array_column($array_sites, 'blog_id'));
|
||||
|
||||
return $attributes;
|
||||
|
||||
} // end reduce_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -316,41 +309,33 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
* Hide when pre-selected.
|
||||
*/
|
||||
if (wu_should_hide_form_field($attributes)) {
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
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_enqueue_script('wu-legacy-signup');
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$site_list = $this->site_list($attributes);
|
||||
|
||||
$customer_sites = array();
|
||||
|
||||
if (wu_get_setting('allow_own_site_as_template')) {
|
||||
|
||||
$customer = wu_get_current_customer();
|
||||
|
||||
if ($customer) {
|
||||
|
||||
$customer_sites = $customer->get_sites(array('fields' => 'ids'));
|
||||
|
||||
$site_list = array_merge(
|
||||
$customer_sites,
|
||||
$site_list
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
$sites = array_map('wu_get_site', $site_list);
|
||||
|
||||
@@ -371,15 +356,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
|
||||
$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'] ] = array(
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return site list according to selection type used.
|
||||
@@ -392,19 +376,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$selection_type = wu_get_isset($attributes, 'template_selection_type', 'name');
|
||||
|
||||
if ($selection_type === 'name') {
|
||||
|
||||
return explode(',', $attributes['template_selection_sites']);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($selection_type === 'all') {
|
||||
|
||||
return wu_get_site_templates(array('fields' => 'blog_id'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($selection_type === 'categories') {
|
||||
|
||||
return array_column(
|
||||
\WP_Ultimo\Models\Site::get_all_by_categories(
|
||||
$attributes['template_selection_categories'],
|
||||
@@ -414,12 +393,8 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
),
|
||||
'blog_id'
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return explode(',', $attributes['template_selection_sites']);
|
||||
|
||||
} // end site_list;
|
||||
|
||||
|
||||
} // end class Signup_Field_Template_Selection;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'terms_of_use';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Terms of Use', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a terms and conditions checkbox that must be marked before the account/site can be created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a terms and conditions checkbox that must be marked before the account/site can be created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -115,8 +109,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-file-text';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
return array(
|
||||
'tou_name' => __('I agree with the terms of use.', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -144,8 +136,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -159,8 +150,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
'id' => 'terms_of_use',
|
||||
'name' => __('Terms of Use', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -185,8 +175,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
'placeholder' => __('e.g. https://yoursite.com/terms', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -212,7 +201,5 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Terms_Of_Use;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'text';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -58,8 +56,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Text', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -72,8 +69,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a text field that the customer can fill with arbitrary data.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -86,8 +82,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a text field that the customer can fill with arbitrary data.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -100,8 +95,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-edit-3';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -115,10 +109,9 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -137,8 +130,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -149,8 +141,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -161,8 +152,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -188,7 +178,5 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Text;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -32,8 +32,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'username';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@@ -44,8 +43,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@@ -59,8 +57,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@@ -73,8 +70,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Username', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@@ -87,8 +83,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds an username field. This username will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@@ -101,8 +96,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds an username field. This username will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@@ -115,8 +109,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-user1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@@ -132,8 +125,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
return array(
|
||||
'auto_generate_username' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@@ -148,8 +140,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@@ -163,8 +154,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'id' => 'username',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@@ -186,8 +176,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@@ -202,13 +191,10 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
* Logged in user, bail.
|
||||
*/
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($attributes['auto_generate_username']) && $attributes['auto_generate_username']) {
|
||||
|
||||
return array(
|
||||
'auto_generate_username' => array(
|
||||
'type' => 'hidden',
|
||||
@@ -221,8 +207,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'value' => uniqid(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array(
|
||||
'username' => array(
|
||||
@@ -245,7 +230,5 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Username;
|
||||
}
|
||||
}
|
||||
|
@@ -29,10 +29,10 @@ class Base_Field_Template {
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Field Template Constructor
|
||||
@@ -41,10 +41,9 @@ class Base_Field_Template {
|
||||
*
|
||||
* @param array $attributes The attributes passed to the field.
|
||||
*/
|
||||
public function __construct($attributes = array())
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
} // end __construct;
|
||||
public function __construct($attributes = array()) {
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The render type for the template.
|
||||
@@ -66,8 +65,7 @@ class Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -80,8 +78,7 @@ class Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Field Template', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -94,8 +91,7 @@ class Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Description', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
*
|
||||
@@ -106,8 +102,7 @@ class Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return '';
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -117,7 +112,7 @@ class Base_Field_Template {
|
||||
* @param array $attributes The field template attributes.
|
||||
* @return void
|
||||
*/
|
||||
public function output($attributes) {} // end output;
|
||||
public function output($attributes) {}
|
||||
|
||||
/**
|
||||
* Renders the content.
|
||||
@@ -136,8 +131,7 @@ class Base_Field_Template {
|
||||
$this->output($attributes);
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content on the checkout form as a wrapper.
|
||||
@@ -153,23 +147,15 @@ class Base_Field_Template {
|
||||
public function render_container($attributes, $signup_field = false) {
|
||||
|
||||
if ($this->get_render_type() === 'ajax') {
|
||||
|
||||
if ($signup_field) {
|
||||
|
||||
$attributes = $signup_field->reduce_attributes($attributes);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$markup = sprintf('<dynamic :template="get_template(\'%s\', %s)"></dynamic>', esc_js($this->id), esc_attr(json_encode($attributes)));
|
||||
|
||||
} else {
|
||||
|
||||
$markup = $this->render($attributes);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $markup;
|
||||
|
||||
} // end render_container;
|
||||
|
||||
} // end class Base_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Order_Bump;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Simple
|
||||
@@ -52,8 +52,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Simple', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,10 +102,8 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
/**
|
||||
* Loads the actual order-bump template
|
||||
*/
|
||||
* Loads the actual order-bump template
|
||||
*/
|
||||
wu_get_template('checkout/templates/order-bump/simple', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Simple_Order_Bump_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Order_Summary;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Order Summary Clean
|
||||
@@ -52,8 +52,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,10 +102,8 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
/**
|
||||
* Loads the actual order-summary template
|
||||
*/
|
||||
* Loads the actual order-summary template
|
||||
*/
|
||||
wu_get_template('checkout/templates/order-summary/simple', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Order_Summary_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Period_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@@ -94,8 +91,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -108,7 +104,5 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/period-selection/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Period_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Period_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Multisite WaaS < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@@ -94,8 +91,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -108,7 +104,5 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/period-selection/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Period_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Pricing_Table;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@@ -94,8 +91,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -108,7 +104,5 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/pricing-table/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Pricing_Table_Field_Template;
|
||||
}
|
||||
}
|
||||
|
17
inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php
17
inc/checkout/signup-fields/field-templates/pricing-table/class-list-pricing-table-field-template.php
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Pricing_Table;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Base Field Template
|
||||
@@ -43,8 +43,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Simple List', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -57,8 +56,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Simple stylized list with price, recurrence, and the plan description.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@@ -71,8 +69,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -85,7 +82,5 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/pricing-table/list', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class List_Pricing_Table_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,7 +102,5 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/legacy-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,7 +102,5 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Minimal', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/minimal-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,7 +102,5 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/minimal', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Minimal_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@@ -52,8 +52,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -66,8 +65,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -80,8 +78,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description(): string {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -92,8 +89,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -106,7 +102,5 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Legacy Field Template Selector
|
||||
@@ -41,8 +41,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -55,8 +54,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -69,8 +67,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@@ -83,8 +80,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -97,7 +93,5 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Minimal
|
||||
@@ -41,8 +41,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@@ -55,8 +54,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Minimal', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@@ -69,8 +67,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@@ -81,8 +78,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');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@@ -95,7 +91,5 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/minimal', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Minimal_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user