r110780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110779‎ | r110780 | r110781 >
Date:20:59, 6 February 2012
Author:yaron
Status:ok
Tags:
Comment:
Replaced SFFormUtils::hiddenFieldHTML() with the method for which it was now simply an alias, Html::hidden()
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.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
@@ -78,7 +78,7 @@
7979 <form action="" method="get">
8080
8181 END;
82 - $text .= SFFormUtils::hiddenFieldHTML( 'title', "$special_namespace:CreateCategory" );
 82+ $text .= "\t" . Html::hidden( 'title', "$special_namespace:CreateCategory" ) . "\n";
8383 $firstRow = wfMsg( 'sf_createcategory_name' ) . ' ' .
8484 Html::input( 'category_name', null, 'text',
8585 array( 'size' => 25 ) ) . "\n";
Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -108,10 +108,10 @@
109109 $text .= SFUtils::formDropdownHTML();
110110
111111 $text .= "\t</p>\n";
112 - $text .= SFFormUtils::hiddenFieldHTML( 'namespace', $target_namespace );
113 - $text .= SFFormUtils::hiddenFieldHTML( 'super_page', $super_page );
114 - $text .= SFFormUtils::hiddenFieldHTML( 'params', $params );
115 - $text .= "\t" . Html::input( null, wfMsg( 'sf_formstart_createoredit' ), 'submit' ) . "\n";
 112+ $text .= Html::hidden( 'namespace', $target_namespace );
 113+ $text .= Html::hidden( 'super_page', $super_page );
 114+ $text .= Html::hidden( 'params', $params );
 115+ $text .= "\n\t" . Html::input( null, wfMsg( 'sf_formstart_createoredit' ), 'submit' ) . "\n";
116116 $text .= "\t</form>\n";
117117 }
118118 $wgOut->addHTML( $text );
Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -218,8 +218,8 @@
219219
220220 $text = "\t" . '<form action="" method="post">' . "\n";
221221 // Set 'title' field, in case there's no URL niceness
222 - $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
223 - $text .= "\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />';
 222+ $text .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() );
 223+ $text .= "\n\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />';
224224 if ( ! empty( $form_name_error_str ) )
225225 $text .= "\t" . Html::element( 'font', array( 'color' => 'red' ), $form_name_error_str );
226226 $text .= "</p>\n";
Index: trunk/extensions/SemanticForms/specials/SF_CreateClass.php
@@ -214,7 +214,7 @@
215215 $text .= Html::rawElement( 'p', null, $add_another_button ) . "\n";
216216 // Set 'title' as hidden field, in case there's no URL niceness
217217 $cc = $this->getTitle();
218 - $text .= SFFormUtils::hiddenFieldHTML( 'title', SFUtils::titleURLString( $cc ) );
 218+ $text .= Html::hidden( 'title', SFUtils::titleURLString( $cc ) );
219219 $text .= Html::element( 'input',
220220 array(
221221 'type' => 'submit',
Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -119,7 +119,7 @@
120120 <form id="sfForm" name="createbox" action="$action" method="post" class="createbox">
121121
122122 END;
123 - $fullFormText .= SFFormUtils::hiddenFieldHTML( 'query', 'true' );
 123+ $fullFormText .= Html::hidden( 'query', 'true' );
124124 $fullFormText .= $form_text;
125125 }
126126
Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php
@@ -185,7 +185,7 @@
186186
187187 $text .= ' <form id="createTemplateForm" action="" method="post">' . "\n";
188188 // Set 'title' field, in case there's no URL niceness
189 - $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() );
 189+ $text .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
