diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/parser/CoreParserFunctions.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'includes/parser/CoreParserFunctions.php')
-rw-r--r-- | includes/parser/CoreParserFunctions.php | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 830a68fc..7639e2f8 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -41,7 +41,7 @@ class CoreParserFunctions { $noHashFunctions = array( 'ns', 'nse', 'urlencode', 'lcfirst', 'ucfirst', 'lc', 'uc', 'localurl', 'localurle', 'fullurl', 'fullurle', 'canonicalurl', - 'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural', + 'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural', 'bidi', 'numberofpages', 'numberofusers', 'numberofactiveusers', 'numberofarticles', 'numberoffiles', 'numberofadmins', 'numberingroup', 'numberofedits', 'language', @@ -88,9 +88,13 @@ class CoreParserFunctions { if ( strval( $part1 ) !== '' ) { $args = array_slice( func_get_args(), 2 ); $message = wfMessage( $part1, $args ) - ->inLanguage( $parser->getOptions()->getUserLangObj() )->plain(); - - return array( $message, 'noparse' => false ); + ->inLanguage( $parser->getOptions()->getUserLangObj() ); + if ( !$message->exists() ) { + // When message does not exists, the message name is surrounded by angle + // and can result in a tag, therefore escape the angles + return $message->escaped(); + } + return array( $message->plain(), 'noparse' => false ); } else { return array( 'found' => false ); } @@ -178,7 +182,9 @@ class CoreParserFunctions { default: $func = 'urlencode'; } - return $parser->markerSkipCallback( $s, $func ); + // See T105242, where the choice to kill markers and various + // other options were discussed. + return $func( $parser->killMarkers( $s ) ); } public static function lcfirst( $parser, $s = '' ) { @@ -354,6 +360,15 @@ class CoreParserFunctions { } /** + * @param Parser $parser + * @param string $text + * @return string + */ + public static function bidi( $parser, $text = '' ) { + return $parser->getFunctionLang()->embedBidi( $text ); + } + + /** * Override the title of the page when viewed, provided we've been given a * title which will normalise to the canonical title * |