Skip to content

Commit

Permalink
Remove ʻokina characters along with other punctuation
Browse files Browse the repository at this point in the history
Fixes #16548
  • Loading branch information
brandonkelly committed Jan 28, 2025
1 parent bd21abd commit e7ac8ab
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fixed a bug where eager-loading element queries could create an excessive amount of cache invalidation tags.
- Fixed a bug where it was possible to enable elements for new sites with validation errors. ([#16505](https://github.com/craftcms/cms/issues/16505))
- Fixed a bug where setting `transaction: true` in the Codeception configuration wasn’t rolling back database DML changes after a test. ([#16546](https://github.com/craftcms/cms/issues/16546))
- Fixed a bug where ʻokina characters weren’t being removed in auto-generated slugs. ([#16548](https://github.com/craftcms/cms/issues/16548))

## 4.14.1 - 2025-01-22

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/ElementHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function normalizeSlug(string $slug): string
$slug = StringHelper::stripHtml($slug);

// Remove inner-word punctuation
$slug = preg_replace('/[\'"‘’“”\[\]\(\)\{\}:]/u', '', $slug);
$slug = preg_replace('/[\'"‘’“”ʻ\[\]\(\)\{\}:]/u', '', $slug);

// Make it lowercase
$generalConfig = Craft::$app->getConfig()->getGeneral();
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ public static function toWords(string $str, bool $lower = false, bool $removePun
}

// Remove inner-word punctuation.
$str = preg_replace('/[\'"‘’“”\[\]\(\)\{\}:]/u', '', $str);
$str = preg_replace('/[\'"‘’“”ʻ\[\]\(\)\{\}:]/u', '', $str);

// Split on the words and return
return static::splitOnWords($str);
Expand All @@ -1800,7 +1800,7 @@ public static function toHandle(string $str): string
$handle = static::stripHtml($str);

// Remove inner-word punctuation
$handle = preg_replace('/[\'"‘’“”\[\]\(\)\{\}:]/', '', $handle);
$handle = preg_replace('/[\'"‘’“”ʻ\[\]\(\)\{\}:]/', '', $handle);

// Make it lowercase
$handle = static::toLowerCase($handle);
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/src/js/EnvVarGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Craft.EnvVarGenerator = Craft.BaseInputGenerator.extend({
let name = sourceVal.replace(/<(.*?)>/g, '');

// Remove inner-word punctuation
name = name.replace(/['"\[\]\(\)\{\}:]/g, '');
name = name.replace(/['"ʻ\[\]\(\)\{\}:]/g, '');

// Make it lowercase
name = name.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/src/js/HandleGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Craft.HandleGenerator = Craft.BaseInputGenerator.extend({
var handle = sourceVal.replace(/<(.*?)>/g, '');

// Remove inner-word punctuation
handle = handle.replace(/['"\[\]\(\)\{\}:]/g, '');
handle = handle.replace(/['"ʻ\[\]\(\)\{\}:]/g, '');

// Make it lowercase
handle = handle.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/src/js/SlugGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Craft.SlugGenerator = Craft.BaseInputGenerator.extend({
sourceVal = sourceVal.replace(/<(.*?)>/g, '');

// Remove inner-word punctuation
sourceVal = sourceVal.replace(/['"\[\]\(\)\{\}:]/g, '');
sourceVal = sourceVal.replace(/['"ʻ\[\]\(\)\{\}:]/g, '');

if (Craft.limitAutoSlugsToAscii) {
// Convert extended ASCII characters to basic ASCII
Expand Down

0 comments on commit e7ac8ab

Please sign in to comment.