summaryrefslogtreecommitdiff
path: root/lib/language.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-22 13:56:16 -0700
committerBrion Vibber <brion@pobox.com>2010-03-22 13:56:16 -0700
commite89908f26140c217e01b2f8f755712f38f3935f3 (patch)
tree6b241fc2e33f3528cf48b415ef67906826b02e24 /lib/language.php
parent714d920faea302b55857cc3bec4e9e6160ea136a (diff)
parenteb563937df921e5fc67ca0c87e229feb2907fd19 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 1.0.x
Conflicts: lib/channel.php scripts/imdaemon.php
Diffstat (limited to 'lib/language.php')
-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];
}