From 424da520cf9933763258fa773948248fb67bd252 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 6 Aug 2018 15:37:59 -0600 Subject: [PATCH] Fix #2134 - inheritance of theme classes that include digits in camelcase --- CHANGELOG.md | 1 + system/src/Grav/Common/Inflector.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c22afbeb6..9d01d354e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Improved `Utils::url()` to support query strings 1. [](#bugfix) * Fixed issue with uppercase extensions and fallback media URLs [#2133](https://github.com/getgrav/grav/issues/2133) + * Fixed theme inheritance issue with `camel-case` that includes numbers [#2134](https://github.com/getgrav/grav/issues/2134) # v1.5.0-rc.1 ## 07/31/2018 diff --git a/system/src/Grav/Common/Inflector.php b/system/src/Grav/Common/Inflector.php index f4a17ba7c..61c233809 100644 --- a/system/src/Grav/Common/Inflector.php +++ b/system/src/Grav/Common/Inflector.php @@ -190,10 +190,11 @@ class Inflector public function hyphenize($word) { $regex1 = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1-\2', $word); - $regex2 = preg_replace('/([a-zd])([A-Z])/', '\1-\2', $regex1); - $regex3 = preg_replace('/[^A-Z^a-z^0-9]+/', '-', $regex2); + $regex2 = preg_replace('/([a-z])([A-Z])/', '\1-\2', $regex1); + $regex3 = preg_replace('/([0-9])([A-Z])/', '\1-\2', $regex2); + $regex4 = preg_replace('/[^A-Z^a-z^0-9]+/', '-', $regex3); - return strtolower($regex3); + return strtolower($regex4); } /**