From 46195a1e663bdfd825aaa180b89995373f4f191f Mon Sep 17 00:00:00 2001 From: Nao Date: Tue, 21 Feb 2017 07:12:29 +0100 Subject: [PATCH] + Added a workaround to choosing another smiley set that doesn't have the same filenames as the default's. They will now fall back to the default set, but of course it's best to think of updating your files... (Subs-Cache.php) - Removed 3 unused bytes in every single page. Will it actually save 3 bytes of bandwidth? Does it matter? (Subs-Cache.php) --- core/app/Subs-Cache.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/app/Subs-Cache.php b/core/app/Subs-Cache.php index b9fa11f7..8e2712c9 100644 --- a/core/app/Subs-Cache.php +++ b/core/app/Subs-Cache.php @@ -1297,8 +1297,14 @@ function wedge_cache_smileys($set, $smileys, $extra) foreach ($smileys as $name => $smiley) { $filename = $path . $smiley['file']; + $cur_url = $url; if (!file_exists($filename)) - continue; + { + if (!file_exists($tmp = ASSETS_DIR . '/smileys/default/' . $smiley['file'])) + continue; + $filename = $tmp; + $cur_url = SMILEYS . '/default/'; + } // Only small files should be embedded, really. 4KB should have a fair bandwidth/hit ratio. if ($extra || ($smiley['embed'] && filesize($filename) > 4096) || !$context['smiley_gzip']) $smiley['embed'] = false; @@ -1306,7 +1312,7 @@ function wedge_cache_smileys($set, $smileys, $extra) $ext = strtolower(substr($filename, strrpos($filename, '.') + 1)); $stream = 'final_' . ($smiley['embed'] ? 'gzip' : 'raw'); $$stream .= '.' . $name . '{width:' . $width . 'px;height:' . $height . 'px;background:url(' - . ($smiley['embed'] ? 'data:image/' . $ext . ';base64,' . base64_encode(file_get_contents($filename)) : $url . $smiley['file']) . ')}'; + . ($smiley['embed'] ? 'data:image/' . $ext . ';base64,' . base64_encode(file_get_contents($filename)) : $cur_url . $smiley['file']) . ')}'; } // We can't apply a mixin here, but as .smiley is a naturally inline tag anyway, .inline-block isn't needed. @@ -1377,7 +1383,7 @@ function theme_base_js($indenting = 0) return (!empty($context['remote_js_files']) ? ' ' . $tab . ' ' . $tab . ' - ' : '') . ' + ' : '') . ' ' . $tab . '