More exceptions added, class loader can now load extra configs
authorRoland Häder <roland@mxchange.org>
Thu, 13 Mar 2008 20:30:57 +0000 (20:30 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 13 Mar 2008 20:30:57 +0000 (20:30 +0000)
13 files changed:
.gitattributes
inc/classes/exceptions/language/class_MissingFileIoHandlerException.php [new file with mode: 0644]
inc/classes/exceptions/language/class_MissingLanguageHandlerException.php [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/database/classes/class_LocalFileDatabase.php
inc/classes/main/template/class_TemplateEngine.php
inc/config-local.php [deleted file]
inc/config.php
inc/config/class_FrameworkConfiguration.php
inc/config/config-override.php [new file with mode: 0644]
inc/includes.php
inc/language/.htaccess [new file with mode: 0644]
inc/loader/class_ClassLoader.php

index 43e83aa723d192e08d923d2a9e02f6004784f603..6f52559c15a8238a4598f1ce56302f2f8577c445 100644 (file)
@@ -47,6 +47,8 @@ inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php -te
 inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php -text
 inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php -text
 inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php -text
+inc/classes/exceptions/language/class_MissingFileIoHandlerException.php -text
+inc/classes/exceptions/language/class_MissingLanguageHandlerException.php -text
 inc/classes/exceptions/main/.htaccess -text
 inc/classes/exceptions/main/class_ClassMismatchException.php -text
 inc/classes/exceptions/main/class_ClassNotFoundException.php -text
@@ -145,16 +147,17 @@ inc/classes/middleware/debug/.htaccess -text
 inc/classes/middleware/debug/class_DebugMiddleware.php -text
 inc/classes/middleware/io/.htaccess -text
 inc/classes/middleware/io/class_FileIOHandler.php -text
-inc/config-local.php -text
 inc/config.php -text
 inc/config/.htaccess -text
 inc/config/class_FrameworkConfiguration.php -text
+inc/config/config-override.php -text
 inc/database.php -text
 inc/database/.htaccess -text
 inc/database/lib-local.php -text
 inc/file_io.php -text
 inc/includes.php -text
 inc/language.php -text
+inc/language/.htaccess -text
 inc/loader/.htaccess -text
 inc/loader/class_ClassLoader.php -text
 inc/output.php -text
diff --git a/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php b/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php
new file mode 100644 (file)
index 0000000..9a56466
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * An exception thrown when the language handler is missing
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class MissingFileIoHandlerException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message        Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (BaseFrameworkSystem $class, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] File i/o sub-system not initialized!",
+                       $class->__toString(),
+                       $this->getLine()
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php b/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php
new file mode 100644 (file)
index 0000000..4b2ef13
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * An exception thrown when the language handler is missing
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class MissingLanguageHandlerException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message        Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (BaseFrameworkSystem $class, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Language sub-system not initialized!",
+                       $class->__toString(),
+                       $this->getLine()
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
index 2ffe0b25eb449fb6298cfca7e344822751dd388f..8ac8d31fb01a35b584214311eea9a8538ec7537a 100644 (file)
@@ -78,6 +78,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $decimals  = ","; // German
 
+       /**
+        * The language instance for the template loader
+        */
+       private $langInstance = null;
+
+       /**
+        * The file I/O instance for the template loader
+        */
+       private $fileIOInstance = null;
+
        /***********************
         * Exception codes.... *
         ***********************/
@@ -127,6 +137,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_ATTRIBUTES_ARE_MISSING       = 0x02b;
        const EXCEPTION_ARRAY_ELEMENTS_MISSING       = 0x02c;
        const EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED  = 0x02d;
+       const EXCEPTION_MISSING_LANGUAGE_HANDLER     = 0x02e;
+       const EXCEPTION_MISSING_FILE_IO_HANDLER      = 0x02f;
 
        /**
         * In the super constructor these system classes shall be ignored or else
@@ -751,7 +763,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Appends a trailing slash to a string
         *
-        * @param               $str            A string (maybe) without trailing slash
+        * @param       $str            A string (maybe) without trailing slash
         * @return      $str            A string with an auto-appended trailing slash
         */
        public final function addMissingTrailingSlash ($str) {
@@ -759,6 +771,112 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                if (substr($str, -1, 1) != "/") $str .= "/";
                return $str;
        }
+
+       /**
+        * Private getter for language instance
+        *
+        * @return      $langInstance   An instance to the language sub-system
+        */
+       protected final function getLanguageInstance () {
+               return $this->langInstance;
+       }
+
+       /**
+        * Setter for language instance
+        *
+        * @param       $langInstance   An instance to the language sub-system
+        * @return      void
+        * @see         LanguageSystem
+        */
+       public final function setLanguageInstance (ManageableLanguage $langInstance) {
+               $this->langInstance = $langInstance;
+       }
+
+       /**
+        * Private getter for file IO instance
+        *
+        * @return      $fileIOInstance An instance to the file I/O sub-system
+        */
+       protected final function getFileIOInstance () {
+               return $this->fileIOInstance;
+       }
+
+       /**
+        * Setter for file I/O instance
+        *
+        * @param       $fileIOInstance An instance to the file I/O sub-system
+        * @return      void
+        */
+       public final function setFileIOInstance (FileIOHandler $fileIOInstance) {
+               $this->fileIOInstance = $fileIOInstance;
+       }
+
+       /**
+        * Prepare the template engine (TemplateEngine by default) for a given
+        * application helper instance (ApplicationHelper by default).
+        *
+        * @param               $appInstance                    An application helper instance
+        * @return              $tplEngine                              The template engine instance
+        * @throws              NullPointerException    If the template engine could not
+        *                                                                              be initialized
+        * @throws              UnsupportedTemplateEngineException      If $tplEngine is an
+        *                                                                              unsupported template engine
+        * @throws              MissingLanguageHandlerException If the language sub-system
+        *                                                                              is not yet initialized
+        */
+       protected function prepareTemplateEngine (BaseFrameworkSystem $appInstance) {
+               // Generate FQFN for all application templates
+               $fqfn = sprintf("%s%s/%s/%s",
+                       PATH,
+                       $this->getConfigInstance()->readConfig("application_path"),
+                       strtolower($appInstance->getAppShortName()),
+                       $this->getConfigInstance()->readConfig("tpl_base_path")
+               );
+
+               // Are both instances set?
+               if ($appInstance->getLanguageInstance() === null) {
+                       // Invalid language instance
+                       throw new MissingLanguageHandlerException($appInstance, self::EXCEPTION_MISSING_LANGUAGE_HANDLER);
+               } elseif ($appInstance->getFileIOInstance() === null) {
+                       // Invalid language instance
+                       throw new MissingFileIoHandlerException($appInstance, self::EXCEPTION_MISSING_FILE_IO_HANDLER);
+               }
+
+               // Initialize the template engine
+               $tplEngine = null;
+               $eval = sprintf("\$tplEngine = %s::create%s(
+       \"%s\",
+       \$appInstance->getLanguageInstance(),
+       \$appInstance->getFileIOInstance()
+);",
+                       $this->getConfigInstance()->readConfig("tpl_engine"),
+                       $this->getConfigInstance()->readConfig("tpl_engine"),
+                       $fqfn
+               );
+
+               // Debug message
+               if ((!is_null($this->getDebugInstance())) && (defined('DEBUG_EVAL'))) {
+                       $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+                               $this->__toString(),
+                               htmlentities($eval)
+                       ));
+               }
+
+               // Run the command
+               eval($eval);
+
+               // Is it a valid instance?
+               if (is_null($tplEngine)) {
+                       // No class returned
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               } elseif (!$tplEngine instanceof CompileableTemplate) {
+                       // Not an object! ;-(
+                       throw new UnsupportedTemplateEngineException($tplEngine, self::EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED);
+               }
+
+               // Return the prepared instance
+               return $tplEngine;
+       }
 }
 
 // [EOF]
