From e6bc73f6b5a624a656b068691a5dad1fe80c60ca Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 30 Nov 2007 18:03:29 +0000 Subject: [PATCH] Fix regression from r26893: a few messages that formerly accepted character entities such as   no longer did. This broke existing behavior with no effective workaround, since a very common browser (Firefox < 3) cannot save forms containing literal nbsp (Mozilla bug 218277). The messages (which are link text) now allow entities, but not wikitext or other HTML, via a new 'escapenoentities' option for wfMsgExt. --- includes/GlobalFunctions.php | 6 +++++- includes/Skin.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 02b4eab7db..26bf20b26f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -546,10 +546,12 @@ function wfMsgWikiHtml( $key ) { * @param array $options Processing rules: * parse: parses wikitext to html * parseinline: parses wikitext to html and removes the surrounding p's added by parser or tidy - * escape: filters message trough htmlspecialchars + * escape: filters message through htmlspecialchars + * escapenoentities: same, but allows entity references like   through * replaceafter: parameters are substituted after parsing or escaping * parsemag: transform the message using magic phrases * content: fetch message for content language instead of interface + * Behavior for conflicting options (e.g., parse+parseinline) is undefined. */ function wfMsgExt( $key, $options ) { global $wgOut, $wgParser; @@ -590,6 +592,8 @@ function wfMsgExt( $key, $options ) { if ( in_array('escape', $options) ) { $string = htmlspecialchars ( $string ); + } elseif ( in_array( 'escapenoentities', $options ) ) { + $string = str_replace( '&', '&', htmlspecialchars( $string ) ); } if( in_array('replaceafter', $options) ) { diff --git a/includes/Skin.php b/includes/Skin.php index e4769d5101..a9b91e7b5d 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1226,7 +1226,7 @@ END; // language (which may or may not be the same as the default language), // but we make the link target be the one site-wide page. return $this->makeKnownLink( wfMsgForContent( $page ), - wfMsgExt( $desc, array( 'parsemag', 'escape' ) ) ); + wfMsgExt( $desc, array( 'parsemag', 'escapenoentities' ) ) ); } } @@ -1659,4 +1659,4 @@ END; return $bar; } -} \ No newline at end of file +} -- 2.20.1