From 4ba6b3e3211400160ff48bc08d15c46029592f31 Mon Sep 17 00:00:00 2001 From: scyrma Date: Tue, 29 Apr 2008 05:10:34 +0000 Subject: [PATCH] MDL-13985 - Fix previous fix to display a warning when whitespace is used in popup window name (merge from 1.9) --- lib/weblib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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'; } -- 2.39.5