Index: Parser.php =================================================================== --- Parser.php (revision 37956) +++ Parser.php (working copy) @@ -107,6 +107,7 @@ # Temporary # These are variables reset at least once per parse regardless of $clearState var $mOptions, // ParserOptions object + $mExhibit, // Exhibit options $mTitle, // Title context, used for self-link rendering and similar things $mOutputType, // Output type, one of the OT_xxx constants $ot, // Shortcut alias, see setOutputType() @@ -4939,6 +4940,24 @@ } return $out; } + + function setExhibitOptions( $params = null) { + $default = array(); + $default['regex'] = '/^\s*[Ii]nfobox[_ ]/'; + #determines whether the PP action is out-of-cycle, ie preprocessToObj() manually called via InfoboxUtils. + $default['regexfind'] = '/{{\s*[Ii]nfobox[_ ]/'; + $default['outofcycle'] = false; + #override defaults + if( !is_null($params) ) { + foreach( $params as $option => $setting ) { + $default[$option] = $setting; + } + } + $this->mExhibit = $default; + } + function getExhibitOptions() { + return $this->mExhibit; + } } /** Index: Preprocessor_DOM.php =================================================================== --- Preprocessor_DOM.php (revision 37956) +++ Preprocessor_DOM.php (working copy) @@ -5,6 +5,7 @@ */ class Preprocessor_DOM implements Preprocessor { var $parser, $memoryLimit; + var $exParams = array(); #exhibit parameters function __construct( $parser ) { $this->parser = $parser; @@ -512,6 +513,17 @@ } } $element .= ""; + + #exhibit - match infoboxes that also have arguments + $exParams = $this->parser->getExhibitOptions(); + #Note: Doing this very restrictively as we don't want to call hooks in here very often + if( !empty($exParams) && preg_match( $exParams['regex'], $title ) && count($parts) > 0 ) { + $infoboxOutput = null; + wfRunHooks( 'RunUnboxCache', array( &$this->parser, $element, $exParams, &$infoboxOutput, $title ) ); + if( !is_null($infoboxOutput) ) { + return $infoboxOutput; + } + } } # Advance input pointer