2 if ( ! defined( 'MEDIAWIKI' ) )
5 * A basic extension that's used by the parser tests to test whether the parser
6 * calls extensions when they're called inside comments, it shouldn't do that
11 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
12 * @copyright Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason
13 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
16 $wgHooks['ParserTestParser'][] = 'wfParserTestStaticParserHookSetup';
18 function wfParserTestStaticParserHookSetup( &$parser ) {
19 $parser->setHook( 'statictag', 'wfParserTestStaticParserHookHook' );
24 function wfParserTestStaticParserHookHook( $in, $argv, $parser ) {
25 if ( ! count( $argv ) ) {
26 $parser->static_tag_buf
= $in;
28 } else if ( count( $argv ) === 1 && isset( $argv['action'] )
29 && $argv['action'] === 'flush' && $in === null )
31 // Clear the buffer, we probably don't need to
32 if ( isset( $parser->static_tag_buf
) ) {
33 $tmp = $parser->static_tag_buf
;
37 $parser->static_tag_buf
= null;
42 "\nCall this extension as <statictag>string</statictag> or as" .
43 " <statictag action=flush/>, not in any other way.\n" .
44 "text: " . var_export( $in, true ) . "\n" .
45 "argv: " . var_export( $argv, true ) . "\n";