From e51607c0f33062258ba0a07b79b8e1f34fd6b832 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Thu, 10 Mar 2011 14:05:22 +0000
Subject: [PATCH] Refactured code for deprecated includes file_io and language:
 - Include inc/file_io.php and inc/language.php are now deprecated, please no 
  longer use them - Therefore the code needs some refacturing - ... and two
 deprecated exceptions! - TODOs.txt updated

---
 docs/TODOs.txt                                | 50 +++++++++----------
 .../class_MissingFileIoHandlerException.php   | 44 +---------------
 .../class_MissingLanguageHandlerException.php | 44 +---------------
 .../main/class_BaseFrameworkSystem.php        | 25 +++-------
 .../databases/class_LocalFileDatabase.php     |  9 ++--
 .../template/class_BaseTemplateEngine.php     |  6 +++
 .../console/class_ConsoleTemplateEngine.php   |  8 ---
 .../image/class_ImageTemplateEngine.php       |  8 ---
 .../mail/class_MailTemplateEngine.php         |  8 ---
 .../menu/class_MenuTemplateEngine.php         |  8 ---
 .../template/web/class_WebTemplateEngine.php  |  8 ---
 inc/database/lib-local.php                    |  3 +-
 inc/file_io.php                               | 35 +------------
 inc/language.php                              | 36 +------------
 inc/loader/class_ClassLoader.php              |  6 ++-
 15 files changed, 51 insertions(+), 247 deletions(-)

diff --git a/docs/TODOs.txt b/docs/TODOs.txt
index 8e647c74..5169e005 100644
--- a/docs/TODOs.txt
+++ b/docs/TODOs.txt
@@ -3,15 +3,16 @@
 ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo		Try to rewrite user/guest login classes and mark this exception as deprecated
 ./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo		Rename this class to NoFoundEntryException
 ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo		Find a better name for this interface
-./inc/classes/main/class_BaseFrameworkSystem.php:1131:	 * @todo	Write a logging mechanism for productive mode
-./inc/classes/main/class_BaseFrameworkSystem.php:1145:			// @TODO Finish this part!
+./inc/classes/main/class_BaseFrameworkSystem.php:1133:	 * @todo	Write a logging mechanism for productive mode
+./inc/classes/main/class_BaseFrameworkSystem.php:1147:			// @TODO Finish this part!
 ./inc/classes/main/class_BaseFrameworkSystem.php:154:	// @todo Try to clean these constants up
-./inc/classes/main/class_BaseFrameworkSystem.php:235:	 * @todo	This is old code. Do we still need this old lost code?
-./inc/classes/main/class_BaseFrameworkSystem.php:303:	 * @todo	SearchableResult and UpdateableResult shall have a super interface to use here
+./inc/classes/main/class_BaseFrameworkSystem.php:233:	 * @todo	This is old code. Do we still need this old lost code?
+./inc/classes/main/class_BaseFrameworkSystem.php:301:	 * @todo	SearchableResult and UpdateableResult shall have a super interface to use here
 ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64:	 * @todo	Add some stuff here: Some personal data, app/game related data
 ./inc/classes/main/commands/web/class_WebProblemCommand.php:58:	 * @todo	0% done
 ./inc/classes/main/commands/web/class_WebStatusCommand.php:58:	 * @todo	0% done
 ./inc/classes/main/console/class_ConsoleTools.php:147:	 * @todo	This should be moved out to an external class, e.g. HttpClient
+./inc/classes/main/console/class_ConsoleTools.php:154:		// @TODO Add some DNS caching here
 ./inc/classes/main/console/class_ConsoleTools.php:45:	 * @todo	We should connect this to a caching class to cache DNS requests
 ./inc/classes/main/console/class_ConsoleTools.php:58:		// @TODO Here should the cacher be implemented
 ./inc/classes/main/controller/console/class_ConsoleDefaultController.php:10: * @todo		This controller shall still provide some headlines for sidebars
@@ -26,7 +27,7 @@
 ./inc/classes/main/controller/web/class_WebStatusController.php:10: * @todo		This controller shall still provide some headlines for sidebars
 ./inc/classes/main/criteria/search/class_SearchCriteria.php:114:	 * @todo	Find a nice casting here. (int) allows until and including 32766.
 ./inc/classes/main/criteria/search/class_SearchCriteria.php:94:	 * @todo	Find a nice casting here. (int) allows until and including 32766.
