From efaa4c0803ddd84fe36b072873f688f85eccba64 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 5 Jan 2010 00:33:15 +0000 Subject: [PATCH] MDL-21242 towards removing og yui2 skin sheet from the huge theme css file --- lib/outputlib.php | 11 ++++++++--- lib/outputrenderers.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index 983354cfcb..8b58ee610c 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -574,17 +574,20 @@ class theme_config { * @param bool $encoded false means use & and true use & in URLs * @return array of moodle_url */ - public function css_urls() { + public function css_urls(moodle_page $page) { global $CFG; $rev = theme_get_revision(); + $urls = array(); + //TODO: MDL-21242 add here link to full YUI2 skin.css - get the url from the $page->requires instance + if ($rev > -1) { $params = array('theme'=>$this->name,'rev'=>$rev); if (check_browser_version('MSIE', 5) and !check_browser_version('MSIE', 8)) { $params['type'] = 'ie'; } - return array(new moodle_url($CFG->httpswwwroot.'/theme/styles.php', $params)); + $urls[] = new moodle_url($CFG->httpswwwroot.'/theme/styles.php', $params); } else { // find out the current CSS and cache it now for 5 seconds @@ -627,8 +630,9 @@ class theme_config { foreach ($css['theme'] as $sheet=>$unused) { $urls[] = new moodle_url($url, array('sheet'=>$sheet, 'theme'=>$this->name, 'type'=>'theme')); // sheet first in order to make long urls easier to read } - return $urls; } + + return $urls; } /** @@ -643,6 +647,7 @@ class theme_config { // legacy YUI2 stylesheets, YUI3 stylesheets are loaded on the fly $yui2_sheets = "\n\n/*** Standard YUI2 sheets ***/\n\n"; $yui2_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui2version/build/assets/skins/sam/skin.css"); + //TODO: MDL-21242 move this YUI2 CSS hack to css_urls(), the page requirements manager should return the correct yui_combo.php?2.x.x/build/skinks/sam/skin.css // search for all images in yui2 CSS and serve them through the yui_image.php script $css['yui2'][] = preg_replace('/([a-z-]+)\.(png|gif)/', 'yui_image.php?file='.$CFG->yui2version.'/$1.$2', $yui2_sheets); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 7f9e2606d2..92c98da7af 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -390,7 +390,7 @@ class core_renderer extends renderer_base { // Get the theme stylesheet - this has to be always first CSS, this loads also styles.css from all plugins; // any other custom CSS can not be overridden via themes and is highly discouraged - $urls = $this->page->theme->css_urls(); + $urls = $this->page->theme->css_urls($this->page); foreach ($urls as $url) { $this->page->requires->css($url->out(), true); } -- 2.39.5