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
This commit is contained in:
Ben Coburn 2006-05-16 10:41:32 +02:00
parent 2b03e74de5
commit 524be65dda
4 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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)';

View File

@ -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'));