MediaWiki  1.23.8
Go to the documentation of this file.
1 <?php
28 class CoreTagHooks {
33  static function register( $parser ) {
34  global $wgRawHtml;
35  $parser->setHook( 'pre', array( __CLASS__, 'pre' ) );
36  $parser->setHook( 'nowiki', array( __CLASS__, 'nowiki' ) );
37  $parser->setHook( 'gallery', array( __CLASS__, 'gallery' ) );
38  if ( $wgRawHtml ) {
39  $parser->setHook( 'html', array( __CLASS__, 'html' ) );
40  }
41  }
53  static function pre( $text, $attribs, $parser ) {
54  // Backwards-compatibility hack
55  $content = StringUtils::delimiterReplace( '<nowiki>', '</nowiki>', '$1', $text, 'i' );
58  return Xml::openElement( 'pre', $attribs ) .
59  Xml::escapeTagsOnly( $content ) .
60  '</pre>';
61  }
78  static function html( $content, $attributes, $parser ) {
79  global $wgRawHtml;
80  if ( $wgRawHtml ) {
81  return array( $content, 'markerType' => 'nowiki' );
82  } else {
83  throw new MWException( '<html> extension tag encountered unexpectedly' );
84  }
85  }
99  static function nowiki( $content, $attributes, $parser ) {
100  $content = strtr( $content, array( '-{' => '-&#123;', '}-' => '&#125;-' ) );
101  return array( Xml::escapeTagsOnly( $content ), 'markerType' => 'nowiki' );
102  }
119  static function gallery( $content, $attributes, $parser ) {
120  return $parser->renderImageGallery( $content, $attributes );
121  }
122 }
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Various tag hooks, registered in Parser::firstCallInit()
Definition: CoreTagHooks.php:28
static nowiki( $content, $attributes, $parser)
Core parser tag hook function for 'nowiki'.
Definition: CoreTagHooks.php:99
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
static gallery( $content, $attributes, $parser)
Core parser tag hook function for 'gallery'.
Definition: CoreTagHooks.php:119
MediaWiki exception.
Definition: MWException.php:26
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:1956
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
static html( $content, $attributes, $parser)
Core parser tag hook function for 'html', used only when $wgRawHtml is enabled.
Definition: CoreTagHooks.php:78
static validateTagAttributes( $attribs, $element)
Take an array of attribute names and values and normalize or discard illegal values for the given ele...
Definition: Sanitizer.php:691
static delimiterReplace( $startDelim, $endDelim, $replace, $subject, $flags='')
Perform an operation equivalent to.
Definition: StringUtils.php:256
static pre( $text, $attribs, $parser)
Core parser tag hook function for 'pre'.
Definition: CoreTagHooks.php:53
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Definition: hooks.txt:1530
static escapeTagsOnly( $in)
Replace " > and < with their respective HTML entities ( ", >, <)
Definition: Xml.php:733