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())) {
- // Generate the eval() command
- $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));",
- $this->getConfigInstance()->readConfig('web_engine'),
- $this->getConfigInstance()->readConfig('web_engine'),
- $this->getConfigInstance()->readConfig('web_content_type')
- );
-
- // Debug message
- if (defined('DEBUG_EVAL')) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\n",
- $this->__toString(),
- htmlentities($eval)
- ));
+ if ((is_null($this->getWebOutputInstance())) && ($this->__toString() != "ObjectFactory")) {
+ // Call our object factory
+ $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
- // Run the command
- eval($eval);
- }
+ // And set the instance
+ $this->setWebOutputInstance($outputInstance);
+ } // END - if
// Initialize compressor channel
if (is_null($this->getCompressorChannel())) {
PATH,
$this->getConfigInstance()->readConfig('compressor_base_path')
)));
- }
+ } // END - if
// Initialize database middleware
if (is_null($this->getDatabaseInstance())) {
if (is_object($db)) {
// Set the database middleware
$this->setDatabaseInstance($db);
- }
- }
- }
+ } // END - if
+ } // END - if
+ } // END - if
}
/**
* Setter for language instance
*
- * @param $configInstance The configuration instance which shall
- * be FrameworkConfiguration
+ * @param $configInstance The configuration instance which shall
+ * be FrameworkConfiguration
* @return void
*/
public final function setConfigInstance (FrameworkConfiguration $configInstance) {
}
// 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:] Constructed PHP command: <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);
- }
+ $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
// Return the prepared instance
return $tplEngine;