PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.20
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.20
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmEntryFormatter.php +31 -29 6.56.20 View file →
@@ -8,18 +8,19 @@
8 8 */
9 9 class FrmEntryFormatter {
10 10
11 11 /**
12 - * @var stdClass
13 12 * @since 2.04
13 + *
14 + * @var stdClass|null
14 15 */
15 - protected $entry = null;
16 + protected $entry;
16 17
17 18 /**
18 - * @var FrmEntryValues
19 + * @var FrmEntryValues|null
19 20 * @since 2.04
20 21 */
21 - protected $entry_values = null;
22 + protected $entry_values;
22 23
23 24 /**
24 25 * @var bool
25 26 * @since 2.04
@@ -56,12 +57,12 @@
56 57 */
57 58 protected $direction = 'ltr';
58 59
59 60 /**
60 - * @var FrmTableHTMLGenerator
61 + * @var FrmTableHTMLGenerator|null
61 62 * @since 2.04
62 63 */
63 - protected $table_generator = null;
64 + protected $table_generator;
64 65
65 66 /**
66 67 * @var bool
67 68 * @since 2.04
@@ -90,9 +91,9 @@
90 91 * FrmEntryFormat constructor
91 92 *
92 93 * @since 2.04
93 94 *
94 - * @param $atts
95 + * @param array $atts
95 96 */
96 97 public function __construct( $atts ) {
97 98 $this->init_entry( $atts );
98 99
@@ -223,9 +224,9 @@
223 224 *
224 225 * @param array $atts
225 226 */
226 227 protected function init_array_key( $atts ) {
227 - if ( isset( $atts['array_key'] ) && $atts['array_key'] == 'id' ) {
228 + if ( isset( $atts['array_key'] ) && $atts['array_key'] === 'id' ) {
228 229 $this->array_key = 'id';
229 230 }
230 231 }
231 232
@@ -288,9 +289,9 @@
288 289 *
289 290 * @since 3.0
290 291 */
291 292 protected function skip_fields() {
292 - return array( 'captcha', 'html' );
293 + return array( 'captcha', 'html', FrmSubmitHelper::FIELD_TYPE );
293 294 }
294 295
295 296 /**
296 297 * Set the include_extras property
@@ -348,9 +349,9 @@
348 349 $atts['source'] = 'entry_formatter';
349 350 $atts['wpautop'] = false;
350 351 $atts['return_array'] = true;
351 352
352 - $unset = array( 'id', 'entry', 'form_id', 'format' );
353 + $unset = array( 'id', 'form_id', 'format' );
353 354 foreach ( $unset as $param ) {
354 355 if ( isset( $atts[ $param ] ) ) {
355 356 unset( $atts[ $param ] );
356 357 }
@@ -355,9 +356,10 @@
355 356 unset( $atts[ $param ] );
356 357 }
357 358 }
358 359
359 - $this->atts = $atts;
360 + $this->atts = $atts;
361 + $this->atts['entry'] = $this->entry;
360 362 }
361 363
362 364 /**
363 365 * Get the field key or ID, depending on array_key property
@@ -365,12 +367,12 @@
365 367 * @since 2.05
366 368 *
367 369 * @param FrmFieldValue $field_value
368 370 *
369 - * @return string|int
371 + * @return int|string
370 372 */
371 373 protected function get_key_or_id( $field_value ) {
372 - return $this->array_key == 'key' ? $field_value->get_field_key() : $field_value->get_field_id();
374 + return $this->array_key === 'key' ? $field_value->get_field_key() : $field_value->get_field_id();
373 375 }
374 376
375 377 /**
376 378 * Package and return the formatted entry values
@@ -449,9 +451,9 @@
449 451 *
450 452 * @param string $content
451 453 */
452 454 protected function add_field_values_to_content( &$content ) {
453 - foreach ( $this->entry_values->get_field_values() as $field_id => $field_value ) {
455 + foreach ( $this->entry_values->get_field_values() as $field_value ) {
454 456
455 457 /**
456 458 * @var FrmFieldValue $field_value
457 459 */
@@ -514,9 +516,9 @@
514 516 *
515 517 * @since 2.04
516 518 *
517 519 * @param FrmFieldValue $field_value
518 - * @param array $output
520 + * @param array $output
519 521 */
520 522 protected function push_single_field_to_array( $field_value, &$output ) {
521 523 if ( $this->include_field_in_content( $field_value ) ) {
522 524
@@ -536,9 +538,9 @@
536 538 *
537 539 * @since 2.04
538 540 *
539 541 * @param string $label
540 - * @param mixed $display_value
542 + * @param mixed $display_value
541 543 * @param string $content
542 544 */
543 545 protected function add_plain_text_row( $label, $display_value, &$content ) {
544 546 $display_value = $this->prepare_display_value_for_plain_text_content( $display_value );
@@ -555,9 +557,9 @@
555 557 *
556 558 * @since 2.04
557 559 *
558 560 * @param FrmFieldValue $field_value
559 - * @param string $content
561 + * @param string $content
560 562 */
561 563 protected function add_field_value_to_content( $field_value, &$content ) {
562 564 if ( $this->is_extra_field( $field_value ) ) {
563 565 $this->add_row_for_extra_field( $field_value, $content );
@@ -572,9 +574,9 @@
572 574 *
573 575 * @since 3.0
574 576 *
575 577 * @param FrmFieldValue $field_value
576 - * @param string $content
578 + * @param string $content
577 579 */
578 580 protected function add_row_for_extra_field( $field_value, &$content ) {
579 581 if ( ! $this->include_field_in_content( $field_value ) ) {
580 582 return;
@@ -592,9 +594,9 @@
592 594 *
593 595 * @since 3.0
594 596 *
595 597 * @param FrmFieldValue $field_value
596 - * @param string $content
598 + * @param string $content
597 599 */
598 600 protected function add_row_for_standard_field( $field_value, &$content ) {
599 601 if ( ! $this->include_field_in_content( $field_value ) ) {
600 602 return;
@@ -613,9 +615,9 @@
613 615 *
614 616 * @since 3.0
615 617 *
616 618 * @param FrmFieldValue $field_value
617 - * @param string $content
619 + * @param string $content
618 620 */
619 621 protected function add_html_row_for_included_extra( $field_value, &$content ) {
620 622 $this->prepare_html_display_value_for_extra_fields( $field_value, $display_value );
621 623
@@ -632,9 +634,9 @@
632 634 *
633 635 * @since 3.0
634 636 *
635 637 * @param FrmFieldValue $field_value
636 - * @param string $content
638 + * @param string $content
637 639 */
638 640 protected function add_plain_text_row_for_included_extra( $field_value, &$content ) {
639 641 $this->prepare_plain_text_display_value_for_extra_fields( $field_value, $display_value );
640 642
@@ -677,9 +679,9 @@
677 679 *
678 680 * @since 3.0
679 681 *
680 682 * @param FrmFieldValue $field_value
681 - * @param mixed $display_value
683 + * @param mixed $display_value
682 684 */
683 685 protected function prepare_html_display_value_for_extra_fields( $field_value, &$display_value ) {
684 686 $display_value = $field_value->get_displayed_value();
685 687 }
@@ -689,9 +691,9 @@
689 691 *
690 692 * @since 3.0
691 693 *
692 694 * @param FrmFieldValue $field_value
693 - * @param mixed $display_value
695 + * @param mixed $display_value
694 696 */
695 697 protected function prepare_plain_text_display_value_for_extra_fields( $field_value, &$display_value ) {
696 698 $display_value = $field_value->get_displayed_value() . "\r\n";
697 699 }
@@ -701,9 +703,9 @@
701 703 *
702 704 * @since 2.04
703 705 *
704 706 * @param FrmFieldValue $field_value
705 - * @param string $content
707 + * @param string $content
706 708 */
707 709 protected function add_standard_row( $field_value, &$content ) {
708 710 if ( $this->format === 'plain_text_block' ) {
709 711 $this->add_plain_text_row( $field_value->get_field_label(), $field_value->get_displayed_value(), $content );
@@ -820,9 +822,9 @@
820 822 * Add a row in an HTML table
821 823 *
822 824 * @since 2.04
823 825 *
824 - * @param array $value_args
826 + * @param array $value_args
825 827 * $value_args = [
826 828 * 'label' => (string) The label. Required
827 829 * 'value' => (mixed) The value to add. Required
828 830 * 'field_type' => (string) The field type. Blank string if not a field.
@@ -852,9 +854,9 @@
852 854 * Prepare a field's display value for an HTML table
853 855 *
854 856 * @since 2.04
855 857 *
856 - * @param mixed $display_value
858 + * @param mixed $display_value
857 859 * @param string $field_type
858 860 *
859 861 * @return mixed|string
860 862 */
@@ -873,9 +875,9 @@
873 875 * @since 2.04
874 876 *
875 877 * @param mixed $display_value
876 878 *
877 - * @return string|int
879 + * @return int|string
878 880 */
879 881 protected function prepare_display_value_for_plain_text_content( $display_value ) {
880 882 $display_value = $this->flatten_array( $display_value );
881 883 $display_value = $this->strip_html( $display_value );
@@ -887,11 +889,11 @@
887 889 * Flatten an array
888 890 *
889 891 * @since 2.04
890 892 *
891 - * @param array|string|int $value
893 + * @param array|int|string $value
892 894 *
893 - * @return string|int
895 + * @return int|string
894 896 */
895 897 protected function flatten_array( $value ) {
896 898 if ( is_array( $value ) ) {
897 899 $separator = isset( $this->atts['array_separator'] ) ? $this->atts['array_separator'] : ', ';