r93393 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93392‎ | r93393 | r93394 >
Date:15:35, 28 July 2011
Author:ashley
Status:deferred
Tags:
Comment:
SemanticForms: coding style tweaks for the files in SemanticForms/includes/forminputs
Modified paths:
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_DateTimeInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_DropdownInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_EnumInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_MultiEnumInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextWithAutocompleteInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_YearInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ListBoxInput.php
@@ -24,26 +24,31 @@
2525 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
2626 global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
2727
28 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
 28+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
2929 if ( array_key_exists( 'class', $other_args ) ) {
30 - $className .= " " . $other_args['class'];
 30+ $className .= ' ' . $other_args['class'];
3131 }
3232 $input_id = "input_$sfgFieldNum";
3333 // get list delimiter - default is comma
3434 if ( array_key_exists( 'delimiter', $other_args ) ) {
3535 $delimiter = $other_args['delimiter'];
3636 } else {
37 - $delimiter = ",";
 37+ $delimiter = ',';
3838 }
3939 $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter );
40 - $className .= " sfShowIfSelected";
 40+ $className .= ' sfShowIfSelected';
4141
4242 if ( ( $possible_values = $other_args['possible_values'] ) == null ) {
4343 $possible_values = array();
4444 }
45 - $optionsText = "";
 45+ $optionsText = '';
4646 foreach ( $possible_values as $possible_value ) {
47 - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) {
 47+ if (
 48+ array_key_exists( 'value_labels', $other_args ) &&
 49+ is_array( $other_args['value_labels'] ) &&
 50+ array_key_exists( $possible_value, $other_args['value_labels'] )
 51+ )
 52+ {
4853 $optionLabel = $other_args['value_labels'][$possible_value];
4954 } else {
5055 $optionLabel = $possible_value;
@@ -88,7 +93,11 @@
8994
9095 public static function getParameters() {
9196 $params = parent::getParameters();
92 - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_listboxsize' ) );
 97+ $params[] = array(
 98+ 'name' => 'size',
 99+ 'type' => 'int',
 100+ 'description' => wfMsg( 'sf_forminputs_listboxsize' )
 101+ );
93102 return $params;
94103 }
95104
@@ -96,6 +105,12 @@
97106 * Returns the HTML code to be included in the output page for this input.
98107 */
99108 public function getHtmlText() {
100 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 109+ return self::getHTML(
 110+ $this->mCurrentValue,
 111+ $this->mInputName,
 112+ $this->mIsMandatory,
 113+ $this->mIsDisabled,
 114+ $mOtherArgs
 115+ );
101116 }
102117 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php
@@ -49,17 +49,20 @@
5050 public static function uploadLinkHTML( $input_id, $delimiter = null, $default_filename = null ) {
5151 $upload_window_page = SpecialPage::getPage( 'UploadWindow' );
5252 $query_string = "sfInputID=$input_id";
53 - if ( $delimiter != null )
 53+ if ( $delimiter != null ) {
5454 $query_string .= "&sfDelimiter=$delimiter";
55 - if ( $default_filename != null )
 55+ }
 56+ if ( $default_filename != null ) {
5657 $query_string .= "&wpDestFile=$default_filename";
 58+ }
5759 $upload_window_url = $upload_window_page->getTitle()->getFullURL( $query_string );
5860 $upload_label = wfMsg( 'upload' );
5961 // window needs to be bigger for MediaWiki version 1.16+
60 - if ( class_exists( 'HTMLForm' ) )
 62+ if ( class_exists( 'HTMLForm' ) ) {
6163 $style = "width:650 height:500";
62 - else
 64+ } else {
6365 $style = '';
 66+ }
6467
6568 $linkAttrs = array(
6669 'href' => $upload_window_url,
@@ -80,12 +83,12 @@
8184 return SFTextWithAutocompleteInput::getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args );
8285 }
8386
84 - $className = "createboxInput";
 87+ $className = 'createboxInput';
8588 if ( $is_mandatory ) {
86 - $className .= " mandatoryField";
 89+ $className .= ' mandatoryField';
8790 }
8891 if ( array_key_exists( 'class', $other_args ) ) {
89 - $className .= " " . $other_args['class'];
 92+ $className .= ' ' . $other_args['class'];
9093 }
9194 $input_id = "input_$sfgFieldNum";
9295 // Set size based on pre-set size, or field type - if field
@@ -130,7 +133,7 @@
131134 if ( array_key_exists( 'delimiter', $other_args ) ) {
132135 $delimiter = $other_args['delimiter'];
133136 } else {
134 - $delimiter = ",";
 137+ $delimiter = ',';
135138 }
136139 } else {
137140 $delimiter = null;
@@ -138,25 +141,43 @@
139142 if ( array_key_exists( 'default filename', $other_args ) ) {
140143 $default_filename = $other_args['default filename'];
141144 } else {
142 - $default_filename = "";
 145+ $default_filename = '';
143146 }
144147 $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename );
145148 }
146 - $spanClass = "inputSpan";
 149+ $spanClass = 'inputSpan';
147150 if ( $inputType != '' ) {
148151 $spanClass .= " {$inputType}Input";
149152 }
150 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 153+ if ( $is_mandatory ) {
 154+ $spanClass .= ' mandatoryFieldSpan';
 155+ }
