Exemplo n.º 1
0
 }
 // JS and CSS special stuffs
 if ($type == 'stylesheets' || $type == 'javascripts') {
     // Compression var
     if ($has_compression) {
         $cache_encoding = 'deflate';
     } else {
         $cache_encoding = 'plain';
     }
     // Get the vars
     $version = getVersion();
     $hash = genHash($version);
     $cache_hash = md5($path . $hash . staticLocation()) . '_' . $cache_encoding;
     // Check if the browser supports DEFLATE
     $deflate_support = false;
     if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && hasCompression() && !$is_developer) {
         $deflate_support = true;
     }
     // Internationalization
     if ($type == 'javascripts') {
         if (isset($_GET['l']) && !empty($_GET['l']) && !preg_match('/\\.\\.\\//', $_GET['l']) && is_dir(JAPPIX_BASE . '/i18n/' . $_GET['l'])) {
             $locale = $_GET['l'];
         } else {
             $locale = 'en';
         }
     } else {
         $locale = '';
     }
     // Define the cache lang name
     if ($locale) {
         $cache_lang = $cache_hash . '_' . $locale;
Exemplo n.º 2
0
function canCompress()
{
    // Compression allowed by admin & browser?
    return hasCompression() && (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'));
}