revert r28340, r28343 to r28349, r28351, r28364
[T119942Repr.git] / Parser_hook.php
blobb5eee6b280d51b909fec0b129077cd3241e9a2b3
1 <?php
2 if (!defined('MEDIAWIKI')) die();
3 /**
4 * A parser hook example, use it on a page like
5 * <hook arg1="foo" arg2="bar" ...>input</hook>
7 * @addtogroup Extensions
9 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
10 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
11 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
14 $wgExtensionFunctions[] = 'wfParserHook';
15 $wgExtensionCredits['parserhook'][] = array(
16 'name' => 'Parser hook',
17 'description' => 'a sample parser hook',
18 'author' => 'Ævar Arnfjörð Bjarmason'
21 function wfParserHook() {
22 global $wgParser;
24 $wgParser->setHook( 'hook' , 'wfParserHookParse' );
27 /**
28 * @param string $in The input passed to <hook>
29 * @param array $argv The attributes of the <hook> element in array form
31 function wfParserHookParse( $in, $argv ) {
32 if ( ! count( $argv ) )
33 return $in;
34 else
35 return '<pre>' . $in . "\n" . print_r( $argv, true ) . '</pre>';