r91410 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91409‎ | r91410 | r91411 >
Date:15:23, 4 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Replaced all calls to Html::hidden() with the wrapper function SFFormUtils::hiddenFieldHTML() - re-adds backward compatibility for MW < 1.16, which has only Xml::hidden().
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateCategory.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateClass.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php
@@ -89,7 +89,7 @@
9090 <form action="" method="get">
9191
9292 END;
93 - $text .= "\t" . Html::Hidden( 'title', "$special_namespace:CreateCategory" ) . "\n";
 93+ $text .= SFFormUtils::hiddenFieldHTML( 'title', "$special_namespace:CreateCategory" );
9494 $text .= <<<END
9595 <p>$name_label <input size="25" name="category_name" value="" />
9696 <span style="color: red;">$category_name_error_str</span>
Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -111,9 +111,9 @@
112112 $text .= SFUtils::formDropdownHTML();
113113
114114 $text .= "\t</p>\n";
115 - $text .= "\t" . Html::Hidden( 'namespace', $target_namespace ) . "\n";
116 - $text .= "\t" . Html::Hidden( 'super_page', $super_page ) . "\n";
117 - $text .= "\t" . Html::Hidden( 'params', $params ) . "\n";
 115+ $text .= SFFormUtils::hiddenFieldHTML( 'namespace', $target_namespace );
 116+ $text .= SFFormUtils::hiddenFieldHTML( 'super_page', $super_page );
 117+ $text .= SFFormUtils::hiddenFieldHTML( 'params', $params );
118118 $text .= "\t" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'sf_formstart_createoredit' ) ) ) . "\n";
119119 $text .= "\t</form>\n";
120120 }
Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -221,7 +221,7 @@
222222
223223 $text = "\t" . '<form action="" method="post">' . "\n";
224224 // Set 'title' field, in case there's no URL niceness
225 - $text .= "\t" . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
 225+ $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
226226 $text .= "\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />';
227227 if ( ! empty( $form_name_error_str ) )
228228 $text .= "\t" . Xml::element( 'font', array( 'color' => 'red' ), $form_name_error_str );
Index: trunk/extensions/SemanticForms/specials/SF_CreateClass.php
@@ -219,7 +219,7 @@
220220 $text .= Xml::tags( 'p', null, $add_another_button ) . "\n";
221221 // Set 'title' as hidden field, in case there's no URL niceness
222222 $cc = $this->getTitle();
223 - $text .= Html::Hidden( 'title', SFUtils::titleURLString( $cc ) ) . "\n";
 223+ $text .= SFFormUtils::hiddenFieldHTML( 'title', SFUtils::titleURLString( $cc ) );
224224 $text .= Xml::element( 'input',
225225 array(
226226 'type' => 'submit',
Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -117,7 +117,7 @@
118118 <form id="sfForm" name="createbox" action="$action" method="post" class="createbox">
119119
120120 END;
121 - $text .= "\t" . Html::Hidden( 'query', 'true' ) . "\n";
 121+ $text .= SFFormUtils::hiddenFieldHTML( 'query', 'true' );
122122 $text .= $form_text;
123123 }
124124 if ( $embedded ) {
Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php
@@ -193,7 +193,7 @@
194194
195195 $text .= ' <form id="createTemplateForm" action="" method="post">' . "\n";
196196 // Set 'title' field, in case there's no URL niceness
197 - $text .= "\t" . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
 197+ $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
198198 $text .= "\t<p id=\"template_name_p\">" . wfMsg( 'sf_createtemplate_namelabel' ) . ' <input size="25" id="template_name" name="template_name" /></p>' . "\n";
199199 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_categorylabel' ) . ' <input size="25" name="category" /></p>' . "\n";
200200 $text .= "\t<fieldset>\n";
Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -683,7 +683,7 @@
684684 $selectAttrs['disabled'] = 'disabled';
685685 }
686686 $text = Xml::tags( 'select', $selectAttrs, $optionsText );
687 - $text .= "\t" . Html::Hidden( $input_name . '[is_list]', 1 ) . "\n";
 687+ $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
688688 if ( $is_mandatory ) {
689689 $text = Xml::tags( 'span', array( 'class' => 'inputSpan mandatoryFieldSpan' ), $text );
690690 }
@@ -795,7 +795,7 @@
796796 }
797797 }
798798
799 - $text .= "\n" . Html::Hidden( $input_name . '[is_list]', 1 ) . "\n";
 799+ $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
