| @@ -16,9 +16,8 @@ | ||
| 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,10 +124,8 @@ | ||
| 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 | 131 | |
| @@ -158,10 +144,8 @@ | ||
| 158 | 144 | * |
| 159 | 145 | * @since 2.04 |
| 160 | 146 | * |
| 161 | 147 | * @param array $atts |
| 162 | - * | |
| 163 | - * @return void | |
| 164 | 148 | */ |
| 165 | 149 | protected function init_entry_values( $atts ) { |
| 166 | 150 | $entry_atts = $this->prepare_entry_attributes( $atts ); |
| 167 | 151 | $this->entry_values = new FrmEntryValues( $this->entry->id, $entry_atts ); |
| @@ -179,9 +163,8 @@ | ||
| 179 | 163 | protected function prepare_entry_attributes( $atts ) { |
| 180 | 164 | $entry_atts = array(); |
| 181 | 165 | |
| 182 | 166 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
| 183 | - | |
| 184 | 167 | foreach ( $conditionally_add as $index ) { |
| 185 | 168 | if ( isset( $atts[ $index ] ) ) { |
| 186 | 169 | $entry_atts[ $index ] = $atts[ $index ]; |
| 187 | 170 | } |
| @@ -195,17 +178,20 @@ | ||
| 195 | 178 | * |
| 196 | 179 | * @since 2.04 |
| 197 | 180 | * |
| 198 | 181 | * @param array $atts |
| 199 | - * | |
| 200 | - * @return void | |
| 201 | 182 | */ |
| 202 | 183 | protected function init_format( $atts ) { |
| 203 | 184 | if ( $atts['format'] === 'array' ) { |
| 185 | + | |
| 204 | 186 | $this->format = 'array'; |
| 187 | + | |
| 205 | 188 | } elseif ( $atts['format'] === 'json' ) { |
| 189 | + | |
| 206 | 190 | $this->format = 'json'; |
| 191 | + | |
| 207 | 192 | } elseif ( $atts['format'] === 'text' ) { |
| 193 | + | |
| 208 | 194 | if ( $this->is_plain_text === true ) { |
| 209 | 195 | $this->format = 'plain_text_block'; |
| 210 | 196 | } else { |
| 211 | 197 | $this->format = 'table'; |
| @@ -236,10 +222,8 @@ | ||
| 236 | 222 | * |
| 237 | 223 | * @since 2.05 |
| 238 | 224 | * |
| 239 | 225 | * @param array $atts |
| 240 | - * | |
| 241 | - * @return void | |
| 242 | 226 | */ |
| 243 | 227 | protected function init_array_key( $atts ) { |
| 244 | 228 | if ( isset( $atts['array_key'] ) && $atts['array_key'] === 'id' ) { |
| 245 | 229 | $this->array_key = 'id'; |
| @@ -251,10 +235,8 @@ | ||
| 251 | 235 | * |
| 252 | 236 | * @since 2.04 |
| 253 | 237 | * |
| 254 | 238 | * @param array $atts |
| 255 | - * | |
| 256 | - * @return void | |
| 257 | 239 | */ |
| 258 | 240 | protected function init_is_plain_text( $atts ) { |
| 259 | 241 | if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) { |
| 260 | 242 | $this->is_plain_text = true; |
| @@ -268,10 +250,8 @@ | ||
| 268 | 250 | * |
| 269 | 251 | * @since 2.04 |
| 270 | 252 | * |
| 271 | 253 | * @param array $atts |
| 272 | - * | |
| 273 | - * @return void | |
| 274 | 254 | */ |
| 275 | 255 | protected function init_include_blank( $atts ) { |
| 276 | 256 | if ( isset( $atts['include_blank'] ) && $atts['include_blank'] ) { |
| 277 | 257 | $this->include_blank = true; |
| @@ -283,10 +263,8 @@ | ||
| 283 | 263 | * |
| 284 | 264 | * @since 2.04 |
| 285 | 265 | * |
| 286 | 266 | * @param array $atts |
| 287 | - * | |
| 288 | - * @return void | |
| 289 | 267 | */ |
| 290 | 268 | protected function init_direction( $atts ) { |
| 291 | 269 | if ( isset( $atts['direction'] ) && $atts['direction'] === 'rtl' ) { |
| 292 | 270 | $this->direction = 'rtl'; |
| @@ -298,10 +276,8 @@ | ||
| 298 | 276 | * |
| 299 | 277 | * @since 2.04 |
| 300 | 278 | * |
| 301 | 279 | * @param array $atts |
| 302 | - * | |
| 303 | - * @return void | |
| 304 | 280 | */ |
| 305 | 281 | protected function init_include_user_info( $atts ) { |
| 306 | 282 | if ( isset( $atts['user_info'] ) && $atts['user_info'] ) { |
| 307 | 283 | $this->include_user_info = true; |
| @@ -311,10 +287,8 @@ | ||
| 311 | 287 | /** |
| 312 | 288 | * Which fields to skip by default |
| 313 | 289 | * |
| 314 | 290 | * @since 3.0 |
| 315 | - * | |
| 316 | - * @return array | |
| 317 | 291 | */ |
| 318 | 292 | protected function skip_fields() { |
| 319 | 293 | return array( 'captcha', 'html', FrmSubmitHelper::FIELD_TYPE ); |
| 320 | 294 | } |
| @@ -324,10 +298,8 @@ | ||
| 324 | 298 | * |
| 325 | 299 | * @since 3.0 |
| 326 | 300 | * |
| 327 | 301 | * @param array $atts |
| 328 | - * | |
| 329 | - * @return void | |
| 330 | 302 | */ |
| 331 | 303 | protected function init_include_extras( $atts ) { |
| 332 | 304 | if ( isset( $atts['include_extras'] ) && $atts['include_extras'] ) { |
| 333 | 305 | $this->include_extras = array_map( 'strtolower', array_map( 'trim', explode( ',', $atts['include_extras'] ) ) ); |
| @@ -337,10 +309,8 @@ | ||
| 337 | 309 | /** |
| 338 | 310 | * Initialize the single_cell_fields property |
| 339 | 311 | * |
| 340 | 312 | * @since 3.0 |
| 341 | - * | |
| 342 | - * @return void | |
| 343 | 313 | */ |
| 344 | 314 | protected function init_single_cell_fields() { |
| 345 | 315 | $this->single_cell_fields = array( 'html' ); |
| 346 | 316 | } |
| @@ -350,10 +320,8 @@ | ||
| 350 | 320 | * |
| 351 | 321 | * @since 2.04 |
| 352 | 322 | * |
| 353 | 323 | * @param array $atts |
| 354 | - * | |
| 355 | - * @return void | |
| 356 | 324 | */ |
| 357 | 325 | protected function init_table_generator( $atts ) { |
| 358 | 326 | $this->table_generator = new FrmTableHTMLGenerator( 'entry', $atts ); |
| 359 | 327 | } |
| @@ -363,10 +331,8 @@ | ||
| 363 | 331 | * |
| 364 | 332 | * @since 2.04 |
| 365 | 333 | * |
| 366 | 334 | * @param array $atts |
| 367 | - * | |
| 368 | - * @return void | |
| 369 | 335 | */ |
| 370 | 336 | protected function init_is_clickable( $atts ) { |
| 371 | 337 | if ( isset( $atts['clickable'] ) && $atts['clickable'] ) { |
| 372 | 338 | $this->is_clickable = true; |
| @@ -377,12 +343,8 @@ | ||
| 377 | 343 | * Save the passed atts for other calls. Exclude some attributes to prevent |
| 378 | 344 | * interaction with processing field values like time format. |
| 379 | 345 | * |
| 380 | 346 | * @since 3.0 |
| 381 | - * | |
| 382 | - * @param array $atts | |
| 383 | - * | |
| 384 | - * @return void | |
| 385 | 347 | */ |
| 386 | 348 | protected function init_atts( $atts ) { |
| 387 | 349 | $atts['source'] = 'entry_formatter'; |
| 388 | 350 | $atts['wpautop'] = false; |
| @@ -388,9 +350,8 @@ | ||
| 388 | 350 | $atts['wpautop'] = false; |
| 389 | 351 | $atts['return_array'] = true; |
| 390 | 352 | |
| 391 | 353 | $unset = array( 'id', 'form_id', 'format' ); |
| 392 | - | |
| 393 | 354 | foreach ( $unset as $param ) { |
| 394 | 355 | if ( isset( $atts[ $param ] ) ) { |
| 395 | 356 | unset( $atts[ $param ] ); |
| 396 | 357 | } |
| @@ -488,13 +449,12 @@ | ||
| 488 | 449 | * |
| 489 | 450 | * @since 2.05 |
| 490 | 451 | * |
| 491 | 452 | * @param string $content |
| 492 | - * | |
| 493 | - * @return void | |
| 494 | 453 | */ |
| 495 | 454 | protected function add_field_values_to_content( &$content ) { |
| 496 | 455 | foreach ( $this->entry_values->get_field_values() as $field_value ) { |
| 456 | + | |
| 497 | 457 | /** |
| 498 | 458 | * @var FrmFieldValue $field_value |
| 499 | 459 | */ |
| 500 | 460 | $field_value->prepare_displayed_value( $this->atts ); |
| @@ -539,10 +499,8 @@ | ||
| 539 | 499 | * @since 2.04 |
| 540 | 500 | * |
| 541 | 501 | * @param array $field_values |
| 542 | 502 | * @param array $output |
| 543 | - * | |
| 544 | - * @return void | |
| 545 | 503 | */ |
| 546 | 504 | protected function push_field_values_to_array( $field_values, &$output ) { |
| 547 | 505 | foreach ( $field_values as $field_value ) { |
| 548 | 506 | /** |
| @@ -559,10 +517,8 @@ | ||
| 559 | 517 | * @since 2.04 |
| 560 | 518 | * |
| 561 | 519 | * @param FrmFieldValue $field_value |
| 562 | 520 | * @param array $output |
| 563 | - * | |
| 564 | - * @return void | |
| 565 | 521 | */ |
| 566 | 522 | protected function push_single_field_to_array( $field_value, &$output ) { |
| 567 | 523 | if ( $this->include_field_in_content( $field_value ) ) { |
| 568 | 524 | |
| @@ -570,9 +526,8 @@ | ||
| 570 | 526 | |
| 571 | 527 | $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
| 572 | 528 | |
| 573 | 529 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
| 574 | - | |
| 575 | 530 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
| 576 | 531 | $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
| 577 | 532 | } |
| 578 | 533 | } |
| @@ -585,15 +540,13 @@ | ||
| 585 | 540 | * |
| 586 | 541 | * @param string $label |
| 587 | 542 | * @param mixed $display_value |
| 588 | 543 | * @param string $content |
| 589 | - * | |
| 590 | - * @return void | |
| 591 | 544 | */ |
| 592 | 545 | protected function add_plain_text_row( $label, $display_value, &$content ) { |
| 593 | 546 | $display_value = $this->prepare_display_value_for_plain_text_content( $display_value ); |
| 594 | 547 | |
| 595 | - if ( 'rtl' === $this->direction ) { | |
| 548 | + if ( 'rtl' == $this->direction ) { | |
| 596 | 549 | $content .= wp_kses_post( $display_value . ' :' . $label ) . "\r\n"; |
| 597 | 550 | } else { |
| 598 | 551 | $content .= wp_kses_post( $label . ': ' . $display_value ) . "\r\n"; |
| 599 | 552 | } |
| @@ -605,10 +558,8 @@ | ||
| 605 | 558 | * @since 2.04 |
| 606 | 559 | * |
| 607 | 560 | * @param FrmFieldValue $field_value |
| 608 | 561 | * @param string $content |
| 609 | - * | |
| 610 | - * @return void | |
| 611 | 562 | */ |
| 612 | 563 | protected function add_field_value_to_content( $field_value, &$content ) { |
| 613 | 564 | if ( $this->is_extra_field( $field_value ) ) { |
| 614 | 565 | $this->add_row_for_extra_field( $field_value, $content ); |
| @@ -624,10 +575,8 @@ | ||
| 624 | 575 | * @since 3.0 |
| 625 | 576 | * |
| 626 | 577 | * @param FrmFieldValue $field_value |
| 627 | 578 | * @param string $content |
| 628 | - * | |
| 629 | - * @return void | |
| 630 | 579 | */ |
| 631 | 580 | protected function add_row_for_extra_field( $field_value, &$content ) { |
| 632 | 581 | if ( ! $this->include_field_in_content( $field_value ) ) { |
| 633 | 582 | return; |
| @@ -646,10 +595,8 @@ | ||
| 646 | 595 | * @since 3.0 |
| 647 | 596 | * |
| 648 | 597 | * @param FrmFieldValue $field_value |
| 649 | 598 | * @param string $content |
| 650 | - * | |
| 651 | - * @return void | |
| 652 | 599 | */ |
| 653 | 600 | protected function add_row_for_standard_field( $field_value, &$content ) { |
| 654 | 601 | if ( ! $this->include_field_in_content( $field_value ) ) { |
| 655 | 602 | return; |
| @@ -669,10 +616,8 @@ | ||
| 669 | 616 | * @since 3.0 |
| 670 | 617 | * |
| 671 | 618 | * @param FrmFieldValue $field_value |
| 672 | 619 | * @param string $content |
| 673 | - * | |
| 674 | - * @return void | |
| 675 | 620 | */ |
| 676 | 621 | protected function add_html_row_for_included_extra( $field_value, &$content ) { |
| 677 | 622 | $this->prepare_html_display_value_for_extra_fields( $field_value, $display_value ); |
| 678 | 623 | |
| @@ -690,10 +635,8 @@ | ||
| 690 | 635 | * @since 3.0 |
| 691 | 636 | * |
| 692 | 637 | * @param FrmFieldValue $field_value |
| 693 | 638 | * @param string $content |
| 694 | - * | |
| 695 | - * @return void | |
| 696 | 639 | */ |
| 697 | 640 | protected function add_plain_text_row_for_included_extra( $field_value, &$content ) { |
| 698 | 641 | $this->prepare_plain_text_display_value_for_extra_fields( $field_value, $display_value ); |
| 699 | 642 | |
| @@ -710,10 +653,8 @@ | ||
| 710 | 653 | * @since 3.0 |
| 711 | 654 | * |
| 712 | 655 | * @param string $display_value |
| 713 | 656 | * @param string $content |
| 714 | - * | |
| 715 | - * @return void | |
| 716 | 657 | */ |
| 717 | 658 | protected function add_single_cell_html_row( $display_value, &$content ) { |
| 718 | 659 | // TODO: maybe move to FrmFieldValue |
| 719 | 660 | $display_value = $this->prepare_display_value_for_html_table( $display_value ); |
| @@ -727,10 +668,8 @@ | ||
| 727 | 668 | * @since 3.0 |
| 728 | 669 | * |
| 729 | 670 | * @param string $display_value |
| 730 | 671 | * @param string $content |
| 731 | - * | |
| 732 | - * @return void | |
| 733 | 672 | */ |
| 734 | 673 | protected function add_single_value_plain_text_row( $display_value, &$content ) { |
| 735 | 674 | $content .= $this->prepare_display_value_for_plain_text_content( $display_value ); |
| 736 | 675 | } |
| @@ -741,10 +680,8 @@ | ||
| 741 | 680 | * @since 3.0 |
| 742 | 681 | * |
| 743 | 682 | * @param FrmFieldValue $field_value |
| 744 | 683 | * @param mixed $display_value |
| 745 | - * | |
| 746 | - * @return void | |
| 747 | 684 | */ |
| 748 | 685 | protected function prepare_html_display_value_for_extra_fields( $field_value, &$display_value ) { |
| 749 | 686 | $display_value = $field_value->get_displayed_value(); |
| 750 | 687 | } |
| @@ -755,10 +692,8 @@ | ||
| 755 | 692 | * @since 3.0 |
| 756 | 693 | * |
| 757 | 694 | * @param FrmFieldValue $field_value |
| 758 | 695 | * @param mixed $display_value |
| 759 | - * | |
| 760 | - * @return void | |
| 761 | 696 | */ |
| 762 | 697 | protected function prepare_plain_text_display_value_for_extra_fields( $field_value, &$display_value ) { |
| 763 | 698 | $display_value = $field_value->get_displayed_value() . "\r\n"; |
| 764 | 699 | } |
| @@ -769,10 +704,8 @@ | ||
| 769 | 704 | * @since 2.04 |
| 770 | 705 | * |
| 771 | 706 | * @param FrmFieldValue $field_value |
| 772 | 707 | * @param string $content |
| 773 | - * | |
| 774 | - * @return void | |
| 775 | 708 | */ |
| 776 | 709 | protected function add_standard_row( $field_value, &$content ) { |
| 777 | 710 | if ( $this->format === 'plain_text_block' ) { |
| 778 | 711 | $this->add_plain_text_row( $field_value->get_field_label(), $field_value->get_displayed_value(), $content ); |
| @@ -804,14 +737,14 @@ | ||
| 804 | 737 | * |
| 805 | 738 | * @since 2.04 |
| 806 | 739 | * |
| 807 | 740 | * @param string $content |
| 808 | - * | |
| 809 | - * @return void | |
| 810 | 741 | */ |
| 811 | 742 | protected function add_user_info_to_html_table( &$content ) { |
| 812 | 743 | if ( $this->include_user_info ) { |
| 744 | + | |
| 813 | 745 | foreach ( $this->entry_values->get_user_info() as $user_info ) { |
| 746 | + | |
| 814 | 747 | $value_args = array( |
| 815 | 748 | 'label' => $user_info['label'], |
| 816 | 749 | 'value' => $user_info['value'], |
| 817 | 750 | 'field_type' => 'none', |
| @@ -827,10 +760,8 @@ | ||
| 827 | 760 | * |
| 828 | 761 | * @since 2.04 |
| 829 | 762 | * |
| 830 | 763 | * @param string $content |
| 831 | - * | |
| 832 | - * @return void | |
| 833 | 764 | */ |
| 834 | 765 | protected function add_user_info_to_plain_text_content( &$content ) { |
| 835 | 766 | if ( $this->include_user_info ) { |
| 836 | 767 | |
| @@ -898,19 +829,13 @@ | ||
| 898 | 829 | * 'value' => (mixed) The value to add. Required |
| 899 | 830 | * 'field_type' => (string) The field type. Blank string if not a field. |
| 900 | 831 | * ] |
| 901 | 832 | * @param string $content |
| 902 | - * | |
| 903 | - * @return void | |
| 904 | 833 | */ |
| 905 | 834 | protected function add_html_row( $value_args, &$content ) { |
| 906 | 835 | $display_value = $this->prepare_display_value_for_html_table( $value_args['value'], $value_args['field_type'] ); |
| 907 | 836 | |
| 908 | - $content .= $this->table_generator->generate_two_cell_table_row( | |
| 909 | - $value_args['label'], | |
| 910 | - $display_value, | |
| 911 | - array( 'field_type' => $value_args['field_type'] ) | |
| 912 | - ); | |
| 837 | + $content .= $this->table_generator->generate_two_cell_table_row( $value_args['label'], $display_value ); | |
| 913 | 838 | } |
| 914 | 839 | |
| 915 | 840 | /** |
| 916 | 841 | * Prepare the displayed value for an array |
| @@ -936,9 +861,8 @@ | ||
| 936 | 861 | * @return mixed|string |
| 937 | 862 | */ |
| 938 | 863 | protected function prepare_display_value_for_html_table( $display_value, $field_type = '' ) { |
| 939 | 864 | $display_value = $this->flatten_array( $display_value ); |
| 940 | - | |
| 941 | 865 | if ( ! isset( $this->atts['line_breaks'] ) || ! empty( $this->atts['line_breaks'] ) ) { |
| 942 | 866 | $display_value = str_replace( array( "\r\n", "\n" ), '<br/>', $display_value ); |
| 943 | 867 | } |
| 944 | 868 | |
| @@ -971,9 +895,9 @@ | ||
| 971 | 895 | * @return int|string |
| 972 | 896 | */ |
| 973 | 897 | protected function flatten_array( $value ) { |
| 974 | 898 | if ( is_array( $value ) ) { |
| 975 | - $separator = $this->atts['array_separator'] ?? ', '; | |
| 899 | + $separator = isset( $this->atts['array_separator'] ) ? $this->atts['array_separator'] : ', '; | |
| 976 | 900 | $value = implode( $separator, $value ); |
| 977 | 901 | } |
| 978 | 902 | |
| 979 | 903 | return $value; |
| @@ -988,9 +912,11 @@ | ||
| 988 | 912 | * |
| 989 | 913 | * @return mixed |
| 990 | 914 | */ |
| 991 | 915 | protected function strip_html( $value ) { |
| 916 | + | |
| 992 | 917 | if ( $this->is_plain_text ) { |
| 918 | + | |
| 993 | 919 | if ( is_array( $value ) ) { |
| 994 | 920 | foreach ( $value as $key => $single_value ) { |
| 995 | 921 | $value[ $key ] = $this->strip_html( $single_value ); |
| 996 | 922 | } |
| @@ -998,9 +924,8 @@ | ||
| 998 | 924 | if ( strpos( $value, '<img' ) !== false ) { |
| 999 | 925 | $value = str_replace( array( '<img', 'src=', '/>', '"' ), '', $value ); |
| 1000 | 926 | $value = trim( $value ); |
| 1001 | 927 | } |
| 1002 | - | |
| 1003 | 928 | $value = strip_tags( $value ); |
| 1004 | 929 | } |
| 1005 | 930 | } |
| 1006 | 931 | |