index 231dfee213994edc114b4f10a76fad8070f91910..0dc66c680890a283cde233d5542340d24abe899a 100644 (file)
@@ -34,11 +34,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        private $fileExtension = "serialized";
 
-       /**
-        * The IO handler for file handling which should be FileIOHandler.
-        */
-       private $ioInstance = null;
-
        /**
         * The last read file's name
         */
@@ -111,7 +106,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                // Set save path and IO instance
                $dbInstance->setSavePath($savePath);
-               $dbInstance->setIOInstance($ioInstance);
+               $dbInstance->setFileIOInstance($ioInstance);
 
                // Return database instance
                return $dbInstance;
@@ -146,15 +141,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                return $this->savePath;
        }
 
-       /**
-        * Getter for file extension
-        *
-        * @return      $fileExtension          The file extension for all file names
-        */
-       public final function getFileExtension () {
-               return $this->fileExtension;
-       }
-
        /**
         * Saves a given object to the local file system by serializing and
         * transparently compressing it
@@ -201,7 +187,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                // Save the file to disc we don't care here if the path is there,
                // this must be done in later methods.
-               $this->getIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
+               $this->getFileIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
        }
 
        /**
@@ -301,7 +287,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $this->setLastFile($fqfn);
 
                        // Get instance for file handler
-                       $inputHandler = $this->getIOInstance();
+                       $inputHandler = $this->getFileIOInstance();
 
                        // Try to read from it. This makes it sure that the file is
                        // readable and a valid database file
@@ -324,27 +310,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                return $isUsed;
        }
 
-       /**
-        * Getter for the file IO instance
-        *
-        *�@return    $ioInstance     An instance for IO operations
-        * @see         FileIOHandler   The concrete handler for IO operations
-        */
-       public final function getIOInstance () {
-               return $this->ioInstance;
-       }
-
-       /**
-        * Setter for the file IO instance
-        *
-        * @param               $ioInstance     An instance for IO operations (should be
-        *                                              FileIOHandler)
-        * @return      void
-        */
-       public final function setIOInstance (FileIOHandler $ioInstance) {
-               $this->ioInstance = $ioInstance;
-       }
-
        /**
         * Setter for the last read file
         *
@@ -406,7 +371,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        public final function getObjectFromCachedData ($uniqueID) {
                // Get instance for file handler
-               $inputHandler = $this->getIOInstance();
+               $inputHandler = $this->getFileIOInstance();
 
                // Get last file's name and contents
                $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID);
index 2fff655b7c4b7a98362a024775e769953925f320..cc95918414a88b9b15e07deb361ed27896169054 100644 (file)
@@ -71,11 +71,6 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
         */
        private $configVariables = array();
 
