diff --git a/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php b/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php index 7b688eb3fb..ecceb1aded 100644 --- a/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php +++ b/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php @@ -480,19 +480,27 @@ public static function customize_fu_response_notices( $notices ) { } /** - * Sanitizes the submitted "Alternative Text" as the plain text it is. + * Sanitizes the submitted free-text fields as the plain text they are. * * @param array $post_array Array of post settings. * @return array */ public static function sanitize_submitted_description( $post_array ) { - // The photo form is the only Frontend Uploader form here; scope to it should another ever be added. - if ( Registrations::get_post_type() !== ( $post_array['post_type'] ?? '' ) ) { - return $post_array; - } + // The description is the photo's alternative text, so it keeps its line breaks; the other two are single lines. + $fields = [ + 'post_title' => 'sanitize_text_field', + 'post_content' => 'sanitize_textarea_field', + 'post_excerpt' => 'sanitize_text_field', + ]; + + foreach ( $fields as $field => $sanitize ) { + if ( ! isset( $post_array[ $field ] ) ) { + continue; + } + + $value = $sanitize( wp_unslash( $post_array[ $field ] ) ); - if ( isset( $post_array['post_content'] ) ) { - $post_array['post_content'] = wp_slash( sanitize_textarea_field( wp_unslash( $post_array['post_content'] ) ) ); + $post_array[ $field ] = wp_slash( strip_shortcodes( $value ) ); } return $post_array;