3 * A basic extension that's used by the parser tests to test whether the parser
4 * calls extensions when they're called inside comments, it shouldn't do that
9 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
10 * @copyright Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason
11 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
14 class ParserTestStaticParserHook
{
15 static function setup( &$parser ) {
16 $parser->setHook( 'statictag', array( __CLASS__
, 'hook' ) );
21 static function hook( $in, $argv, $parser ) {
22 if ( ! count( $argv ) ) {
23 $parser->static_tag_buf
= $in;
25 } else if ( count( $argv ) === 1 && isset( $argv['action'] )
26 && $argv['action'] === 'flush' && $in === null )
28 // Clear the buffer, we probably don't need to
29 if ( isset( $parser->static_tag_buf
) ) {
30 $tmp = $parser->static_tag_buf
;
34 $parser->static_tag_buf
= null;
39 "\nCall this extension as <statictag>string</statictag> or as" .
40 " <statictag action=flush/>, not in any other way.\n" .
41 "text: " . var_export( $in, true ) . "\n" .
42 "argv: " . var_export( $argv, true ) . "\n";