Notice : include(): read of 17072 bytes failed with errno=12 Cannot allocate memory in /home/arandano/public_html/wp-content/plugins/elementor/vendor/composer/ClassLoader.php on line 576
Notice : include(): read of 17072 bytes failed with errno=12 Cannot allocate memory in /home/arandano/public_html/wp-content/plugins/elementor/vendor/composer/ClassLoader.php on line 576
l'] ) ? esc_attr( $field['time_interval'] ) : '30';
/**
* Filters the time intervals available for the Time field.
*
* @since 1.6.0
*
* @param array $time_intervals Array of time intervals.
*/
$time_intervals = apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
'wpforms_datetime_time_intervals',
[
'15' => esc_html__( '15 minutes', 'wpforms-lite' ),
'30' => esc_html__( '30 minutes', 'wpforms-lite' ),
'60' => esc_html__( '1 hour', 'wpforms-lite' ),
]
);
printf(
'';
echo '';
// Custom CSS classes.
$this->field_option( 'css', $field );
// Hide label.
$this->field_option( 'label_hide', $field );
// Hide sublabels.
$sublabel_class = isset( $field['format'] ) && $field['format'] !== self::DEFAULTS['format'] ? 'wpforms-hidden' : '';
$this->field_option( 'sublabel_hide', $field, [ 'class' => $sublabel_class ] );
// Options close markup.
$this->field_option(
'advanced-options',
$field,
[
'markup' => 'close',
]
);
}
/**
* Get regular date formats.
*
* @since 1.9.8.3
*
* @return array
*/
private function get_regular_date_formats(): array {
return [
self::DEFAULTS['date_format'],
self::ALT_DATE_FORMAT,
'Y/m/d',
'm.d.Y',
'd.m.Y',
'Y.m.d',
];
}
/**
* Display limit days options.
*
* @since 1.9.4
*
* @param array $field Field setting.
*/
private function field_options_limit_days( array $field ): void {
echo '
';
$output = $this->field_element(
'toggle',
$field,
[
'slug' => 'date_limit_days',
'value' => ! empty( $field['date_limit_days'] ) ? '1' : '0',
'desc' => esc_html__( 'Limit Days', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Check this option to adjust which days of the week can be selected.', 'wpforms-lite' ),
'class' => 'wpforms-panel-field-toggle',
],
false
);
$this->field_element(
'row',
$field,
[
'slug' => 'date_limit_days',
'content' => $output,
'class' => 'wpforms-clear',
]
);
$week_days = [
'sun' => esc_html__( 'Sun', 'wpforms-lite' ),
'mon' => esc_html__( 'Mon', 'wpforms-lite' ),
'tue' => esc_html__( 'Tue', 'wpforms-lite' ),
'wed' => esc_html__( 'Wed', 'wpforms-lite' ),
'thu' => esc_html__( 'Thu', 'wpforms-lite' ),
'fri' => esc_html__( 'Fri', 'wpforms-lite' ),
'sat' => esc_html__( 'Sat', 'wpforms-lite' ),
];
// Rearrange days array according to the Start of Week setting.
$start_of_week = get_option( 'start_of_week' );
$start_of_week = ! empty( $start_of_week ) ? (int) $start_of_week : 0;
if ( $start_of_week > 0 ) {
$days_after = $week_days;
$days_begin = array_splice( $days_after, 0, $start_of_week );
$days = array_merge( $days_after, $days_begin );
} else {
$days = $week_days;
}
// Limit Days body.
$field = $this->field_options_limit_days_body( $days, $field );
// Disable Past Dates.
$this->field_options_limit_days_disable_past_dates( $field );
// Disable Today's Date.
$output = $this->field_element(
'toggle',
$field,
[
'slug' => 'date_disable_todays_date',
'value' => ! empty( $field['date_disable_todays_date'] ) ? '1' : '0',
'desc' => esc_html__( 'Disable Today\'s Date', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Check this option to prevent today\'s date from being selected.', 'wpforms-lite' ),
],
false
);
$this->field_element(
'row',
$field,
[
'slug' => 'date_disable_todays_date',
'content' => $output,
'class' => ! isset( $field['date_disable_past_dates'] ) ? 'wpforms-hide' : '',
]
);
}
/**
* Display limit hours options.
*
* @since 1.9.4
*
* @param array $field Field setting.
*/
private function field_options_limit_hours( array $field ): void {
echo '
';
$output = $this->field_element(
'toggle',
$field,
[
'slug' => 'time_limit_hours',
'value' => ! empty( $field['time_limit_hours'] ) ? '1' : '0',
'desc' => esc_html__( 'Limit Hours', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Check this option to adjust the range of times that can be selected.', 'wpforms-lite' ),
'class' => 'wpforms-panel-field-toggle',
],
false
);
$this->field_element(
'row',
$field,
[
'slug' => 'time_limit_hours',
'content' => $output,
]
);
// Determine a time format type.
// If the format contains `g` or `h`, then this is 12-hour format, otherwise 24 hours.
$time_format = empty( $field['time_format'] ) || preg_match( '/[gh]/', $field['time_format'] ) ? 12 : 24;
// Limit Hours body.
$output = $this->field_options_limit_hours_body( $field, $time_format );
printf(
'%5$s
',
'time_limit_hours_options',
'wpforms-panel-field-toggle-body',
esc_attr( $field['id'] ),
esc_attr( 'fields[' . (int) $field['id'] . '][time_limit_hours]' ),
$output // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
}
/**
* Generate an array of numeric options for date/time selectors.
*
* @since 1.9.4
*
* @param integer $min Minimum value.
* @param integer $max Maximum value.
* @param integer $step Step.
*
* @return array
*/
private function get_selector_numeric_options( int $min, int $max, int $step = 1 ): array {
$range = range( $min, $max, $step );
$options = [];
foreach ( $range as $i ) {
$value = str_pad( $i, 2, '0', STR_PAD_LEFT );
$options[ $value ] = $value;
}
return $options;
}
/**
* Add class to field options wrapper to indicate if field confirmation is enabled.
*
* @since 1.9.4
*
* @param string|mixed $css_class CSS class.
* @param array $field Field data.
*
* @return string
*/
public function field_option_class( $css_class, array $field ): string {
$css_class = (string) $css_class;
if ( $this->type === $field['type'] ) {
$date_type = ! empty( $field['date_type'] ) ? sanitize_html_class( $field['date_type'] ) : 'datepicker';
$css_class .= " wpforms-date-type-$date_type";
}
return $css_class;
}
/**
* Field preview inside the builder.
*
* @since 1.9.4
*
* @param array $field Field data and settings.
*/
public function field_preview( $field ) {
$date_placeholder = ! empty( $field['date_placeholder'] ) ? $field['date_placeholder'] : '';
$time_placeholder = ! empty( $field['time_placeholder'] ) ? $field['time_placeholder'] : '';
$format = ! empty( $field['format'] ) ? $field['format'] : self::DEFAULTS['format'];
$date_type = ! empty( $field['date_type'] ) ? $field['date_type'] : 'datepicker';
$date_format = ! empty( $field['date_format'] ) ? $field['date_format'] : self::DEFAULTS['date_format'];
if ( in_array( $date_format, $this->get_month_day_formats(), true ) ) {
$date_first_select = 'MM';
$date_second_select = 'DD';
$date_third_select = 'YYYY';
} elseif ( in_array( $date_format, $this->get_day_month_formats(), true ) ) {
$date_first_select = 'DD';
$date_second_select = 'MM';
$date_third_select = 'YYYY';
} else {
$date_first_select = 'YYYY';
$date_second_select = 'MM';
$date_third_select = 'DD';
}
// Label.
$this->field_preview_option(
'label',
$field,
[
'label_badge' => $this->get_field_preview_badge(),
]
);
printf(
'';
// Description.
$this->field_preview_option( 'description', $field );
}
/**
* Get month-day date formats.
*
* @since 1.9.8.3
*
* @return array
*/
private function get_month_day_formats(): array {
return [ 'mm/dd/yyyy', self::DEFAULTS['date_format'], 'm.d.Y' ];
}
/**
* Get day-month date formats.
*
* @since 1.9.8.3
*
* @return array
*/
private function get_day_month_formats(): array {
return [ 'dd/mm/yyyy', self::ALT_DATE_FORMAT, 'd.m.Y' ];
}
/**
* Field display on the form front-end.
*
* @since 1.9.4
*
* @param array $field Field data and settings.
* @param array $deprecated Deprecated array of field attributes.
* @param array $form_data Form data and settings.
*/
public function field_display( $field, $deprecated, $form_data ) {
}
/**
* Field options: Limit Days body section.
*
* @since 1.9.4
*
* @param array $days Array of days.
* @param array $field Field data and settings.
*
* @return array Modified field data array.
*/
public function field_options_limit_days_body( array $days, array $field ): array {
// Limit Days body.
$output = '';
foreach ( $days as $day => $day_translation ) {
$day_slug = 'date_limit_days_' . $day;
// Set defaults.
if ( ! isset( $field['date_format'] ) ) {
$field[ $day_slug ] = $this->default_settings[ $day_slug ];
}
$output .= '';
$output .= $this->field_element(
'checkbox',
$field,
[
'slug' => $day_slug,
'value' => ! empty( $field[ $day_slug ] ) ? '1' : '0',
'nodesc' => '1',
'class' => 'wpforms-field-options-column',
],
false
);
$output .= ' ' . $day_translation . ' ';
}
printf(
'%3$s
',
esc_attr( $field['id'] ),
esc_attr( 'fields[' . (int) $field['id'] . '][date_limit_days]' ),
$output // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
return $field;
}
/**
* Field options: Limit Days - Disable Past Dates section.
*
* @since 1.9.4
*
* @param array $field Field data.
*/
public function field_options_limit_days_disable_past_dates( array $field ): void {
$output = $this->field_element(
'toggle',
$field,
[
'slug' => 'date_disable_past_dates',
'value' => ! empty( $field['date_disable_past_dates'] ) ? '1' : '0',
'desc' => esc_html__( 'Disable Past Dates', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Check this option to prevent any previous date from being selected.', 'wpforms-lite' ),
],
false
);
$this->field_element(
'row',
$field,
[
'slug' => 'date_disable_past_dates',
'content' => $output,
]
);
}
/**
* Field options: Limit Hours - body section.
*
* @since 1.9.4
*
* @param array $field Field data.
* @param int $time_format Time format.
*
* @return string
*/
private function field_options_limit_hours_body( array $field, int $time_format ): string {
$output = '';
foreach ( [ 'start', 'end' ] as $option ) {
$output .= ''; // Open columns container.
$slug = 'time_limit_hours_' . $option . '_hour';
$output .= $this->field_element(
'select',
$field,
[
'slug' => $slug,
'value' => ! empty( $field[ $slug ] ) ? $field[ $slug ] : $this->default_settings[ $slug ],
'options' => $time_format === 12
? $this->get_selector_numeric_options( 1, $time_format )
: $this->get_selector_numeric_options( 0, $time_format - 1 ),
'class' => 'wpforms-field-options-column',
],
false
);
$slug = 'time_limit_hours_' . $option . '_min';
$output .= $this->field_element(
'select',
$field,
[
'slug' => $slug,
'value' => ! empty( $field[ $slug ] ) ? $field[ $slug ] : $this->default_settings[ $slug ],
'options' => $this->get_selector_numeric_options( 0, 59, 5 ),
'class' => 'wpforms-field-options-column',
],
false
);
$slug = 'time_limit_hours_' . $option . '_ampm';
$output .= $this->field_element(
'select',
$field,
[
'slug' => $slug,
'value' => ! empty( $field[ $slug ] ) ? $field[ $slug ] : $this->default_settings[ $slug ],
'options' => [
'am' => 'AM',
'pm' => 'PM',
],
'class' => [
'wpforms-field-options-column',
$time_format === 24 ? 'wpforms-hidden-strict' : '',
],
],
false
);
$slug = 'time_limit_hours_' . $option . '_hour';
$output .= $this->field_element(
'label',
$field,
[
'slug' => $slug,
'value' => $option === 'start' ? esc_html__( 'Start Time', 'wpforms-lite' ) : esc_html__( 'End Time', 'wpforms-lite' ),
'class' => [
'sub-label',
'wpforms-field-options-column',
],
],
false
);
$output .= sprintf(
'
',
$time_format === 12 ? 'wpforms-hidden-strict' : ''
);
$output .= '
'; // Close columns container.
}
return $output;
}
}
gafas – Arándano Boutique
Ir al contenido
Inicio / gafas
Mostrando todos los resultados 14