190190 $text .= "\t<p id=\"template_name_p\">" . wfMsg( 'sf_createtemplate_namelabel' ) . ' <input size="25" id="template_name" name="template_name" /></p>' . "\n";
191191 $text .= "\t<p>" . wfMsg( 'sf_createtemplate_categorylabel' ) . ' <input size="25" name="category" /></p>' . "\n";
192192 $text .= "\t<fieldset>\n";
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -951,7 +951,7 @@
952952 // the page, using <free_text> tags - once all the free text
953953 // is known (at the end), it will get substituted in.
954954 if ( $is_hidden ) {
955 - $new_text = SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' );
 955+ $new_text = Html::hidden( 'free_text', '!free_text!' );
956956 } else {
957957 $sfgTabIndex++;
958958 $sfgFieldNum++;
@@ -1228,9 +1228,9 @@
12291229 // reason don't submit their value.
12301230 if ( $form_field->isDisabled() ) {
12311231 if ( $field_name == 'free text' || $field_name == '<freetext>' ) {
1232 - $new_text .= SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' );
 1232+ $new_text .= Html::hidden( 'free_text', '!free_text!' );
12331233 } else {
1234 - $new_text .= SFFormUtils::hiddenFieldHTML( $input_name, $cur_value );
 1234+ $new_text .= Html::hidden( $input_name, $cur_value );
12351235 }
12361236 }
12371237
@@ -1463,7 +1463,7 @@
14641464 // if it wasn't included in the form definition, add the
14651465 // 'free text' input as a hidden field at the bottom
14661466 if ( ! $free_text_was_included ) {
1467 - $form_text .= SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' );
 1467+ $form_text .= Html::hidden( 'free_text', '!free_text!' );
14681468 }
14691469 // Get free text, and add to page data, as well as retroactively
14701470 // inserting it into the form.
@@ -1474,7 +1474,7 @@
14751475 if ( $form_is_partial ) {
14761476 if ( !$wgRequest->getCheck( 'partial' ) ) {
14771477 $free_text = $original_page_content;
1478 - $form_text .= SFFormUtils::hiddenFieldHTML( 'partial', 1 );
 1478+ $form_text .= Html::hidden( 'partial', 1 );
14791479 } else {
14801480 $free_text = null;
14811481 $existing_page_content = preg_replace( array( '/�\{/m', '/\}�/m' ),
@@ -1539,8 +1539,8 @@
15401540 $page_article = new Article( $this->mPageTitle, 0 );
15411541
15421542 if ( !$is_query ) {
1543 - $form_text .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', wfTimestampNow() );
1544 - $form_text .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $page_article->getTimestamp() );
 1543+ $form_text .= Html::hidden( 'wpStarttime', wfTimestampNow() );
 1544+ $form_text .= Html::hidden( 'wpEdittime', $page_article->getTimestamp() );
15451545 }
15461546
15471547 $form_text .= "\t</form>\n";
@@ -1599,7 +1599,7 @@
16001600 $template_field = $form_field->getTemplateField();
16011601
16021602 if ( $form_field->isHidden() ) {
1603 - $text = SFFormUtils::hiddenFieldHTML( $form_field->getInputName(), $cur_value );
 1603+ $text = Html::hidden( $form_field->getInputName(), $cur_value );
16041604 } elseif ( $form_field->getInputType() !== '' &&
16051605 array_key_exists( $form_field->getInputType(), $this->mInputTypeHooks ) &&
16061606 $this->mInputTypeHooks[$form_field->getInputType()] != null ) {
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
@@ -41,10 +41,6 @@
4242 return true;
4343 }
4444
45 - static function hiddenFieldHTML( $input_name, $cur_value ) {
46 - return "\t" . Html::hidden( $input_name, $cur_value ) . "\n";
47 - }
48 -
4945 /**
5046 * Add a hidden input for each field in the template call that's
5147 * not handled by the form itself
@@ -54,7 +50,7 @@
5551 foreach ( $templateContents as $key => $value ) {
5652 if ( !is_null( $key ) && !is_numeric( $key ) ) {
5753 $key = urlencode( $key );
58 - $text .= self::hiddenFieldHTML( '_unhandled_' . $templateName . '_' . $key, $value );
 54+ $text .= Html::hidden( '_unhandled_' . $templateName . '_' . $key, $value );
5955 }
6056 }
6157 return $text;
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -294,12 +294,12 @@
295295 // (i.e., it's in the default URL style), add in the title as a
296296 // hidden value
297297 if ( ( $pos = strpos( $fs_url, "title=" ) ) > - 1 ) {
298 - $str .= SFFormUtils::hiddenFieldHTML( "title", urldecode( substr( $fs_url, $pos + 6 ) ) );
 298+ $str .= Html::hidden( "title", urldecode( substr( $fs_url, $pos + 6 ) ) );
299299 }
300300 if ( $inFormName == '' ) {
301301 $str .= SFUtils::formDropdownHTML();
302302 } else {
303 - $str .= SFFormUtils::hiddenFieldHTML( "form", $inFormName );
 303+ $str .= Html::hidden( "form", $inFormName );
304304 }
305305
306306 // Recreate the passed-in query string as a set of hidden variables.
@@ -311,7 +311,7 @@
312312 foreach ( $query_components as $query_component ) {
313313 $var_and_val = explode( '=', $query_component, 2 );
314314 if ( count( $var_and_val ) == 2 ) {
315 - $str .= SFFormUtils::hiddenFieldHTML( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) );
 315+ $str .= Html::hidden( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) );
316316 }
317317 }
318318 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php
@@ -69,7 +69,7 @@
7070 $selectAttrs['disabled'] = 'disabled';
7171 }
7272 $text = Html::rawElement( 'select', $selectAttrs, $optionsText );
73 - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
 73+ $text .= Html::hidden( $input_name . '[is_list]', 1 );
7474 if ( $is_mandatory ) {
7575 $text = Html::rawElement( 'span', array( 'class' => 'inputSpan mandatoryFieldSpan' ), $text );
7676 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
@@ -111,7 +111,7 @@
112112
113113 $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . '</div>';
114114
115 - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
 115+ $text .= Html::hidden( $input_name . '[is_list]', 1 );
116116 $spanClass = 'checkboxesSpan';
117117 if ( $is_mandatory ) {
118118 $spanClass .= ' mandatoryFieldSpan';
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
@@ -101,7 +101,7 @@
102102 }
103103 }
104104
105 - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
 105+ $text .= Html::hidden( $input_name . '[is_list]', 1 );
106106 $outerSpanAttrs = array( 'id' => $outerSpanID, 'class' => $outerSpanClass );
107107 $text = "\t" . Html::rawElement( 'span', $outerSpanAttrs, $text ) . "\n";
108108
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -217,18 +217,18 @@
218218 <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p>
219219
220220 END;
221 - $form_body = SFFormUtils::hiddenFieldHTML( 'wpTextbox1', $page_contents );
222 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpSummary', $edit_summary );
223 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', $start_time );
224 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $edit_time );
225 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX );
226 - $form_body .= SFFormUtils::hiddenFieldHTML( $action, null );
 221+ $form_body = Html::hidden( 'wpTextbox1', $page_contents );
 222+ $form_body .= Html::hidden( 'wpSummary', $edit_summary );
 223+ $form_body .= Html::hidden( 'wpStarttime', $start_time );
 224+ $form_body .= Html::hidden( 'wpEdittime', $edit_time );
 225+ $form_body .= Html::hidden( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX );
 226+ $form_body .= Html::hidden( $action, null );
227227
228228 if ( $is_minor_edit ) {
229 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpMinoredit' , null );
 229+ $form_body .= Html::hidden( 'wpMinoredit' , null );
230230 }
231231 if ( $watch_this ) {
232 - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpWatchthis', null );
 232+ $form_body .= Html::hidden( 'wpWatchthis', null );
233233 }
234234 $text .= Html::rawElement(
235235 'form',
@@ -974,7 +974,7 @@
975975 foreach ( $query_components as $query_component ) {
976976 $var_and_val = explode( '=', $query_component, 2 );
977977 if ( count( $var_and_val ) == 2 ) {
978 - $hidden_inputs .= SFFormUtils::hiddenFieldHTML( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) );
 978+ $hidden_inputs .= Html::hidden( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) );
979979 }
980980 }
981981 } else {

Status & tagging log