From: Dongsheng Cai Date: Fri, 18 Dec 2009 07:17:46 +0000 (+0000) Subject: "MDL-21141, fixed a regression introduced by last commit, thanks for testing, jerome" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9f509643f032ddab67aca484de1386b499c054b3;p=moodle.git "MDL-21141, fixed a regression introduced by last commit, thanks for testing, jerome" --- 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); } }