Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 29 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| CoreTagHooks | |
0.00% |
0 / 28 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| register | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| pre | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| html | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| nowiki | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| gallery | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| indicator | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| langconvert | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Tag hooks provided by MediaWiki core |
| 4 | * |
| 5 | * @license GPL-2.0-or-later |
| 6 | * @file |
| 7 | * @ingroup Parser |
| 8 | */ |
| 9 | |
| 10 | namespace MediaWiki\Parser; |
| 11 | |
| 12 | use MediaWiki\Config\ServiceOptions; |
| 13 | use MediaWiki\MediaWikiServices; |
| 14 | |
| 15 | /** |
| 16 | * Various tag hooks, registered in every Parser |
| 17 | * @ingroup Parser |
| 18 | * @deprecated since 1.46, use the ParserCoreTagHooks service instead. |
| 19 | */ |
| 20 | class CoreTagHooks { |
| 21 | |
| 22 | /** |
| 23 | * @param Parser $parser |
| 24 | * @param ServiceOptions $options |
| 25 | * |
| 26 | * @return void |
| 27 | * @internal |
| 28 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 29 | */ |
| 30 | public static function register( Parser $parser, ServiceOptions $options ) { |
| 31 | wfDeprecated( __METHOD__, '1.46' ); |
| 32 | MediaWikiServices::getInstance()->getParserCoreTagHooks()->register( |
| 33 | $parser |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Core parser tag hook function for 'pre'. |
| 39 | * Text is treated roughly as 'nowiki' wrapped in an HTML 'pre' tag; |
| 40 | * valid HTML attributes are passed on. |
| 41 | * |
| 42 | * @param ?string $content |
| 43 | * @param array $attribs |
| 44 | * @param Parser $parser |
| 45 | * @param PPFrame $frame |
| 46 | * @return string HTML |
| 47 | * @internal |
| 48 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 49 | */ |
| 50 | public static function pre( |
| 51 | ?string $content, array $attribs, Parser $parser, PPFrame $frame |
| 52 | ): string { |
| 53 | wfDeprecated( __METHOD__, '1.46' ); |
| 54 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->pre( |
| 55 | $content, $attribs, $parser, $frame |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Core parser tag hook function for 'html', used only when |
| 61 | * $wgRawHtml is enabled. |
| 62 | * |
| 63 | * This is potentially unsafe and should be used only in very careful |
| 64 | * circumstances, as the contents are emitted as raw HTML. |
| 65 | * |
| 66 | * Uses undocumented extended tag hook return values, introduced in r61913. |
| 67 | * |
| 68 | * @param ?string $content |
| 69 | * @param array $attributes |
| 70 | * @param Parser $parser |
| 71 | * @return array|string Output of tag hook |
| 72 | * @internal |
| 73 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 74 | */ |
| 75 | public static function html( ?string $content, array $attributes, Parser $parser ) { |
| 76 | wfDeprecated( __METHOD__, '1.46' ); |
| 77 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->html( |
| 78 | $content, $attributes, $parser |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Core parser tag hook function for 'nowiki'. Text within this section |
| 84 | * gets interpreted as a string of text with HTML-compatible character |
| 85 | * references, and wiki markup within it will not be expanded. |
| 86 | * |
| 87 | * Uses undocumented extended tag hook return values, introduced in r61913. |
| 88 | * |
| 89 | * Uses custom html escaping which phan-taint-check won't recognize |
| 90 | * hence we suppress the error. |
| 91 | * |
| 92 | * @param ?string $content |
| 93 | * @param array $attributes |
| 94 | * @param Parser $parser |
| 95 | * @return array |
| 96 | * @internal |
| 97 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 98 | */ |
| 99 | public static function nowiki( ?string $content, array $attributes, Parser $parser ): array { |
| 100 | wfDeprecated( __METHOD__, '1.46' ); |
| 101 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->nowiki( |
| 102 | $content, $attributes, $parser |
| 103 | ); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Core parser tag hook function for 'gallery'. |
| 108 | * |
| 109 | * Renders a thumbnail list of the given images, with optional captions. |
| 110 | * Full syntax documented on the wiki: |
| 111 | * |
| 112 | * https://www.mediawiki.org/wiki/Help:Images#Gallery_syntax |
| 113 | * |
| 114 | * @todo break Parser::renderImageGallery out here too. |
| 115 | * |
| 116 | * @param ?string $content |
| 117 | * @param array $attributes |
| 118 | * @param Parser $parser |
| 119 | * @return string HTML |
| 120 | * @internal |
| 121 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 122 | */ |
| 123 | public static function gallery( ?string $content, array $attributes, Parser $parser ): string { |
| 124 | wfDeprecated( __METHOD__, '1.46' ); |
| 125 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->gallery( |
| 126 | $content, $attributes, $parser |
| 127 | ); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * XML-style tag for page status indicators: icons (or short text snippets) usually displayed in |
| 132 | * the top-right corner of the page, outside of the main content. |
| 133 | * |
| 134 | * @param ?string $content |
| 135 | * @param array $attributes |
| 136 | * @param Parser $parser |
| 137 | * @param PPFrame $frame |
| 138 | * @return string |
| 139 | * @since 1.25 |
| 140 | * @internal |
| 141 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 142 | */ |
| 143 | public static function indicator( ?string $content, array $attributes, Parser $parser, PPFrame $frame ): string { |
| 144 | wfDeprecated( __METHOD__, '1.46' ); |
| 145 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->indicator( |
| 146 | $content, $attributes, $parser, $frame |
| 147 | ); |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Returns content converted into the requested language variant, using LanguageConverter. |
| 152 | * |
| 153 | * @param ?string $content |
| 154 | * @param array $attributes |
| 155 | * @param Parser $parser |
| 156 | * @param PPFrame $frame |
| 157 | * @return array |
| 158 | * @since 1.36 |
| 159 | * @internal |
| 160 | * @deprecated since 1.46; use the ParserCoreTagHooks service instead |
| 161 | */ |
| 162 | public static function langconvert( ?string $content, array $attributes, Parser $parser, PPFrame $frame ): array { |
| 163 | wfDeprecated( __METHOD__, '1.46' ); |
| 164 | return MediaWikiServices::getInstance()->getParserCoreTagHooks()->langconvert( |
| 165 | $content, $attributes, $parser, $frame |
| 166 | ); |
| 167 | } |
| 168 | |
| 169 | } |
| 170 | |
| 171 | /** @deprecated class alias since 1.43 */ |
| 172 | class_alias( CoreTagHooks::class, 'CoreTagHooks' ); |