151156 $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
152157 return $text;
153158 }
154159
155160 public static function getParameters() {
156161 $params = parent::getParameters();
157 - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) );
158 - $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) );
159 - $params[] = array( 'name' => 'uploadable', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_uploadable' ) );
160 - $params[] = array( 'name' => 'default filename', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_defaultfilename' ) );
 162+ $params[] = array(
 163+ 'name' => 'size',
 164+ 'type' => 'int',
 165+ 'description' => wfMsg( 'sf_forminputs_size' )
 166+ );
 167+ $params[] = array(
 168+ 'name' => 'maxlength',
 169+ 'type' => 'int',
 170+ 'description' => wfMsg( 'sf_forminputs_maxlength' )
 171+ );
 172+ $params[] = array(
 173+ 'name' => 'uploadable',
 174+ 'type' => 'boolean',
 175+ 'description' => wfMsg( 'sf_forminputs_uploadable' )
 176+ );
 177+ $params[] = array(
 178+ 'name' => 'default filename',
 179+ 'type' => 'string',
 180+ 'description' => wfMsg( 'sf_forminputs_defaultfilename' )
 181+ );
161182 return $params;
162183 }
163184
@@ -164,6 +185,12 @@
165186 * Returns the HTML code to be included in the output page for this input.
166187 */
167188 public function getHtmlText() {
168 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 189+ return self::getHTML(
 190+ $this->mCurrentValue,
 191+ $this->mInputName,
 192+ $this->mIsMandatory,
 193+ $this->mIsDisabled,
 194+ $mOtherArgs
 195+ );
169196 }
170197 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
@@ -26,21 +26,23 @@
2727
2828 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
2929 // escape if CategoryTree extension isn't included
30 - if ( ! function_exists( 'efCategoryTreeParserHook' ) )
 30+ if ( !function_exists( 'efCategoryTreeParserHook' ) ) {
3131 return null;
 32+ }
3233
3334 global $sfgTabIndex, $sfgFieldNum, $wgCapitalLinks;
3435
35 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
36 - if ( array_key_exists( 'class', $other_args ) )
37 - $className .= " " . $other_args['class'];
 36+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
 37+ if ( array_key_exists( 'class', $other_args ) ) {
 38+ $className .= ' ' . $other_args['class'];
 39+ }
3840 $input_id = "input_$sfgFieldNum";
3941 $info_id = "info_$sfgFieldNum";
4042 // get list delimiter - default is comma
4143 if ( array_key_exists( 'delimiter', $other_args ) ) {
4244 $delimiter = $other_args['delimiter'];
4345 } else {
44 - $delimiter = ",";
 46+ $delimiter = ',';
4547 }
4648 $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter );
4749 if ( array_key_exists( 'top category', $other_args ) ) {
@@ -53,12 +55,12 @@
5456 if ( array_key_exists( 'height', $other_args ) ) {
5557 $height = $other_args['height'];
5658 } else {
57 - $height = "100";
 59+ $height = '100';
5860 }
5961 if ( array_key_exists( 'width', $other_args ) ) {
6062 $width = $other_args['width'];
6163 } else {
62 - $width = "500";
 64+ $width = '500';
6365 }
6466
6567 global $wgCategoryTreeMaxDepth;
@@ -74,7 +76,13 @@
7577 // Some string that will hopefully never show up in a category,
7678 // template or field name.
7779 $dummy_str = 'REPLACE THIS STRING!';
78 - $tree = preg_replace( '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', '<input id="' . $input_id . '" tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[' . $dummy_str . ']" value="$2" type="checkbox"> $1$2$3', $tree );
 80+ $tree = preg_replace(
 81+ '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/',
 82+ '<input id="' . $input_id . '" tabindex="' . $sfgTabIndex .
 83+ '" name="' . $input_name . '[' . $dummy_str .
 84+ ']" value="$2" type="checkbox"> $1$2$3',
 85+ $tree
 86+ );
7987 // replace values one at a time, by an incrementing index -
8088 // inspired by http://bugs.php.net/bug.php?id=11457
8189 $i = 0;
@@ -98,13 +106,20 @@
99107 }
100108
101109 // Get rid of all the 'no subcategories' messages.
102 - $tree = str_replace( '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', '', $tree );
 110+ $tree = str_replace(
 111+ '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' .
 112+ wfMsg( 'categorytree-no-subcategories' ) . '</i></div>',
 113+ '',
 114+ $tree
 115+ );
103116
104117 $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">' . $tree . '</div>';
105118
106119 $text .= SFFormUtils::hiddenFieldHTML( $input_name . '[is_list]', 1 );
107 - $spanClass = "checkboxesSpan";
108 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 120+ $spanClass = 'checkboxesSpan';
 121+ if ( $is_mandatory ) {
 122+ $spanClass .= ' mandatoryFieldSpan';
 123+ }
109124 $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text ) . "\n";
110125
111126 return $text;
@@ -114,6 +129,12 @@
115130 * Returns the HTML code to be included in the output page for this input.
116131 */
117132 public function getHtmlText() {
118 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 133+ return self::getHTML(
 134+ $this->mCurrentValue,
 135+ $this->mInputName,
 136+ $this->mIsMandatory,
 137+ $this->mIsDisabled,
 138+ $mOtherArgs
 139+ );
119140 }
120141 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxInput.php
@@ -27,13 +27,14 @@
2828 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
2929 global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
3030
31 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
32 - if ( array_key_exists( 'class', $other_args ) )
33 - $className .= " " . $other_args['class'];
 31+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
 32+ if ( array_key_exists( 'class', $other_args ) ) {
 33+ $className .= ' ' . $other_args['class'];
 34+ }
3435 $input_id = "input_$sfgFieldNum";
35 - $disabled_text = ( $is_disabled ) ? "disabled" : "";
 36+ $disabled_text = ( $is_disabled ) ? 'disabled' : '';
