| @@ -429,9 +429,9 @@ | ||
| 429 | 429 | return get_permalink( $this->args['page_id'] ); |
| 430 | 430 | break; |
| 431 | 431 | |
| 432 | 432 | case 'url_referer': |
| 433 | - return isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_url( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; | |
| 433 | + return isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; | |
| 434 | 434 | break; |
| 435 | 435 | |
| 436 | 436 | case 'url_login': |
| 437 | 437 | return wp_login_url(); |
| @@ -601,9 +601,8 @@ | ||
| 601 | 601 | * |
| 602 | 602 | * @return string |
| 603 | 603 | */ |
| 604 | 604 | public static function replace_file_tags( $text, $entry_id ) { |
| 605 | - $text = $text ?? ''; | |
| 606 | 605 | $pattern = '/{(?:image|file):(\w*)}/'; |
| 607 | 606 | |
| 608 | 607 | preg_match_all( $pattern, $text, $matches ); |
| 609 | 608 | |
| @@ -614,12 +613,19 @@ | ||
| 614 | 613 | |
| 615 | 614 | foreach ( $matches[1] as $index => $meta_key ) { |
| 616 | 615 | $meta_value = weforms_get_entry_meta( $entry_id, $meta_key, true ); |
| 617 | 616 | |
| 618 | - $files = []; | |
| 619 | - $attachments = is_array( $meta_value ) ? $meta_value : array( $meta_value ); | |
| 617 | + $files = []; | |
| 620 | 618 | |
| 621 | - foreach ( $attachments as $attachment_id ) { | |
| 619 | + if ( is_array( $meta_value ) ) { | |
| 620 | + foreach ( $meta_value as $key => $attachment_id ) { | |
| 621 | + $file_url = wp_get_attachment_url( $attachment_id ); | |
| 622 | + | |
| 623 | + if ( $file_url ) { | |
| 624 | + $files[] = $file_url; | |
| 625 | + } | |
| 626 | + } | |
| 627 | + } else { | |
| 622 | 628 | $file_url = wp_get_attachment_url( $attachment_id ); |
| 623 | 629 | |
| 624 | 630 | if ( $file_url ) { |
| 625 | 631 | $files[] = $file_url; |