https://www.mediawiki.org/wiki/Special:Code/MediaWiki/110780
Revision: 110780 Author: yaron Date: 2012-02-06 20:59:32 +0000 (Mon, 06 Feb 2012) Log Message: ----------- 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 trunk/extensions/SemanticForms/includes/SF_FormUtils.php trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php trunk/extensions/SemanticForms/includes/SF_Utils.php trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php trunk/extensions/SemanticForms/specials/SF_CreateCategory.php trunk/extensions/SemanticForms/specials/SF_CreateClass.php trunk/extensions/SemanticForms/specials/SF_CreateForm.php trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php trunk/extensions/SemanticForms/specials/SF_FormStart.php trunk/extensions/SemanticForms/specials/SF_RunQuery.php Modified: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_FormPrinter.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/SF_FormPrinter.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -951,7 +951,7 @@ // the page, using <free_text> tags - once all the free text // is known (at the end), it will get substituted in. if ( $is_hidden ) { - $new_text = SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' ); + $new_text = Html::hidden( 'free_text', '!free_text!' ); } else { $sfgTabIndex++; $sfgFieldNum++; @@ -1228,9 +1228,9 @@ // reason don't submit their value. if ( $form_field->isDisabled() ) { if ( $field_name == 'free text' || $field_name == '<freetext>' ) { - $new_text .= SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' ); + $new_text .= Html::hidden( 'free_text', '!free_text!' ); } else { - $new_text .= SFFormUtils::hiddenFieldHTML( $input_name, $cur_value ); + $new_text .= Html::hidden( $input_name, $cur_value ); } } @@ -1463,7 +1463,7 @@ // if it wasn't included in the form definition, add the // 'free text' input as a hidden field at the bottom if ( ! $free_text_was_included ) { - $form_text .= SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' ); + $form_text .= Html::hidden( 'free_text', '!free_text!' ); } // Get free text, and add to page data, as well as retroactively // inserting it into the form. @@ -1474,7 +1474,7 @@ if ( $form_is_partial ) { if ( !$wgRequest->getCheck( 'partial' ) ) { $free_text = $original_page_content; - $form_text .= SFFormUtils::hiddenFieldHTML( 'partial', 1 ); + $form_text .= Html::hidden( 'partial', 1 ); } else { $free_text = null; $existing_page_content = preg_replace( array( '/�\{/m', '/\}�/m' ), @@ -1539,8 +1539,8 @@ $page_article = new Article( $this->mPageTitle, 0 ); if ( !$is_query ) { - $form_text .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', wfTimestampNow() ); - $form_text .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $page_article->getTimestamp() ); + $form_text .= Html::hidden( 'wpStarttime', wfTimestampNow() ); + $form_text .= Html::hidden( 'wpEdittime', $page_article->getTimestamp() ); } $form_text .= "\t</form>\n"; @@ -1599,7 +1599,7 @@ $template_field = $form_field->getTemplateField(); if ( $form_field->isHidden() ) { - $text = SFFormUtils::hiddenFieldHTML( $form_field->getInputName(), $cur_value ); + $text = Html::hidden( $form_field->getInputName(), $cur_value ); } elseif ( $form_field->getInputType() !== '' && array_key_exists( $form_field->getInputType(), $this->mInputTypeHooks ) && $this->mInputTypeHooks[$form_field->getInputType()] != null ) { Modified: trunk/extensions/SemanticForms/includes/SF_FormUtils.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_FormUtils.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/SF_FormUtils.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -41,10 +41,6 @@ return true; } - static function hiddenFieldHTML( $input_name, $cur_value ) { - return "\t" . Html::hidden( $input_name, $cur_value ) . "\n"; - } - /** * Add a hidden input for each field in the template call that's * not handled by the form itself @@ -54,7 +50,7 @@ foreach ( $templateContents as $key => $value ) { if ( !is_null( $key ) && !is_numeric( $key ) ) { $key = urlencode( $key ); - $text .= self::hiddenFieldHTML( '_unhandled_' . $templateName . '_' . $key, $value ); + $text .= Html::hidden( '_unhandled_' . $templateName . '_' . $key, $value ); } } return $text; Modified: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -294,12 +294,12 @@ // (i.e., it's in the default URL style), add in the title as a // hidden value if ( ( $pos = strpos( $fs_url, "title=" ) ) > - 1 ) { - $str .= SFFormUtils::hiddenFieldHTML( "title", urldecode( substr( $fs_url, $pos + 6 ) ) ); + $str .= Html::hidden( "title", urldecode( substr( $fs_url, $pos + 6 ) ) ); } if ( $inFormName == '' ) { $str .= SFUtils::formDropdownHTML(); } else { - $str .= SFFormUtils::hiddenFieldHTML( "form", $inFormName ); + $str .= Html::hidden( "form", $inFormName ); } // Recreate the passed-in query string as a set of hidden variables. @@ -311,7 +311,7 @@ foreach ( $query_components as $query_component ) { $var_and_val = explode( '=', $query_component, 2 ); if ( count( $var_and_val ) == 2 ) { - $str .= SFFormUtils::hiddenFieldHTML( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) ); + $str .= Html::hidden( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) ); } } } Modified: trunk/extensions/SemanticForms/includes/SF_Utils.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_Utils.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/SF_Utils.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -217,18 +217,18 @@ <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p> END; - $form_body = SFFormUtils::hiddenFieldHTML( 'wpTextbox1', $page_contents ); - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpSummary', $edit_summary ); - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', $start_time ); - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $edit_time ); - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX ); - $form_body .= SFFormUtils::hiddenFieldHTML( $action, null ); + $form_body = Html::hidden( 'wpTextbox1', $page_contents ); + $form_body .= Html::hidden( 'wpSummary', $edit_summary ); + $form_body .= Html::hidden( 'wpStarttime', $start_time ); + $form_body .= Html::hidden( 'wpEdittime', $edit_time ); + $form_body .= Html::hidden( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX ); + $form_body .= Html::hidden( $action, null ); if ( $is_minor_edit ) { - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpMinoredit' , null ); + $form_body .= Html::hidden( 'wpMinoredit' , null ); } if ( $watch_this ) { - $form_body .= SFFormUtils::hiddenFieldHTML( 'wpWatchthis', null ); + $form_body .= Html::hidden( 'wpWatchthis', null ); } $text .= Html::rawElement( 'form', @@ -974,7 +974,7 @@ foreach ( $query_components as $query_component ) { $var_and_val = explode( '=', $query_component, 2 ); if ( count( $var_and_val ) == 2 ) { - $hidden_inputs .= SFFormUtils::hiddenFieldHTML( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) ); + $hidden_inputs .= Html::hidden( urldecode( $var_and_val[0] ), urldecode( $var_and_val[1] ) ); } } } else { Modified: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php =================================================================== --- trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -111,7 +111,7 @@ $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . '</div>'; - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 ); + $text .= Html::hidden( $input_name . '[is_list]', 1 ); $spanClass = 'checkboxesSpan'; if ( $is_mandatory ) { $spanClass .= ' mandatoryFieldSpan'; Modified: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php =================================================================== --- trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -101,7 +101,7 @@ } } - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 ); + $text .= Html::hidden( $input_name . '[is_list]', 1 ); $outerSpanAttrs = array( 'id' => $outerSpanID, 'class' => $outerSpanClass ); $text = "\t" . Html::rawElement( 'span', $outerSpanAttrs, $text ) . "\n"; Modified: trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php =================================================================== --- trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -69,7 +69,7 @@ $selectAttrs['disabled'] = 'disabled'; } $text = Html::rawElement( 'select', $selectAttrs, $optionsText ); - $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 ); + $text .= Html::hidden( $input_name . '[is_list]', 1 ); if ( $is_mandatory ) { $text = Html::rawElement( 'span', array( 'class' => 'inputSpan mandatoryFieldSpan' ), $text ); } Modified: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_CreateCategory.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_CreateCategory.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -78,7 +78,7 @@ <form action="" method="get"> END; - $text .= SFFormUtils::hiddenFieldHTML( 'title', "$special_namespace:CreateCategory" ); + $text .= "\t" . Html::hidden( 'title', "$special_namespace:CreateCategory" ) . "\n"; $firstRow = wfMsg( 'sf_createcategory_name' ) . ' ' . Html::input( 'category_name', null, 'text', array( 'size' => 25 ) ) . "\n"; Modified: trunk/extensions/SemanticForms/specials/SF_CreateClass.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_CreateClass.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_CreateClass.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -214,7 +214,7 @@ $text .= Html::rawElement( 'p', null, $add_another_button ) . "\n"; // Set 'title' as hidden field, in case there's no URL niceness $cc = $this->getTitle(); - $text .= SFFormUtils::hiddenFieldHTML( 'title', SFUtils::titleURLString( $cc ) ); + $text .= Html::hidden( 'title', SFUtils::titleURLString( $cc ) ); $text .= Html::element( 'input', array( 'type' => 'submit', Modified: trunk/extensions/SemanticForms/specials/SF_CreateForm.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_CreateForm.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_CreateForm.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -218,8 +218,8 @@ $text = "\t" . '<form action="" method="post">' . "\n"; // Set 'title' field, in case there's no URL niceness - $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() ); - $text .= "\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />'; + $text .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ); + $text .= "\n\t<p>" . wfMsg( 'sf_createform_nameinput' ) . ' ' . wfMsg( 'sf_createform_nameinputdesc' ) . ' <input size=25 name="form_name" value="' . $form_name . '" />'; if ( ! empty( $form_name_error_str ) ) $text .= "\t" . Html::element( 'font', array( 'color' => 'red' ), $form_name_error_str ); $text .= "</p>\n"; Modified: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -185,7 +185,7 @@ $text .= ' <form id="createTemplateForm" action="" method="post">' . "\n"; // Set 'title' field, in case there's no URL niceness - $text .= SFFormUtils::hiddenFieldHTML( 'title', $this->getTitle()->getPrefixedText() ); + $text .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n"; $text .= "\t<p id=\"template_name_p\">" . wfMsg( 'sf_createtemplate_namelabel' ) . ' <input size="25" id="template_name" name="template_name" /></p>' . "\n"; $text .= "\t<p>" . wfMsg( 'sf_createtemplate_categorylabel' ) . ' <input size="25" name="category" /></p>' . "\n"; $text .= "\t<fieldset>\n"; Modified: trunk/extensions/SemanticForms/specials/SF_FormStart.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_FormStart.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_FormStart.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -108,10 +108,10 @@ $text .= SFUtils::formDropdownHTML(); $text .= "\t</p>\n"; - $text .= SFFormUtils::hiddenFieldHTML( 'namespace', $target_namespace ); - $text .= SFFormUtils::hiddenFieldHTML( 'super_page', $super_page ); - $text .= SFFormUtils::hiddenFieldHTML( 'params', $params ); - $text .= "\t" . Html::input( null, wfMsg( 'sf_formstart_createoredit' ), 'submit' ) . "\n"; + $text .= Html::hidden( 'namespace', $target_namespace ); + $text .= Html::hidden( 'super_page', $super_page ); + $text .= Html::hidden( 'params', $params ); + $text .= "\n\t" . Html::input( null, wfMsg( 'sf_formstart_createoredit' ), 'submit' ) . "\n"; $text .= "\t</form>\n"; } $wgOut->addHTML( $text ); Modified: trunk/extensions/SemanticForms/specials/SF_RunQuery.php =================================================================== --- trunk/extensions/SemanticForms/specials/SF_RunQuery.php 2012-02-06 20:59:17 UTC (rev 110779) +++ trunk/extensions/SemanticForms/specials/SF_RunQuery.php 2012-02-06 20:59:32 UTC (rev 110780) @@ -119,7 +119,7 @@ <form id="sfForm" name="createbox" action="$action" method="post" class="createbox"> END; - $fullFormText .= SFFormUtils::hiddenFieldHTML( 'query', 'true' ); + $fullFormText .= Html::hidden( 'query', 'true' ); $fullFormText .= $form_text; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs