mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merged MDL-15892 Improved get_string - it can now handle paths as the module like 'mod/forum' or 'grade/import/txt' and will look in the right file automatically (eg forum.php and gradeimport_txt.php)
This commit is contained in:
parent
c5d2d0dd7c
commit
bea418fd03
1 changed files with 30 additions and 1 deletions
|
@ -5113,7 +5113,36 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
|
|||
$module = 'moodle';
|
||||
}
|
||||
|
||||
// if $a happens to have % in it, double it so sprintf() doesn't break
|
||||
/// If the "module" is actually a pathname, then automatically derive the proper module name
|
||||
if (strpos($module, '/') !== false) {
|
||||
$modulepath = split('/', $module);
|
||||
|
||||
switch ($modulepath[0]) {
|
||||
|
||||
case 'mod':
|
||||
$module = $modulepath[1];
|
||||
break;
|
||||
|
||||
case 'blocks':
|
||||
case 'block':
|
||||
$module = 'block_'.$modulepath[1];
|
||||
break;
|
||||
|
||||
case 'enrol':
|
||||
$module = 'enrol_'.$modulepath[1];
|
||||
break;
|
||||
|
||||
case 'format':
|
||||
$module = 'format_'.$modulepath[1];
|
||||
break;
|
||||
|
||||
case 'grade':
|
||||
$module = 'grade'.$modulepath[1].'_'.$modulepath[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// if $a happens to have % in it, double it so sprintf() doesn't break
|
||||
if ($a) {
|
||||
$a = clean_getstring_data( $a );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue