Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<?php
/**
* Checkbox multi field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php foreach ($field->options as $option_value => $option_name) : ?>
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option_value); ?>">
<input id="field-gateway-<?php echo esc_attr($option_value); ?>" type="checkbox" name="<?php echo esc_attr($field->id); ?>[]" value="<?php echo esc_attr($option_value); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value == $option_value); ?>>
<?php echo $option_name; ?>
</label>
<?php endforeach; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,34 @@
<?php
/**
* Checkbox field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<label class="wu-block wu-my-4" for="field-<?php echo esc_attr($field->id); ?>">
<input id="field-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field->id); ?>" value="1" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value); ?>>
<?php echo $field->title; ?>
<?php echo wu_tooltip($field->tooltip); ?>
<?php echo $field->desc; ?>
</label>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,8 @@
<?php
/**
* Clear field view.
*
* @since 2.0.0
*/
?>
<span class="wu-clear-both wu-block"></span>

View File

@ -0,0 +1,65 @@
<?php
/**
* Group field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<span class="wu-block wu-w-full <?php echo esc_attr($field->classes); ?>">
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php
/**
* Instantiate the form for the order details.
*
* @since 2.0.0
*/
$form = new \WP_Ultimo\UI\Form($field->id, $field->fields, array(
'views' => 'checkout/fields',
'classes' => 'wu-flex wu-my-1',
'field_wrapper_classes' => 'wu-bg-transparent',
'wrap_tag' => 'span',
'step' => (object) array(
'classes' => '',
),
));
$form->render();
/**
* Adds the partial error template.
*
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
<?php if ($field->desc) : ?>
<span class="wu-mt-2 wu-block wu-bg-gray-100 wu-rounded wu-border-solid wu-border-gray-400 wu-border-t wu-border-l wu-border-b wu-border-r wu-text-2xs wu-py-2 wu-p-2">
<?php echo $field->desc; ?>
</span>
<?php endif; ?>
</span>
</div>

View File

@ -0,0 +1,33 @@
<?php
/**
* Hidden field view.
*
* @since 2.0.0
*/
?>
<?php if (is_array($field->value)) : ?>
<?php foreach ($field->value as $index => $value) : ?>
<input id="field-<?php echo esc_attr($field->id).'-'.esc_attr($index); ?>" name="<?php echo esc_attr($field->id); ?>[]" type="<?php echo esc_attr($field->type); ?>" placeholder="<?php echo esc_attr($field->placeholder); ?>" value="<?php echo esc_attr($value); ?>" <?php echo $field->get_html_attributes(); ?>>
<?php endforeach; ?>
<?php else : ?>
<input id="field-<?php echo esc_attr($field->id); ?>" name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" placeholder="<?php echo esc_attr($field->placeholder); ?>" value="<?php echo esc_attr($field->value); ?>" <?php echo $field->get_html_attributes(); ?>>
<?php endif; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>

View File

@ -0,0 +1,53 @@
<?php
/**
* HTML field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<div class="wu-block wu-w-full">
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
/**
* Adds the partial description template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-description', array(
'field' => $field,
));
?>
<div class="wu-block wu-w-full wu-mt-4">
<?php echo $field->content; ?>
</div>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>
</div>

View File

@ -0,0 +1,13 @@
<?php
/**
* Note field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php echo $field->desc; ?>
</div>

View File

@ -0,0 +1,55 @@
<?php
/**
* Password field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<input class="form-control wu-w-full wu-my-1 <?php echo esc_attr(trim($field->classes)); ?>" id="field-<?php echo esc_attr($field->id); ?>" name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" placeholder="<?php echo esc_attr($field->placeholder); ?>" value="<?php echo esc_attr($field->value); ?>" <?php echo $field->get_html_attributes(); ?>>
<?php if ($field->meter) : ?>
<span class="wu-block">
<span id="pass-strength-result" class="wu-py-2 wu-px-4 wu-bg-gray-100 wu-block wu-text-sm">
<?php _e('Strength Meter', 'wp-ultimo'); ?>
</span>
</span>
<?php endif; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
<!--
<div class="wu-border-red-300"></div>
<div class="wu-border-yellow-300"></div>
-->
</div>

View File

@ -0,0 +1,79 @@
<?php
/**
* Payment methods field view.
*
* @since 2.0.0
*/
$active_gateways = wu_get_active_gateway_as_options();
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" v-cloak v-show="order && order.should_collect_payment" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php foreach ($active_gateways as $option_value => $option_name) : ?>
<?php if (count($active_gateways) === 1) : ?>
<input
id="field-gateway"
type="hidden"
name="gateway"
value="<?php echo esc_attr($option_value); ?>"
v-model="gateway"
<?php echo $field->get_html_attributes(); ?>
>
<?php else : ?>
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option_value); ?>">
<input
id="field-gateway-<?php echo esc_attr($option_value); ?>"
type="radio"
name="gateway"
value="<?php echo esc_attr($option_value); ?>"
v-model="gateway"
class="<?php echo trim($field->classes); ?>"
<?php echo $field->get_html_attributes(); ?>
<?php checked($field->value == $option_value); ?>
>
<?php echo $option_name; ?>
</label>
<?php endif; ?>
<?php endforeach; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
/**
* Load Gateway fields
* @since 2.0.0
*/
do_action('wu_checkout_gateway_fields');
?>
</div>

View File

