New, shorter intro to styles files that calls a function.
This function sets header information to improve caching (default 5 minutes) Cookies are also prevented to improve cacheability.
This commit is contained in:
@@ -780,6 +780,24 @@ function print_footer ($course=NULL) {
|
||||
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
|
||||
}
|
||||
|
||||
function style_sheet_setup($lastmodified, $lifetime, $themename="") {
|
||||
|
||||
global $CFG;
|
||||
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
|
||||
header("Cache-control: max_age = $lifetime");
|
||||
header("Pragma: ");
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (!empty($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
return "$CFG->wwwroot/theme/$CFG->theme";
|
||||
|
||||
}
|
||||
|
||||
|
||||
function user_login_string($course, $user=NULL) {
|
||||
global $USER, $CFG;
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); /// Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
|
||||
@@ -2,15 +2,10 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
header("Content-type: text/css"); /// Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -26,13 +26,9 @@
|
||||
|
||||
/* We use PHP so we can do value substitutions into the styles */
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/*
|
||||
From here on it's nearly a normal stylesheet.
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
|
||||
/// We use PHP so we can do value substitutions into the styles
|
||||
|
||||
require_once("../../config.php");
|
||||
|
||||
header("Content-type: text/css"); // Correct MIME type
|
||||
|
||||
if (isset($themename)) {
|
||||
$CFG->theme = $themename;
|
||||
}
|
||||
|
||||
$themeurl = "$CFG->wwwroot/theme/$CFG->theme";
|
||||
$nomoodlecookie = true;
|
||||
require_once("../../config.php");
|
||||
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
|
||||
|
||||
/// From here on it's nearly a normal stylesheet.
|
||||
/// First are some CSS definitions for normal tags,
|
||||
|
||||
Reference in New Issue
Block a user