diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-05-16 10:41:32 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-05-16 10:41:32 +0200 |
commit | 524be65dda410b9a3ced3fa06e672b4fd2cda5e4 (patch) | |
tree | 928fe3dfe442a2847d5fefcb7d62bb09ac7b17af /inc | |
parent | 2b03e74de514af15d4004e7635625fa64816231a (diff) | |
download | rpg-524be65dda410b9a3ced3fa06e672b4fd2cda5e4.tar.gz rpg-524be65dda410b9a3ced3fa06e672b4fd2cda5e4.tar.bz2 |
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
Diffstat (limited to 'inc')
-rw-r--r-- | inc/template.php | 7 |
1 files changed, 6 insertions, 1 deletions
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 <andi@splitbrain.org> */ 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; |