Permalink
Browse files

Merge branch 'MDL-59148-master-7' of git://github.com/andrewnicols/mo…

…odle
  • Loading branch information...
dmonllao committed Jun 28, 2017
2 parents 0248d16 + 0e9911e commit 185455dcc3f538622097a857443dcd92fcdea4c6
Showing with 226 additions and 72 deletions.
  1. +21 −1 lib/csslib.php
  2. +29 −1 lib/outputlib.php
  3. +1 −0 theme/boost/config.php
  4. +1 −0 theme/more/config.php
  5. +174 −70 theme/styles.php
@@ -329,6 +329,26 @@ function css_send_cached_css_content($csscontent, $etag) {
die;
}
/**
* Sends CSS directly and disables all caching.
* The Content-Length of the body is also included, but the script is not ended.
*
* @param string $css The CSS content to send
* @param int $expiry The anticipated expiry of the file
*/
function css_send_temporary_css($css) {
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
header('Content-Disposition: inline; filename="styles_debug.php"');
header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
header('Accept-Ranges: none');
header('Content-Type: text/css; charset=utf-8');
header('Content-Length: ' . strlen($css));
echo $css;
}
/**
* Sends CSS directly without caching it.
*
@@ -382,4 +402,4 @@ function css_send_unmodified($lastmodified, $etag) {
function css_send_css_not_found() {
header('HTTP/1.0 404 not found');
die('CSS was not found, sorry.');
}
}
@@ -363,6 +363,12 @@ class theme_config {
*/
public $editor_sheets = array();
/**
* @var bool Whether a fallback version of the stylesheet will be used
* whilst the final version is generated.
*/
public $usefallback = false;
/**
* @var array The names of all the javascript files this theme that you would
* like included from head, in order. Give the names of the files without .js.
@@ -724,7 +730,7 @@ private function __construct($config) {
}
$configurable = array(
'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets',
'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'usefallback',
'javascripts', 'javascripts_footer', 'parents_exclude_javascripts',
'layouts', 'enable_dock', 'enablecourseajax', 'requiredblocks',
'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'uarrow', 'darrow',
@@ -1102,6 +1108,19 @@ public function set_css_content_cache($csscontent) {
return $cache->set($key, $csscontent);
}
/**
* Return whether the post processed CSS content has been cached.
*
* @return bool Whether the post-processed CSS is available in the cache.
*/
public function has_css_cached_content() {
$key = $this->get_css_cache_key();
$cache = cache::make('core', 'postprocessedcss');
return $cache->has($key);
}
/**
* Return cached post processed CSS content.
*
@@ -2218,6 +2237,15 @@ public function set_rtl_mode($inrtl = true) {
$this->rtlmode = $inrtl;
}
/**
* Whether the theme is being served in RTL mode.
*
* @return bool True when in RTL mode.
*/
public function get_rtl_mode() {
return $this->rtlmode;
}
/**
* Checks if file with any image extension exists.
*
@@ -29,6 +29,7 @@
$THEME->name = 'boost';
$THEME->sheets = [];
$THEME->editor_sheets = [];
$THEME->usefallback = true;
$THEME->scss = function($theme) {
return theme_boost_get_main_scss_content($theme);
};
@@ -28,6 +28,7 @@
$THEME->doctype = 'html5';
$THEME->sheets = array('custom');
$THEME->lessfile = 'moodle';
$THEME->usefallback = true;
$THEME->parents_exclude_sheets = array('bootstrapbase' => array('moodle'), 'clean' => array('custom'));
$THEME->lessvariablescallback = 'theme_more_less_variables';
$THEME->extralesscallback = 'theme_more_extra_less';
Oops, something went wrong.

0 comments on commit 185455d

Please sign in to comment.