diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index d1fc851fd3deea5300e05321ceed48b3fa14920e..f95eb56fef97f854366abb1209902c70f0f75dc2 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -76,6 +76,7 @@ $conf['purgeonadd'] = 1; //purge cache when a new file is added $conf['locktime'] = 15*60; //maximum age for lockfiles (defaults to 15 minutes) $conf['notify'] = ''; //send change info to this email (leave blank for nobody) $conf['mailfrom'] = ''; //use this email when sending mails +$conf['gzip_output'] = 1; //use gzip content encodeing for the output xhtml (if allowed by browser) $conf['gdlib'] = 2; //the GDlib version (0, 1 or 2) 2 tries to autodetect $conf['im_convert'] = ''; //path to ImageMagicks convert (will be used instead of GD) $conf['jpg_quality'] = '70'; //quality of compression when scaling jpg images (0-100) diff --git a/inc/template.php b/inc/template.php index 17d6294bcfd380e0be37d09975b819cab3d709fd..1af73538246a0647cc4aa644904f6272b99b6396 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; diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index b4140207201e53fe0856a1b68c467a407bce7913..5e25994191aaa28319c2638870cc51ce84791ebd 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -93,18 +93,19 @@ $lang['usedraft'] = 'Automatically save a draft while editing'; $lang['sepchar'] = 'Page name word separator'; $lang['canonical'] = 'Use fully canonical URLs'; $lang['autoplural'] = 'Check for plural forms in links'; -$lang['usegzip'] = 'Use gzip (for attic)'; +$lang['usegzip'] = 'Use gzip for attic files'; $lang['cachetime'] = 'Maximum age for cache (sec)'; $lang['purgeonadd'] = 'Purge cache when new pages are added'; $lang['locktime'] = 'Maximum age for lock files (sec)'; $lang['notify'] = 'Send change notifications to this email address'; $lang['mailfrom'] = 'Email address to use for automatic mails'; +$lang['gzip_output'] = 'Use gzip Content-Encoding for xhtml'; $lang['gdlib'] = 'GD Lib version'; $lang['im_convert'] = 'Path to ImageMagick\'s convert tool'; $lang['jpg_quality'] = 'JPG compression quality (0-100)'; $lang['spellchecker']= 'Enable spellchecker'; $lang['subscribers'] = 'Enable page subscription support'; -$lang['compress'] = 'Compress CSS and javascript files'; +$lang['compress'] = 'Compact CSS and javascript output'; $lang['hidepages'] = 'Hide matching pages (regular expressions)'; $lang['send404'] = 'Send "HTTP 404/Page Not Found" for non existing pages'; $lang['sitemap'] = 'Generate Google sitemap (days)'; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index d48d08d56a3b7d224d77fa080d9e47941f094c58..1514d731c07232969b1b06fb1104b4ab70cc8b87 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -144,11 +144,12 @@ $meta['useslash'] = array('onoff'); $meta['sepchar'] = array('sepchar'); $meta['canonical'] = array('onoff'); $meta['autoplural'] = array('onoff'); -$meta['usegzip'] = array('onoff'); $meta['mailfrom'] = array('email'); $meta['compress'] = array('onoff'); +$meta['gzip_output'] = array('onoff'); $meta['hidepages'] = array('string'); $meta['send404'] = array('onoff'); +$meta['usegzip'] = array('onoff'); $meta['sitemap'] = array('numeric'); $meta['rss_type'] = array('multichoice','_choices' => array('rss','rss1','rss2','atom')); $meta['rss_linkto'] = array('multichoice','_choices' => array('diff','page','rev','current'));