function _support_mail_text in Support Ticketing System 6
Same name and namespace in other branches
- 7 support.module \_support_mail_text()
Returns the appropriate mail string for a given key.
1 call to _support_mail_text()
- support_mail in ./
support.module - Implementation of hook_mail().
File
- ./
support.module, line 1269 - support.module
Code
function _support_mail_text($key, $language = NULL, $variables = array(), $integrate_email) {
$langcode = isset($language) ? $language->language : NULL;
// Add one 'special unadvertised token' to $variables.
// This part of the text is not stored as a multilingual variable
// but as a 'common' translatable string.
if ($integrate_email == TRUE) {
$variables['!reply'] = t('You can reply to this email or visit the following URL to update this ticket');
}
else {
$variables['!reply'] = t('You can visit the following URL to update this ticket');
}
/* Get text from (possibly multilingual) variable, if it's user-configured.
* The following behavior provides backward compatibility with v1.3,
* and only makes i18n.module a requirement when the web site needs
* custom mail texts translated in multiple languages:
*
* - if a normal variable is set, return it untranslated.
* (because it might contain an already-translated text)
* - if a multilingual variable is not set, do check the normal variable
* (for the same reason)
* - if no variable is set, translate the default text using t()
*/
if (module_exists('i18n')) {
$admin_setting = i18n_variable_get('support_mail_' . $key, $langcode);
}
if (empty($admin_setting)) {
$admin_setting = variable_get('support_mail_' . $key, '');
}
if (empty($admin_setting)) {
return t(_support_mail_text_default($key), $variables, $langcode);
}
return strtr($admin_setting, $variables);
}