Example #1
0
            $chunkurl = "{$relroot}/theme/styles.php?theme={$themename}&rev={$rev}&type=all&svg=0";
        }
    }
    $cssfiles = array();
    foreach ($css as $key => $value) {
        foreach ($value as $val) {
            if (is_array($val)) {
                foreach ($val as $k => $v) {
                    $cssfiles[] = $v;
                }
            } else {
                $cssfiles[] = $val;
            }
        }
    }
    css_store_css($theme, "{$candidatedir}/all.css", $cssfiles, true, $chunkurl);
}
// verify nothing failed in cache file creation
clearstatcache();
if (!file_exists($candidatesheet)) {
    // We need to send at least something, IE does not get it chunked properly but who cares.
    $css = '';
    foreach ($cssfiles as $file) {
        $css .= file_get_contents($file) . "\n";
    }
    css_send_uncached_css($css, false);
} else {
    if (!$cache) {
        // Do not pollute browser caches if invalid revision requested.
        css_send_uncached_css(file_get_contents($candidatesheet), false);
    } else {
Example #2
0
        $basedir .= '/nosvg';
    }
    $css = $theme->css_files();
    $allfiles = array();
    foreach ($css as $key=>$value) {
        $cssfiles = array();
        foreach($value as $val) {
            if (is_array($val)) {
                foreach ($val as $k=>$v) {
                    $cssfiles[] = $v;
                }
            } else {
                $cssfiles[] = $val;
            }
        }
        $cssfile = "$basedir/$key.css";
        css_store_css($theme, $cssfile, $cssfiles);
        $allfiles = array_merge($allfiles, $cssfiles);
    }
    $cssfile = "$basedir/all.css";
    css_store_css($theme, $cssfile, $allfiles);
}

// verify nothing failed in cache file creation
clearstatcache();
if (!file_exists($candidatesheet)) {
    css_send_css_not_found();
}

css_send_cached_css($candidatesheet, $etag);
Example #3
0
    $csscontent = $theme->get_css_content();
    $relroot = preg_replace('|^http.?://[^/]+|', '', $CFG->wwwroot);
    if (!empty($slashargument)) {
        if ($usesvg) {
            $chunkurl = "{$relroot}/theme/styles.php/{$themename}/{$rev}/{$type}";
        } else {
            $chunkurl = "{$relroot}/theme/styles.php/_s/{$themename}/{$rev}/{$type}";
        }
    } else {
        if ($usesvg) {
            $chunkurl = "{$relroot}/theme/styles.php?theme={$themename}&rev={$rev}&type={$type}";
        } else {
            $chunkurl = "{$relroot}/theme/styles.php?theme={$themename}&rev={$rev}&type={$type}&svg=0";
        }
    }
    css_store_css($theme, "{$candidatedir}/{$type}.css", $csscontent, true, $chunkurl);
    // Release the lock.
    if ($lock) {
        $lock->release();
    }
}
if (!$cache) {
    // Do not pollute browser caches if invalid revision requested,
    // let's ignore legacy IE breakage here too.
    css_send_uncached_css($csscontent);
} else {
    if ($chunk !== null and file_exists($candidatesheet)) {
        // Greetings stupid legacy IEs!
        css_send_cached_css($candidatesheet, $etag);
    } else {
        // Real browsers - this is the expected result!