r102940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102939‎ | r102940 | r102941 >
Date:05:23, 14 November 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fix for r102365 - changed comparator to check for null, instead of blank; also made XML creation more robust
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_PageSchemas.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
@@ -67,10 +67,11 @@
6868 public static function createSchemaXMLFromForm() {
6969 global $wgRequest;
7070
 71+ $formName = null;
7172 $xml = '';
7273 foreach ( $wgRequest->getValues() as $var => $val ) {
7374 if ( $var == 'sf_form_name' ) {
74 - $xml = '<semanticforms_Form name="' . $val . '" >';
 75+ $formName = $val;
7576 } elseif ( $var == 'sf_page_name_formula' ) {
7677 if ( !empty( $val ) ) {
7778 $xml .= '<PageNameFormula>' . $val . '</PageNameFormula>';
@@ -83,9 +84,10 @@
8485 if ( !empty( $val ) ) {
8586 $xml .= '<EditTitle>' . $val . '</EditTitle>';
8687 }
87 - $xml .= '</semanticforms_Form>';
8888 }
8989 }
 90+ $xml = '<semanticforms_Form name="' . $formName . '" >' . $xml;
 91+ $xml .= '</semanticforms_Form>';
9092 return $xml;
9193 }
9294
@@ -186,7 +188,7 @@
187189 // we set it based on whether or not a page formula has been
188190 // specified.
189191 $twoStepProcessAttrs = array( 'id' => 'sf-two-step-process' );
190 - if ( $pageNameFormula === '' ) {
 192+ if ( is_null( $pageNameFormula ) ) {
191193 $twoStepProcessAttrs['checked'] = true;
192194 }
193195 $text .= '<p>' . Html::input( 'sf_two_step_process', null, 'checkbox', $twoStepProcessAttrs );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102365strict comparators for empty stringsjeroendedauw02:25, 8 November 2011