From f63a2007b99e30879164f7e1f40859a4a06f1471 Mon Sep 17 00:00:00 2001
From: chris <chris@jalakai.co.uk>
Date: Sat, 15 Apr 2006 18:02:10 +0200
Subject: [PATCH] event SEND_HEADERS

Event data an array of headers dokuwiki will send[1].
The default action is to output all the headers in order using the header() function.

This event is a full trigger, meaning there are three advises:
- SEND_HEADERS_before
- SEND_HEADERS
- SEND_HEADERS_after

Handlers of this event can add/modify/delete the headers in the event data. The event
data must remain an array, even if emptied.

[1] There is one dokuwiki header 'Content-Type: text/html; charset

darcs-hash:20060415160210-9b6ab-841bd034b797c7f1b8d4bbc66f90185a16e5a043.gz
---
 inc/actions.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/inc/actions.php b/inc/actions.php
index d585ccace..8218dd8a6 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -107,12 +107,19 @@ function act_dispatch(){
   }
 
   //call template FIXME: all needed vars available?
-  header('Content-Type: text/html; charset=utf-8');
+  $headers[] = 'Content-Type: text/html; charset=utf-8';
+  $evt = new event('SEND_HEADERS',$headers,act_sendheaders);
+  $evt->trigger();
+
   include(template('main.php'));
   // output for the commands is now handled in inc/templates.php
   // in function tpl_content()
 }
 
+function act_sendheaders($headers) {
+  foreach ($headers as $hdr) header($hdr);
+}
+
 /**
  * Sanitize the action command
  *
-- 
GitLab