+// Load the extension and maybe found language and function files
+function LOAD_EXTENSION ($ext_name) {
+ global $EXT_LOADED, $_CONFIG, $CSS, $cacheMode;
+
+ // Is the extension already loaded?
+ if (isset($EXT_LOADED[$ext_name])) {
+ // Debug message
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
+ return false;
+ }
+
+ // Construct FQFN for extension file
+ $extInclude = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
+
+ // Is the extension file NOT there?
+ if (!FILE_READABLE($extInclude)) {
+ // Debug message
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s not found.", $ext_name));
+
+ // Abort here
+ return false;
+ } // END - if
+
+ // Construct FQFN for language file
+ $langInclude = sprintf("%sinc/language/%s_%s.php", PATH, $ext_name, GET_LANGUAGE());
+
+ // Is this include there?
+ if (FILE_READABLE($langInclude)) {
+ // Then load it
+ require($langInclude);
+ } // END - if
+
+ // Construct FQFN for functions file
+ $funcsInclude = sprintf("%sinc/libs/%s_functions.php", PATH, $ext_name);
+
+ // Is this include there?
+ if (FILE_READABLE($funcsInclude)) {
+ // Then load it
+ require($funcsInclude);
+ } // END - if
+
+ // Set extension load mode to nothing (default)
+ $EXT_LOAD_MODE = "";
+
+ // Include the extension file
+ require($extInclude);
+
+ // Mark it as loaded
+ $EXT_LOADED[$ext_name] = true;
+
+ // All fine!
+ return true;
+}
+