]> _ Git - cubist_cms-back.git/commitdiff
wip #6246 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Sep 2023 07:11:51 +0000 (09:11 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Sep 2023 07:11:51 +0000 (09:11 +0200)
src/app/Magic/Models/Translate.php

index e309d106f731dfbfcf4037842483a901a2d06620..76c8bb3cf54275ca345dd6ddecb94ea53dab17fb 100644 (file)
@@ -218,4 +218,29 @@ class Translate extends CubistMagicTranslatableModel
     {
         return [];
     }
+
+
+    /**
+     * @param $key string
+     * @return string
+     */
+    public static function keyToStr($key)
+    {
+        if (self::isKey($key)) {
+            return base64_decode(substr($key, 2));
+        }
+        return $key;
+    }
+
+    /**
+     * @param $key string
+     * @return bool
+     */
+    public static function isKey($key)
+    {
+        if (!$key) {
+            return false;
+        }
+        return (bool)preg_match("/^t_[a-zA-Z0-9\/\+]*={0,2}$/", $key);
+    }
 }