Skip to content

Commit

Permalink
Saves apostrophes as entities in built-in language editor
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Stovell <[email protected]>
  • Loading branch information
Sesquipedalian committed Mar 15, 2024
1 parent ceb5709 commit d270cf3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/Actions/Admin/Languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,10 @@ protected function cleanLangString(string $string, bool $to_display = true): str
$in_string = 0;
$is_escape = false;

// Present &apos; entity as a character.
// We'll revert it back to an entity when saving.
$string = str_replace('&apos;', "\\'", $string);

for ($i = 0; $i < strlen($string); $i++) {
// Handle escapes first.
if ($string[$i] == '\\') {
Expand Down Expand Up @@ -1856,8 +1860,10 @@ protected function cleanLangString(string $string, bool $to_display = true): str
}
// A single quote?
elseif ($string[$i] == '\'') {
// Must be in a string so escape it.
$new_string .= '\\';
// Replace with an entity.
$new_string .= '&apos;';

continue;
}

// Finally add the character to the string!
Expand Down

0 comments on commit d270cf3

Please sign in to comment.