* (bug 7681, 11559) Cookie values no longer override GET and POST variables.
[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 * @addtogroup Maintenance
9 *
10 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
11 * @copyright Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason
12 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
13 */
14
15 $wgHooks['ParserTestParser'][] = 'wfParserTestStaticParserHookSetup';
16
17 function wfParserTestStaticParserHookSetup( &$parser ) {
18 $parser->setHook( 'statictag', 'wfParserTestStaticParserHookHook' );
19
20 return true;
21 }
22
23 function wfParserTestStaticParserHookHook( $in, $argv ) {
24 static $buf = null;
25
26 if ( ! count( $argv ) ) {
27 $buf = $in;
28 return '';
29 } else if ( count( $argv ) === 1 && $argv['action'] === 'flush' && $in === null ) {
30 // Clear the buffer, we probably don't need to
31 $tmp = $buf;
32 $buf = null;
33 return $tmp;
34 } else
35 // wtf?
36 die(
37 "\nCall this extension as <statictag>string</statictag> or as" .
38 " <statictag action=flush/>, not in any other way.\n" .
39 "text: " . var_export( $in, true ) . "\n" .
40 "argv: " . var_export( $argv, true ) . "\n"
41 );
42 }
43