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