-./inc/classes/main/database/databases/class_LocalFileDatabase.php:363:	 * @todo	Do some checks on the database directory and files here
+./inc/classes/main/database/databases/class_LocalFileDatabase.php:360:	 * @todo	Do some checks on the database directory and files here
 ./inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php:426:	 * @todo	Find something useful with this!
 ./inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php:82:	 * @todo	0% done
 ./inc/classes/main/filter/change/class_EmailChangeFilter.php:54:	 * @todo	Implement email change of the user here. HINT: Use the User class!
@@ -74,22 +75,22 @@
 ./inc/classes/main/result/class_DatabaseResult.php:379:4	 * @todo	Find a caching way without modifying the result array
 ./inc/classes/main/rng/class_RandomNumberGenerator.php:150:	 * @todo	I had a better random number generator here but now it is somewhere lost :(
 ./inc/classes/main/rng/class_RandomNumberGenerator.php:83:	 * @todo	Add site key for stronger salt!
-./inc/classes/main/template/class_BaseTemplateEngine.php:1049:			// @TODO This silent abort should be logged, maybe.
-./inc/classes/main/template/class_BaseTemplateEngine.php:1057:			// @TODO Old behaviour, will become obsolete!
-./inc/classes/main/template/class_BaseTemplateEngine.php:1060:			// @TODO Yet another old way
-./inc/classes/main/template/class_BaseTemplateEngine.php:1126:			// @TODO This silent abort should be logged, maybe.
-./inc/classes/main/template/class_BaseTemplateEngine.php:1147:	 * @todo	Make this code some nicer...
-./inc/classes/main/template/class_BaseTemplateEngine.php:955:	 * @todo	Unfinished work or don't die here.
-./inc/classes/main/template/class_BaseTemplateEngine.php:972:				// @TODO Non-string found so we need some deeper analysis...
+./inc/classes/main/template/class_BaseTemplateEngine.php:1055:			// @TODO This silent abort should be logged, maybe.
+./inc/classes/main/template/class_BaseTemplateEngine.php:1063:			// @TODO Old behaviour, will become obsolete!
+./inc/classes/main/template/class_BaseTemplateEngine.php:1066:			// @TODO Yet another old way
+./inc/classes/main/template/class_BaseTemplateEngine.php:1132:			// @TODO This silent abort should be logged, maybe.
+./inc/classes/main/template/class_BaseTemplateEngine.php:1153:	 * @todo	Make this code some nicer...
+./inc/classes/main/template/class_BaseTemplateEngine.php:961:	 * @todo	Unfinished work or don't die here.
+./inc/classes/main/template/class_BaseTemplateEngine.php:978:				// @TODO Non-string found so we need some deeper analysis...
 ./inc/classes/main/template/console/class_ConsoleTemplateEngine.php:10: * @todo		This template engine does not make use of setTemplateType()
-./inc/classes/main/template/image/class_ImageTemplateEngine.php:221:	 * @todo	Find something usefull with this!
-./inc/classes/main/template/image/class_ImageTemplateEngine.php:241:	 * @todo	Add cache creation here
+./inc/classes/main/template/image/class_ImageTemplateEngine.php:213:	 * @todo	Find something usefull with this!
+./inc/classes/main/template/image/class_ImageTemplateEngine.php:233:	 * @todo	Add cache creation here
 ./inc/classes/main/template/mail/class_MailTemplateEngine.php:10: * @todo		This template engine does not make use of setTemplateType()
-./inc/classes/main/template/mail/class_MailTemplateEngine.php:234:	 * @todo	Add cache creation here
-./inc/classes/main/template/mail/class_MailTemplateEngine.php:244:	 * @todo	Should we call back the mailer class here?
-./inc/classes/main/template/mail/class_MailTemplateEngine.php:325:	 * @todo	0% done
-./inc/classes/main/template/menu/class_MenuTemplateEngine.php:273:	 * @todo	Find something useful with this!
-./inc/classes/main/template/menu/class_MenuTemplateEngine.php:319:	 * @todo	Add cache creation here
+./inc/classes/main/template/mail/class_MailTemplateEngine.php:226:	 * @todo	Add cache creation here
+./inc/classes/main/template/mail/class_MailTemplateEngine.php:236:	 * @todo	Should we call back the mailer class here?
+./inc/classes/main/template/mail/class_MailTemplateEngine.php:317:	 * @todo	0% done
+./inc/classes/main/template/menu/class_MenuTemplateEngine.php:265:	 * @todo	Find something useful with this!
+./inc/classes/main/template/menu/class_MenuTemplateEngine.php:311:	 * @todo	Add cache creation here
 ./inc/classes/main/user/class_BaseUser.php:308:	 * @todo	Try to make this method more generic so we can move it in BaseFrameworkSystem
 ./inc/classes/main/user/class_BaseUser.php:80:	 * @todo	Find a way of casting here. "(int)" might destroy the user id > 32766
 ./inc/classes/main/user/member/class_Member.php:84:	 * @todo	Add more ways over creating user classes
@@ -98,27 +99,26 @@
 ./inc/config/class_FrameworkConfiguration.php:172:	 * @todo	We have to add some more entries from $_SERVER here
 ./inc/database.php:11: * @todo		We should minimize these includes
 ./inc/database.php:51:// @TODO Rewrite this
-./inc/file_io.php:13: * @todo		We should minimize these includes
 ./inc/hooks.php:11: * @todo		We should minimize these includes
 ./inc/hooks.php:28:// @TODO This makes the core depending on the SPL. But it should be installed anyway.
 ./inc/includes.php:11: * @todo		We should minimize these includes
 ./inc/includes.php:38:// @TODO Find a nicer OOP-ed way for this
-./inc/language.php:10: * @todo		We should minimize these includes
-./inc/language.php:33:// @TODO Rewrite this
-./inc/loader/class_ClassLoader.php:262:			/* @todo: Do not die here. */
+./inc/loader/class_ClassLoader.php:264:			/* @todo: Do not die here. */
 ./inc/output.php:11: * @todo		We should minimize these includes
 ./inc/selector.php:11: * @todo		We should minimize these includes
 ### ### DEPRECATION FOLLOWS: ### ###
 ./inc/classes/exceptions/io/class_FileNotFoundException.php:2:// @DEPRECATED
 ./inc/classes/exceptions/io/class_FilePointerNotOpenedException.php:2:// @DEPRECATED
 ./inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php:2:// @DEPRECATED
+./inc/classes/exceptions/language/class_MissingFileIoHandlerException.php:2:// @DEPRECATED
+./inc/classes/exceptions/language/class_MissingLanguageHandlerException.php:2:// @DEPRECATED
 ./inc/classes/exceptions/main/class_ClassNotFoundException.php:2:// @DEPRECATED
 ./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:2:// @DEPRECATED
 ./inc/classes.php:9: * @deprecated
 ./inc/database.php:10: * @deprecated
-./inc/file_io.php:12: * @deprecated
+./inc/file_io.php:2:// @DEPRECATED
 ./inc/hooks.php:10: * @deprecated
 ./inc/includes.php:10: * @deprecated
-./inc/language.php:9: * @deprecated
+./inc/language.php:2:// @DEPRECATED
 ./inc/output.php:10: * @deprecated
 ./inc/selector.php:10: * @deprecated
diff --git a/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php b/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php
index b21616bc..f551ef47 100644
--- a/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php
+++ b/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php
@@ -1,45 +1,3 @@
 <?php
-/**
- * An exception thrown when the language handler is missing
- *
- * @author		Roland Haeder <webmaster@ship-simu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @link		http://www.ship-simu.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	$class	Class throwing this exception
-	 * @param	$code	Code number for the exception
-	 * @return	void
-	 */
-	public function __construct (FrameworkInterface $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]
+// @DEPRECATED
 ?>
diff --git a/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php b/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php
index 2b116331..f551ef47 100644
--- a/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php
+++ b/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php
@@ -1,45 +1,3 @@
 <?php
-/**
- * An exception thrown when the language handler is missing
- *
- * @author		Roland Haeder <webmaster@ship-simu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @link		http://www.ship-simu.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	$class	Class throwing this exception
-	 * @param	$code	Code number for the exception
-	 * @return	void
-	 */
-	public function __construct (FrameworkInterface $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]
+// @DEPRECATED
 ?>
diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php
index 656e3cdc..48526421 100644
--- a/inc/classes/main/class_BaseFrameworkSystem.php
+++ b/inc/classes/main/class_BaseFrameworkSystem.php
@@ -197,8 +197,6 @@ 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;
 	const EXCEPTION_MISSING_ELEMENT              = 0x030;
 	const EXCEPTION_HEADERS_ALREADY_SENT         = 0x031;
 	const EXCEPTION_DEFAULT_CONTROLLER_GONE      = 0x032;
@@ -626,7 +624,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 		if ((!isset($this->decimals)) || (!isset($this->thousands))) {
 			// Throw an exception
 			throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING);
-		}
+		} // END - if
 
 		// Cast the number
 		$value = (float) $value;
