X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fparser%2FSanitizer.php;h=89a7c96124515b089b34e09faa9ba3cc2c751c70;hb=a60dcdc2e346d0b0df621daee991cbd26729cd4b;hp=ff543dbb30450d54a0138ee8e2b68478ec8ba2df;hpb=91dd393b4c044588a4df0674b1e9035a0bf06feb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php index ff543dbb30..89a7c96124 100644 --- a/includes/parser/Sanitizer.php +++ b/includes/parser/Sanitizer.php @@ -1141,6 +1141,27 @@ class Sanitizer { return $encValue; } + /** + * Armor French spaces with a replacement character + * + * @since 1.32 + * @param string $text Text to armor + * @param string $space Space character for the French spaces, defaults to ' ' + * @return string Armored text + */ + public static function armorFrenchSpaces( $text, $space = ' ' ) { + // Replace $ with \$ and \ with \\ + $space = preg_replace( '#(? "\\1$space", + # French spaces, Guillemet-right + '/(\\302\\253) /' => "\\1$space", + ]; + return preg_replace( array_keys( $fixtags ), array_values( $fixtags ), $text ); + } + /** * Encode an attribute value for HTML tags, with extra armoring * against further wiki processing. @@ -1168,6 +1189,9 @@ class Sanitizer { '__' => '__', ] ); + # Armor against French spaces detection (T5158) + $encValue = self::armorFrenchSpaces( $encValue, ' ' ); + # Stupid hack $encValue = preg_replace_callback( '/((?i)' . wfUrlProtocols() . ')/',