r91264 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91263‎ | r91264 | r91265 >
Date:14:30, 1 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Follow-up to r9125 - better initialization of variables
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -652,7 +652,7 @@
653653 $input_type = null;
654654 $field_args = array();
655655 $show_on_select = array();
656 - $default_value = "";
 656+ $default_value = null;
657657 $possible_values = null;
658658 $semantic_property = null;
659659 $preload_page = null;
@@ -780,12 +780,15 @@
781781 // necessary.
782782 $field_args['no autocomplete'] = true;
783783 }
784 - if ( $allow_multiple )
 784+ if ( $allow_multiple ) {
785785 $field_args['part_of_multiple'] = $allow_multiple;
786 - if ( count( $show_on_select ) > 0 )
 786+ }
 787+ if ( count( $show_on_select ) > 0 ) {
787788 $field_args['show on select'] = $show_on_select;
 789+ }
788790 // Get the value from the request, if
789791 // it's there, and if it's not an array.
 792+ $cur_value = null;
790793 $escaped_field_name = str_replace( "'", "\'", $field_name );
791794 if ( isset( $template_instance_query_values ) &&
792795 $template_instance_query_values != null &&
@@ -805,8 +808,6 @@
806809 if ( $form_submitted || ( ! empty( $field_query_val ) && ! is_array( $field_query_val ) ) ) {
807810 $cur_value = $field_query_val;
808811 }
809 - } else {
810 - $cur_value = '';
811812 }
812813
813814 if ( empty( $cur_value ) && !$form_submitted ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r9125move default parameter to the right per recommendations...eloquence17:41, 21 May 2005