PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 1.6.0
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v1.6.0
2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 All 96 releases
← All changes | inc/fields/base.php +20 -26 trunk1.6.0 View file →
@@ -391,32 +391,28 @@
391 391 $default_classes = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : '';
392 392 $filter_classes = apply_filters( 'srfm_field_classes', $default_classes, [ 'attributes' => $attributes ] );
393 393 $field_config = apply_filters( 'srfm_field_config', [], [ 'attributes' => $attributes ] );
394 394
395 - $this->field_config = $field_config ? htmlspecialchars( Helper::get_string_value( wp_json_encode( $field_config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ), ENT_QUOTES, 'UTF-8' ) : '';
396 - $this->attributes = $attributes;
397 - $this->required = $attributes['required'] ?? false;
398 - $this->field_width = $attributes['fieldWidth'] ?? '';
399 - $this->label = $attributes['label'] ?? '';
400 - $this->help = $attributes['help'] ?? '';
401 - $this->block_id = isset( $attributes['block_id'] ) ? Helper::get_string_value( $attributes['block_id'] ) : '';
402 - $this->form_id = isset( $attributes['formId'] ) ? Helper::get_string_value( $attributes['formId'] ) : '';
403 - $this->block_slug = $attributes['slug'] ?? '';
404 - $this->class_name = $filter_classes;
405 - $this->placeholder = $attributes['placeholder'] ?? '';
406 - $this->default = $attributes['defaultValue'] ?? '';
407 - $this->checked = $attributes['checked'] ?? '';
408 - // Inject the block type slug (e.g. 'dropdown', 'multi-choice') into the attributes passed to
409 - // the filter. The field's `slug` attribute can be prefixed when the block is inside a repeater
410 - // (e.g. 'srfm-repeater-srfm-dropdown'), so filter consumers need a reliable block type identifier.
411 - $block_args = [ 'block_args' => [ 'slug' => $this->slug ] ];
412 - $this->options = apply_filters( 'srfm_field_options', $attributes['options'] ?? '', array_merge( $attributes, $block_args ) );
395 + $this->field_config = $field_config ? htmlspecialchars( Helper::get_string_value( wp_json_encode( $field_config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ), ENT_QUOTES, 'UTF-8' ) : '';
396 + $this->attributes = $attributes;
397 + $this->required = $attributes['required'] ?? false;
398 + $this->field_width = $attributes['fieldWidth'] ?? '';
399 + $this->label = $attributes['label'] ?? '';
400 + $this->help = $attributes['help'] ?? '';
401 + $this->block_id = isset( $attributes['block_id'] ) ? Helper::get_string_value( $attributes['block_id'] ) : '';
402 + $this->form_id = isset( $attributes['formId'] ) ? Helper::get_string_value( $attributes['formId'] ) : '';
403 + $this->block_slug = $attributes['slug'] ?? '';
404 + $this->class_name = $filter_classes;
405 + $this->placeholder = $attributes['placeholder'] ?? '';
406 + $this->default = $attributes['defaultValue'] ?? '';
407 + $this->checked = $attributes['checked'] ?? '';
408 + $this->options = $attributes['options'] ?? '';
413 409 $this->is_unique = $attributes['isUnique'] ?? false;
414 410 $this->conditional_class = apply_filters( 'srfm_conditional_logic_classes', $this->form_id, $this->block_id );
415 411 $this->data_require_attr = $this->required ? 'true' : 'false';
416 412 $this->block_width = $this->field_width ? ' srfm-block-width-' . str_replace( '.', '-', $this->field_width ) : '';
417 - $this->placeholder_attr = '' !== $this->placeholder ? ' placeholder="' . esc_attr( $this->placeholder ) . '" ' : '';
418 - $this->default_value_attr = '' !== $this->default ? ' value="' . esc_attr( $this->default ) . '" ' : '';
413 + $this->placeholder_attr = $this->placeholder ? ' placeholder="' . $this->placeholder . '" ' : '';
414 + $this->default_value_attr = $this->default ? ' value="' . $this->default . '" ' : '';
419 415 $this->checked_attr = $this->checked ? 'checked' : '';
420 416 $this->aria_unique = $this->is_unique ? 'true' : 'false';
421 417 $this->allowed_tags = [
422 418 'a' => [
@@ -440,9 +436,9 @@
440 436 * @return void
441 437 */
442 438 protected function set_input_label( $value ) {
443 439 $this->input_label_fallback = $this->label ? $this->label : $value;
444 - $this->input_label = '-lbl-' . Helper::encode( $this->input_label_fallback );
440 + $this->input_label = '-lbl-' . Helper::encrypt( $this->input_label_fallback );
445 441 $this->set_field_name( $this->input_label );
446 442 }
447 443
448 444 /**
@@ -524,11 +520,9 @@
524 520 $this->placeholder_attr = '';
525 521 $placeholder = Helper::generate_common_form_markup( $this->form_id, 'placeholder', $this->label, $this->slug, $this->block_id . $input_label, boolval( $this->required ) );
526 522 if ( ! empty( $placeholder ) ) {
527 523 $this->label_markup = '';
528 - $this->placeholder_attr = ' placeholder="' . esc_attr( $placeholder ) . '" ';
529 - } elseif ( '' !== $this->placeholder ) {
530 - $this->placeholder_attr = ' placeholder="' . esc_attr( $this->placeholder ) . '" ';
524 + $this->placeholder_attr = ' placeholder="' . $placeholder . '" ';
531 525 }
532 526 }
533 527
534 528 /**
@@ -537,8 +531,8 @@
537 531 * @since 0.0.6
538 532 * @return void
539 533 */
540 534 protected function set_aria_described_by() {
541 - $this->aria_described_by .= ' srfm-error-' . esc_attr( $this->block_id );
542 - $this->aria_described_by .= ! empty( $this->help ) ? ' srfm-description-' . esc_attr( $this->block_id ) : '';
535 + $this->aria_described_by .= ' srfm-error-' . $this->block_id;
536 + $this->aria_described_by .= ! empty( $this->help ) ? ' srfm-description-' . $this->block_id : '';
543 537 }
544 538 }