From 9f509643f032ddab67aca484de1386b499c054b3 Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Fri, 18 Dec 2009 07:17:46 +0000 Subject: [PATCH] "MDL-21141, fixed a regression introduced by last commit, thanks for testing, jerome" --- lib/ajax/ajaxlib.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index 6502d11608..35b3dabc77 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -185,21 +185,22 @@ class page_requirements_manager { */ public function css($stylesheet, $fullurl = false) { global $CFG; + if (!$fullurl) { + if (!file_exists($CFG->dirroot . '/' . strtok($stylesheet, '?'))) { + throw new coding_exception('Attempt to require a CSS file that does not exist.', $stylesheet); + } + $url = $CFG->httpswwwroot . '/' . $stylesheet; + } else { + $url = $stylesheet; + } if (isset($this->linkedrequirements[$url])) { + // already required, ignore it return; } else { if ($this->headdone) { throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet); } - if (!$fullurl) { - if (!file_exists($CFG->dirroot . '/' . strtok($stylesheet, '?'))) { - throw new coding_exception('Attempt to require a CSS file that does not exist.', $stylesheet); - } - $url = $CFG->httpswwwroot . '/' . $stylesheet; - } else { - $url = $stylesheet; - } $this->linkedrequirements[$url] = new required_css($this, $url); } } -- 2.39.5