Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -210,16 +210,19 @@ |
211 | 211 | /** |
212 | 212 | * Formats an array of message strings so that it appears as a tooltip. |
213 | 213 | * $icon should be one of: 'warning' (default), 'info'. |
214 | | - * @note callers of this funcion must ensure safety, since the $icon string is |
215 | | - * used in the output directly. This is not hard: $icon acts simply like an |
216 | | - * enum, and callers have no need to compute it but use constant strings. |
| 214 | + * |
| 215 | + * @param array $messages |
| 216 | + * @param string $icon Acts like an enum. Callers must ensure safety, since this value is used directly in the output. |
| 217 | + * @param string $seperator |
| 218 | + * |
| 219 | + * @return string |
217 | 220 | */ |
218 | | -function smwfEncodeMessages( $msgarray, $icon = 'warning', $sep = " <!--br-->" ) { |
219 | | - if ( count( $msgarray ) > 0 ) { |
| 221 | +function smwfEncodeMessages( array $messages, $icon = 'warning', $seperator = ' <!--br-->' ) { |
| 222 | + if ( count( $messages ) > 0 ) { |
220 | 223 | SMWOutputs::requireHeadItem( SMW_HEADER_TOOLTIP ); |
221 | | - $msgs = implode( $sep, $msgarray ); |
222 | | - return '<span class="smwttpersist"><span class="smwtticon">' . $icon . '.png</span><span class="smwttcontent">' . $msgs . '</span> </span>'; |
223 | | - // Note: the space is essential to make FF (and maybe other) align icons properly in tables |
| 224 | + foreach( $messages as &$message ) $message = htmlspecialchars( $message ); |
| 225 | + $messageString = implode( $seperator, $messages ); |
| 226 | + return '<span class="smwttpersist"><span class="smwtticon">' . $icon . '.png</span><span class="smwttcontent">' . $messageString . '</span> </span>'; |
224 | 227 | } else { |
225 | 228 | return ''; |
226 | 229 | } |