@@ -667,7 +665,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 	 */
 	public final function addMissingTrailingSlash ($str) {
 		// Is there a trailing slash?
-		if (substr($str, -1, 1) != '/') $str .= '/';
+		if (substr($str, -1, 1) != '/') {
+			$str .= '/';
+		} // END - if
+
+		// Return string with trailing slash
 		return $str;
 	}
 
@@ -696,17 +698,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 	 *
 	 * @param		$appInstance			An application helper instance or
 	 *										null if we shall use the default
-	 * @return		$templateInstance				The template engine instance
+	 * @return		$templateInstance		The template engine instance
 	 * @throws		NullPointerException	If the template engine could not
 	 *										be initialized
 	 * @throws		UnsupportedTemplateEngineException	If $templateInstance is an
 	 * 										unsupported template engine
-	 * @throws		MissingLanguageHandlerException	If the language sub-system
-	 * 										is not yet initialized
 	 * @throws		NullPointerException	If the discovered application
 	 *										instance is still null
 	 */
-	protected function prepareTemplateInstance (FrameworkInterface $appInstance=null) {
+	protected function prepareTemplateInstance (ManageableApplication $appInstance = null) {
 		// Is the application instance set?
 		if (is_null($appInstance)) {
 			// Get the current instance
@@ -719,15 +719,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 			} // END - if
 		} // END - if
 
-		// 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
 		$templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class', array($appInstance));
 
diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php
index 54b1841d..854a8888 100644
--- a/inc/classes/main/database/databases/class_LocalFileDatabase.php
+++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php
@@ -92,18 +92,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 	 * Create an object of LocalFileDatabase and set the save path for local files.
 	 * This method also validates the given file path.
 	 *
-	 * @param		$savePath		The local file path string
-	 * @param		$ioInstance		The input/output handler. This
-	 *								should be FileIoHandler
-	 * @return	$dbInstance			An instance of LocalFileDatabase
+	 * @param	$savePath		The local file path string
+	 * @return	$dbInstance		An instance of LocalFileDatabase
 	 */
-	public static final function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) {
+	public static final function createLocalFileDatabase ($savePath) {
 		// Get an instance
 		$databaseInstance = new LocalFileDatabase();
 
 		// Set save path and IO instance
 		$databaseInstance->setSavePath($savePath);
-		$databaseInstance->setFileIoInstance($ioInstance);
 
 		// Set the compressor channel
 		$databaseInstance->setCompressorChannel(CompressorChannel::createCompressorChannel(
diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php
index 89570fd2..2b9406b0 100644
--- a/inc/classes/main/template/class_BaseTemplateEngine.php
+++ b/inc/classes/main/template/class_BaseTemplateEngine.php
@@ -156,6 +156,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 	protected function __construct ($className) {
 		// Call parent constructor
 		parent::__construct($className);
+
+		// Init file I/O instance
+		$ioInstance = ObjectFactory::createObjectByConfiguredName('file_io_class');
+
+		// Set it
+		$this->setFileIoInstance($ioInstance);
 	}
 
 	/**
diff --git a/inc/classes/main/template/console/class_ConsoleTemplateEngine.php b/inc/classes/main/template/console/class_ConsoleTemplateEngine.php
index 016a108b..aae8d6c8 100644
--- a/inc/classes/main/template/console/class_ConsoleTemplateEngine.php
+++ b/inc/classes/main/template/console/class_ConsoleTemplateEngine.php
@@ -49,10 +49,6 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem
 		// Get a new instance
 		$templateInstance = new ConsoleTemplateEngine();
 
-		// Get language and file I/O instances from application
-		$langInstance = $appInstance->getLanguageInstance();
-		$ioInstance = $appInstance->getFileIoInstance();
-
 		// Determine base path
 		$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -74,10 +70,6 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem
 		// Set the base path
 		$templateInstance->setTemplateBasePath($templateBasePath);
 
-		// Set the language and IO instances
-		$templateInstance->setLanguageInstance($langInstance);
-		$templateInstance->setFileIoInstance($ioInstance);
-
 		// Set template extensions
 		$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
 		$templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
diff --git a/inc/classes/main/template/image/class_ImageTemplateEngine.php b/inc/classes/main/template/image/class_ImageTemplateEngine.php
index d0cba615..3a692e1f 100644
--- a/inc/classes/main/template/image/class_ImageTemplateEngine.php
+++ b/inc/classes/main/template/image/class_ImageTemplateEngine.php
@@ -82,10 +82,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
 		// Get a new instance
 		$templateInstance = new ImageTemplateEngine();
 
-		// Get language and file I/O instances from application
-		$langInstance = $appInstance->getLanguageInstance();
-		$ioInstance = $appInstance->getFileIoInstance();
-
 		// Determine base path
 		$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -107,10 +103,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
 		// Set the base path
 		$templateInstance->setTemplateBasePath($templateBasePath);
 
-		// Set the language and IO instances
-		$templateInstance->setLanguageInstance($langInstance);
-		$templateInstance->setFileIoInstance($ioInstance);
-
 		// Set template extensions
 		$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
 		$templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
diff --git a/inc/classes/main/template/mail/class_MailTemplateEngine.php b/inc/classes/main/template/mail/class_MailTemplateEngine.php
index f4b4f692..1afb1f00 100644
--- a/inc/classes/main/template/mail/class_MailTemplateEngine.php
+++ b/inc/classes/main/template/mail/class_MailTemplateEngine.php
@@ -76,10 +76,6 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
 		// Get a new instance
 		$templateInstance = new MailTemplateEngine();
 
-		// Get language and file I/O instances from application
-		$langInstance = $appInstance->getLanguageInstance();
-		$ioInstance = $appInstance->getFileIoInstance();
-
 		// Determine base path
 		$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -101,10 +97,6 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
 		// Set the base path
 		$templateInstance->setTemplateBasePath($templateBasePath);
 
-		// Set the language and IO instances
-		$templateInstance->setLanguageInstance($langInstance);
-		$templateInstance->setFileIoInstance($ioInstance);
-
 		// Set template extensions
 		$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
 		$templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
diff --git a/inc/classes/main/template/menu/class_MenuTemplateEngine.php b/inc/classes/main/template/menu/class_MenuTemplateEngine.php
index b8fb5fe6..9e024047 100644
--- a/inc/classes/main/template/menu/class_MenuTemplateEngine.php
+++ b/inc/classes/main/template/menu/class_MenuTemplateEngine.php
@@ -99,10 +99,6 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
 		// Get a new instance
 		$templateInstance = new MenuTemplateEngine();
 
-		// Get language and file I/O instances from application
-		$langInstance = $appInstance->getLanguageInstance();
-		$ioInstance = $appInstance->getFileIoInstance();
-
 		// Determine base path
 		$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -124,10 +120,6 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
 		// Set the base path
 		$templateInstance->setTemplateBasePath($templateBasePath);
 
-		// Set the language and IO instances
-		$templateInstance->setLanguageInstance($langInstance);
-		$templateInstance->setFileIoInstance($ioInstance);
-
 		// Set template extensions
 		$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
 		$templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('menu_template_extension'));
diff --git a/inc/classes/main/template/web/class_WebTemplateEngine.php b/inc/classes/main/template/web/class_WebTemplateEngine.php
index 6033ef59..ef473dc0 100644
--- a/inc/classes/main/template/web/class_WebTemplateEngine.php
+++ b/inc/classes/main/template/web/class_WebTemplateEngine.php
@@ -49,10 +49,6 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat
 		// Get a new instance
 		$templateInstance = new WebTemplateEngine();
 
-		// Get language and file I/O instances from application
-		$langInstance = $appInstance->getLanguageInstance();
-		$ioInstance = $appInstance->getFileIoInstance();
-
 		// Determine base path
 		$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -74,10 +70,6 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat
 		// Set the base path
 		$templateInstance->setTemplateBasePath($templateBasePath);
 
-		// Set the language and IO instances
-		$templateInstance->setLanguageInstance($langInstance);
-		$templateInstance->setFileIoInstance($ioInstance);
-
 		// Set template extensions
 		$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
 		$templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php
index aa4dc2e6..7ca9530c 100644
--- a/inc/database/lib-local.php
+++ b/inc/database/lib-local.php
@@ -24,8 +24,7 @@
 
 // For testing purposes we use a local file database
 $databaseInstance = LocalFileDatabase::createLocalFileDatabase(
-	FrameworkConfiguration::getInstance()->getConfigEntry('local_db_path'),
-	FileIoHandler::getInstance()
+	FrameworkConfiguration::getInstance()->getConfigEntry('local_db_path')
 );
 
 // [EOF]
diff --git a/inc/file_io.php b/inc/file_io.php
index cd64b1a0..f551ef47 100644
--- a/inc/file_io.php
+++ b/inc/file_io.php
@@ -1,36 +1,3 @@
 <?php
-/**
- * Initialize the file I/O handler. Currently there is no need to check if
- * the initialization was successfull or not because only some class
- * instances will we generated.
- *
- * @author		Roland Haeder <webmaster@ship-simu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @link		http://www.ship-simu.org
- * @deprecated
- * @todo		We should minimize these includes
- *
- * 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/>.
- */
-
-// Get the instance
-$io = ObjectFactory::createObjectByConfiguredName('file_io_class');
-
-// Is the app variable there and valid?
-if (is_object($app)) $app->setFileIoInstance($io);
-
-// [EOF]
+// @DEPRECATED
 ?>
diff --git a/inc/language.php b/inc/language.php
index 52dbea7d..f551ef47 100644
--- a/inc/language.php
+++ b/inc/language.php
@@ -1,37 +1,3 @@
 <?php
-/**
- * Try to initializes the language system
- *
- * @author		Roland Haeder <webmaster@ship-simu.org>
- * @version		0.0.0
- * @copyright	Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
- * @license		GNU GPL 3.0 or any newer version
- * @deprecated
- * @todo		We should minimize these includes
- *
- * 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/>.
- */
-
-// Try to instance the language system
-$lang = LanguageSystem::createLanguageSystem(
-	FrameworkConfiguration::getInstance()->getConfigEntry('base_path').
-	FrameworkConfiguration::getInstance()->getConfigEntry('lang_base_path')
-);
-
-// Is the app variable there and valid?
-// @TODO Rewrite this
-if (is_object($app)) $app->setLanguageInstance($lang);
-
-// [EOF]
+// @DEPRECATED
 ?>
diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php
index 9322c4da..601b06d9 100644
--- a/inc/loader/class_ClassLoader.php
+++ b/inc/loader/class_ClassLoader.php
@@ -205,7 +205,9 @@ class ClassLoader {
 	 */
 	public function __destruct () {
 		// Skip here if dev-mode
-		if (defined('DEVELOPER')) return;
+		if (defined('DEVELOPER')) {
+			return;
+		} // END - if
 
 		// Skip here if already cached
 		if ($this->listCached === false) {
@@ -240,7 +242,7 @@ class ClassLoader {
 		if ($this->listCached === true) {
 			// Abort here
 			return;
-		}
+		} // END - if
 
 		// Directories which our class loader ignores by default while
 		// deep-scanning the directory structure.
-- 
2.39.5