X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fparser%2FCoreTagHooks.php;h=9755ea93f6b3a61b474c074fc20f665d2fe3e471;hb=eb735233feca68aed49d536f19c1cae12e971349;hp=85920cc11f8f09e3efff10446c157146c1f40343;hpb=04d7d46b1d39340121698ba76fd8e433f60929c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/CoreTagHooks.php b/includes/parser/CoreTagHooks.php index 85920cc11f..9755ea93f6 100644 --- a/includes/parser/CoreTagHooks.php +++ b/includes/parser/CoreTagHooks.php @@ -35,6 +35,7 @@ class CoreTagHooks { $parser->setHook( 'pre', array( __CLASS__, 'pre' ) ); $parser->setHook( 'nowiki', array( __CLASS__, 'nowiki' ) ); $parser->setHook( 'gallery', array( __CLASS__, 'gallery' ) ); + $parser->setHook( 'indicator', array( __CLASS__, 'indicator' ) ); if ( $wgRawHtml ) { $parser->setHook( 'html', array( __CLASS__, 'html' ) ); } @@ -119,4 +120,30 @@ class CoreTagHooks { public static function gallery( $content, $attributes, $parser ) { return $parser->renderImageGallery( $content, $attributes ); } + + /** + * XML-style tag for page status indicators: icons (or short text snippets) usually displayed in + * the top-right corner of the page, outside of the main content. + * + * @param string $content + * @param array $attributes + * @param Parser $parser + * @param PPFrame $frame + * @return string + * @since 1.25 + */ + public static function indicator( $content, array $attributes, Parser $parser, PPFrame $frame ) { + if ( !isset( $attributes['name'] ) || trim( $attributes['name'] ) === '' ) { + return '' . + wfMessage( 'invalid-indicator-name' )->inContentLanguage()->parse() . + ''; + } + + $parser->getOutput()->setIndicator( + trim( $attributes['name'] ), + Parser::stripOuterParagraph( $parser->recursiveTagParseFully( $content, $frame ) ) + ); + + return ''; + } }