MDL-22061 workaround for missing alttext of some emoticons

This commit is contained in:
Petr Skoda
2010-04-11 20:22:07 +00:00
parent f020dd1b6b
commit ef44fbedb6
2 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -5905,7 +5905,12 @@ class amos_string_manager implements string_manager {
$string = $this->load_component_strings($component, $lang);
if (!isset($string[$identifier])) {
if ($identifier !== 'parentlanguage' and $component !== 'pix') {
if ($component === 'pix' or $component === 'core_pix') {
// this component contains only alt tags for emoticons,
// not all of them are supposed to be defined
return '';
}
if ($identifier !== 'parentlanguage') {
debugging("Invalid get_string() identifier: '$identifier' or component '$component'", DEBUG_DEVELOPER);
}
return "[[$identifier]]";
+3 -1
View File
@@ -1628,7 +1628,9 @@ function replace_smilies(&$text) {
$img[$lang] = array();
foreach ($emoticons as $emoticon => $image){
$alttext = get_string($image, 'pix');
$alttext = preg_replace('/^\[\[(.*)\]\]$/', '$1', $alttext); /// Clean alttext in case there isn't lang string for it.
if ($alttext === '') {
$alttext = $image;
}
$e[$lang][] = $emoticon;
$img[$lang][] = '<img alt="'. $alttext .'" width="15" height="15" src="'. $OUTPUT->pix_url('s/' . $image) . '" />';
}