800800 $outerSpanAttrs = array( 'id' => $outerSpanID, 'class' => $outerSpanClass );
801801 $text = "\t" . Xml::tags( 'span', $outerSpanAttrs, $text ) . "\n";
802802
@@ -1633,7 +1633,7 @@
16341634
16351635 $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . '</div>';
16361636
1637 - $text .= "\t" . Html::Hidden( $input_name . '[is_list]', 1 ) . "\n";
 1637+ $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
16381638 $spanClass = "checkboxesSpan";
16391639 if ( $is_mandatory) { $spanClass .= " mandatoryFieldSpan"; }
16401640 $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ) . "\n";
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -1373,8 +1373,8 @@
13741374 $page_article = new Article( $this->mPageTitle );
13751375 $edittime = $page_article->getTimestamp();
13761376 if ( !$is_query ) {
1377 - $form_text .= "\t" . Html::Hidden( 'wpStarttime', wfTimestampNow() ) . "\n";
1378 - $form_text .= "\t" . Html::Hidden( 'wpEdittime', $page_article->getTimestamp() ) . "\n";
 1377+ $form_text .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', wfTimestampNow() );
 1378+ $form_text .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $page_article->getTimestamp() );
13791379 }
13801380 $form_text .= "\t</form>\n";
13811381
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -209,7 +209,7 @@
210210 $query_component = urldecode( $query_component );
211211 $var_and_val = explode( '=', $query_component );
212212 if ( count( $var_and_val ) == 2 ) {
213 - $hidden_inputs .= Html::Hidden( $var_and_val[0], $var_and_val[1] ) . "\n";
 213+ $hidden_inputs .= SFFormUtils::hiddenFieldHTML( $var_and_val[0], $var_and_val[1] );
214214 }
215215 }
216216 } else {
@@ -351,12 +351,12 @@
352352 // (i.e., it's in the default URL style), add in the title as a
353353 // hidden value
354354 if ( ( $pos = strpos( $fs_url, "title=" ) ) > - 1 ) {
355 - $str .= "\t\t\t" . Html::Hidden( "title", urldecode( substr( $fs_url, $pos + 6 ) ) ) . "\n";
 355+ $str .= SFFormUtils::hiddenFieldHTML( "title", urldecode( substr( $fs_url, $pos + 6 ) ) );
356356 }
357357 if ( $inFormName == '' ) {
358358 $str .= SFUtils::formDropdownHTML();
359359 } else {
360 - $str .= "\t\t\t" . Html::Hidden( "form", $inFormName ) . "\n";
 360+ $str .= SFFormUtils::hiddenFieldHTML( "form", $inFormName );
361361 }
362362 // Recreate the passed-in query string as a set of hidden
363363 // variables.
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -233,18 +233,18 @@
234234 <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p>
235235
236236 END;
237 - $form_body = "\t" . Html::hidden( 'wpTextbox1', $page_contents ) . "\n";
238 - $form_body .= "\t" . Html::hidden( 'wpSummary', $edit_summary ) . "\n";
239 - $form_body .= "\t" . Html::hidden( 'wpStarttime', $start_time ) . "\n";
240 - $form_body .= "\t" . Html::hidden( 'wpEdittime', $edit_time ) . "\n";
241 - $form_body .= "\t" . Html::hidden( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX ) . "\n";
242 - $form_body .= "\t" . Html::hidden( $action, null ) . "\n";
 237+ $form_body = SFFormUtils::hiddenFieldHTML( 'wpTextbox1', $page_contents );
 238+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpSummary', $edit_summary );
 239+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', $start_time );
 240+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $edit_time );
 241+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX );
 242+ $form_body .= SFFormUtils::hiddenFieldHTML( $action, null );
243243
244244 if ( $is_minor_edit ) {
245 - $form_body .= "\t" . Html::hidden( 'wpMinoredit' , null ) . "\n";
 245+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpMinoredit' , null );
246246 }
247247 if ( $watch_this ) {
248 - $form_body .= "\t" . Html::hidden( 'wpWatchthis', null ) . "\n";
 248+ $form_body .= SFFormUtils::hiddenFieldHTML( 'wpWatchthis', null );
249249 }
250250 $text .= Xml::tags(
251251 'form',