r99753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99752‎ | r99753 | r99754 >
Date:02:46, 14 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Attempting to standardize variable names
Modified paths:
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -258,25 +258,25 @@
259259 /**
260260 * Returns the HTML for a section of the form comprising one template.
261261 */
262 - static function printTemplateSection( $template_num = 'tnum', $template_xml = null, $pageSchemaTemplate = null ) {
263 - if ( is_null( $pageSchemaTemplate ) ) {
264 - $pageSchemaTemplateFields = array();
 262+ static function printTemplateSection( $template_num = 'tnum', $templateXML = null, $psTemplate = null ) {
 263+ if ( is_null( $psTemplate ) ) {
 264+ $psTemplateFields = array();
265265 } else {
266 - $pageSchemaTemplateFields = $pageSchemaTemplate->getFields();
 266+ $psTemplateFields = $psTemplate->getFields();
267267 }
268268 $attrs = array();
269269 $templateXMLElements = array();
270270 $text = "\t";
271 - if ( is_null( $template_xml ) ) {
 271+ if ( is_null( $templateXML ) ) {
272272 $text .= '<div class="templateBox" id="starterTemplate" style="display: none">' . "\n";
273273 $templateName = '';
274274 } else {
275275 $text .= '<div class="templateBox" >' . "\n";
276 - $templateName = (string) $template_xml->attributes()->name;
277 - if ( ( (string)$template_xml->attributes()->multiple ) == "multiple" ) {
 276+ $templateName = (string) $templateXML->attributes()->name;
 277+ if ( ( (string)$templateXML->attributes()->multiple ) == "multiple" ) {
278278 $attrs['checked'] = 'checked';
279279 }
280 - $templateXMLElements = $template_xml->children();
 280+ $templateXMLElements = $templateXML->children();
281281 }
282282 $templateNameInput = wfMsg( 'ps-namelabel' ) . ' ';
283283 $templateNameInput .= Html::input( 't_name_' . $template_num, $templateName, 'text' );
@@ -294,7 +294,7 @@
295295 */
296296
297297 $htmlForTemplate = array();
298 - wfRunHooks( 'PageSchemasGetTemplateHTML', array( $pageSchemaTemplate, &$htmlForTemplate ) );
 298+ wfRunHooks( 'PageSchemasGetTemplateHTML', array( $psTemplate, &$htmlForTemplate ) );
299299 foreach ( $htmlForTemplate as $valuesFromExtension ) {
300300 $html = self::printFieldHTMLForExtension( $valuesFromExtension );
301301 $templateHTML .= str_replace( 'num', $template_num, $html );
@@ -304,15 +304,15 @@
305305 $fieldNumInTemplate = 0;
306306 // If this is a "starter" template, create the starter
307307 // field HTML.
308 - if ( is_null( $pageSchemaTemplate ) ) {
 308+ if ( is_null( $psTemplate ) ) {
309309 $templateHTML .= self::printFieldSection();
310310 }
311311 foreach ( $templateXMLElements as $templateXMLElement ) {
312312 if ( empty( $templateXMLElement ) ) {
313313 // Do nothing (?)
314314 } elseif ( $templateXMLElement->getName() == "Field" ) {
315 - $pageSchemaField = $pageSchemaTemplateFields[$fieldNumInTemplate];
316 - $templateHTML .= self::printFieldSection( $templateXMLElement, $pageSchemaField );
 315+ $psTemplateField = $psTemplateFields[$fieldNumInTemplate];
 316+ $templateHTML .= self::printFieldSection( $templateXMLElement, $psTemplateField );
317317 $fieldNumInTemplate++;
318318 }
319319 }
@@ -342,9 +342,9 @@
343343 wfRunHooks( 'PageSchemasGetSchemaHTML', array( $pageSchemaObj, &$htmlForSchema ) );
344344
345345 if ( is_null( $pageSchemaObj ) ) {
346 - $template_all = array();
 346+ $psTemplates = array();
347347 } else {
348 - $template_all = $pageSchemaObj->getTemplates();
 348+ $psTemplates = $pageSchemaObj->getTemplates();
349349 }
350350
351351 if ( is_null( $pageXML ) ) {
@@ -373,16 +373,16 @@
374374
375375 $text .= '<div id="templatesList">' . "\n";
376376
377 - $template_num = 0;
 377+ $templateNum = 0;
378378
379379 // Add 'starter', hidden template section.
380380 $text .= self::printTemplateSection();
381381 /* index for template objects */
382 - foreach ( $pageXMLChildren as $tag => $template_xml ) {
 382+ foreach ( $pageXMLChildren as $tag => $pageXMLChild ) {
383383 if ( $tag == 'Template' ) {
384 - $pageSchemaTemplate = $template_all[$template_num];
385 - $text .= self::printTemplateSection( $template_num, $template_xml, $pageSchemaTemplate );
386 - $template_num++;
 384+ $psTemplate = $psTemplates[$templateNum];
 385+ $text .= self::printTemplateSection( $templateNum, $pageXMLChild, $psTemplate );
 386+ $templateNum++;
387387 }
388388 }
389389 $add_template_button = Xml::element( 'input',

Status & tagging log