-       /**
-        * The language instance which should link to an object of LanguageSystem
-        */
-       private $langInstance = null;
-
        /**
         * Loaded templates for recursive protection and detection
         */
@@ -152,7 +147,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
         * @throws      BasePathReadProtectedException  If $basePath is
         *                                                                              read-protected
         */
-       public final static function createTemplateEngine ($basePath, $langInstance, $ioInstance) {
+       public final static function createTemplateEngine ($basePath, ManageableLanguage  $langInstance, FileIOHandler $ioInstance) {
                // Get a new instance
                $tplInstance = new TemplateEngine();
 
@@ -182,7 +177,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
 
                // Set the language and IO instances
                $tplInstance->setLanguageInstance($langInstance);
-               $tplInstance->setIOInstance($ioInstance);
+               $tplInstance->setFileIOInstance($ioInstance);
 
                // Set template extensions
                $tplInstance->setRawTemplateExtension($cfgInstance->readConfig("raw_template_extension"));
@@ -271,35 +266,6 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                $this->varStack = new FrameworkArrayObject();
        }
 
-       /**
-        * Setter for language instance which should be LanguageSystem
-        *
-        * @param               $langInstance           The language instance
-        * @return      void
-        */
-       public final function setLanguageInstance (ManageableLanguage $langInstance) {
-               $this->langInstance = $langInstance;
-       }
-
-       /**
-        * Setter for file I/O instance which should be FileIOHandler
-        *
-        * @param               $ioInstance             The file I/O instance
-        * @return      void
-        */
-       public final function setIOInstance (FileIOHandler $ioInstance) {
-               $this->ioInstance = $ioInstance;
-       }
-
-       /**
-        * Getter for file I/O instance which should be FileIOHandler
-        *
-        * @return      $ioInstance             The file I/O instance
-        */
-       public final function getIOInstance () {
-               return $this->ioInstance;
-       }
-
        /**
         * Setter for base path
         *
@@ -533,7 +499,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                // Construct the FQFN for the template by honoring the current language
                $fqfn = sprintf("%s%s/%s/%s%s",
                        $this->getBasePath(),
-                       $this->langInstance->getLanguageCode(),
+                       $this->getLanguageInstance()->getLanguageCode(),
                        $this->getTemplateType(),
                        $template,
                        $ext
@@ -562,7 +528,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                ));
 
                // Get a input/output instance from the middleware
-               $ioInstance = $this->getIOInstance();
+               $ioInstance = $this->getFileIOInstance();
 
                // Validate the instance
                if (is_null($ioInstance)) {
diff --git a/inc/config-local.php b/inc/config-local.php
deleted file mode 100644 (file)
index 99b4e66..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * Local configuration. Do not edit config.php! Better overwrite the configuration here:
- *
- * @author             Roland Haeder <webmaster@mxchange.org>
- * @version            0.3.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.mxchange.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// CFG: DEFAULT-APPLICATION
-$cfg->setConfigEntry("default_application", "mxchange");
-
-// [EOF]
-?>
index 3a14eaa9c8b7d245437130914495e4792353cdc0..ab944bf11599b7057a678acae0b6e900d0866fb2 100644 (file)
@@ -141,17 +141,5 @@ $cfg->setConfigEntry("default_application", "selector");
 // CFG: VERBOSE-LEVEL
 $cfg->setConfigEntry("verbose_level", 0);
 
-// Shall we include config-local.php where you can configure some things? Then
-// We need to do some things:
-//
-// First generate FQFN
-$localConfig = sprintf("%sinc/config-local%s", PATH, $cfg->readConfig("php_extension"));
-
-// Second is the file there and readable?
-if ((file_exists($localConfig)) && (is_readable($localConfig))) {
-       // The third step to load it
-       require_once($localConfig);
-}
-
 // [EOF]
 ?>
index a1ca42a3aead470ecf98d016c3d3044abc316759..957a3537d86a814ca0fe397a3abfa33971215ca3 100644 (file)
@@ -11,7 +11,7 @@
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.mxchange.org
- * 
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class FrameworkConfiguration {
-       /**
-        * Include files which shall be included before the main loader.
-        */
-       private $moreIncPre = null;
-
-       /**
-        * Include files which shall be included after the main loader.
-        */
-       private $moreIncPost = null;
-
        /**
         * The framework's main configuration array which will be initialized with
         * hard-coded configuration data and might be overwritten/extended by
@@ -56,9 +46,7 @@ class FrameworkConfiguration {
         * Private constructor
         */
        private function __construct () {
-               // Initialize both include lists
-               $this->moreIncPre  = new ArrayObject();
-               $this->moreIncPost = new ArrayObject();
+               // Empty for now
        }
 
        /**
@@ -156,26 +144,6 @@ class FrameworkConfiguration {
                }
        }
 
-       /**
-        * Load all includes before main loader and clears the array after usage
-        *
-        * @return      void
-        */
-       public function loadPreIncludes () {
-               $this->loadIncludes($this->moreIncPre);
-               unset($this->moreIncPre);
-       }
-
-       /**
-        * Load all includes after main loader and clears the array after usage
-        *
-        * @return      void
-        */
-       public function loadPostIncludes () {
-               $this->loadIncludes($this->moreIncPost);
-               unset($this->moreIncPost);
-       }
-
        /**
         * Define the database type which must be valid and will not be verified.
         *
diff --git a/inc/config/config-override.php b/inc/config/config-override.php
new file mode 100644 (file)
index 0000000..99b4e66
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Local configuration. Do not edit config.php! Better overwrite the configuration here:
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// CFG: DEFAULT-APPLICATION
+$cfg->setConfigEntry("default_application", "mxchange");
+
+// [EOF]
+?>
index 5cecef88756d542602b14f07b043de476a8fd243..c9158581e7c6ffdce0e64538e0687ef2e1926d15 100644 (file)
@@ -35,26 +35,9 @@ if (is_dir(sprintf("%sdevel", PATH))) {
        ClassLoader::getInstance()->loadClasses("devel");
 }
 
-/**
- * Load additional include files before main load
- */
-FrameworkConfiguration::getInstance()->loadPreIncludes();
-
-/**
- * Load all main include files
- *
- * +++ MAIN LOADER! +++
- *
- */
-
-///////////////////////////////////////////////////
-// Maybe we need this place for future releases? //
-///////////////////////////////////////////////////
-
-/**
- * Load additional include files after main load
- */
-FrameworkConfiguration::getInstance()->loadPostIncludes();
+// Shall we include additional configs where you can configure some things? Then
+// Load matching config
+ClassLoader::getInstance()->loadExtraConfigs();
 
 // [EOF]
 ?>
diff --git a/inc/language/.htaccess b/inc/language/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index cd065629b3db6e39fb9610b8ded76718d328165b..61e8c216ffe532bb1875c22423acadb39135cb48 100644 (file)
@@ -212,7 +212,7 @@ class ClassLoader {
                        //* DEBUG: */ print "Suffix=".$this->suffix."(".substr($dirClass2, -$this->sufLen, $this->sufLen).")\n";
                        //* DEBUG: */ print "ENTRY={$dirClass}\n";
                        if (
-                          (is_file($dirClass))
+                                (is_file($dirClass))
                        && (is_readable($dirClass))
                        && (substr($dirClass2, 0 , $this->preLen) == $this->prefix)
                        && (substr($dirClass2, -$this->sufLen, $this->sufLen) == $this->suffix)
@@ -262,6 +262,28 @@ class ClassLoader {
                        $this->classes = new ArrayObject();
                }
        }
+
+       /**
+        * Load extra config files
+        *
+        * @return      void
+        */
+       public function loadExtraConfigs () {
+               // Backup old prefix
+               $oldPrefix = $this->prefix;
+
+               // Set new prefix (temporary!)
+               $this->prefix = "config-";
+
+               // Set base directory
+               $basePath = sprintf("%s/inc/config/", PATH);
+
+               // Load all classes from the config directory
+               $this->loadClasses($basePath);
+
+               // Set the prefix back
+               $this->prefix = $oldPrefix;
+       }
 }
 
 // Initial load of core classes and the FrameworkDirectoryPointer class