]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21252 shortened image urls in CSS
authorPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 21:45:08 +0000 (21:45 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 21:45:08 +0000 (21:45 +0000)
lib/outputlib.php

index 3bc688cbe9c552a7dbba24bf0811bfc0f91e675b..b0001cfe42fa180643f3e89ad9480747a873609a 100644 (file)
@@ -800,6 +800,8 @@ class theme_config {
     }
 
     protected function post_process($css) {
+        global $CFG;
+
         // now resolve all image locations
         if (preg_match_all('/\[\[pix:([a-z_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
             $replaced = array();
@@ -810,7 +812,10 @@ class theme_config {
                 $replaced[$match[0]] = true;
                 $imagename = $match[2];
                 $component = rtrim($match[1], '|');
-                $css = str_replace($match[0], $this->pix_url($imagename, $component)->out(false, array(), false), $css);
+                $imageurl = $this->pix_url($imagename, $component)->out_raw();
+                 // we do not need full url because the image.php is always in the same dir
+                $imageurl = str_replace("$CFG->httpswwwroot/theme/", '', $imageurl);
+                $css = str_replace($match[0], $imageurl, $css);
             }
         }