r90424 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90423‎ | r90424 | r90425 >
Date:01:49, 20 June 2011
Author:yaron
Status:deferred
Tags:
Comment:
Removed support for "field|free text" syntax (now it has to be "standard input|free text"); improved some formatting and comments
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -782,8 +782,8 @@
783783 $field_args['part_of_multiple'] = $allow_multiple;
784784 if ( count( $show_on_select ) > 0 )
785785 $field_args['show on select'] = $show_on_select;
786 - // get the value from the request, if it's there, and if it's not
787 - // an array
 786+ // Get the value from the request, if
 787+ // it's there, and if it's not an array.
788788 $escaped_field_name = str_replace( "'", "\'", $field_name );
789789 if ( isset( $template_instance_query_values ) &&
790790 $template_instance_query_values != null &&
@@ -821,11 +821,8 @@
822822 }
823823 }
824824
825 - // Handle the free text field - if it was declared as
826 - // "field|free text" (a deprecated usage), it has to be outside
827 - // of a template.
828 - if ( ( $template_name == '' && $field_name == 'free text' ) ||
829 - $field_name == '<freetext>' ) {
 825+ // Handle the free text field.
 826+ if ( $field_name == '<freetext>' ) {
830827 // Add placeholders for the free text in both the form and
831828 // the page, using <free_text> tags - once all the free text
832829 // is known (at the end), it will get substituted in.
@@ -943,14 +940,15 @@
944941 } else { // value is not an array
945942 $cur_value_in_template = $cur_value;
946943 }
947 - if ( $template_name == null || $template_name == '' )
 944+ if ( $template_name == null || $template_name == '' ) {
948945 $input_name = $field_name;
949 - elseif ( $allow_multiple )
 946+ } elseif ( $allow_multiple ) {
950947 // 'num' will get replaced by an actual index, either in PHP
951948 // or in Javascript, later on
952949 $input_name = $template_name . '[num][' . $field_name . ']';
953 - else
 950+ } else {
954951 $input_name = $template_name . '[' . $field_name . ']';
 952+ }
955953
956954 // if we're creating the page name from a formula based on
957955 // form values, see if the current input is part of that formula,
@@ -1193,8 +1191,8 @@
11941192 // =====================================================
11951193 // default outer level processing
11961194 // =====================================================
1197 - } else { // tag is not one of the three allowed values
1198 - // ignore tag
 1195+ } else { // Tag is not one of the three allowed values -
 1196+ // ignore the tag.
11991197 $start_position = $brackets_end_loc;
12001198 } // end if
12011199 } // end while
@@ -1288,8 +1286,8 @@
12891287 if ( ! $free_text_was_included ) {
12901288 $form_text .= SFFormUtils::hiddenFieldHTML( 'free_text', '!free_text!' );
12911289 }
1292 - // get free text, and add to page data, as well as retroactively
1293 - // inserting it into the form
 1290+ // Get free text, and add to page data, as well as retroactively
 1291+ // inserting it into the form.
12941292
12951293 // If $form_is_partial is true then either:
12961294 // (a) we're processing a replacement (param 'partial' == 1)