From 6e6034e550fc9064818545f3397a86a12b35eb26 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 12 Feb 2011 21:56:03 +0100 Subject: [PATCH] MDL-26153 fix yui combo loading for images with numbers in file name --- theme/yui_combo.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/theme/yui_combo.php b/theme/yui_combo.php index 222846552ff..464638a0ce2 100644 --- a/theme/yui_combo.php +++ b/theme/yui_combo.php @@ -93,18 +93,18 @@ foreach ($parts as $part) { if ($mimetype === 'text/css') { if ($version == 'moodle') { - $filecontent = preg_replace('/([a-z_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/'.$frankenstyle.'/'.array_shift($bits).'/$1.$2', $filecontent); + $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/'.$frankenstyle.'/'.array_shift($bits).'/$1.$2', $filecontent); } else if ($version == 'gallery') { // search for all images in gallery module CSS and serve them through the yui_image.php script - $filecontent = preg_replace('/([a-z_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/'.$bits[0].'/'.$bits[1].'/$1.$2', $filecontent); + $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/'.$bits[0].'/'.$bits[1].'/$1.$2', $filecontent); } else { // First we need to remove relative paths to images. These are used by YUI modules to make use of global assets. // I've added this as a separate regex so it can be easily removed once // YUI standardise there CSS methods - $filecontent = preg_replace('#(\.\./\.\./\.\./\.\./assets/skins/sam/)?([a-z_-]+)\.(png|gif)#', '$2.$3', $filecontent); + $filecontent = preg_replace('#(\.\./\.\./\.\./\.\./assets/skins/sam/)?([a-z0-9_-]+)\.(png|gif)#', '$2.$3', $filecontent); // search for all images in yui2 CSS and serve them through the yui_image.php script - $filecontent = preg_replace('/([a-z_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/$1.$2', $filecontent); + $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', 'yui_image.php?file='.$version.'/$1.$2', $filecontent); } }