summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-13 12:12:06 -0800
committerBrion Vibber <brion@pobox.com>2010-03-13 12:12:06 -0800
commit14c488ebb02a7d1ca5837453f1ffdb673db31b25 (patch)
tree0dcc0ebce6fd6b02e0cb77916b98dde2c8e66144 /lib
parentd2c4ff5f7c8f1aa0319489fcd91bc6b91bde24cb (diff)
Fix for _m() usage with context in StatusNet main code.
Diffstat (limited to 'lib')
-rw-r--r--lib/language.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/language.php b/lib/language.php
index 64b59e739..76c788025 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -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];
}