From 36a96a3b68cb6da4e1b431fbc5983821de918618 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 21 Mar 2011 23:21:48 +0000 Subject: [PATCH] Obsolete parameter 'applicationInstance' removed from all template engines --- inc/classes/main/class_BaseFrameworkSystem.php | 2 +- inc/classes/main/menu/class_BaseMenu.php | 2 +- .../main/template/console/class_ConsoleTemplateEngine.php | 6 ++++-- .../main/template/image/class_ImageTemplateEngine.php | 6 ++++-- .../main/template/mail/class_MailTemplateEngine.php | 6 ++++-- .../main/template/menu/class_MenuTemplateEngine.php | 8 +++++--- inc/classes/main/template/web/class_WebTemplateEngine.php | 6 ++++-- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index f8dc6b85..70ab0465 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -720,7 +720,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Initialize the template engine - $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class', array($applicationInstance)); + $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class'); // Return the prepared instance return $templateInstance; diff --git a/inc/classes/main/menu/class_BaseMenu.php b/inc/classes/main/menu/class_BaseMenu.php index 4dd1d9c4..32a57c06 100644 --- a/inc/classes/main/menu/class_BaseMenu.php +++ b/inc/classes/main/menu/class_BaseMenu.php @@ -41,7 +41,7 @@ class BaseMenu extends BaseFrameworkSystem { */ public function renderMenu () { // Initialize the menu system by preparing it's template instance - $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getApplicationInstance(), $this)); + $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this)); // Set it for later use $this->setTemplateInstance($templateInstance); diff --git a/inc/classes/main/template/console/class_ConsoleTemplateEngine.php b/inc/classes/main/template/console/class_ConsoleTemplateEngine.php index 0a9bc8dc..15f2f8f3 100644 --- a/inc/classes/main/template/console/class_ConsoleTemplateEngine.php +++ b/inc/classes/main/template/console/class_ConsoleTemplateEngine.php @@ -36,7 +36,6 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $applicationInstance A manageable application * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty * @throws InvalidBasePathStringException If $templateBasePath is no string @@ -45,10 +44,13 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public static final function createConsoleTemplateEngine (ManageableApplication $applicationInstance) { + public static final function createConsoleTemplateEngine () { // Get a new instance $templateInstance = new ConsoleTemplateEngine(); + // Get the application instance from registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Determine base path $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; diff --git a/inc/classes/main/template/image/class_ImageTemplateEngine.php b/inc/classes/main/template/image/class_ImageTemplateEngine.php index 98203154..d59c91fa 100644 --- a/inc/classes/main/template/image/class_ImageTemplateEngine.php +++ b/inc/classes/main/template/image/class_ImageTemplateEngine.php @@ -69,7 +69,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $applicationInstance A manageable application * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty * @throws InvalidBasePathStringException If $templateBasePath is no string @@ -78,10 +77,13 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public static final function createImageTemplateEngine (ManageableApplication $applicationInstance) { + public static final function createImageTemplateEngine () { // Get a new instance $templateInstance = new ImageTemplateEngine(); + // Get the application instance from registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Determine base path $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; diff --git a/inc/classes/main/template/mail/class_MailTemplateEngine.php b/inc/classes/main/template/mail/class_MailTemplateEngine.php index eda00738..c4e49b22 100644 --- a/inc/classes/main/template/mail/class_MailTemplateEngine.php +++ b/inc/classes/main/template/mail/class_MailTemplateEngine.php @@ -63,7 +63,6 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $applicationInstance A manageable application * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty * @throws InvalidBasePathStringException If $templateBasePath is no string @@ -72,10 +71,13 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public static final function createMailTemplateEngine (ManageableApplication $applicationInstance) { + public static final function createMailTemplateEngine () { // Get a new instance $templateInstance = new MailTemplateEngine(); + // Get the application instance from registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Determine base path $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; diff --git a/inc/classes/main/template/menu/class_MenuTemplateEngine.php b/inc/classes/main/template/menu/class_MenuTemplateEngine.php index b67f7207..1438c914 100644 --- a/inc/classes/main/template/menu/class_MenuTemplateEngine.php +++ b/inc/classes/main/template/menu/class_MenuTemplateEngine.php @@ -85,7 +85,6 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $applicationInstance A manageable application * @param $menuInstance A RenderableMenu instance * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty @@ -95,10 +94,13 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public static final function createMenuTemplateEngine (ManageableApplication $applicationInstance, RenderableMenu $menuInstance) { + public static final function createMenuTemplateEngine (RenderableMenu $menuInstance) { // Get a new instance $templateInstance = new MenuTemplateEngine(); + // Get the application instance from registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Determine base path $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; @@ -290,7 +292,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla // Is the template dependency set? if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) { // Get a temporay menu template instance - $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getApplicationInstance(), $this->getMenuInstance())); + $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getMenuInstance())); // Then load it $templateInstance->loadMenuTemplate($templateDependency); diff --git a/inc/classes/main/template/web/class_WebTemplateEngine.php b/inc/classes/main/template/web/class_WebTemplateEngine.php index e4846a81..ef5a0e2d 100644 --- a/inc/classes/main/template/web/class_WebTemplateEngine.php +++ b/inc/classes/main/template/web/class_WebTemplateEngine.php @@ -36,7 +36,6 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $applicationInstance A manageable application * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty * @throws InvalidBasePathStringException If $templateBasePath is no string @@ -45,10 +44,13 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public static final function createWebTemplateEngine (ManageableApplication $applicationInstance) { + public static final function createWebTemplateEngine () { // Get a new instance $templateInstance = new WebTemplateEngine(); + // Get the application instance from registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Determine base path $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; -- 2.39.5