16 private static $instance = NULL;
29 self::$instance =
new self();
30 self::$instance->folder = (defined(
"ERRORS_FOLDER") && ERRORS_FOLDER ? ERRORS_FOLDER :
"");
31 self::$instance->messages = array();
32 if (!file_exists(self::$instance->folder) || !is_dir(self::$instance->folder)) {
33 self::$instance->folder = FALSE;
35 if (self::$instance->folder) {
37 self::$instance->LoadLanguage(
"en");
40 self::$instance->LoadLanguage($language);
49 private static function LoadLanguage($language) {
50 $filename = self::$instance->folder .
"errors_" . $language .
".php";
51 if (self::$instance->language != $language && file_exists($filename)) {
53 self::$instance->language = $language;
56 include_once $filename;
58 $filename = self::$instance->folder .
"errors_" . $language .
"_custom.php";
59 if (file_exists($filename))
60 include_once $filename;
61 if (isset($errors) && is_array($errors)) {
62 self::$instance->messages = array_merge(self::$instance->messages, $errors);
73 public static function Get($errorName) {
74 if (array_key_exists($errorName, self::$instance->messages)) {
75 return self::$instance->messages[$errorName];
85 return self::$instance->language;
static Initialize($language="en")