Remove unused parameter
[mediawiki.git] / maintenance / parserTestsStaticParserHook.php
blob98c4bba163d131c86e8fbd7c6b530c9c92d8f2dd
1 <?php
2 if ( ! defined( 'MEDIAWIKI' ) )
3 die( -1 );
4 /**
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
8 * @file
9 * @ingroup Maintenance
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' );
21 return true;
24 function wfParserTestStaticParserHookHook( $in, $argv, $parser ) {
25 if ( ! count( $argv ) ) {
26 $parser->static_tag_buf = $in;
27 return '';
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;
34 } else {
35 $tmp = '';
37 $parser->static_tag_buf = null;
38 return $tmp;
39 } else
40 // wtf?
41 return
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";