<?php
/**
- * Starter of the application
+ * The application launcher
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Get the application helper instance
-$app = ApplicationHelper::getInstance();
+// Is there an application helper instance? We need the method main() for
+// maining the application
+$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), "getInstance"), array());
// Some sanity checks
if ((empty($app)) || (is_null($app))) {
// Call the entry point method
try {
- $eval = sprintf("%s::getInstance()->%s();",
- FrameworkConfiguration::getInstance()->readConfig('app_helper_class'),
- FrameworkConfiguration::getInstance()->readConfig('entry_method')
- );
- eval($eval);
+ // Call user function
+ call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
} catch (FrameworkException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> could not be launched for the follwing reason: <strong>%s</strong>",
$application,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+// Initialize output system
+require(PATH . 'inc/output.php');
+
+// Initialize file i/o system
+require(PATH . 'inc/file_io.php');
+
+// Include the language sub-system
+require(PATH . 'inc/language.php');
+
+// This application needs a database connection then we have to simply include
+// the inc/database.php script
+require(PATH . 'inc/database.php');
+
// Generate call-back function
$callback = sprintf("%s::getInstance",
FrameworkConfiguration::getInstance()->readConfig('app_helper_class')
$app->setAppVersion("0.0.0");
$app->setAppShortName("ship-simu");
-// Initialize output system
-require(PATH . 'inc/output.php');
-
-// Initialize file i/o system
-require(PATH . 'inc/file_io.php');
+// Set instances
$app->setFileIoInstance($io);
-
-// Include the language sub-system
-require(PATH . 'inc/language.php');
$app->setLanguageInstance($lang);
-
-// This application needs a database connection then we have to simply include
-// the inc/database.php script
-require(PATH . 'inc/database.php');
+$app->setDatabaseInstance($db);
// [EOF]
?>
// Is there an application helper instance? We need the method main() for
// maining the application
-$app = ApplicationHelper::getInstance();
+$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), "getInstance"), array());
// Some sanity checks
if ((empty($app)) || (is_null($app))) {
// Call the entry point method
try {
- $eval = sprintf("%s::getInstance()->%s();",
- FrameworkConfiguration::getInstance()->readConfig('app_helper_class'),
- FrameworkConfiguration::getInstance()->readConfig('entry_method')
- );
- eval($eval);
+ // Call user function
+ call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
} catch (FrameworkException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> could not be launched for the follwing reason: <strong>%s</strong>",
$application,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FrameworkDatabaseInterface extends FrameworkInterface {
- /**
- * Saves a whole object by serializing it entirely or some specifyable
- * parts. Specifying parts must be done before this method is called. If
- * it is not done this method will serialize the whole object.
- *
- * @param $object An instance to the object we want to save
- * @return void
- * @see limitObject(ObjectLimits) limitObject
- * @deprecated
- */
- function saveObject (FrameworkInterface $object);
-
/**
* Analyses if a unique ID has already been used or not. This method does
* only pass the given ID through to the "real" database layer.
* isUniqueIdUsed() was not found
*/
function isUniqueIdUsed ($uniqueID, $inConstructor = false);
-
- /**
- * Gets cached data from the database layer and if not found fetch it from
- * the database again. This method does not return the header stuff because
- * The underlaying database class will return only the requested content.
- *
- * @param $idNumber The ID number which we need for looking up
- * the requested data
- * @return $cachedArray The maybe cached data from the database
- * @throws NullPointerException If $dbInstance is null
- * @throws NoObjectException If $dbInstance is not an object
- * @throws MissingMethodException If the required method
- * isUniqueIdUsed() was not found
- * @deprecated
- */
- function getObjectFromCachedData ($idNumber);
}
// [EOF]
*/
class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
/**
- * The instance to the debug output handler (should be DebugConsoleOutput or DebugWebOutput)
- *
- * @see DebugConsoleOutput
- * @see DebugWebOutput
- */
- private static $debug = null;
-
- /**
- * The instance to the web output handler (should be WebOutput)
- *
- * @see WebOutput
- */
- private static $webOutput = null;
-
- /**
- * The instance to the compression layer which should be CompressorChannel
- */
- private static $compressor = null;
-
- /**
- * The configuration instance which shall be FrameworkConfiguration
- */
- private static $cfgInstance = null;
-
- /**
- * The instance to the database layer which should be DatabaseConnection
+ * Instance to an application helper class
*/
- private $dbInstance = null;
+ private static $applicationInstance = null;
/**
- * Instance to an application helper class
+ * The language instance for the template loader
*/
- private $applicationInstance = null;
+ private static $langInstance = null;
/**
* The real class name
*/
private $decimals = ","; // German
- /**
- * The language instance for the template loader
- */
- private $langInstance = null;
-
/**
* The file I/O instance for the template loader
*/
*/
private $systemClasses = array(
"DebugMiddleware", // Debug middleware output sub-system
+ "Registry", // Object registry
+ "ObjectFactory", // Object factory
"DebugWebOutput", // Debug web output sub-system
+ "WebOutput", // Web output sub-system
+ "CompressorChannel", // Compressor sub-system
"DebugConsoleOutput", // Debug console output sub-system
"DebugErrorLogOutput", // Debug error_log() output sub-system
- "CompressorChannel", // Compressor sub-system
"FrameworkDirectoryPointer", // Directory handler sub-system
"NullCompressor", // Null compressor
"Bzip2Compressor", // BZIP2 compressor
"GzipCompressor", // GZIP compressor
- "WebOutput", // Web output sub-system
- "ObjectFactory", // Object factory
);
+ /* No longer used:
+ */
+
/**
* Private super constructor
*
// Set real class
$this->setRealClass($class);
- // Init this instance
- $this->initInstance($class);
+ // Initialize the class if the registry is there
+ if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
+ $this->initInstance();
+ }
}
/**
}
/**
- * Initializes the instance
+ * Private initializer for this class
*
* @return void
*/
- public function initInstance ($class) {
- // Get the current (singleton) configuration instance
- $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
-
- // Is the class weather debug nor compressor channel?
- if (!in_array($class, $this->systemClasses)) {
- // Initialize debug instance
- if (is_null($this->getDebugInstance())) {
- // Set the debug output system if it is not debug class ;)
- $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine')));
- } // END - if
-
- // Initialize web instance
- if (is_null($this->getWebOutputInstance())) {
- // Call our object factory
- $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
-
- // And set the instance
- $this->setWebOutputInstance($outputInstance);
- } // END - if
-
- // Initialize compressor channel
- if (is_null($this->getCompressorChannel())) {
- // Set the compressor channel
- $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s",
- PATH,
- $this->getConfigInstance()->readConfig('compressor_base_path')
- )));
- } // END - if
-
- // Initialize database middleware
- if (is_null($this->getDatabaseInstance())) {
- // Get the middleware instance
- $db = DatabaseConnection::getInstance();
- if (is_object($db)) {
- // Set the database middleware
- $this->setDatabaseInstance($db);
- } // END - if
- } // END - if
- } // END - if
+ private final function initInstance () {
+ // Is this a system class?
+ if (!in_array($this->__toString(), $this->systemClasses)) {
+ // Add application helper to our class
+ $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class');
+
+ // Set debug instance
+ $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine')));
+
+ // Get output instance and set it
+ $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
+ $this->setWebOutputInstance($outputInstance);
+
+ // Set the compressor channel
+ $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s",
+ PATH,
+ $this->getConfigInstance()->readConfig('compressor_base_path')
+ )));
+
+ // Initialization done! :D
+ Registry::isInitialized("OK");
+ } elseif ($this->__toString() == "DebugMiddleware") {
+ // Set configuration instance
+ $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
+ }
}
/**
* @return void
*/
public final function setConfigInstance (FrameworkConfiguration $configInstance) {
- self::$cfgInstance = $configInstance;
+ Registry::getRegistry()->addInstance('config', $configInstance);
}
/**
* @return $cfhInstance - Configuration instance
*/
protected final function getConfigInstance () {
- return self::$cfgInstance;
+ return Registry::getRegistry()->getInstance('config');
}
/**
* @return void
*/
public final function setDebugInstance (DebugMiddleware $debugInstance) {
- self::$debug = $debugInstance;
+ Registry::getRegistry()->addInstance('debug', $debugInstance);
}
/**
* @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput
*/
public final function getDebugInstance () {
- return self::$debug;
+ return Registry::getRegistry()->getInstance('debug');
}
/**
* @return void
*/
public final function setWebOutputInstance (OutputStreamer $webInstance) {
- self::$webOutput = $webInstance;
+ Registry::getRegistry()->addInstance('web_output', $webInstance);
}
/**
* @return $webOutput - Instance to class WebOutput
*/
public final function getWebOutputInstance () {
- return self::$webOutput;
+ return Registry::getRegistry()->getInstance('web_output');
}
/**
- * Static setter for database instance
+ * Setter for database instance
*
* @param $dbInstance The instance for the database connection
* (forced DatabaseConnection)
* @return void
*/
public final function setDatabaseInstance (DatabaseConnection $dbInstance) {
- $this->dbInstance = $dbInstance;
+ Registry::getRegistry()->addInstance('dbInstance', $dbInstance);
+ }
+
+ /**
+ * Getter for database layer
+ *
+ * @return $dbInstance The database layer instance
+ */
+ public final function getDatabaseInstance () {
+ if ((class_exists('Registry')) && (Registry::isInitialized() === true)) {
+ return Registry::getRegistry()->getInstance('dbInstance');
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Setter for compressor channel
+ *
+ * @param $compressorChannel An instance of CompressorChannel
+ * @return void
+ */
+ public final function setCompressorChannel (CompressorChannel $compressorChannel) {
+ Registry::getRegistry()->addInstance('compressor', $compressorChannel);
+ }
+
+ /**
+ * Getter for compressor channel
+ *
+ * @return $compressor The compressor channel
+ */
+ public final function getCompressorChannel () {
+ return Registry::getRegistry()->getInstance('compressor');
+ }
+
+ /**
+ * Protected getter for a manageable application helper class
+ *
+ * @return $applicationInstance An instance of a manageable application helper class
+ */
+ protected final function getApplicationInstance () {
+ return self::$applicationInstance;
+ }
+
+ /**
+ * Setter for a manageable application helper class
+ *
+ * @param $applicationInstance An instance of a manageable application helper class
+ * @return void
+ */
+ public final function setApplicationInstance (ManageableApplication $applicationInstance) {
+ self::$applicationInstance = $applicationInstance;
}
/**
* @return void
*/
public final function generateUniqueId () {
- // Existiert noch keine?
+ // Is the id set for this class?
if (empty($this->uniqueID)) {
// Correct missing class name
$corrected = true;
}
- // Neue ID erstellen
+ // Cache datbase instance
+ $db = $this->getDatabaseInstance();
+
+ // Generate new id
$tempID = false;
while (true) {
// Generate a unique ID number
// Try to figure out if the ID number is not yet used
try {
- if (is_object($this->getDatabaseInstance())) {
- $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true);
+ // Is this a registry?
+ if ($this->__toString() == "Registry") {
+ // Registry, then abort here
+ break;
+ } elseif (is_object($db)) {
+ $isUsed = $db->isUniqueIdUsed($tempID, true);
}
} catch (FrameworkException $e) {
// Catches all and ignores all ;-)
$tempID !== false
) && (
(
- $this->getDatabaseInstance() === null
+ $db === null
) || (
(
- is_object($this->getDatabaseInstance())
+ is_object($db)
) && (
!$isUsed
)
}
/**
- * Getter for database layer
+ * Private getter for language instance
*
- * @return $dbInstance The database layer instance
+ * @return $langInstance An instance to the language sub-system
*/
- public final function getDatabaseInstance () {
- return $this->dbInstance;
+ protected final function getLanguageInstance () {
+ return self::$langInstance;
}
/**
- * Setter for compressor channel
+ * Setter for language instance
*
- * @param $compressorChannel An instance of CompressorChannel
+ * @param $langInstance An instance to the language sub-system
* @return void
+ * @see LanguageSystem
*/
- public final function setCompressorChannel (CompressorChannel $compressorChannel) {
- self::$compressor = $compressorChannel;
- }
-
- /**
- * Getter for compressor channel
- *
- * @return $compressor The compressor channel
- */
- public final function getCompressorChannel () {
- return self::$compressor;
+ public final function setLanguageInstance (ManageableLanguage $langInstance) {
+ self::$langInstance = $langInstance;
}
/**
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
*
$this->fileIOInstance = $fileIOInstance;
}
- /**
- * Protected getter for a manageable application helper class
- *
- * @return $applicationInstance An instance of a manageable application helper class
- */
- protected final function getApplicationInstance () {
- return $this->applicationInstance;
- }
-
- /**
- * Setter for a manageable application helper class
- *
- * @param $applicationInstance An instance of a manageable application helper class
- * @return void
- */
- public final function setApplicationInstance (ManageableApplication $applicationInstance) {
- $this->applicationInstance = $applicationInstance;
- }
-
/**
* Prepare the template engine (TemplateEngine by default) for a given
* application helper instance (ApplicationHelper by default).
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ObjectFactory extends BaseFactory {
+ /**
+ * Total objects generated
+ */
+ private static $total = 0;
+
/**
* Protected constructor
*
// Run the user function
$objectInstance = call_user_func_array($callback, $args);
+ // Count generated objects up
+ self::$total++;
+
// Return the prepared instance
return $objectInstance;
}
// Return the instance
return $objectInstance;
}
+
+ /**
+ * Static getter for total object count
+ *
+ * @return $total Total amount of generated objects
+ */
+ public final static function getTotal () {
+ return self::$total;
+ }
}
// [EOF]
*
* @return string Directory and/or file names read from the current
* directory pointer
- * @throws NullPointerException If the directory pointer instance
- * is not set by setPointer()
- * @throws InvalidDirectoryResourceException If there is being set
- * an invalid directory resource
*/
public function readRawDirectory () {
- if (is_null($this->getPointer())) {
- // Pointer not initialized
- throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_resource($this->getPointer())) {
- // Pointer is not a valid resource!
- throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
- }
-
// Read data from the directory pointer and return it
return readdir($this->getPointer());
}
* to empty
*
* @return void
- * @throws NullPointerException If the directory pointer instance
- * is not set by setPointer()
- * @throws InvalidDirectoryResourceException If there is being set
*/
public function closeDirectory () {
- if (is_null($this->getPointer())) {
- // Pointer not initialized
- return;
- } elseif (!is_resource($this->getPointer())) {
- // Pointer is not a valid resource!
- throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
- }
-
// Close the directory pointer and reset the instance variable
@closedir($this->getPointer());
$this->setPointer(null);
* 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 WebOutput extends BaseFrameworkSystem implements OutputStreamer {
+class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registerable {
/**
* The instance for the singleton design pattern
*/
*/
private static $selfInstance = null;
+ /**
+ * Wether the registry is initialized
+ */
+ private static $initialized = false;
+
/**
* Instance registry
*/
return self::$selfInstance;
}
+ /**
+ * Checks or sets wether the registry has been initialized. This had only be done once
+ *
+ * @param $initialized Wether the registry is initialized
+ * @return $initialized Wether the registry is initialized
+ */
+ public final static function isInitialized ($initialized = null) {
+ if (is_null($initialized)) {
+ // Get status if initialized
+ return self::$initialized;
+ } elseif (!is_null($initialized)) {
+ // Registry is initialized!
+ self::$initialized = true;
+ }
+ }
+
/**
* Checks wether an instance key was found
*
* 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 CompressorChannel extends BaseMiddleware {
+class CompressorChannel extends BaseMiddleware implements Registerable {
/**
* Real compressor instance
*/
* 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 DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject {
+class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Registerable {
/**
* Array for connection data
*/
}
/**
- * Save a whole object or parts of it to the database or local file
- *
- * @param $object The object we shall save
- * @return void
- */
- public function saveObject (FrameworkInterface $object) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // For now just pipe it through to the database layer
- $this->dbLayer->saveObject($object);
- }
-
- /**
- * Set a limitation for the saving process. This shall be done before
- * saveObject() is called else saveObject() shall save the whole object.
- *
- * @param $limitInstance An instance of ObjectLimits which contains
- * elements we shall exclusivly include in
- * saving process
+ * Setter for the real database layer
+ * @param $dbLayer An instance of the real database layer
* @return void
*/
- public function limitObject (ObjectLimits $limitInstance) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // For now we pipe this through to the real database instance
- $this->dbLayer->limitObject($limitInstance);
+ public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
+ $this->dbLayer = $dbLayer;
}
/**
return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor);
}
- /**
- * Gets cached data from the database layer and if not found fetch it from
- * the database again. This method does not return the header stuff because
- * the underlaying database class will return only the requested content.
- *
- * @param $idNumber The ID number which we need for looking up
- * the requested data
- * @return $cachedArray The maybe cached data from the database
- */
- public function getObjectFromCachedData ($idNumber) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // Pass the returning result through
- return $this->dbLayer->getObjectFromCachedData($idNumber);
- }
-
- /**
- * Setter for the real database layer
- * @param $dbLayer An instance of the real database layer
- * @return void
- */
- public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
- $this->dbLayer = $dbLayer;
- }
-
/**
* Runs a "select" statement on the database layer with given table name
* and criteria. If this doesn't fail the result will be returned
* 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 DebugMiddleware extends BaseMiddleware {
+class DebugMiddleware extends BaseMiddleware implements Registerable {
/**
* The concrete output instance
*/
*/
// Load the class from inc/config direktory
+@require_once(dirname(__FILE__) . '/classes/interfaces/class_FrameworkInterface.php');
+@require_once(dirname(__FILE__) . '/classes/interfaces/registry/class_Registerable.php');
@require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php');
// Get a new configuration instance
* 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 FrameworkConfiguration {
+class FrameworkConfiguration implements Registerable {
/**
* The framework's main configuration array which will be initialized with
* hard-coded configuration data and might be overwritten/extended by
/**
* Instance of this class
*/
- private static $thisInstance = null;
+ private static $selfInstance = null;
/**
* The *public* constructor
$this->classes = new ArrayObject();
// Set own instance
- self::$thisInstance = $this;
+ self::$selfInstance = $this;
}
/**
* Getter for an instance of this class
*
- * @return $thisInstance An instance of this class
+ * @return $selfInstance An instance of this class
*/
public final static function getInstance () {
- return self::$thisInstance;
+ // Is the instance there?
+ if (is_null(self::$selfInstance)) {
+ // Get a new one
+ self::$selfInstance = new ClassLoader(FrameworkConfiguration::getInstance());
+ } // END - if
+
+ // Return the instance
+ return self::$selfInstance;
}
/**
// Scan the directory
$this->scanLocalPath($currPath);
- }
+ } // END - for
// Check if we can leave
$cnt = 0;
for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) {
if ($idx->current() == "") $cnt++;
- }
- }
+ } // END - for
+ } // END - while
}
/**
} elseif (is_dir($dirClass) && !in_array($dirClass2, $this->ignoreList)) {
// Directory found and added to list
//* DEBUG: */ print "DIR={$dirClass}\n";
- if ($dirClass2 == "interfaces") {
- $this->scanLocalPath($dirClass);
- } else {
- $this->dirList->append($dirClass);
- }
+ $this->dirList->append($dirClass);
$this->dirCnt++;
}
//* DEBUG: */ print "LOOP!\n";
// Close directory handler
$dirInstance->closeDirectory();
+ unset($dirInstance);
// Output counter in debug mode
if (defined('DEBUG_MODE')) print(sprintf("[%s:] <strong>%d</strong> Klassendateien in <strong>%d</strong> Verzeichnissen gefunden und geladen.<br />\n",
// Load current class
//* DEBUG: */ print "Class=".$idx->current()."\n";
require_once($idx->current());
- }
+ } // END - for
// Re-initialize the classes list
$this->classes = new ArrayObject();
- }
+ } // END - if
}
/**
require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension')));
require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension')));
-// Initialize the class loader
-$loader = new ClassLoader(FrameworkConfiguration::getInstance());
-
// [EOF]
?>
if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) {
// Use the template engine for putting out (nicer look) the message
try {
- $eval = sprintf("\$tplEngine = %s::create%s(\"%s%s\", \$lang, \$io);",
- FrameworkConfiguration::getInstance()->readConfig('tpl_engine'),
- FrameworkConfiguration::getInstance()->readConfig('tpl_engine'),
- PATH,
- FrameworkConfiguration::getInstance()->readConfig('tpl_base_path')
- );
- eval($eval);
+ // Get the template instance from our object factory
+ $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
} catch (BasePathIsEmptyException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (InvalidBasePathStringException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (BasePathIsNoDirectoryException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (BasePathReadProtectedException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
$e->getMessage()
));
}
// Assign variables
$tplEngine->assignVariable('message', $message);
$tplEngine->assignVariable('backtrace', $backtrace);
+ $tplEngine->assignVariable('total_objects', ObjectFactory::getTotal());
// Load the template
$tplEngine->loadCodeTemplate('emergency_exit');