]> git.mxchange.org Git - mailer.git/blobdiff - inc/load_extensions.php
Debug line added if is not an array
[mailer.git] / inc / load_extensions.php
index 4a7015304512b2d0b9dd5d9a156ddacae73118a2..8d69d37d79da508a1975e1a91517c32bedacd45d 100644 (file)
@@ -70,15 +70,15 @@ if (EXT_IS_ACTIVE("cache")) {
 
        // Do not recreate cache file when it's switched off!
        if (($cacheMode == "init") && ($_CONFIG['cache_exts'] == "N")) $cacheMode = "skip";
-
-       // Load language
-       if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php");
 } else {
        // Cache extension not active
        $cacheMode = "no";
 }
 
 if ($cacheMode == "load") {
+       // Init include array
+       $EXT_POOL = array();
+
        // Re-initialize handler
        $cacheInstance->cache_file("extensions", true);
 
@@ -96,7 +96,10 @@ if ($cacheMode == "load") {
                // Load Language file
                if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
                        $INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
-                       if (FILE_READABLE($INC)) require_once($INC);
+                       if (FILE_READABLE($INC)) {
+                               // Add it
+                               $EXT_POOL[] = $INC;
+                       }
                } // END - if
 
                // Load CSS file
@@ -104,7 +107,7 @@ if ($cacheMode == "load") {
 
                // Load extension file itself
                if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
-                       require_once(PATH."inc/extensions/ext-".$name.".php");
+                       $EXT_POOL[] = sprintf("%sinc/extensions/ext-%s.php", PATH, $name);
                } // END - if
 
                // Version number
@@ -154,6 +157,14 @@ if ($cacheMode == "load") {
 
        // Load more cache files (like admins)
        require_once(PATH."inc/load_cache.php");
+
+       // Load all extension files
+       foreach ($EXT_POOL as $inc) {
+               require_once($inc);
+       } // END - foreach
+
+       // Remove array
+       unset($EXT_POOL);
 } else {
        // If current user is not admin load only activated extensions
        // The admin shall use every available extension for testing purposes
@@ -280,11 +291,14 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
        SQL_FREERESULT($res_ext_crt);
 }
 
-// Load include files
+// Load include files if found
 if (!empty($INC_POOL[0])) {
        foreach ($INC_POOL as $inc) {
                require_once($inc);
        } // END - foreach
+
+       // Remove array
+       unset($INC_POOL);
 } // END - if
 
 // Uninstall extensions that are no longer in our system