Several bugfixes, getMessage() introduced
[mailer.git] / inc / functions.php
index a1d9b344f625bbcb0694f77ce52c51c4464ce4df..cb7e4c1536d2528fafaada603fbc3b0723db18d1 100644 (file)
@@ -2868,6 +2868,28 @@ function getConfig ($entry) {
        return $value;
 }
 
+// @TODO Rewrite all language constants to the function getLanguage().
+// "Getter" for language strings
+function getMessage ($messageId) {
+       // Default is not found!
+       $return = "!".$messageId."!";
+
+       // Is the language string found?
+       if (isset($GLOBALS['msg'][$messageId])) {
+               // Language array element found
+               $return = $GLOBALS['msg'][$messageId];
+       } elseif (defined($messageId)) {
+               // @DEPRECATED Deprecated constant found
+               $return = constant($messageId);
+       } else {
+               // Missing language constant
+               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Missing message string %s detected.", $messageId));
+       }
+
+       // Return the string
+       return $return;
+}
+
 //////////////////////////////////////////////////
 //                                              //
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //