From 524be65dda410b9a3ced3fa06e672b4fd2cda5e4 Mon Sep 17 00:00:00 2001 From: Ben Coburn Date: Tue, 16 May 2006 10:41:32 +0200 Subject: gzip content-encoding option - Enables gzip compression of output xhtml for browsers that support it. For example the wiki:syntax page takes up 46.80KB raw, but only 9.88KB gzip encoded. - Setting is configurable through the config plugin. darcs-hash:20060516084132-05dcb-d8d1c7911a951b00e166c5a94f46a2cf1cfa5846.gz --- inc/template.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/template.php b/inc/template.php index 17d6294bc..1af735382 100644 --- a/inc/template.php +++ b/inc/template.php @@ -11,13 +11,18 @@ /** * Returns the path to the given template, uses - * default one if the custom version doesn't exist + * default one if the custom version doesn't exist. + * Also enables gzip compression if configured. * * @author Andreas Gohr */ function template($tpl){ global $conf; + if ($conf['gzip_output'] && extension_loaded('zlib') && preg_match('/gzip|deflate/', $_SERVER['HTTP_ACCEPT_ENCODING'])) { + ob_start('ob_gzhandler'); + } + if(@is_readable(DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl)) return DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl; -- cgit v1.2.3