]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/language.php
Fix for _m() usage with context in StatusNet main code.
[quix0rs-gnu-social.git] / lib / language.php
index 64b59e73966e61b9894e85efbd57eadd4e6a2f9b..76c7880257f5b36a4b3572013f2618c399dac62e 100644 (file)
@@ -202,16 +202,19 @@ function _mdomain($backtrace)
     static $cached;
     $path = $backtrace[0]['file'];
     if (!isset($cached[$path])) {
+        $final = 'statusnet'; // assume default domain
         if (DIRECTORY_SEPARATOR !== '/') {
             $path = strtr($path, DIRECTORY_SEPARATOR, '/');
         }
-        $cut = strpos($path, '/plugins/') + 9;
-        $cut2 = strpos($path, '/', $cut);
-        if ($cut && $cut2) {
-            $cached[$path] = substr($path, $cut, $cut2 - $cut);
-        } else {
-            return null;
+        $cut = strpos($path, '/plugins/');
+        if ($cut) {
+            $cut += strlen('/plugins/');
+            $cut2 = strpos($path, '/', $cut);
+            if ($cut && $cut2) {
+                $final = substr($path, $cut, $cut2 - $cut);
+            }
         }
+        $cached[$path] = $final;
     }
     return $cached[$path];
 }