From 8fab7eb39603b28fa2666c583c5215e17f41659b Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Mon, 15 May 2023 16:52:25 +0100 Subject: [PATCH] Prevent additional white space above font credits --- admin/class-manage-fonts.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/class-manage-fonts.php b/admin/class-manage-fonts.php index 163d6761..e55ec806 100644 --- a/admin/class-manage-fonts.php +++ b/admin/class-manage-fonts.php @@ -355,12 +355,16 @@ function manage_font_license( $font_name, $file_name ) { // Build the font credits string $font_credits = " - {$font_name} Font {$copyright} {$license_info} {$license_url} {$font_source} {$end_credits_note} "; + // Check if readme.txt ends with a new line + if ( "\n" !== $readme_file_contents[ strlen( $readme_file_contents ) - 1 ] ) { + $font_credits = "\n" . $font_credits; + } + // Add font credits to the end of readme.txt file_put_contents( $readme_file,