3637 if ( array_key_exists( 'show on select', $other_args ) ) {
37 - $className .= " sfShowIfCheckedCheckbox";
 38+ $className .= ' sfShowIfCheckedCheckbox';
3839 $div_id = key( $other_args['show on select'] );
3940 $sfgShowOnSelect[$input_id] = $div_id;
4041 }
@@ -41,7 +42,7 @@
4243 // Can show up here either as an array or a string, depending on
4344 // whether it came from user input or a wiki page
4445 if ( is_array( $cur_value ) ) {
45 - $checked_str = ( array_key_exists( 'value', $cur_value ) && $cur_value['value'] == 'on' ) ? ' checked="checked"' : "";
 46+ $checked_str = ( array_key_exists( 'value', $cur_value ) && $cur_value['value'] == 'on' ) ? ' checked="checked"' : '';
4647 } else {
4748 // Default to false - no need to check if it matches
4849 // a 'false' word.
@@ -52,10 +53,10 @@
5354 if ( version_compare( $wgVersion, '1.16', '<' ) ) {
5455 wfLoadExtensionMessages( 'SemanticMediaWiki' );
5556 }
56 - if ( in_array( $vlc, explode( ',', wfMsgForContent( 'smw_true_words' ) ), TRUE ) ) {
 57+ if ( in_array( $vlc, explode( ',', wfMsgForContent( 'smw_true_words' ) ), true ) ) {
5758 $checked_str = ' checked="checked"';
5859 } else {
59 - $checked_str = "";
 60+ $checked_str = '';
6061 }
6162 }
6263 $text = <<<END
@@ -82,6 +83,12 @@
8384 * Returns the HTML code to be included in the output page for this input.
8485 */
8586 public function getHtmlText() {
86 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 87+ return self::getHTML(
 88+ $this->mCurrentValue,
 89+ $this->mInputName,
 90+ $this->mIsMandatory,
 91+ $this->mIsDisabled,
 92+ $mOtherArgs
 93+ );
8794 }
8895 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
@@ -40,26 +40,27 @@
4141 // mandatory field and there's a current value in place (either
4242 // through a default value or because we're editing an existing
4343 // page).
44 - if ( ! $is_mandatory || $cur_value == '' ) {
 44+ if ( !$is_mandatory || $cur_value == '' ) {
4545 array_unshift( $possible_values, '' );
4646 }
4747
4848 // Set $cur_value to be one of the allowed options, if it isn't
4949 // already - that makes it easier to automatically have one of
5050 // the radiobuttons be checked at the beginning.
51 - if ( ! in_array( $cur_value, $possible_values ) ) {
52 - if ( in_array( '', $possible_values ) )
 51+ if ( !in_array( $cur_value, $possible_values ) ) {
 52+ if ( in_array( '', $possible_values ) ) {
5353 $cur_value = '';
54 - else
 54+ } else {
5555 $cur_value = $possible_values[0];
 56+ }
5657 }
5758
5859 $text = '';
59 - $itemClass = "radioButtonItem";
 60+ $itemClass = 'radioButtonItem';
6061 if ( array_key_exists( 'class', $other_args ) ) {
61 - $itemClass .= " " . $other_args['class'];
 62+ $itemClass .= ' ' . $other_args['class'];
6263 }
63 - $itemAttrs = array ( 'class' => $itemClass );
 64+ $itemAttrs = array( 'class' => $itemClass );
6465
6566 foreach ( $possible_values as $i => $possible_value ) {
6667 $sfgTabIndex++;
@@ -79,29 +80,37 @@
8081 if ( $is_disabled ) {
8182 $radiobutton_attrs['disabled'] = 'disabled';
8283 }
83 - if ( $possible_value == '' ) // blank/"None" value
 84+ if ( $possible_value == '' ) { // blank/"None" value
8485 $label = wfMsg( 'sf_formedit_none' );
85 - elseif ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) )
 86+ } elseif (
 87+ array_key_exists( 'value_labels', $other_args ) &&
 88+ is_array( $other_args['value_labels'] ) &&
 89+ array_key_exists( $possible_value, $other_args['value_labels'] )
 90+ )
 91+ {
8692 $label = htmlspecialchars( $other_args['value_labels'][$possible_value] );
87 - else
 93+ } else {
8894 $label = $possible_value;
 95+ }
8996
90 - $text .= "\t" . Xml::openElement( 'span', $itemAttrs ) . Xml::element ( 'input', $radiobutton_attrs ) . " $label\n" . Xml::closeElement( 'span' );
 97+ $text .= "\t" . Xml::openElement( 'span', $itemAttrs ) .
 98+ Xml::element( 'input', $radiobutton_attrs ) . " $label\n" .
 99+ Xml::closeElement( 'span' );
91100 }
92101
93 - $spanClass = "radioButtonSpan";
 102+ $spanClass = 'radioButtonSpan';
94103 if ( array_key_exists( 'class', $other_args ) ) {
95 - $spanClass .= " " . $other_args['class'];
 104+ $spanClass .= ' ' . $other_args['class'];
96105 }
97106 if ( $is_mandatory ) {
98 - $spanClass .= " mandatoryFieldSpan";
 107+ $spanClass .= ' mandatoryFieldSpan';
99108 }
100109
101110 $spanID = "span_$sfgFieldNum";
102111
103112 // Do the 'show on select' handling.
104113 if ( array_key_exists( 'show on select', $other_args ) ) {
105 - $spanClass .= " sfShowIfChecked";
 114+ $spanClass .= ' sfShowIfChecked';
106115 foreach ( $other_args['show on select'] as $div_id => $options ) {
107116 if ( array_key_exists( $spanID, $sfgShowOnSelect ) ) {
108117 $sfgShowOnSelect[$spanID][] = array( $options, $div_id );
@@ -123,6 +132,12 @@
124133 * Returns the HTML code to be included in the output page for this input.
125134 */
126135 public function getHtmlText() {
127 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 136+ return self::getHTML(
 137+ $this->mCurrentValue,
 138+ $this->mInputName,
 139+ $this->mIsMandatory,
 140+ $this->mIsDisabled,
 141+ $mOtherArgs
 142+ );
128143 }
129144 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php
@@ -45,10 +45,11 @@
4646
4747 list( $autocompleteSettings, $remoteDataType, $delimiter ) = SFTextWithAutocompleteInput::setAutocompleteValues( $other_args );
4848
49 - $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput";
50 - if ( array_key_exists( 'class', $other_args ) )
51 - $className .= " " . $other_args['class'];
52 - $input_id = "input_" . $sfgFieldNum;
 49+ $className = ( $is_mandatory ) ? 'autocompleteInput mandatoryField' : 'autocompleteInput createboxInput';
 50+ if ( array_key_exists( 'class', $other_args ) ) {
 51+ $className .= ' ' . $other_args['class'];
 52+ }
 53+ $input_id = 'input_' . $sfgFieldNum;
5354
5455 if ( array_key_exists( 'rows', $other_args ) ) {
5556 $rows = $other_args['rows'];
@@ -60,7 +61,7 @@
6162 } else {
6263 $cols = 80;
6364 }
64 - $text = "";
 65+ $text = '';
6566 if ( array_key_exists( 'autogrow', $other_args ) ) {
6667 $className .= ' autoGrow';
6768 }
@@ -105,13 +106,15 @@
106107 if ( array_key_exists( 'default filename', $other_args ) ) {
107108 $default_filename = $other_args['default filename'];
108109 } else {
109 - $default_filename = "";
 110+ $default_filename = '';
110111 }
111112 $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename );
112113 }
113114
114 - $spanClass = "inputSpan";
115 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 115+ $spanClass = 'inputSpan';
 116+ if ( $is_mandatory ) {
 117+ $spanClass .= ' mandatoryFieldSpan';
 118+ }
116119 $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text );
117120
118121 return $text;
@@ -127,6 +130,12 @@
128131 * Returns the HTML code to be included in the output page for this input.
129132 */
130133 public function getHtmlText() {
131 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 134+ return self::getHTML(
 135+ $this->mCurrentValue,
 136+ $this->mInputName,
 137+ $this->mIsMandatory,
 138+ $this->mIsDisabled,
 139+ $mOtherArgs
 140+ );
132141 }
133142 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateTimeInput.php
@@ -38,13 +38,23 @@
3939 // depending on whether it came from user input or a
4040 // wiki page.
4141 if ( is_array( $datetime ) ) {
42 - if ( isset( $datetime['hour'] ) ) $hour = $datetime['hour'];
43 - if ( isset( $datetime['minute'] ) ) $minute = $datetime['minute'];
44 - if ( isset( $datetime['second'] ) ) $second = $datetime['second'];
45 - if ( ! $sfg24HourTime ) {
46 - if ( isset( $datetime['ampm24h'] ) ) $ampm24h = $datetime['ampm24h'];
 42+ if ( isset( $datetime['hour'] ) ) {
 43+ $hour = $datetime['hour'];
4744 }
48 - if ( isset( $datetime['timezone'] ) ) $timezone = $datetime['timezone'];
 45+ if ( isset( $datetime['minute'] ) ) {
 46+ $minute = $datetime['minute'];
 47+ }
 48+ if ( isset( $datetime['second'] ) ) {
 49+ $second = $datetime['second'];
 50+ }
 51+ if ( !$sfg24HourTime ) {
 52+ if ( isset( $datetime['ampm24h'] ) ) {
 53+ $ampm24h = $datetime['ampm24h'];
 54+ }
 55+ }
 56+ if ( isset( $datetime['timezone'] ) ) {
 57+ $timezone = $datetime['timezone'];
 58+ }
4959 } else {
5060 // TODO - this should change to use SMW's own
5161 // date-handling class, just like
@@ -62,16 +72,16 @@
6373 $actual_date = strtotime( $datetime );
6474 }
6575 if ( $sfg24HourTime ) {
66 - $hour = date( "G", $actual_date );
 76+ $hour = date( 'G', $actual_date );
6777 } else {
68 - $hour = date( "g", $actual_date );
 78+ $hour = date( 'g', $actual_date );
6979 }
70 - $minute = date( "i", $actual_date );
71 - $second = date( "s", $actual_date );
72 - if ( ! $sfg24HourTime ) {
73 - $ampm24h = date( "A", $actual_date );
 80+ $minute = date( 'i', $actual_date );
 81+ $second = date( 's', $actual_date );
 82+ if ( !$sfg24HourTime ) {
 83+ $ampm24h = date( 'A', $actual_date );
7484 }
75 - $timezone = date( "T", $actual_date );
 85+ $timezone = date( 'T', $actual_date );
7686 // Restore back to the server's timezone.
7787 if ( $datetime == 'now' ) {
7888 if ( isset( $wgLocaltimezone ) ) {
@@ -83,20 +93,20 @@
8494 $cur_date = getdate();
8595 $hour = null;
8696 $minute = null;
87 - $second = "00"; // default at least this value
88 - $ampm24h = "";
89 - $timezone = "";
 97+ $second = '00'; // default at least this value
 98+ $ampm24h = '';
 99+ $timezone = '';
90100 }
91101
92102 $text = parent::getMainHTML( $datetime, $input_name, $is_mandatory, $is_disabled, $other_args );
93 - $disabled_text = ( $is_disabled ) ? "disabled" : "";
 103+ $disabled_text = ( $is_disabled ) ? 'disabled' : '';
94104 $text .= ' &#160;<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[hour]" type="text" value="' . $hour . '" size="2"/ ' . $disabled_text . '>';
95105 $sfgTabIndex++;
96106 $text .= ' :<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[minute]" type="text" value="' . $minute . '" size="2"/ ' . $disabled_text . '>';
97107 $sfgTabIndex++;
98108 $text .= ':<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '[second]" type="text" value="' . $second . '" size="2"/ ' . $disabled_text . '>' . "\n";
99109
100 - if ( ! $sfg24HourTime ) {
 110+ if ( !$sfg24HourTime ) {
101111 $sfgTabIndex++;
102112 $text .= ' <select tabindex="' . $sfgTabIndex . '" name="' . $input_name . "[ampm24h]\" $disabled_text>\n";
103113 $ampm24h_options = array( '', 'AM', 'PM' );
@@ -118,7 +128,11 @@
119129
120130 public static function getParameters() {
121131 $params = parent::getParameters();
122 - $params[] = array( 'name' => 'include timezone', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_includetimezone' ) );
 132+ $params[] = array(
 133+ 'name' => 'include timezone',
 134+ 'type' => 'boolean',
 135+ 'description' => wfMsg( 'sf_forminputs_includetimezone' )
 136+ );
123137 return $params;
124138 }
125139
@@ -126,6 +140,12 @@
127141 * Returns the HTML code to be included in the output page for this input.
128142 */
129143 public function getHtmlText() {
130 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 144+ return self::getHTML(
 145+ $this->mCurrentValue,
 146+ $this->mInputName,
 147+ $this->mIsMandatory,
 148+ $this->mIsDisabled,
 149+ $mOtherArgs
 150+ );
131151 }
132152 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DropdownInput.php
@@ -33,13 +33,13 @@
3434 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
3535 global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
3636
37 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
 37+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
3838 if ( array_key_exists( 'class', $other_args ) ) {
39 - $className .= " " . $other_args['class'];
 39+ $className .= ' ' . $other_args['class'];
4040 }
4141 $input_id = "input_$sfgFieldNum";
4242 if ( array_key_exists( 'show on select', $other_args ) ) {
43 - $className .= " sfShowIfSelected";
 43+ $className .= ' sfShowIfSelected';
4444 foreach ( $other_args['show on select'] as $div_id => $options ) {
4545 if ( array_key_exists( $input_id, $sfgShowOnSelect ) ) {
4646 $sfgShowOnSelect[$input_id][] = array( $options, $div_id );
@@ -48,12 +48,12 @@
4949 }
5050 }
5151 }
52 - $innerDropdown = "";
 52+ $innerDropdown = '';
5353 // Add a blank value at the beginning, unless this is a
5454 // mandatory field and there's a current value in place
5555 // (either through a default value or because we're editing
5656 // an existing page).
57 - if ( ! $is_mandatory || $cur_value == '' ) {
 57+ if ( !$is_mandatory || $cur_value == '' ) {
5858 $innerDropdown .= " <option value=\"\"></option>\n";
5959 }
6060 if ( ( $possible_values = $other_args['possible_values'] ) == null ) {
@@ -73,7 +73,12 @@
7474 if ( $possible_value == $cur_value ) {
7575 $optionAttrs['selected'] = "selected";
7676 }
77 - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) ) {
 77+ if (
 78+ array_key_exists( 'value_labels', $other_args ) &&
 79+ is_array( $other_args['value_labels'] ) &&
 80+ array_key_exists( $possible_value, $other_args['value_labels'] )
 81+ )
 82+ {
7883 $label = $other_args['value_labels'][$possible_value];
7984 } else {
8085 $label = $possible_value;
@@ -90,8 +95,10 @@
9196 $selectAttrs['disabled'] = 'disabled';
9297 }
9398 $text = Xml::tags( 'select', $selectAttrs, $innerDropdown );
94 - $spanClass = "inputSpan";
95 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 99+ $spanClass = 'inputSpan';
 100+ if ( $is_mandatory ) {
 101+ $spanClass .= ' mandatoryFieldSpan';
 102+ }
96103 $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
97104 return $text;
98105 }
@@ -100,6 +107,12 @@
101108 * Returns the HTML code to be included in the output page for this input.
102109 */
103110 public function getHtmlText() {
104 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 111+ return self::getHTML(
 112+ $this->mCurrentValue,
 113+ $this->mInputName,
 114+ $this->mIsMandatory,
 115+ $this->mIsDisabled,
 116+ $mOtherArgs
 117+ );
105118 }
106119 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_YearInput.php
@@ -43,11 +43,31 @@
4444
4545 public static function getParameters() {
4646 $params = array();
47 - $params[] = array( 'name' => 'mandatory', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_mandatory' ) );
48 - $params[] = array( 'name' => 'restricted', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_restricted' ) );
49 - $params[] = array( 'name' => 'class', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_class' ) );
50 - $params[] = array( 'name' => 'default', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_default' ) );
51 - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) );
 47+ $params[] = array(
 48+ 'name' => 'mandatory',
 49+ 'type' => 'boolean',
 50+ 'description' => wfMsg( 'sf_forminputs_mandatory' )
 51+ );
 52+ $params[] = array(
 53+ 'name' => 'restricted',
 54+ 'type' => 'boolean',
 55+ 'description' => wfMsg( 'sf_forminputs_restricted' )
 56+ );
 57+ $params[] = array(
 58+ 'name' => 'class',
 59+ 'type' => 'string',
 60+ 'description' => wfMsg( 'sf_forminputs_class' )
 61+ );
 62+ $params[] = array(
 63+ 'name' => 'default',
 64+ 'type' => 'string',
 65+ 'description' => wfMsg( 'sf_forminputs_default' )
 66+ );
 67+ $params[] = array(
 68+ 'name' => 'size',
 69+ 'type' => 'int',
 70+ 'description' => wfMsg( 'sf_forminputs_size' )
 71+ );
5272 return $params;
5373 }
5474
@@ -55,6 +75,12 @@
5676 * Returns the HTML code to be included in the output page for this input.
5777 */
5878 public function getHtmlText() {
59 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 79+ return self::getHTML(
 80+ $this->mCurrentValue,
 81+ $this->mInputName,
 82+ $this->mIsMandatory,
 83+ $this->mIsDisabled,
 84+ $mOtherArgs
 85+ );
6086 }
6187 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextWithAutocompleteInput.php
@@ -101,12 +101,12 @@
102102 $autocompleteSettings = $autocompletionSource;
103103 $is_list = ( array_key_exists( 'is_list', $field_args ) && $field_args['is_list'] == true );
104104 if ( $is_list ) {
105 - $autocompleteSettings .= ",list";
 105+ $autocompleteSettings .= ',list';
106106 if ( array_key_exists( 'delimiter', $field_args ) ) {
107107 $delimiter = $field_args['delimiter'];
108 - $autocompleteSettings .= "," . $delimiter;
 108+ $autocompleteSettings .= ',' . $delimiter;
109109 } else {
110 - $delimiter = ",";
 110+ $delimiter = ',';
111111 }
112112 } else {
113113 $delimiter = null;
@@ -144,17 +144,18 @@
145145
146146 list( $autocompleteSettings, $remoteDataType, $delimiter ) = self::setAutocompleteValues( $other_args );
147147
148 - $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput";
149 - if ( array_key_exists( 'class', $other_args ) )
150 - $className .= " " . $other_args['class'];
151 - $input_id = "input_" . $sfgFieldNum;
 148+ $className = ( $is_mandatory ) ? 'autocompleteInput mandatoryField' : 'autocompleteInput createboxInput';
 149+ if ( array_key_exists( 'class', $other_args ) ) {
 150+ $className .= ' ' . $other_args['class'];
 151+ }
 152+ $input_id = 'input_' . $sfgFieldNum;
152153
153154 if ( array_key_exists( 'size', $other_args ) ) {
154155 $size = $other_args['size'];
155156 } elseif ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] ) {
156 - $size = "100";
 157+ $size = '100';
157158 } else {
158 - $size = "35";
 159+ $size = '35';
159160 }
160161
161162 $inputAttrs = array(
@@ -182,13 +183,15 @@
183184 if ( array_key_exists( 'default filename', $other_args ) ) {
184185 $default_filename = $other_args['default filename'];
185186 } else {
186 - $default_filename = "";
 187+ $default_filename = '';
187188 }
188189 $text .= self::uploadLinkHTML( $input_id, $delimiter, $default_filename );
189190 }
190191
191 - $spanClass = "inputSpan";
192 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 192+ $spanClass = 'inputSpan';
 193+ if ( $is_mandatory ) {
 194+ $spanClass .= ' mandatoryFieldSpan';
 195+ }
193196 $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text );
194197
195198 return $text;
@@ -196,10 +199,26 @@
197200
198201 public static function getAutocompletionParameters() {
199202 $params = SFEnumInput::getValuesParameters();
200 - $params[] = array( 'name' => 'values from url', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromurl' ) );
201 - $params[] = array( 'name' => 'remote autocompletion', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_remoteautocompletion' ) );
202 - $params[] = array( 'name' => 'list', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_list' ) );
203 - $params[] = array( 'name' => 'delimiter', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_delimiter' ) );
 203+ $params[] = array(
 204+ 'name' => 'values from url',
 205+ 'type' => 'string',
 206+ 'description' => wfMsg( 'sf_forminputs_valuesfromurl' )
 207+ );
 208+ $params[] = array(
 209+ 'name' => 'remote autocompletion',
 210+ 'type' => 'boolean',
 211+ 'description' => wfMsg( 'sf_forminputs_remoteautocompletion' )
 212+ );
 213+ $params[] = array(
 214+ 'name' => 'list',
 215+ 'type' => 'boolean',
 216+ 'description' => wfMsg( 'sf_forminputs_list' )
 217+ );
 218+ $params[] = array(
 219+ 'name' => 'delimiter',
 220+ 'type' => 'string',
 221+ 'description' => wfMsg( 'sf_forminputs_delimiter' )
 222+ );
204223 return $params;
205224 }
206225
@@ -213,6 +232,12 @@
214233 * Returns the HTML code to be included in the output page for this input.
215234 */
216235 public function getHtmlText() {
217 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 236+ return self::getHTML(
 237+ $this->mCurrentValue,
 238+ $this->mInputName,
 239+ $this->mIsMandatory,
 240+ $this->mIsDisabled,
 241+ $mOtherArgs
 242+ );
218243 }
219244 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.php
@@ -36,7 +36,6 @@
3737 private $mJsInitFunctionData = array();
3838 private $mJsValidationFunctionData = array();
3939
40 -
4140 /**
4241 * Constructor for the SFFormInput class.
4342 *
@@ -53,13 +52,11 @@
5453 * An associative array of other parameters that were present in the
5554 * input definition.
5655 */
57 - public function __construct ( $input_number, $cur_value, $input_name, $other_args ) {
58 -
 56+ public function __construct( $input_number, $cur_value, $input_name, $other_args ) {
5957 $this->mInputNumber = $input_number;
6058 $this->mCurrentValue = $cur_value;
6159 $this->mInputName = $input_name;
6260 $this->mOtherArgs = $other_args;
63 -
6461 }
6562
6663 /**
@@ -92,11 +89,31 @@
9390 */
9491 public static function getParameters() {
9592 $params = array();
96 - $params[] = array( 'name' => 'mandatory', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_mandatory' ) );
97 - $params[] = array( 'name' => 'restricted', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_restricted' ) );
98 - $params[] = array( 'name' => 'class', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_class' ) );
99 - $params[] = array( 'name' => 'property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_property' ) );
100 - $params[] = array( 'name' => 'default', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_default' ) );
 93+ $params[] = array(
 94+ 'name' => 'mandatory',
 95+ 'type' => 'boolean',
 96+ 'description' => wfMsg( 'sf_forminputs_mandatory' )
 97+ );
 98+ $params[] = array(
 99+ 'name' => 'restricted',
 100+ 'type' => 'boolean',
 101+ 'description' => wfMsg( 'sf_forminputs_restricted' )
 102+ );
 103+ $params[] = array(
 104+ 'name' => 'class',
 105+ 'type' => 'string',
 106+ 'description' => wfMsg( 'sf_forminputs_class' )
 107+ );
 108+ $params[] = array(
 109+ 'name' => 'property',
 110+ 'type' => 'string',
 111+ 'description' => wfMsg( 'sf_forminputs_property' )
 112+ );
 113+ $params[] = array(
 114+ 'name' => 'default',
 115+ 'type' => 'string',
 116+ 'description' => wfMsg( 'sf_forminputs_default' )
 117+ );
101118 return $params;
102119 }
103120
@@ -114,7 +131,7 @@
115132 * Returns the HTML code to be included in the output page for this input.
116133 *
117134 * Ideally this HTML code should provide a basic functionality even if the
118 - * browser is not Javascript capable. I.e. even without Javascript the user
 135+ * browser is not JavaScript capable. I.e. even without JavaScript the user
119136 * should be able to input values.
120137 *
121138 * This function is not used yet.
@@ -131,8 +148,8 @@
132149 return false;
133150 }
134151
135 - /**
136 - * Returns the name and parameters for the initialization Javascript
 152+ /**
 153+ * Returns the name and parameters for the initialization JavaScript
137154 * function for this input type, if any.
138155 *
139156 * This function is not used yet.
@@ -142,7 +159,7 @@
143160 }
144161
145162 /**
146 - * Returns the name and parameters for the validation Javascript
 163+ * Returns the name and parameters for the validation JavaScript
147164 * functions for this input type, if any.
148165 *
149166 * This function is not used yet.
@@ -207,14 +224,6 @@
208225 $this->mJsInitFunctionData[] = array( 'name' => $name, 'param' => $param );
209226 }
210227
211 -
212 -
213 -
214 -
215 -
216 -
217 -
218 -
219228 /**
220229 * Returns the set of SMW property types for which this input is
221230 * meant to be the default one - ideally, no more than one input
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_EnumInput.php
@@ -25,18 +25,42 @@
2626
2727 public static function getValuesParameters() {
2828 $params = array();
29 - $params[] = array( 'name' => 'values', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_values' ) );
30 - $params[] = array( 'name' => 'values from property', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromproperty' ) );
31 - $params[] = array( 'name' => 'values from category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromcategory' ) );
32 - $params[] = array( 'name' => 'values from namespace', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromnamespace' ) );
33 - $params[] = array( 'name' => 'values from concept', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_valuesfromconcept' ) );
 29+ $params[] = array(
 30+ 'name' => 'values',
 31+ 'type' => 'string',
 32+ 'description' => wfMsg( 'sf_forminputs_values' )
 33+ );
 34+ $params[] = array(
 35+ 'name' => 'values from property',
 36+ 'type' => 'string',
 37+ 'description' => wfMsg( 'sf_forminputs_valuesfromproperty' )
 38+ );
 39+ $params[] = array(
 40+ 'name' => 'values from category',
 41+ 'type' => 'string',
 42+ 'description' => wfMsg( 'sf_forminputs_valuesfromcategory' )
 43+ );
 44+ $params[] = array(
 45+ 'name' => 'values from namespace',
 46+ 'type' => 'string',
 47+ 'description' => wfMsg( 'sf_forminputs_valuesfromnamespace' )
 48+ );
 49+ $params[] = array(
 50+ 'name' => 'values from concept',
 51+ 'type' => 'string',
 52+ 'description' => wfMsg( 'sf_forminputs_valuesfromconcept' )
 53+ );
3454 return $params;
3555 }
3656
3757 public static function getParameters() {
3858 $params = parent::getParameters();
3959 $params = array_merge( $params, self::getValuesParameters() );
40 - $params[] = array( 'name' => 'show on select', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_showonselect' ) );
 60+ $params[] = array(
 61+ 'name' => 'show on select',
 62+ 'type' => 'string',
 63+ 'description' => wfMsg( 'sf_forminputs_showonselect' )
 64+ );
4165 return $params;
4266 }
4367 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php
@@ -34,25 +34,25 @@
3535
3636 global $sfgTabIndex, $sfgFieldNum;
3737
38 - $className = "sfComboBox";
 38+ $className = 'sfComboBox';
3939 if ( $is_mandatory ) {
40 - $className .= " mandatoryField";
 40+ $className .= ' mandatoryField';
4141 }
4242 if ( array_key_exists( 'class', $other_args ) ) {
43 - $className .= " " . $other_args['class'];
 43+ $className .= ' ' . $other_args['class'];
4444 }
45 - $disabled_text = ( $is_disabled ) ? "disabled" : "";
 45+ $disabled_text = ( $is_disabled ) ? 'disabled' : '';
4646
4747 if ( array_key_exists( 'size', $other_args ) ) {
4848 $size = $other_args['size'];
4949 } else {
50 - $size = "35";
 50+ $size = '35';
5151 }
5252 // There's no direct correspondence between the 'size='
5353 // attribute for text inputs and the number of pixels, but
5454 // multiplying by 6 seems to be about right for the major
5555 // browsers.
56 - $pixel_width = $size * 6 . "px";
 56+ $pixel_width = $size * 6 . 'px';
5757
5858 list( $autocompleteFieldType, $autocompletionSource ) =
5959 SFTextWithAutocompleteInput::getAutocompletionTypeAndSource( $other_args );
@@ -87,17 +87,27 @@
8888 }
8989 $selectText = Xml::tags( 'select', $selectAttrs, $optionsText );
9090
91 - $divClass = "ui-widget";
92 - if ( $is_mandatory ) { $divClass .= " mandatory"; }
 91+ $divClass = 'ui-widget';
 92+ if ( $is_mandatory ) {
 93+ $divClass .= ' mandatory';
 94+ }
9395 $text = Xml::tags( 'div', array( 'class' => $divClass ), $selectText );
9496 return $text;
9597 }
9698
9799 public static function getParameters() {
98100 $params = parent::getParameters();
99 - $params[] = array( 'name' => 'size', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_size' ) );
 101+ $params[] = array(
 102+ 'name' => 'size',
 103+ 'type' => 'int',
 104+ 'description' => wfMsg( 'sf_forminputs_size' )
 105+ );
100106 $params = array_merge( $params, SFEnumInput::getValuesParameters() );
101 - $params[] = array( 'name' => 'existing values only', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_existingvaluesonly' ) );
 107+ $params[] = array(
 108+ 'name' => 'existing values only',
 109+ 'type' => 'boolean',
 110+ 'description' => wfMsg( 'sf_forminputs_existingvaluesonly' )
 111+ );
102112 return $params;
103113 }
104114
@@ -105,6 +115,12 @@
106116 * Returns the HTML code to be included in the output page for this input.
107117 */
108118 public function getHtmlText() {
109 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 119+ return self::getHTML(
 120+ $this->mCurrentValue,
 121+ $this->mInputName,
 122+ $this->mIsMandatory,
 123+ $this->mIsDisabled,
 124+ $mOtherArgs
 125+ );
110126 }
111127 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php
@@ -26,14 +26,16 @@
2727
2828 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
2929 // escape if CategoryTree extension isn't included
30 - if ( ! function_exists( 'efCategoryTreeParserHook' ) )
 30+ if ( !function_exists( 'efCategoryTreeParserHook' ) ) {
3131 return null;
 32+ }
3233
3334 global $sfgTabIndex, $sfgFieldNum;
3435
35 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
36 - if ( array_key_exists( 'class', $other_args ) )
37 - $className .= " " . $other_args['class'];
 36+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
 37+ if ( array_key_exists( 'class', $other_args ) ) {
 38+ $className .= ' ' . $other_args['class'];
 39+ }
3840 if ( array_key_exists( 'top category', $other_args ) ) {
3941 $top_category = $other_args['top category'];
4042 } else {
@@ -44,12 +46,12 @@
4547 if ( array_key_exists( 'height', $other_args ) ) {
4648 $height = $other_args['height'];
4749 } else {
48 - $height = "100";
 50+ $height = '100';
4951 }
5052 if ( array_key_exists( 'width', $other_args ) ) {
5153 $width = $other_args['width'];
5254 } else {
53 - $width = "500";
 55+ $width = '500';
5456 }
5557
5658 $text = '<div style="overflow: auto; padding: 5px; border: 1px #aaaaaa solid; max-height: ' . $height . 'px; width: ' . $width . 'px;">';
@@ -58,12 +60,12 @@
5961 // mandatory field and there's a current value in place
6062 // (either through a default value or because we're editing
6163 // an existing page)
62 - if ( ! $is_mandatory || $cur_value == '' ) {
 64+ if ( !$is_mandatory || $cur_value == '' ) {
6365 $text .= ' <input type="radio" tabindex="' . $sfgTabIndex . '" name="' . $input_name . '" value=""';
64 - if ( ! $cur_value ) {
 66+ if ( !$cur_value ) {
6567 $text .= ' checked="checked"';
6668 }
67 - $disabled_text = ( $is_disabled ) ? "disabled" : "";
 69+ $disabled_text = ( $is_disabled ) ? 'disabled' : '';
6870 $text .= " $disabled_text/> <em>" . wfMsg( 'sf_formedit_none' ) . "</em>\n";
6971 }
7072
@@ -86,7 +88,12 @@
8789 $cur_value = $wgContLang->ucfirst( $cur_value );
8890 }
8991
90 - $tree = preg_replace( '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', '<input tabindex="' . $sfgTabIndex . '" name="' . $input_name . '" value="$2" type="radio"> $1$2$3', $tree );
 92+ $tree = preg_replace(
 93+ '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/',
 94+ '<input tabindex="' . $sfgTabIndex . '" name="' . $input_name .
 95+ '" value="$2" type="radio"> $1$2$3',
 96+ $tree
 97+ );
9198 $tree = str_replace( "value=\"$cur_value\"", "value=\"$cur_value\" checked=\"checked\"", $tree );
9299 // if it's disabled, set all to disabled
93100 if ( $is_disabled ) {
@@ -94,12 +101,19 @@
95102 }
96103
97104 // Get rid of all the 'no subcategories' messages.
98 - $tree = str_replace( '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' . wfMsg( 'categorytree-no-subcategories' ) . '</i></div>', '', $tree );
 105+ $tree = str_replace(
 106+ '<div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">' .
 107+ wfMsg( 'categorytree-no-subcategories' ) . '</i></div>',
 108+ '',
 109+ $tree
 110+ );
99111
100112 $text .= $tree . '</div>';
101113
102 - $spanClass = "radioButtonSpan";
103 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 114+ $spanClass = 'radioButtonSpan';
 115+ if ( $is_mandatory ) {
 116+ $spanClass .= ' mandatoryFieldSpan';
 117+ }
104118 $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
105119
106120 return $text;
@@ -107,10 +121,26 @@
108122
109123 public static function getParameters() {
110124 $params = parent::getParameters();
111 - $params[] = array( 'name' => 'top category', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_topcategory' ) );
112 - $params[] = array( 'name' => 'hideroot', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_hideroot' ) );
113 - $params[] = array( 'name' => 'height', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_height' ) );
114 - $params[] = array( 'name' => 'width', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_width' ) );
 125+ $params[] = array(
 126+ 'name' => 'top category',
 127+ 'type' => 'string',
 128+ 'description' => wfMsg( 'sf_forminputs_topcategory' )
 129+ );
 130+ $params[] = array(
 131+ 'name' => 'hideroot',
 132+ 'type' => 'boolean',
 133+ 'description' => wfMsg( 'sf_forminputs_hideroot' )
 134+ );
 135+ $params[] = array(
 136+ 'name' => 'height',
 137+ 'type' => 'int',
 138+ 'description' => wfMsg( 'sf_forminputs_height' )
 139+ );
 140+ $params[] = array(
 141+ 'name' => 'width',
 142+ 'type' => 'int',
 143+ 'description' => wfMsg( 'sf_forminputs_width' )
 144+ );
115145 return $params;
116146 }
117147
@@ -118,6 +148,12 @@
119149 * Returns the HTML code to be included in the output page for this input.
120150 */
121151 public function getHtmlText() {
122 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 152+ return self::getHTML(
 153+ $this->mCurrentValue,
 154+ $this->mInputName,
 155+ $this->mIsMandatory,
 156+ $this->mIsDisabled,
 157+ $mOtherArgs
 158+ );
123159 }
124160 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php
@@ -27,11 +27,11 @@
2828 public static function monthDropdownHTML( $cur_month, $input_name, $is_disabled ) {
2929 global $sfgTabIndex, $wgAmericanDates;
3030
31 - $optionsText = "";
 31+ $optionsText = '';
3232 $month_names = SFFormUtils::getMonthNames();
3333 foreach ( $month_names as $i => $name ) {
3434 // pad out month to always be two digits
35 - $month_value = ( $wgAmericanDates == true ) ? $name : str_pad( $i + 1, 2, "0", STR_PAD_LEFT );
 35+ $month_value = ( $wgAmericanDates == true ) ? $name : str_pad( $i + 1, 2, '0', STR_PAD_LEFT );
3636 $optionAttrs = array ( 'value' => $month_value );
3737 if ( $name == $cur_month || ( $i + 1 ) == $cur_month ) {
3838 $optionAttrs['selected'] = 'selected';
@@ -81,7 +81,9 @@
8282 $year = $actual_date->getYear();
8383 // TODO - the code to convert from negative to
8484 // BC notation should be in SMW itself.
85 - if ( $year < 0 ) { $year = ( $year * - 1 + 1 ) . " BC"; }
 85+ if ( $year < 0 ) {
 86+ $year = ( $year * - 1 + 1 ) . ' BC';
 87+ }
8688 $month = $actual_date->getMonth();
8789 $day = $actual_date->getDay();
8890 }
@@ -92,7 +94,7 @@
9395 $day = null; // no need for day
9496 }
9597 $text = "";
96 - $disabled_text = ( $is_disabled ) ? "disabled" : "";
 98+ $disabled_text = ( $is_disabled ) ? 'disabled' : '';
9799 $monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled );
98100 $dayInput = ' <input tabindex="' . $sfgTabIndex . '" class="dayInput" name="' . $input_name . '[day]" type="text" value="' . $day . '" size="2" ' . $disabled_text . '/>';
99101 if ( $wgAmericanDates ) {
@@ -106,8 +108,10 @@
107109
108110 public static function getHTML( $date, $input_name, $is_mandatory, $is_disabled, $other_args ) {
109111 $text = self::getMainHTML( $date, $input_name, $is_mandatory, $is_disabled, $other_args );
110 - $spanClass = "dateInput";
111 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 112+ $spanClass = 'dateInput';
 113+ if ( $is_mandatory ) {
 114+ $spanClass .= ' mandatoryFieldSpan';
 115+ }
112116 $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
113117 return $text;
114118 }
@@ -116,6 +120,12 @@
117121 * Returns the HTML code to be included in the output page for this input.
118122 */
119123 public function getHtmlText() {
120 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 124+ return self::getHTML(
 125+ $this->mCurrentValue,
 126+ $this->mInputName,
 127+ $this->mIsMandatory,
 128+ $this->mIsDisabled,
 129+ $mOtherArgs
 130+ );
121131 }
122132 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php
@@ -35,12 +35,12 @@
3636 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
3737 global $sfgTabIndex, $sfgFieldNum;
3838
39 - $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
 39+ $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
4040 if ( array_key_exists( 'class', $other_args ) ) {
4141 $className .= " " . $other_args['class'];
4242 }
4343 // Use a special ID for the free text field, for FCK's needs.
44 - $input_id = $input_name == "free_text" ? "free_text" : "input_$sfgFieldNum";
 44+ $input_id = $input_name == 'free_text' ? 'free_text' : "input_$sfgFieldNum";
4545
4646 if ( array_key_exists( 'rows', $other_args ) ) {
4747 $rows = $other_args['rows'];
@@ -63,7 +63,7 @@
6464 if ( array_key_exists( 'cols', $other_args ) ) {
6565 $textarea_attrs['cols'] = $other_args['cols'];
6666 } else {
67 - $textarea_attrs['style'] = "width: 100%";
 67+ $textarea_attrs['style'] = 'width: 100%';
6868 }
6969
7070 if ( $is_disabled ) {
@@ -88,19 +88,41 @@
8989 $cur_value = '';
9090 }
9191 $text = Xml::element( 'textarea', $textarea_attrs, $cur_value, false );
92 - $spanClass = "inputSpan";
93 - if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
 92+ $spanClass = 'inputSpan';
 93+ if ( $is_mandatory ) {
 94+ $spanClass .= ' mandatoryFieldSpan';
 95+ }
9496 $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
9597 return $text;
9698 }
9799
98100 public static function getParameters() {
99101 $params = parent::getParameters();
100 - $params[] = array( 'name' => 'preload', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_preload' ) );
101 - $params[] = array( 'name' => 'rows', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_rows' ) );
102 - $params[] = array( 'name' => 'cols', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_cols' ) );
103 - $params[] = array( 'name' => 'maxlength', 'type' => 'int', 'description' => wfMsg( 'sf_forminputs_maxlength' ) );
104 - $params[] = array( 'name' => 'autogrow', 'type' => 'boolean', 'description' => wfMsg( 'sf_forminputs_autogrow' ) );
 102+ $params[] = array(
 103+ 'name' => 'preload',
 104+ 'type' => 'string',
 105+ 'description' => wfMsg( 'sf_forminputs_preload' )
 106+ );
 107+ $params[] = array(
 108+ 'name' => 'rows',
 109+ 'type' => 'int',
 110+ 'description' => wfMsg( 'sf_forminputs_rows' )
 111+ );
 112+ $params[] = array(
 113+ 'name' => 'cols',
 114+ 'type' => 'int',
 115+ 'description' => wfMsg( 'sf_forminputs_cols' )
 116+ );
 117+ $params[] = array(
 118+ 'name' => 'maxlength',
 119+ 'type' => 'int',
 120+ 'description' => wfMsg( 'sf_forminputs_maxlength' )
 121+ );
 122+ $params[] = array(
 123+ 'name' => 'autogrow',
 124+ 'type' => 'boolean',
 125+ 'description' => wfMsg( 'sf_forminputs_autogrow' )
 126+ );
105127 return $params;
106128 }
107129
@@ -108,6 +130,12 @@
109131 * Returns the HTML code to be included in the output page for this input.
110132 */
111133 public function getHtmlText() {
112 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 134+ return self::getHTML(
 135+ $this->mCurrentValue,
 136+ $this->mInputName,
 137+ $this->mIsMandatory,
 138+ $this->mIsDisabled,
 139+ $mOtherArgs
 140+ );
113141 }
114142 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CheckboxesInput.php
@@ -34,29 +34,37 @@
3535 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
3636 global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
3737
38 - $checkbox_class = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
39 - $span_class = "checkboxSpan";
40 - if ( array_key_exists( 'class', $other_args ) )
41 - $span_class .= " " . $other_args['class'];
 38+ $checkbox_class = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
 39+ $span_class = 'checkboxSpan';
 40+ if ( array_key_exists( 'class', $other_args ) ) {
 41+ $span_class .= ' ' . $other_args['class'];
 42+ }
4243 $input_id = "input_$sfgFieldNum";
4344 // get list delimiter - default is comma
4445 if ( array_key_exists( 'delimiter', $other_args ) ) {
4546 $delimiter = $other_args['delimiter'];
4647 } else {
47 - $delimiter = ",";
 48+ $delimiter = ',';
4849 }
4950 $cur_values = SFUtils::getValuesArray( $cur_value, $delimiter );
5051
51 - if ( ( $possible_values = $other_args['possible_values'] ) == null )
 52+ if ( ( $possible_values = $other_args['possible_values'] ) == null ) {
5253 $possible_values = array();
53 - $text = "";
 54+ }
 55+ $text = '';
5456 foreach ( $possible_values as $key => $possible_value ) {
55 - $cur_input_name = $input_name . "[" . $key . "]";
 57+ $cur_input_name = $input_name . '[' . $key . ']';
5658
57 - if ( array_key_exists( 'value_labels', $other_args ) && is_array( $other_args['value_labels'] ) && array_key_exists( $possible_value, $other_args['value_labels'] ) )
 59+ if (
 60+ array_key_exists( 'value_labels', $other_args ) &&
 61+ is_array( $other_args['value_labels'] ) &&
 62+ array_key_exists( $possible_value, $other_args['value_labels'] )
 63+ )
 64+ {
5865 $label = $other_args['value_labels'][$possible_value];
59 - else
 66+ } else {
6067 $label = $possible_value;
 68+ }
6169
6270 $checkbox_attrs = array(
6371 'type' => 'checkbox',
@@ -84,13 +92,13 @@
8593 }
8694
8795 $outerSpanID = "span_$sfgFieldNum";
88 - $outerSpanClass = "checkboxesSpan";
 96+ $outerSpanClass = 'checkboxesSpan';
8997 if ( $is_mandatory ) {
90 - $outerSpanClass .= " mandatoryFieldSpan";
 98+ $outerSpanClass .= ' mandatoryFieldSpan';
9199 }
92100
93101 if ( array_key_exists( 'show on select', $other_args ) ) {
94 - $outerSpanClass .= " sfShowIfChecked";
 102+ $outerSpanClass .= ' sfShowIfChecked';
95103 foreach ( $other_args['show on select'] as $div_id => $options ) {
96104 if ( array_key_exists( $outerSpanID, $sfgShowOnSelect ) ) {
97105 $sfgShowOnSelect[$outerSpanID][] = array( $options, $div_id );
@@ -111,6 +119,12 @@
112120 * Returns the HTML code to be included in the output page for this input.
113121 */
114122 public function getHtmlText() {
115 - return self::getHTML( $this -> mCurrentValue, $this -> mInputName, $this -> mIsMandatory, $this -> mIsDisabled, $mOtherArgs );
 123+ return self::getHTML(
 124+ $this->mCurrentValue,
 125+ $this->mInputName,
 126+ $this->mIsMandatory,
 127+ $this->mIsDisabled,
 128+ $mOtherArgs
 129+ );
116130 }
117131 }
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_MultiEnumInput.php
@@ -29,7 +29,11 @@
3030
3131 public static function getParameters() {
3232 $params = parent::getParameters();
33 - $params[] = array( 'name' => 'delimiter', 'type' => 'string', 'description' => wfMsg( 'sf_forminputs_delimiter' ) );
 33+ $params[] = array(
 34+ 'name' => 'delimiter',
 35+ 'type' => 'string',
 36+ 'description' => wfMsg( 'sf_forminputs_delimiter' )
 37+ );
3438 return $params;
3539 }
3640 }