$parser->setFunctionHook( $func, array( __CLASS__, $func ), Parser::SFH_NO_HASH );
}
- $parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), Parser::SFH_NO_HASH );
+ $parser->setFunctionHook(
+ 'namespace',
+ array( __CLASS__, 'mwnamespace' ),
+ Parser::SFH_NO_HASH
+ );
$parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), Parser::SFH_NO_HASH );
$parser->setFunctionHook( 'special', array( __CLASS__, 'special' ) );
$parser->setFunctionHook( 'speciale', array( __CLASS__, 'speciale' ) );
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
if ( $wgAllowDisplayTitle ) {
- $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), Parser::SFH_NO_HASH );
+ $parser->setFunctionHook(
+ 'displaytitle',
+ array( __CLASS__, 'displaytitle' ),
+ Parser::SFH_NO_HASH
+ );
}
if ( $wgAllowSlowParserFunctions ) {
$parser->setFunctionHook(
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 );
}
// split the given option to its variable
if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
- //{{pagesincategory:|raw[|type]}}
+ // {{pagesincategory:|raw[|type]}}
$raw = $arg1;
$type = $magicWords->matchStartToEnd( $arg2 );
} else {
- //{{pagesincategory:[|type[|raw]]}}
+ // {{pagesincategory:[|type[|raw]]}}
$type = $magicWords->matchStartToEnd( $arg1 );
$raw = $arg2;
}
- if ( !$type ) { //backward compatibility
+ if ( !$type ) { // backward compatibility
$type = 'pagesincategory_all';
}
* @param int $direction
* @return string
*/
- public static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
+ public static function pad(
+ $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT
+ ) {
$padding = $parser->killMarkers( $padding );
$lengthOfPadding = mb_strlen( $padding );
if ( $lengthOfPadding == 0 ) {