PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
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 +69 -123 6.286.14 View file →
@@ -10,15 +10,14 @@
10 10
11 11 /**
12 12 * @since 2.04
13 13 *
14 - * @var false|stdClass|null
14 + * @var stdClass|null
15 15 */
16 16 protected $entry;
17 17
18 18 /**
19 19 * @var FrmEntryValues|null
20 - *
21 20 * @since 2.04
22 21 */
23 22 protected $entry_values;
24 23
@@ -23,9 +22,8 @@
23 22 protected $entry_values;
24 23
25 24 /**
26 25 * @var bool
27 - *
28 26 * @since 2.04
29 27 */
30 28 protected $is_plain_text = false;
31 29
@@ -30,9 +28,8 @@
30 28 protected $is_plain_text = false;
31 29
32 30 /**
33 31 * @var bool
34 - *
35 32 * @since 2.04
36 33 */
37 34 protected $include_user_info = false;
38 35
@@ -37,9 +34,8 @@
37 34 protected $include_user_info = false;
38 35
39 36 /**
40 37 * @var bool
41 - *
42 38 * @since 2.04
43 39 */
44 40 protected $include_blank = false;
45 41
@@ -44,9 +40,8 @@
44 40 protected $include_blank = false;
45 41
46 42 /**
47 43 * @var string
48 - *
49 44 * @since 2.04
50 45 */
51 46 protected $format = 'text';
52 47
@@ -51,9 +46,8 @@
51 46 protected $format = 'text';
52 47
53 48 /**
54 49 * @var string
55 - *
56 50 * @since 2.05
57 51 */
58 52 protected $array_key = 'key';
59 53
@@ -58,9 +52,8 @@
58 52 protected $array_key = 'key';
59 53
60 54 /**
61 55 * @var string
62 - *
63 56 * @since 2.04
64 57 */
65 58 protected $direction = 'ltr';
66 59
@@ -65,9 +58,8 @@
65 58 protected $direction = 'ltr';
66 59
67 60 /**
68 61 * @var FrmTableHTMLGenerator|null
69 - *
70 62 * @since 2.04
71 63 */
72 64 protected $table_generator;
73 65
@@ -72,9 +64,8 @@
72 64 protected $table_generator;
73 65
74 66 /**
75 67 * @var bool
76 - *
77 68 * @since 2.04
78 69 */
79 70 protected $is_clickable = false;
80 71
@@ -79,9 +70,8 @@
79 70 protected $is_clickable = false;
80 71
81 72 /**
82 73 * @var array
83 - *
84 74 * @since 2.04
85 75 */
86 76 protected $include_extras = array();
87 77
@@ -86,9 +76,8 @@
86 76 protected $include_extras = array();
87 77
88 78 /**
89 79 * @var array
90 - *
91 80 * @since 3.0
92 81 */
93 82 protected $single_cell_fields = array();
94 83
@@ -93,9 +82,8 @@
93 82 protected $single_cell_fields = array();
94 83
95 84 /**
96 85 * @var array
97 - *
98 86 * @since 3.0
99 87 */
100 88 protected $atts = array();
101 89
@@ -136,14 +124,17 @@
136 124 *
137 125 * @since 2.04
138 126 *
139 127 * @param array $atts
140 - *
141 - * @return void
142 128 */
143 129 protected function init_entry( $atts ) {
144 130 if ( isset( $atts['entry'] ) && is_object( $atts['entry'] ) ) {
145 - $this->entry = isset( $atts['entry']->metas ) ? $atts['entry'] : FrmEntry::getOne( $atts['entry']->id, true );
131 +
132 + if ( isset( $atts['entry']->metas ) ) {
133 + $this->entry = $atts['entry'];
134 + } else {
135 + $this->entry = FrmEntry::getOne( $atts['entry']->id, true );
136 + }
146 137 } elseif ( ! empty( $atts['id'] ) ) {
147 138 $this->entry = FrmEntry::getOne( $atts['id'], true );
148 139 }
149 140 }
@@ -153,10 +144,8 @@
153 144 *
154 145 * @since 2.04
155 146 *
156 147 * @param array $atts
157 - *
158 - * @return void
159 148 */
160 149 protected function init_entry_values( $atts ) {
161 150 $entry_atts = $this->prepare_entry_attributes( $atts );
162 151 $this->entry_values = new FrmEntryValues( $this->entry->id, $entry_atts );
@@ -171,11 +160,11 @@
171 160 *
172 161 * @return array
173 162 */
174 163 protected function prepare_entry_attributes( $atts ) {
175 - $entry_atts = array();
164 + $entry_atts = array();
165 +
176 166 $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' );
177 -
178 167 foreach ( $conditionally_add as $index ) {
179 168 if ( isset( $atts[ $index ] ) ) {
180 169 $entry_atts[ $index ] = $atts[ $index ];
181 170 }
@@ -189,18 +178,25 @@
189 178 *
190 179 * @since 2.04
191 180 *
192 181 * @param array $atts
193 - *
194 - * @return void
195 182 */
196 183 protected function init_format( $atts ) {
197 184 if ( $atts['format'] === 'array' ) {
185 +
198 186 $this->format = 'array';
187 +
199 188 } elseif ( $atts['format'] === 'json' ) {
189 +
200 190 $this->format = 'json';
191 +
201 192 } elseif ( $atts['format'] === 'text' ) {
202 - $this->format = $this->is_plain_text === true ? 'plain_text_block' : 'table';
193 +
194 + if ( $this->is_plain_text === true ) {
195 + $this->format = 'plain_text_block';
196 + } else {
197 + $this->format = 'table';
198 + }
203 199 }
204 200
205 201 /**
206 202 * Allows modifying the format property of FrmEntryFormatter object.
@@ -226,10 +222,8 @@
226 222 *
227 223 * @since 2.05
228 224 *
229 225 * @param array $atts
230 - *
231 - * @return void
232 226 */
233 227 protected function init_array_key( $atts ) {
234 228 if ( isset( $atts['array_key'] ) && $atts['array_key'] === 'id' ) {
235 229 $this->array_key = 'id';
@@ -241,13 +235,11 @@
241 235 *
242 236 * @since 2.04
243 237 *
244 238 * @param array $atts
245 - *
246 - * @return void
247 239 */
248 240 protected function init_is_plain_text( $atts ) {
249 - if ( ! empty( $atts['plain_text'] ) ) {
241 + if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) {
250 242 $this->is_plain_text = true;
251 243 } elseif ( $atts['format'] !== 'text' ) {
252 244 $this->is_plain_text = true;
253 245 }
@@ -258,13 +250,11 @@
258 250 *
259 251 * @since 2.04
260 252 *
261 253 * @param array $atts
262 - *
263 - * @return void
264 254 */
265 255 protected function init_include_blank( $atts ) {
266 - if ( ! empty( $atts['include_blank'] ) ) {
256 + if ( isset( $atts['include_blank'] ) && $atts['include_blank'] ) {
267 257 $this->include_blank = true;
268 258 }
269 259 }
270 260
@@ -273,10 +263,8 @@
273 263 *
274 264 * @since 2.04
275 265 *
276 266 * @param array $atts
277 - *
278 - * @return void
279 267 */
280 268 protected function init_direction( $atts ) {
281 269 if ( isset( $atts['direction'] ) && $atts['direction'] === 'rtl' ) {
282 270 $this->direction = 'rtl';
@@ -288,13 +276,11 @@
288 276 *
289 277 * @since 2.04
290 278 *
291 279 * @param array $atts
292 - *
293 - * @return void
294 280 */
295 281 protected function init_include_user_info( $atts ) {
296 - if ( ! empty( $atts['user_info'] ) ) {
282 + if ( isset( $atts['user_info'] ) && $atts['user_info'] ) {
297 283 $this->include_user_info = true;
298 284 }
299 285 }
300 286
@@ -301,10 +287,8 @@
301 287 /**
302 288 * Which fields to skip by default
303 289 *
304 290 * @since 3.0
305 - *
306 - * @return array
307 291 */
308 292 protected function skip_fields() {
309 293 return array( 'captcha', 'html', FrmSubmitHelper::FIELD_TYPE );
310 294 }
@@ -314,13 +298,11 @@
314 298 *
315 299 * @since 3.0
316 300 *
317 301 * @param array $atts
318 - *
319 - * @return void
320 302 */
321 303 protected function init_include_extras( $atts ) {
322 - if ( ! empty( $atts['include_extras'] ) ) {
304 + if ( isset( $atts['include_extras'] ) && $atts['include_extras'] ) {
323 305 $this->include_extras = array_map( 'strtolower', array_map( 'trim', explode( ',', $atts['include_extras'] ) ) );
324 306 }
325 307 }
326 308
@@ -327,10 +309,8 @@
327 309 /**
328 310 * Initialize the single_cell_fields property
329 311 *
330 312 * @since 3.0
331 - *
332 - * @return void
333 313 */
334 314 protected function init_single_cell_fields() {
335 315 $this->single_cell_fields = array( 'html' );
336 316 }
@@ -340,10 +320,8 @@
340 320 *
341 321 * @since 2.04
342 322 *
343 323 * @param array $atts
344 - *
345 - * @return void
346 324 */
347 325 protected function init_table_generator( $atts ) {
348 326 $this->table_generator = new FrmTableHTMLGenerator( 'entry', $atts );
349 327 }
@@ -353,13 +331,11 @@
353 331 *
354 332 * @since 2.04
355 333 *
356 334 * @param array $atts
357 - *
358 - * @return void
359 335 */
360 336 protected function init_is_clickable( $atts ) {
361 - if ( ! empty( $atts['clickable'] ) ) {
337 + if ( isset( $atts['clickable'] ) && $atts['clickable'] ) {
362 338 $this->is_clickable = true;
363 339 }
364 340 }
365 341
@@ -367,12 +343,8 @@
367 343 * Save the passed atts for other calls. Exclude some attributes to prevent
368 344 * interaction with processing field values like time format.
369 345 *
370 346 * @since 3.0
371 - *
372 - * @param array $atts
373 - *
374 - * @return void
375 347 */
376 348 protected function init_atts( $atts ) {
377 349 $atts['source'] = 'entry_formatter';
378 350 $atts['wpautop'] = false;
@@ -378,9 +350,8 @@
378 350 $atts['wpautop'] = false;
379 351 $atts['return_array'] = true;
380 352
381 353 $unset = array( 'id', 'form_id', 'format' );
382 -
383 354 foreach ( $unset as $param ) {
384 355 if ( isset( $atts[ $param ] ) ) {
385 356 unset( $atts[ $param ] );
386 357 }
@@ -416,14 +387,18 @@
416 387 }
417 388
418 389 if ( $this->format === 'json' ) {
419 390 $content = json_encode( $this->prepare_array() );
391 +
420 392 } elseif ( $this->format === 'array' ) {
421 393 $content = $this->prepare_array();
394 +
422 395 } elseif ( $this->format === 'table' ) {
423 396 $content = $this->prepare_html_table();
397 +
424 398 } elseif ( $this->format === 'plain_text_block' ) {
425 399 $content = $this->prepare_plain_text_block();
400 +
426 401 } else {
427 402 $content = '';
428 403 }
429 404
@@ -461,9 +436,13 @@
461 436 $this->add_user_info_to_html_table( $content );
462 437
463 438 $content .= $this->table_generator->generate_table_footer();
464 439
465 - return $this->is_clickable ? make_clickable( $content ) : $content;
440 + if ( $this->is_clickable ) {
441 + $content = make_clickable( $content );
442 + }
443 +
444 + return $content;
466 445 }
467 446
468 447 /**
469 448 * Add field values to table or plain text content
@@ -470,13 +449,12 @@
470 449 *
471 450 * @since 2.05
472 451 *
473 452 * @param string $content
474 - *
475 - * @return void
476 453 */
477 454 protected function add_field_values_to_content( &$content ) {
478 455 foreach ( $this->entry_values->get_field_values() as $field_value ) {
456 +
479 457 /**
480 458 * @var FrmFieldValue $field_value
481 459 */
482 460 $field_value->prepare_displayed_value( $this->atts );
@@ -521,10 +499,8 @@
521 499 * @since 2.04
522 500 *
523 501 * @param array $field_values
524 502 * @param array $output
525 - *
526 - * @return void
527 503 */
528 504 protected function push_field_values_to_array( $field_values, &$output ) {
529 505 foreach ( $field_values as $field_value ) {
530 506 /**
@@ -541,22 +517,20 @@
541 517 * @since 2.04
542 518 *
543 519 * @param FrmFieldValue $field_value
544 520 * @param array $output
545 - *
546 - * @return void
547 521 */
548 522 protected function push_single_field_to_array( $field_value, &$output ) {
549 - if ( ! $this->include_field_in_content( $field_value ) ) {
550 - return;
551 - }
523 + if ( $this->include_field_in_content( $field_value ) ) {
552 524
553 - $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() );
554 - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value;
555 - $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' );
525 + $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() );
556 526
557 - if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) {
558 - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value();
527 + $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value;
528 +
529 + $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' );
530 + if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) {
531 + $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value();
532 + }
559 533 }
560 534 }
561 535
562 536 /**
@@ -566,15 +540,13 @@
566 540 *
567 541 * @param string $label
568 542 * @param mixed $display_value
569 543 * @param string $content
570 - *
571 - * @return void
572 544 */
573 545 protected function add_plain_text_row( $label, $display_value, &$content ) {
574 546 $display_value = $this->prepare_display_value_for_plain_text_content( $display_value );
575 547
576 - if ( 'rtl' === $this->direction ) {
548 + if ( 'rtl' == $this->direction ) {
577 549 $content .= wp_kses_post( $display_value . ' :' . $label ) . "\r\n";
578 550 } else {
579 551 $content .= wp_kses_post( $label . ': ' . $display_value ) . "\r\n";
580 552 }
@@ -586,14 +558,13 @@
586 558 * @since 2.04
587 559 *
588 560 * @param FrmFieldValue $field_value
589 561 * @param string $content
590 - *
591 - * @return void
592 562 */
593 563 protected function add_field_value_to_content( $field_value, &$content ) {
594 564 if ( $this->is_extra_field( $field_value ) ) {
595 565 $this->add_row_for_extra_field( $field_value, $content );
566 +
596 567 } else {
597 568 $this->add_row_for_standard_field( $field_value, $content );
598 569 }
599 570 }
@@ -604,10 +575,8 @@
604 575 * @since 3.0
605 576 *
606 577 * @param FrmFieldValue $field_value
607 578 * @param string $content
608 - *
609 - * @return void
610 579 */
611 580 protected function add_row_for_extra_field( $field_value, &$content ) {
612 581 if ( ! $this->include_field_in_content( $field_value ) ) {
613 582 return;
@@ -626,10 +595,8 @@
626 595 * @since 3.0
627 596 *
628 597 * @param FrmFieldValue $field_value
629 598 * @param string $content
630 - *
631 - * @return void
632 599 */
633 600 protected function add_row_for_standard_field( $field_value, &$content ) {
634 601 if ( ! $this->include_field_in_content( $field_value ) ) {
635 602 return;
@@ -649,15 +616,13 @@
649 616 * @since 3.0
650 617 *
651 618 * @param FrmFieldValue $field_value
652 619 * @param string $content
653 - *
654 - * @return void
655 620 */
656 621 protected function add_html_row_for_included_extra( $field_value, &$content ) {
657 622 $this->prepare_html_display_value_for_extra_fields( $field_value, $display_value );
658 623
659 - if ( in_array( $field_value->get_field_type(), $this->single_cell_fields, true ) ) {
624 + if ( in_array( $field_value->get_field_type(), $this->single_cell_fields ) ) {
660 625 $this->add_single_cell_html_row( $display_value, $content );
661 626 } else {
662 627 $value_args = $this->package_value_args( $field_value );
663 628 $this->add_html_row( $value_args, $content );
@@ -670,15 +635,13 @@
670 635 * @since 3.0
671 636 *
672 637 * @param FrmFieldValue $field_value
673 638 * @param string $content
674 - *
675 - * @return void
676 639 */
677 640 protected function add_plain_text_row_for_included_extra( $field_value, &$content ) {
678 641 $this->prepare_plain_text_display_value_for_extra_fields( $field_value, $display_value );
679 642
680 - if ( in_array( $field_value->get_field_type(), $this->single_cell_fields, true ) ) {
643 + if ( in_array( $field_value->get_field_type(), $this->single_cell_fields ) ) {
681 644 $this->add_single_value_plain_text_row( $display_value, $content );
682 645 } else {
683 646 $this->add_plain_text_row( $field_value->get_field_label(), $display_value, $content );
684 647 }
@@ -690,10 +653,8 @@
690 653 * @since 3.0
691 654 *
692 655 * @param string $display_value
693 656 * @param string $content
694 - *
695 - * @return void
696 657 */
697 658 protected function add_single_cell_html_row( $display_value, &$content ) {
698 659 // TODO: maybe move to FrmFieldValue
699 660 $display_value = $this->prepare_display_value_for_html_table( $display_value );
@@ -707,10 +668,8 @@
707 668 * @since 3.0
708 669 *
709 670 * @param string $display_value
710 671 * @param string $content
711 - *
712 - * @return void
713 672 */
714 673 protected function add_single_value_plain_text_row( $display_value, &$content ) {
715 674 $content .= $this->prepare_display_value_for_plain_text_content( $display_value );
716 675 }
@@ -721,10 +680,8 @@
721 680 * @since 3.0
722 681 *
723 682 * @param FrmFieldValue $field_value
724 683 * @param mixed $display_value
725 - *
726 - * @return void
727 684 */
728 685 protected function prepare_html_display_value_for_extra_fields( $field_value, &$display_value ) {
729 686 $display_value = $field_value->get_displayed_value();
730 687 }
@@ -735,10 +692,8 @@
735 692 * @since 3.0
736 693 *
737 694 * @param FrmFieldValue $field_value
738 695 * @param mixed $display_value
739 - *
740 - * @return void
741 696 */
742 697 protected function prepare_plain_text_display_value_for_extra_fields( $field_value, &$display_value ) {
743 698 $display_value = $field_value->get_displayed_value() . "\r\n";
744 699 }
@@ -749,10 +704,8 @@
749 704 * @since 2.04
750 705 *
751 706 * @param FrmFieldValue $field_value
752 707 * @param string $content
753 - *
754 - * @return void
755 708 */
756 709 protected function add_standard_row( $field_value, &$content ) {
757 710 if ( $this->format === 'plain_text_block' ) {
758 711 $this->add_plain_text_row( $field_value->get_field_label(), $field_value->get_displayed_value(), $content );
@@ -784,14 +737,14 @@
784 737 *
785 738 * @since 2.04
786 739 *
787 740 * @param string $content
788 - *
789 - * @return void
790 741 */
791 742 protected function add_user_info_to_html_table( &$content ) {
792 743 if ( $this->include_user_info ) {
744 +
793 745 foreach ( $this->entry_values->get_user_info() as $user_info ) {
746 +
794 747 $value_args = array(
795 748 'label' => $user_info['label'],
796 749 'value' => $user_info['value'],
797 750 'field_type' => 'none',
@@ -807,13 +760,12 @@
807 760 *
808 761 * @since 2.04
809 762 *
810 763 * @param string $content
811 - *
812 - * @return void
813 764 */
814 765 protected function add_user_info_to_plain_text_content( &$content ) {
815 766 if ( $this->include_user_info ) {
767 +
816 768 foreach ( $this->entry_values->get_user_info() as $user_info ) {
817 769 $this->add_plain_text_row( $user_info['label'], $user_info['value'], $content );
818 770 }
819 771 }
@@ -849,9 +801,9 @@
849 801 *
850 802 * @return bool
851 803 */
852 804 protected function is_extra_field( $field_value ) {
853 - return in_array( $field_value->get_field_type(), $this->skip_fields(), true );
805 + return in_array( $field_value->get_field_type(), $this->skip_fields() );
854 806 }
855 807
856 808 /**
857 809 * Check if an extra field is included
@@ -862,9 +814,9 @@
862 814 *
863 815 * @return bool
864 816 */
865 817 protected function is_extra_field_included( $field_value ) {
866 - return in_array( $field_value->get_field_type(), $this->include_extras, true );
818 + return in_array( $field_value->get_field_type(), $this->include_extras );
867 819 }
868 820
869 821 /**
870 822 * Add a row in an HTML table
@@ -877,19 +829,13 @@
877 829 * 'value' => (mixed) The value to add. Required
878 830 * 'field_type' => (string) The field type. Blank string if not a field.
879 831 * ]
880 832 * @param string $content
881 - *
882 - * @return void
883 833 */
884 834 protected function add_html_row( $value_args, &$content ) {
885 835 $display_value = $this->prepare_display_value_for_html_table( $value_args['value'], $value_args['field_type'] );
886 836
887 - $content .= $this->table_generator->generate_two_cell_table_row(
888 - $value_args['label'],
889 - $display_value,
890 - array( 'field_type' => $value_args['field_type'] )
891 - );
837 + $content .= $this->table_generator->generate_two_cell_table_row( $value_args['label'], $display_value );
892 838 }
893 839
894 840 /**
895 841 * Prepare the displayed value for an array
@@ -915,11 +861,10 @@
915 861 * @return mixed|string
916 862 */
917 863 protected function prepare_display_value_for_html_table( $display_value, $field_type = '' ) {
918 864 $display_value = $this->flatten_array( $display_value );
919 -
920 865 if ( ! isset( $this->atts['line_breaks'] ) || ! empty( $this->atts['line_breaks'] ) ) {
921 - return str_replace( array( "\r\n", "\n" ), '<br/>', $display_value );
866 + $display_value = str_replace( array( "\r\n", "\n" ), '<br/>', $display_value );
922 867 }
923 868
924 869 return $display_value;
925 870 }
@@ -934,9 +879,11 @@
934 879 * @return int|string
935 880 */
936 881 protected function prepare_display_value_for_plain_text_content( $display_value ) {
937 882 $display_value = $this->flatten_array( $display_value );
938 - return $this->strip_html( $display_value );
883 + $display_value = $this->strip_html( $display_value );
884 +
885 + return $display_value;
939 886 }
940 887
941 888 /**
942 889 * Flatten an array
@@ -948,9 +895,9 @@
948 895 * @return int|string
949 896 */
950 897 protected function flatten_array( $value ) {
951 898 if ( is_array( $value ) ) {
952 - $separator = $this->atts['array_separator'] ?? ', ';
899 + $separator = isset( $this->atts['array_separator'] ) ? $this->atts['array_separator'] : ', ';
953 900 $value = implode( $separator, $value );
954 901 }
955 902
956 903 return $value;
@@ -965,23 +912,22 @@
965 912 *
966 913 * @return mixed
967 914 */
968 915 protected function strip_html( $value ) {
969 - if ( ! $this->is_plain_text ) {
970 - return $value;
971 - }
972 916
973 - if ( is_array( $value ) ) {
974 - foreach ( $value as $key => $single_value ) {
975 - $value[ $key ] = $this->strip_html( $single_value );
917 + if ( $this->is_plain_text ) {
918 +
919 + if ( is_array( $value ) ) {
920 + foreach ( $value as $key => $single_value ) {
921 + $value[ $key ] = $this->strip_html( $single_value );
922 + }
923 + } elseif ( $this->is_plain_text && ! is_array( $value ) ) {
924 + if ( strpos( $value, '<img' ) !== false ) {
925 + $value = str_replace( array( '<img', 'src=', '/>', '"' ), '', $value );
926 + $value = trim( $value );
927 + }
928 + $value = strip_tags( $value );
976 929 }
977 - } elseif ( $this->is_plain_text && ! is_array( $value ) ) {
978 - if ( str_contains( $value, '<img' ) ) {
979 - $value = str_replace( array( '<img', 'src=', '/>', '"' ), '', $value );
980 - $value = trim( $value );
981 - }
982 -
983 - $value = strip_tags( $value );
984 930 }
985 931
986 932 return $value;
987 933 }