Skip to content
Snippets Groups Projects
Commit 524be65d authored by Ben Coburn's avatar Ben Coburn
Browse files

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
parent 2b03e74d
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,7 @@ $conf['purgeonadd'] = 1; //purge cache when a new file is added ...@@ -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['locktime'] = 15*60; //maximum age for lockfiles (defaults to 15 minutes)
$conf['notify'] = ''; //send change info to this email (leave blank for nobody) $conf['notify'] = ''; //send change info to this email (leave blank for nobody)
$conf['mailfrom'] = ''; //use this email when sending mails $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['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['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) $conf['jpg_quality'] = '70'; //quality of compression when scaling jpg images (0-100)
......
...@@ -11,13 +11,18 @@ ...@@ -11,13 +11,18 @@
/** /**
* Returns the path to the given template, uses * 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> * @author Andreas Gohr <andi@splitbrain.org>
*/ */
function template($tpl){ function template($tpl){
global $conf; 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)) if(@is_readable(DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl))
return DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl; return DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl;
......
...@@ -93,18 +93,19 @@ $lang['usedraft'] = 'Automatically save a draft while editing'; ...@@ -93,18 +93,19 @@ $lang['usedraft'] = 'Automatically save a draft while editing';
$lang['sepchar'] = 'Page name word separator'; $lang['sepchar'] = 'Page name word separator';
$lang['canonical'] = 'Use fully canonical URLs'; $lang['canonical'] = 'Use fully canonical URLs';
$lang['autoplural'] = 'Check for plural forms in links'; $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['cachetime'] = 'Maximum age for cache (sec)';
$lang['purgeonadd'] = 'Purge cache when new pages are added'; $lang['purgeonadd'] = 'Purge cache when new pages are added';
$lang['locktime'] = 'Maximum age for lock files (sec)'; $lang['locktime'] = 'Maximum age for lock files (sec)';
$lang['notify'] = 'Send change notifications to this email address'; $lang['notify'] = 'Send change notifications to this email address';
$lang['mailfrom'] = 'Email address to use for automatic mails'; $lang['mailfrom'] = 'Email address to use for automatic mails';
$lang['gzip_output'] = 'Use gzip Content-Encoding for xhtml';
$lang['gdlib'] = 'GD Lib version'; $lang['gdlib'] = 'GD Lib version';
$lang['im_convert'] = 'Path to ImageMagick\'s convert tool'; $lang['im_convert'] = 'Path to ImageMagick\'s convert tool';
$lang['jpg_quality'] = 'JPG compression quality (0-100)'; $lang['jpg_quality'] = 'JPG compression quality (0-100)';
$lang['spellchecker']= 'Enable spellchecker'; $lang['spellchecker']= 'Enable spellchecker';
$lang['subscribers'] = 'Enable page subscription support'; $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['hidepages'] = 'Hide matching pages (regular expressions)';
$lang['send404'] = 'Send "HTTP 404/Page Not Found" for non existing pages'; $lang['send404'] = 'Send "HTTP 404/Page Not Found" for non existing pages';
$lang['sitemap'] = 'Generate Google sitemap (days)'; $lang['sitemap'] = 'Generate Google sitemap (days)';
......
...@@ -144,11 +144,12 @@ $meta['useslash'] = array('onoff'); ...@@ -144,11 +144,12 @@ $meta['useslash'] = array('onoff');
$meta['sepchar'] = array('sepchar'); $meta['sepchar'] = array('sepchar');
$meta['canonical'] = array('onoff'); $meta['canonical'] = array('onoff');
$meta['autoplural'] = array('onoff'); $meta['autoplural'] = array('onoff');
$meta['usegzip'] = array('onoff');
$meta['mailfrom'] = array('email'); $meta['mailfrom'] = array('email');
$meta['compress'] = array('onoff'); $meta['compress'] = array('onoff');
$meta['gzip_output'] = array('onoff');
$meta['hidepages'] = array('string'); $meta['hidepages'] = array('string');
$meta['send404'] = array('onoff'); $meta['send404'] = array('onoff');
$meta['usegzip'] = array('onoff');
$meta['sitemap'] = array('numeric'); $meta['sitemap'] = array('numeric');
$meta['rss_type'] = array('multichoice','_choices' => array('rss','rss1','rss2','atom')); $meta['rss_type'] = array('multichoice','_choices' => array('rss','rss1','rss2','atom'));
$meta['rss_linkto'] = array('multichoice','_choices' => array('diff','page','rev','current')); $meta['rss_linkto'] = array('multichoice','_choices' => array('diff','page','rev','current'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment