]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-21141, fixed a regression introduced by last commit, thanks for testing, jerome"
authorDongsheng Cai <unoter@gmail.com>
Fri, 18 Dec 2009 07:17:46 +0000 (07:17 +0000)
committerDongsheng Cai <unoter@gmail.com>
Fri, 18 Dec 2009 07:17:46 +0000 (07:17 +0000)
lib/ajax/ajaxlib.php

index 6502d11608812e2273e548a688c803c736e6ce17..35b3dabc77c2aafaaa35614c8c0f554d5302bdd1 100644 (file)
@@ -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 &lt;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);
         }
     }