r49029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49028‎ | r49029 | r49030 >
Date:10:52, 30 March 2009
Author:nad
Status:deferred
Tags:
Comment:
use $wgParser not a new parser instance for rendering rows so that parser functions are present
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -298,15 +298,13 @@
299299 * Render a set of records returned by getRecords() as an HTML table
300300 */
301301 function renderRecords( $records, $cols = false, $sortable = true, $template = false ) {
302 - global $wgUser;
 302+ global $wgParser;
303303 if ( count( $records ) < 1 ) return wfMsg( 'recordadmin-nomatch' );
304304
305305 $special = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' );
306306 $type = $this->type;
307307 $sortable = $sortable ? ' sortable' : '';
308308 $br = $sortable ? '<br />' : '';
309 - $parser = new Parser;
310 - $options = ParserOptions::newFromUser( $wgUser );
311309
312310 # Table header
313311 $table = "<table class='recordadmin$sortable $type-record'>\n<tr>";
@@ -347,7 +345,7 @@
348346 $text .= "|$col=$v";
349347 }
350348 $text .= '}}';
351 - $text = $parser->parse( $text, $special, $options, true, true )->getText();
 349+ $text = $wgParser->parse( $text, $special, $wgParser->mOptions, true, true )->getText();
352350 $text = preg_replace( "|&lt;(/?td.*?)&gt;|", "<$1>", $text );
353351 $table .= "$text\n";
354352 }
@@ -481,7 +479,7 @@
482480 function parsePart($part) {
483481 global $wgUser, $wgParser;
484482 $options = ParserOptions::newFromUser( $wgUser );
485 - $html = $wgParser->parse($part[0], $this->mTitle, $options, true, true )->getText();
 483+ $html = $wgParser->parse($part[0], $this->title, $options, true, true )->getText();
486484 return preg_match("|(<option.+</option>)|s", $html, $m) ? $m[1] : '';
487485 }
488486
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.6.1, 2009-03-29' );
 15+define( 'RECORDADMIN_VERSION', '0.6.2, 2009-03-30' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log