We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 697a9948 authored by Brion Vibber's avatar Brion Vibber

Ticket #2329: fix for use of _m() translation functions from outside of plugin directories

parent 3e9b3567
...@@ -205,14 +205,22 @@ function _mdomain($backtrace) ...@@ -205,14 +205,22 @@ function _mdomain($backtrace)
if (DIRECTORY_SEPARATOR !== '/') { if (DIRECTORY_SEPARATOR !== '/') {
$path = strtr($path, DIRECTORY_SEPARATOR, '/'); $path = strtr($path, DIRECTORY_SEPARATOR, '/');
} }
$cut = strpos($path, '/plugins/') + 9; $plug = strpos($path, '/plugins/');
if ($plug === false) {
// We're not in a plugin; return null for the default domain.
return null;
} else {
$cut = $plug + 9;
$cut2 = strpos($path, '/', $cut); $cut2 = strpos($path, '/', $cut);
if ($cut && $cut2) { if ($cut2) {
$cached[$path] = substr($path, $cut, $cut2 - $cut); $cached[$path] = substr($path, $cut, $cut2 - $cut);
} else { } else {
// We might be running directly from the plugins dir?
// If so, there's no place to store locale info.
return null; return null;
} }
} }
}
return $cached[$path]; return $cached[$path];
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment