tableName calls moved inside fieldInfoMulti and removed call that existed only for...
[lhc/web/wiklou.git] / maintenance / parserTestsStaticParserHook.php
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
7 *
8 * @file
9 * @ingroup Maintenance
10 *
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
14 */
15
16 $wgHooks['ParserTestParser'][] = 'wfParserTestStaticParserHookSetup';
17
18 function wfParserTestStaticParserHookSetup( &$parser ) {
19 $parser->setHook( 'statictag', 'wfParserTestStaticParserHookHook' );
20
21 return true;
22 }
23
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 )
30 {
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 = '';
36 }
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";
46 }
47