X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=4536b8f766585564cbc0cefc6ad55a98709fc870;hb=eb2f439768d34254964e798d9523211ba8ea2f5f;hp=0360d19731afb81e15eacd5fcfcfe5f56c45cb73;hpb=c978c945d7706fb16fb087ddc280da6579c31959;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0360d19731..4536b8f766 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1656,6 +1656,8 @@ function wfClientAcceptsGzip( $force = false ) { } /** + * @deprecated since 1.28, use Parser::escapeWikitext() directly + * * Escapes the given text so that it may be output using addWikiText() * without any linking, formatting, etc. making its way through. This * is achieved by substituting certain characters with HTML entities. @@ -1665,47 +1667,8 @@ function wfClientAcceptsGzip( $force = false ) { * @return string */ function wfEscapeWikiText( $text ) { - global $wgEnableMagicLinks; - static $repl = null, $repl2 = null; - if ( $repl === null ) { - $repl = [ - '"' => '"', '&' => '&', "'" => ''', '<' => '<', - '=' => '=', '>' => '>', '[' => '[', ']' => ']', - '{' => '{', '|' => '|', '}' => '}', ';' => ';', - "\n#" => "\n#", "\r#" => "\r#", - "\n*" => "\n*", "\r*" => "\r*", - "\n:" => "\n:", "\r:" => "\r:", - "\n " => "\n ", "\r " => "\r ", - "\n\n" => "\n ", "\r\n" => " \n", - "\n\r" => "\n ", "\r\r" => "\r ", - "\n\t" => "\n ", "\r\t" => "\r ", // "\n\t\n" is treated like "\n\n" - "\n----" => "\n----", "\r----" => "\r----", - '__' => '__', '://' => '://', - ]; - - $magicLinks = array_keys( array_filter( $wgEnableMagicLinks ) ); - // We have to catch everything "\s" matches in PCRE - foreach ( $magicLinks as $magic ) { - $repl["$magic "] = "$magic "; - $repl["$magic\t"] = "$magic "; - $repl["$magic\r"] = "$magic "; - $repl["$magic\n"] = "$magic "; - $repl["$magic\f"] = "$magic "; - } - - // And handle protocols that don't use "://" - global $wgUrlProtocols; - $repl2 = []; - foreach ( $wgUrlProtocols as $prot ) { - if ( substr( $prot, -1 ) === ':' ) { - $repl2[] = preg_quote( substr( $prot, 0, -1 ), '/' ); - } - } - $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : '/^(?!)/'; - } - $text = substr( strtr( "\n$text", $repl ), 1 ); - $text = preg_replace( $repl2, '$1:', $text ); - return $text; + global $wgParser; + return $wgParser->escapeWikitext( $text ); } /** @@ -2033,7 +1996,7 @@ function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) { */ function wfTimestampNow() { # return NOW - return MWTimestamp::convert( TS_MW, time() ); + return MWTimestamp::now( TS_MW ); } /**