increment year in copyright notices
[squirrelmail.git] / class / template / Template.class.php
index 7b3fa0b1c73798eb5673e7913c184ac213c39169..b0104584faee2ed913aef14d54ff724ff947d339 100644 (file)
@@ -8,7 +8,7 @@
   * class with any custom functionality needed to interface a target
   * templating engine with SquirrelMail.
   *
-  * @copyright © 2003-2006 The SquirrelMail Project Team
+  * @copyright © 2003-2007 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   * @version $Id$
   * @package squirrelmail
@@ -311,10 +311,15 @@ class Template
       * Allow template set to override plugin configuration by either
       * adding or removing plugins.
       *
+      * NOTE: due to when this code executes, plugins activated here
+      *       do not have access to the config_override and loading_prefs 
+      *       hooks; instead, such plugins can use the 
+      *       "template_plugins_override_after" hook defined below.
+      *
       */
     function override_plugins() {
 
-        global $disable_plugins, $plugins, $squirrelmail_plugin_hooks;
+        global $disable_plugins, $plugins, $squirrelmail_plugin_hooks, $null;
         if ($disable_plugins) return;
 
         $add_plugins = Template::get_template_config($this->template_set_id,
@@ -371,6 +376,8 @@ class Template
             }
         }
 
+        do_hook('template_plugins_override_after', $null);
+
     }
 
     /**
@@ -1309,7 +1316,7 @@ FIXME: We could make the incoming array more complex so it can
       * Send HTTP header(s) to browser.
       *
       * Subclasses can override this function if headers are
-      * managed differently in the template set's target output
+      * managed differently in the engine's target output
       * interface.
       *
       * @param mixed $headers A list of (or a single) header
@@ -1322,7 +1329,8 @@ FIXME: We could make the incoming array more complex so it can
         if (!is_array($headers)) $headers = array($headers);
 
         foreach ($headers as $header) {
-            header($header);
+            $this->assign('header', $header);
+            header($this->fetch('header.tpl'));
         }
 
     }
@@ -1403,14 +1411,9 @@ FIXME: We could make the incoming array more complex so it can
         } else {
 
             $aPluginOutput = array();
-            // At this moment concat_hook_function can return string and arrays.
-            // In php 4.3.x a notice will be raised when a string is passed as $aPluginOutput
-            // TODO, only return an arrays by concat_hook_function.
-            $mixedOutput = concat_hook_function('template_construct_' . $file,
-                                                  $temp=array(&$aPluginOutput, &$this));
-            if (is_array($mixedOutput)) {
-                $aPluginOutput = $mixedOutput;
-            }
+            $aPluginOutput = concat_hook_function('template_construct_' . $file,
+                                                  $temp=array(&$aPluginOutput, &$this),
+                                                  TRUE);
             $this->assign('plugin_output', $aPluginOutput);
 
             //$output = $this->apply_template($template);