From 2e40c7f77ee66f83586cbd7c2b5d90cadd93144f Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 4 Mar 2014 16:45:10 +0100 Subject: Added headers parameter to it_html (e.g. for Vary header) --- it_html.class | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'it_html.class') diff --git a/it_html.class b/it_html.class index fbab0db..c69e10d 100644 --- a/it_html.class +++ b/it_html.class @@ -167,6 +167,7 @@ function html($args) * * @param args... any number of assoc arrays and strings. strings will be content of
* @param $p['content-type'] content type (default: "text/html; charset=iso-8859-1") + * @param $p['headers'] Array of HTTP headers (e.g. [ 'Vary' => "User-Agent,Accept-Language" ]) * @param $p['cssinline'] stylesheet to be put in header * @param $p['description'] data for tag * @param $p['keywords'] data for tag @@ -209,7 +210,11 @@ function head($args = array()) if($this->p['htmltype'] == "xhtml-mobile" && strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) header("Content-Type: application/xhtml+xml; charset={$this->p['charset']}"); # for validation else if (!headers_sent()) # prevent warnings when ED() in use + { header("Content-Type: " . $p['content-type']); + foreach ((array)$p['headers'] as $key => $value) + header("$key: $value"); + } $js = isset($p['jsenv']) ? "var env = " . itjs::serialize($p['jsenv']) . ";\n" : ''; $js .= $this->_itjs($p['jsinline'], 'inline'); -- cgit v1.2.3