From: scyrma Date: Tue, 29 Apr 2008 05:10:34 +0000 (+0000) Subject: MDL-13985 - Fix previous fix to display a warning when whitespace is used in popup... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4ba6b3e3211400160ff48bc08d15c46029592f31;p=moodle.git MDL-13985 - Fix previous fix to display a warning when whitespace is used in popup window name (merge from 1.9) --- diff --git a/lib/weblib.php b/lib/weblib.php index c47c641c4f..c3b1a271e8 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -729,8 +729,10 @@ function element_to_popup_window ($type=null, $url=null, $name=null, $linkname=n $class = ' class="'.$class.'" '; } if ($name) { - $name = str_replace(' ', '_', $name); - debugging('The $name of a popup window shouldn\'t contain spaces - string modified.', DEBUG_DEVELOPER); + $_name = $name; + if (($name = preg_replace("/\s/", '_', $name)) != $_name) { + debugging('The $name of a popup window shouldn\'t contain spaces - string modified. '. $_name .' changed to '. $name, DEBUG_DEVELOPER); + } } else { $name = 'popup'; }