summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-06-18 10:16:47 +0200
committerAndreas Gohr <andi@splitbrain.org>2011-06-18 10:16:47 +0200
commit28f4004c937cfc11f16e6cc7c0eb7da1a61dfcbe (patch)
treebd271a130837a35f1ca5932d57d1e0c730c10468 /lib
parent809d3ba53bea8b34155cb8d009d7fa4b8a7bbdaf (diff)
downloadrpg-28f4004c937cfc11f16e6cc7c0eb7da1a61dfcbe.tar.gz
rpg-28f4004c937cfc11f16e6cc7c0eb7da1a61dfcbe.tar.bz2
Made the maximum embed size for datauris configurable
The feature is now disabled by default. Metadata for config manager was added.
Diffstat (limited to 'lib')
-rw-r--r--lib/exe/css.php4
-rw-r--r--lib/plugins/config/lang/en/lang.php1
-rw-r--r--lib/plugins/config/settings/config.metadata.php1
3 files changed, 5 insertions, 1 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php
index 02ed169c4..92d198e19 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -289,6 +289,8 @@ function css_loadfile($file,$location=''){
* Callback for preg_replace_callback
*/
function css_datauri($match){
+ global $conf;
+
$pre = unslash($match[1]);
$base = unslash($match[2]);
$url = unslash($match[3]);
@@ -296,7 +298,7 @@ function css_datauri($match){
$local = DOKU_INC.$url;
$size = @filesize($local);
- if($size && $size < 600){
+ if($size && $size < $conf['cssdatauri']){
$data = base64_encode(file_get_contents($local));
}
if($data){
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index 9b7c643bf..e5dd4707a 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -133,6 +133,7 @@ $lang['jpg_quality'] = 'JPG compression quality (0-100)';
$lang['subscribers'] = 'Enable page subscription support';
$lang['subscribe_time'] = 'Time after which subscription lists and digests are sent (sec); This should be smaller than the time specified in recent_days.';
$lang['compress'] = 'Compact CSS and javascript output';
+$lang['cssdatauri'] = 'Size in bytes up to which images referenced in CSS files should be embedded right into the stylesheet to reduce HTTP request header overhead. This technique won\'t work in IE < 8! <code>400</code> to <code>600</code> bytes is a good value. Set <code>0</code> to disable.';
$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 af7e63a61..abea1be1c 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -179,6 +179,7 @@ $meta['autoplural'] = array('onoff');
$meta['mailfrom'] = array('richemail');
$meta['mailprefix'] = array('string');
$meta['compress'] = array('onoff');
+$meta['cssdatauri'] = array('numeric','_pattern' => '/^\d+$/');
$meta['gzip_output'] = array('onoff');
$meta['hidepages'] = array('string');
$meta['send404'] = array('onoff');