From 8a7f624558cb3735e892cd41f77cbb5db9d57f2b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 26 May 2019 13:23:08 +0300 Subject: [PATCH] =?UTF-8?q?return=20the=20found=20language=20rather=20than?= =?UTF-8?q?=20just=20=E2=80=98true=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/src/Grav/Common/Utils.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 9b0992f99..32da72b81 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -975,20 +975,16 @@ abstract class Utils * * @param string $string The path * - * @return bool + * @return bool|string Either false or the language * */ public static function pathPrefixedByLangCode($string) { - if (strlen($string) <= 3) { - return false; - } - $languages_enabled = Grav::instance()['config']->get('system.languages.supported', []); $parts = explode('/', trim($string, '/')); if (count($parts) > 0 && in_array($parts[0], $languages_enabled)) { - return true; + return $parts[0]; } return false;