@ -0,0 +1,46 @@
<?php
/**
* Products field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php foreach (wu_get_plans() as $option) : ?>
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option->get_id()); ?>">
<input id="field-products-<?php echo esc_attr($option->get_id()); ?>" type="checkbox" name="products[]" value="<?php echo esc_attr($option->get_id()); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value == $option->get_id()); ?> v-model="products">
<?php echo $option->get_name(); ?>
</label>
<?php endforeach; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,46 @@
<?php
/**
* Radio field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php foreach ($field->options as $option_value => $option_name) : ?>
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option_value); ?>">
<input id="field-gateway-<?php echo esc_attr($option_value); ?>" type="radio" name="<?php echo esc_attr($field->id); ?>" value="<?php echo esc_attr($option_value); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value == $option_value); ?>>
<?php echo $option_name; ?>
</label>
<?php endforeach; ?>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,67 @@
<?php
/**
* Select field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<select
class="form-control wu-w-full wu-my-1 <?php echo esc_attr(trim($field->classes)); ?>"
id="field-<?php echo esc_attr($field->id); ?>"
name="<?php echo esc_attr($field->id); ?>"
value="<?php echo esc_attr($field->value); ?>"
<?php echo $field->get_html_attributes(); ?>
>
<?php if ($field->placeholder) : ?>
<option <?php checked(!$field->value); ?> class="wu-opacity-75"><?php echo $field->placeholder; ?></option>
<?php endif; ?>
<?php foreach ($field->options as $key => $label) : ?>
<option
value="<?php echo esc_attr($key); ?>"
<?php checked($key, $field->value); ?>
>
<?php echo $label; ?>
</option>
<?php endforeach; ?>
<?php if ($field->options_template) : ?>
<?php echo $field->options_template; ?>
<?php endif; ?>
</select>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,16 @@
<?php
/**
* Submit field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<button id="<?php echo esc_attr($field->id); ?>-btn" type="submit" name="<?php echo esc_attr($field->id); ?>-btn" <?php echo $field->get_html_attributes(); ?> class="button <?php echo esc_attr(trim($field->classes)); ?>">
<?php echo $field->title; ?>
</button>
</div>

View File

@ -0,0 +1,60 @@
<?php
/**
* Text field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<?php
/**
* Adds the partial title template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-title', array(
'field' => $field,
));
?>
<?php if ($field->prefix) : ?>
<div class="sm:wu-flex wu-items-stretch wu-content-center">
<div <?php echo wu_array_to_html_attrs($field->prefix_html_attr ?? array()); ?>>
<?php echo $field->prefix; ?>
</div>
<?php endif; ?>
<input class="form-control wu-w-full wu-my-1 <?php echo esc_attr(trim($field->classes)); ?>" id="field-<?php echo esc_attr($field->id); ?>" name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" placeholder="<?php echo esc_attr($field->placeholder); ?>" value="<?php echo esc_attr($field->value); ?>" <?php echo $field->get_html_attributes(); ?>>
<?php if ($field->suffix) : ?>
<div <?php echo wu_array_to_html_attrs($field->suffix_html_attr ?? array()); ?>>
<?php echo $field->suffix; ?>
</div>
<?php endif; ?>
<?php if ($field->prefix || $field->suffix) : ?>
</div>
<?php endif; ?>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,34 @@
<?php
/**
* Checkbox field view.
*
* @since 2.0.0
*/
?>
<div class="<?php echo esc_attr(trim($field->wrapper_classes)); ?>" <?php echo $field->get_wrapper_html_attributes(); ?>>
<label class="wu-block wu-my-4" for="field-<?php echo esc_attr($field->id); ?>">
<input id="field-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field->id); ?>" value="1" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value); ?>>
<?php echo $field->title; ?>
<?php echo wu_tooltip($field->tooltip); ?>
<?php echo $field->desc; ?>
</label>
<?php
/**
* Adds the partial error template.
* @since 2.0.0
*/
wu_get_template('checkout/fields/partials/field-errors', array(
'field' => $field,
));
?>
</div>

View File

@ -0,0 +1,34 @@
<?php
/**
* Form fields view.
*
* @since 2.0.0
*/
?>
<?php if ($form->wrap_in_form_tag) : ?>
<form id="<?php echo esc_attr($form_slug); ?>" method="<?php echo esc_attr($form->method); ?>" <?php echo $form->get_html_attributes(); ?>>
<?php else : ?>
<<?php echo $form->wrap_tag; ?> class="<?php echo esc_attr(trim($form->classes ? $form->classes.' '.$step->classes.' wu-mt-2' : $step->classes.' wu-mt-2')); ?>" <?php echo $form->get_html_attributes(); ?>>
<?php endif; ?>
<?php if ($form->title) : ?>
<h3 class="wu-checkout-section-title"><?php echo $form->title; ?></h3>
<?php endif; ?>
<?php echo $rendered_fields; ?>
<?php if ($form->wrap_in_form_tag) : ?>
</form>
<?php else : ?>
</<?php echo $form->wrap_tag; ?>>
<?php endif; ?>

View File

@ -0,0 +1,13 @@
<?php
/**
* Title field partial view.
*
* @since 2.0.0
*/
?>
<?php if ($field->desc) : ?>
<?php echo $field->desc; ?>
<?php endif; ?>

View File

@ -0,0 +1,14 @@
<?php
/**
* Errors field partial view.
*
* @since 2.0.0
*/
?>
<span
v-cloak
class="wu-block wu-bg-red-100 wu-p-2 wu-mb-4"
v-if="get_error('<?php echo esc_attr($field->id); ?>')"
v-html="get_error('<?php echo esc_attr($field->id); ?>').message"
></span>

View File

@ -0,0 +1,25 @@
<?php
/**
* Title field partial view.
*
* @since 2.0.0
*/
?>
<?php if ($field->title) : ?>
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>">
<?php echo $field->title; ?>
<?php if ($field->required) : ?>
<span class="wu-checkout-required-field wu-text-red-500">*</span>
<?php endif; ?>
<?php echo wu_tooltip($field->tooltip); ?>
</label>
<?php endif; ?>