Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,56 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's agreement box
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $checked bool checked
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/checkbox'
|
||||
* @action After the template: 'us_after_template:templates/form/checkbox'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/checkbox'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$value = isset( $value ) ? trim( $value ) : '1';
|
||||
$checked = ( isset( $checked ) AND $checked ) ? 'checked' : '';
|
||||
$classes .= ' required';
|
||||
$required_atts = 'data-required="true" aria-required="true"';
|
||||
?>
|
||||
<div class="w-form-row for_agreement<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) . ' <span class="required">*</span>' ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars ) ?>
|
||||
<label>
|
||||
<input class="screen-reader-text" type="checkbox" name="<?php echo( ! empty( $name ) ? $name : $field_id ) ?>" <?php echo esc_attr( $checked ) . 'value="' . esc_attr( $value ) . '"' ?> <?php echo $required_atts ?>/>
|
||||
<span class="w-form-checkbox"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'You need to agree with the terms to proceed', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's captcha field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/captcha'
|
||||
* @action After the template: 'us_after_template:templates/form/captcha'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/captcha'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$label = strip_tags( $label, '<a><br><strong>' );
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$numbers = array( rand( 16, 30 ), rand( 1, 15 ) );
|
||||
$sign = rand( 0, 1 );
|
||||
$label .= ' <span>' . implode( $sign ? ' + ' : ' - ', $numbers );
|
||||
$result_hash = md5( ( $numbers[0] + ( $sign ? 1 : - 1 ) * $numbers[1] ) . NONCE_SALT );
|
||||
|
||||
// Always required field
|
||||
$classes .= ' required';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' = ?</span>';
|
||||
}
|
||||
|
||||
$field_atts = 'type="text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' placeholder="' . esc_attr( $placeholder ) . '"';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_captcha<?php echo $classes ?>">
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo $label ?></span>
|
||||
</div>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_captcha_start', $vars ) ?>
|
||||
<input type="hidden" name="<?php echo( ! empty( $name ) ? $name : $field_id ) ?>_hash" value="<?php echo $result_hash ?>" />
|
||||
<?php echo $icon; ?>
|
||||
<input <?php echo $field_atts ?>"/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_captcha_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Enter the equation result to proceed', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's checkboxes
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $description string Field description
|
||||
* @var $required bool Is the field required?
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/checkboxes'
|
||||
* @action After the template: 'us_after_template:templates/form/checkboxes'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/checkboxes'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$required = isset( $required ) ? $required : FALSE;
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", $values ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$field_atts = 'type="checkbox"';
|
||||
$field_atts .= ' class="screen-reader-text"';
|
||||
$field_atts .= ' name="' . $field_id . '[]"';
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= 'data-required="true" aria-required="true"';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_checkboxes<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) . ( $required ? ' <span class="required">*</span>' : '' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
foreach ( $values as $key => $value ) {
|
||||
$value = trim( $value );
|
||||
if ( empty( $value ) ) {
|
||||
continue;
|
||||
}
|
||||
$checkbox_id = $field_id . '_' . ( $key + 1 );
|
||||
?>
|
||||
<label>
|
||||
<input value="<?php echo esc_attr( $value ) ?>" <?php echo $field_atts ?>/>
|
||||
<span class="w-form-checkbox"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's email field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/email'
|
||||
* @action After the template: 'us_after_template:templates/form/email'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/email'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="email"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_email<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php echo us_translate( 'Please enter a valid email address.' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a single form
|
||||
*
|
||||
* @var $type string Form type: 'contact' / 'search' / 'comment' / 'protectedpost' / ...
|
||||
* @var $action string Form action
|
||||
* @var $method string Form method: 'post' / 'get'
|
||||
* @var $fields array Form fields (see any of the fields template header for details)
|
||||
* @var $content string
|
||||
* @var $json_data array Json data to pass to JavaScript
|
||||
* @var $classes string Additional classes to append to form
|
||||
* @var $start_html string HTML to append to the form's start
|
||||
* @var $end_html string HTML to append to the form's end
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/form'
|
||||
* @action After the template: 'us_after_template:templates/form/form'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/form'
|
||||
*/
|
||||
|
||||
// Variables defaults and filtering
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$action = isset( $action ) ? $action : site_url( $_SERVER['REQUEST_URI'] );
|
||||
$method = isset( $method ) ? $method : 'post';
|
||||
$fields = isset( $fields ) ? (array) $fields : array();
|
||||
|
||||
// Repeatable fields IDs start from 1
|
||||
$repeatable_fields = array(
|
||||
'text' => 1,
|
||||
'email' => 1,
|
||||
'textarea' => 1,
|
||||
'select' => 1,
|
||||
'agreement' => 1,
|
||||
'checkboxes' => 1,
|
||||
'radio' => 1,
|
||||
);
|
||||
|
||||
foreach ( $fields as $field_name => $field ) {
|
||||
if ( isset( $field['type'] ) ) {
|
||||
$fields[ $field_name ]['type'] = $field['type'];
|
||||
if ( in_array( $field['type'], array_keys( $repeatable_fields ) ) ) {
|
||||
$fields[ $field_name ]['field_id'] = $repeatable_fields[ $field['type'] ];
|
||||
$repeatable_fields[ $field['type'] ] += 1;
|
||||
}
|
||||
if ( $field['type'] == 'agreement' ) {
|
||||
$field['required'] = 1;
|
||||
}
|
||||
} else {
|
||||
$fields[ $field_name ]['type'] = 'text';
|
||||
}
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
);
|
||||
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
$el_id = isset( $el_id ) ? $el_id : '';
|
||||
$start_html = isset( $start_html ) ? $start_html : '';
|
||||
$end_html = isset( $end_html ) ? $end_html : '';
|
||||
if ( ! empty( $type ) ) {
|
||||
$classes = ' for_' . $type . $classes;
|
||||
}
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$classes .= ' us_form_' . $us_cform_index;
|
||||
?>
|
||||
<div class="w-form<?php echo $classes ?>"<?php echo $el_id ?>>
|
||||
<form class="w-form-h" autocomplete="off" action="<?php echo esc_attr( $action ) ?>" method="<?php echo $method ?>">
|
||||
<?php echo $start_html ?>
|
||||
<?php foreach ( $fields as $field ):
|
||||
if ( isset( $field['type'] ) ) {
|
||||
us_load_template( 'templates/form/' . $field['type'], $field );
|
||||
}
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<div class="w-form-message"></div>
|
||||
<?php echo $end_html ?>
|
||||
</form>
|
||||
<div class="w-form-json hidden"<?php echo us_pass_data_to_js( $json_data ) ?>></div>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's hidden field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $value string Field value
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/hidden'
|
||||
* @action After the template: 'us_after_template:templates/form/hidden'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/hidden'
|
||||
*/
|
||||
|
||||
$name = isset( $label ) ? $label : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
|
||||
?>
|
||||
<input type="hidden" name="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $value ) ?>" />
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's info field
|
||||
*
|
||||
* @var $value string Field value
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/info'
|
||||
* @action After the template: 'us_after_template:templates/form/info'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/info'
|
||||
*/
|
||||
|
||||
$value = isset( $value ) ? trim( $value ) : '';
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
?>
|
||||
<div class="w-form-row for_info<?php echo $classes ?>">
|
||||
<p><?php echo strip_tags( $value, '<a><br><strong>' ) ?></p>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
/**
|
||||
* Output a form's nonce field
|
||||
*
|
||||
* @var $name string Nonce Name
|
||||
* @var $action string Nonce Action
|
||||
*/
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$action = isset( $action ) ? $action : '';
|
||||
|
||||
if ( ! empty( $action ) AND ! empty( $name ) ) {
|
||||
wp_nonce_field( $action, $name );
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's password field
|
||||
*
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/password'
|
||||
* @action After the template: 'us_after_template:templates/form/password'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/password'
|
||||
*/
|
||||
global $us_cform_index;
|
||||
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="password"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . esc_attr( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_password<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's radio input
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/radio'
|
||||
* @action After the template: 'us_after_template:templates/form/radio'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/radio'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$required = isset( $required ) ? $required : FALSE;
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", $values ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$field_atts = 'type="radio"';
|
||||
$field_atts .= ' class="screen-reader-text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= 'data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_radio<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
foreach ( $values as $key => $value ) {
|
||||
$value = trim( $value );
|
||||
if ( empty( $value ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<label>
|
||||
<input <?php echo $field_atts ?> value="<?php echo esc_attr( $value ) ?>"<?php checked( $key, 0 ) ?>/>
|
||||
<span class="w-form-radio"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's select field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/select'
|
||||
* @action After the template: 'us_after_template:templates/form/select'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/select'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", trim( $values ) ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = '';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_select<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<select <?php echo $field_atts ?>>
|
||||
<?php
|
||||
foreach ( $values as $value ) {
|
||||
echo '<option value="' . esc_attr( $value ) . '">' . $value . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's hidden field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $classes string Additional field classes
|
||||
* @var $title string Submit button title
|
||||
* @var $btn_classes string Additional button classes
|
||||
* @var $btn_inner_css string Button inner css
|
||||
* @var $btn_size_mobiles string Button Size on Mobiles
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/submit'
|
||||
* @action After the template: 'us_after_template:templates/form/submit'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/submit'
|
||||
*/
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
$title = ! empty( $title ) ? $title : us_translate( 'Submit' );
|
||||
$btn_classes = ! empty( $btn_classes ) ? ( ' ' . $btn_classes ) : '';
|
||||
$btn_inner_css = ! empty( $btn_inner_css ) ? ( ' style="' . $btn_inner_css . '"' ) : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$icon_pos = isset( $icon_pos ) ? $icon_pos : 'left';
|
||||
|
||||
// Add Size on mobiles as inline style tag
|
||||
$inline_style = '';
|
||||
if ( ! empty( $btn_size_mobiles ) ) {
|
||||
global $us_cform_index;
|
||||
$inline_style .= '<style>@media(max-width:600px){.us_form_' . $us_cform_index . ' .w-btn{font-size:' . $btn_size_mobiles . '!important}}</style>';
|
||||
}
|
||||
|
||||
// Swap icon position for RTL
|
||||
if ( is_rtl() ) {
|
||||
$icon_pos = ( $icon_pos == 'left' ) ? 'right' : 'left';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="w-form-row for_submit<?php echo $classes ?>">
|
||||
<div class="w-form-row-field">
|
||||
<?php echo $inline_style ?>
|
||||
<button class="w-btn<?php echo $btn_classes ?>"<?php echo $btn_inner_css ?> type="submit" aria-label="<?php echo esc_attr( $title ) ?>">
|
||||
<span class="g-preloader type_1"></span>
|
||||
<?php echo ( $icon_pos == 'left' ) ? $icon : ''; ?>
|
||||
<span class="w-btn-label"><?php echo strip_tags( $title, '<br>' ) ?></span>
|
||||
<?php echo ( $icon_pos == 'right' ) ? $icon : ''; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's text field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/text'
|
||||
* @action After the template: 'us_after_template:templates/form/text'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/text'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_text<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's textarea field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/textarea'
|
||||
* @action After the template: 'us_after_template:templates/form/textarea'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/textarea'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = '';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_textarea<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<textarea <?php echo $field_atts ?>><?php echo esc_textarea( $value ) ?></textarea>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
Reference in new issue
Block a user