r106565 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106564‎ | r106565 | r106566 >
Date:15:10, 18 December 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Stylize
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_AutoeditAPI.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormEditPage.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormLinker.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_PageSchemas.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.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)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormEditPage.php
@@ -1,7 +1,7 @@
22 <?php
33 /**
44 * Contains Form Edit Page inheriting from EditPage
5 - *
 5+ *
66 * @author Daniel Friesen
77 * @author Yaron Koren
88 * @file
@@ -25,7 +25,7 @@
2626 $this->form = Title::makeTitleSafe( SF_NS_FORM, $form_name );
2727 $this->form_name = $form_name;
2828 }
29 -
 29+
3030 protected function isSectionEditSupported() {
3131 return false; // sections and forms don't mix
3232 }
@@ -43,11 +43,11 @@
4444 if ( $this->textbox1 != null )
4545 parent::displayPreviewArea( $previewOutput );
4646 }
47 -
 47+
4848 protected function importContentFormData( &$request ) {
4949 // @todo This is where $request to save&preview page text should go
5050 }
51 -
 51+
5252 protected function showContentForm() {
5353 $target_title = $this->mArticle->getTitle();
5454 $target_name = SFUtils::titleString( $target_title );
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -208,7 +208,7 @@
209209 * - this might make sense in the SFUtils class, if it's useful in
210210 * other places.
211211 */
212 - function strReplaceFirst( $search, $replace, $subject) {
 212+ function strReplaceFirst( $search, $replace, $subject ) {
213213 $firstChar = strpos( $subject, $search );
214214 if ( $firstChar !== false ) {
215215 $beforeStr = substr( $subject, 0, $firstChar );
@@ -254,7 +254,7 @@
255255
256256 $removeButton = Xml::element( 'input', $attributes );
257257
258 - $text =<<<END
 258+ $text = <<<END
259259 <table>
260260 <tr>
261261 <td>$mainText</td>
@@ -292,7 +292,7 @@
293293 $this->multipleTemplateInstanceTableHTML( $form_is_disabled, $section )
294294 ) . "\n";
295295
296 - } else { //if ( $all_instances_printed ) {
 296+ } else { // if ( $all_instances_printed ) {
297297 // This is the last instance of this
298298 // template - print all the sections
299299 // necessary for adding additional
@@ -304,7 +304,7 @@
305305 ),
306306 $this->multipleTemplateInstanceTableHTML( $form_is_disabled, $section )
307307 ) . "\n";
308 -
 308+
309309 $attributes = array(
310310 'type' => 'button',
311311 'value' => Sanitizer::decodeCharReferences( $add_button_text ),
@@ -338,7 +338,7 @@
339339 global $sfgFieldNum; // used for setting various HTML IDs
340340
341341 wfProfileIn( __METHOD__ );
342 -
 342+
343343 // initialize some variables
344344 $sfgTabIndex = 1;
345345 $sfgFieldNum = 1;
@@ -354,7 +354,7 @@
355355 $new_text = "";
356356 // flag for placing "<onlyinclude>" tags in form output
357357 $onlyinclude_free_text = false;
358 -
 358+
359359 // If we have existing content and we're not in an active replacement
360360 // situation, preserve the original content. We do this because we want
361361 // to pass the original content on IF this is a partial form.
@@ -403,7 +403,7 @@
404404 // permission errors from the start, and use those to determine whether
405405 // the page is editable.
406406 if ( !$is_query ) {
407 - //$userCanEditPage = ( $wgUser->isAllowed( 'edit' ) && $this->mPageTitle->userCan( 'edit' ) );
 407+ // $userCanEditPage = ( $wgUser->isAllowed( 'edit' ) && $this->mPageTitle->userCan( 'edit' ) );
408408 $permissionErrors = $this->mPageTitle->getUserPermissionsErrors( 'edit', $wgUser );
409409 $userCanEditPage = count( $permissionErrors ) == 0;
410410 wfRunHooks( 'sfUserCanEditPage', array( $this->mPageTitle, &$userCanEditPage ) );
@@ -431,9 +431,9 @@
432432 $wgParser->Options( ParserOptions::newFromUser( $wgUser ) );
433433 $wgParser->Title( $this->mPageTitle );
434434 $wgParser->clearState();
435 -
 435+
436436 $form_def = SFFormUtils::getFormDefinition( $wgParser, $form_def, $form_id );
437 -
 437+
438438 // Turn form definition file into an array of sections, one for each
439439 // template definition (plus the first section)
440440 $form_def_sections = array();
@@ -477,14 +477,14 @@
478478 $instance_num = 0;
479479 $all_instances_printed = false;
480480 $strict_parsing = false;
481 -
 481+
482482 // Placeholder name in the form
483483 $curPlaceholder = null;
484 - // Used to store the HTML code of the multiple template, to reinsert it into the right spot
485 - $multipleTemplateString = "";
 484+ // Used to store the HTML code of the multiple template, to reinsert it into the right spot
 485+ $multipleTemplateString = "";
486486 // This array will keep track of all the replaced @<name>@ strings
487 - $placeholderFields = array();
488 -
 487+ $placeholderFields = array();
 488+
489489 for ( $section_num = 0; $section_num < count( $form_def_sections ); $section_num++ ) {
490490 $start_position = 0;
491491 $template_text = "";
@@ -492,9 +492,9 @@
493493 // array doesn't get modified; is it necessary?
494494 $section = " " . $form_def_sections[$section_num];
495495
496 -
497 - $multipleTemplateString="";
498 -
 496+
 497+ $multipleTemplateString = "";
 498+
499499 while ( $brackets_loc = strpos( $section, '{{{', $start_position ) ) {
500500 $brackets_end_loc = strpos( $section, "}}}", $brackets_loc );
501501 $bracketed_string = substr( $section, $brackets_loc + 3, $brackets_end_loc - ( $brackets_loc + 3 ) );
@@ -525,14 +525,14 @@
526526 $template_label = $sub_components[1];
527527 } elseif ( $sub_components[0] == 'add button text' ) {
528528 $add_button_text = $sub_components[1];
529 - } elseif ($sub_components[0] == 'embed in field') {
 529+ } elseif ( $sub_components[0] == 'embed in field' ) {
530530 // Placeholder on form template level. Assume that the template form def
531531 // will have a multiple+placeholder parameters, and get the placeholder value.
532532 // We expect something like TemplateName[fieldName], and convert it to the
533533 // TemplateName___fieldName form used internally.
534534 preg_match( '/\s*(.*)\[(.*)\]\s*/', $sub_components[1], $matches );
535535 $curPlaceholder = ( count( $matches ) > 2 ) ? self::placeholderFormat( $matches[1], $matches[2] ) : null;
536 - unset ($matches);
 536+ unset ( $matches );
537537 }
538538 }
539539 }
@@ -549,13 +549,13 @@
550550 // If $curPlaceholder is set, it means we want to insert a
551551 // multiple template form's HTML into the main form's HTML.
552552 // So, the HTML will be stored in $multipleTemplateString.
553 - if ($allow_multiple) {
 553+ if ( $allow_multiple ) {
554554 $multipleTemplateString .= "\t" . '<div class="multipleTemplateWrapper">' . "\n";
555555 $multipleTemplateString .= "\t" . '<div class="multipleTemplateList">' . "\n";
556556 }
557557 }
558558 if ( $curPlaceholder == null ) {
559 - $form_text .= $multipleTemplateString;
 559+ $form_text .= $multipleTemplateString;
560560 }
561561 $template_text .= "{{" . $template_name;
562562 $all_fields = $tif->getAllFields();
@@ -597,7 +597,7 @@
598598 $matches = array();
599599 $search_pattern = '/{{' . $preg_match_template_str . '\s*[\|}]/i';
600600 $content_str = str_replace( '_', ' ', $existing_page_content );
601 - preg_match($search_pattern, $content_str, $matches, PREG_OFFSET_CAPTURE);
 601+ preg_match( $search_pattern, $content_str, $matches, PREG_OFFSET_CAPTURE );
602602 // is this check necessary?
603603 if ( array_key_exists( 0, $matches ) && array_key_exists( 1, $matches[0] ) ) {
604604 $start_char = $matches[0][1];
@@ -607,7 +607,7 @@
608608 $fields_start_char++;
609609 }
610610 // If the next character is a pipe, skip that too.
611 - if( $existing_page_content[$fields_start_char] == '|' ) {
 611+ if ( $existing_page_content[$fields_start_char] == '|' ) {
612612 $fields_start_char++;
613613 }
614614 $template_contents = array( '0' => '' );
@@ -754,11 +754,11 @@
755755 $semantic_property = null;
756756 $preload_page = null;
757757 $holds_template = false;
758 -
 758+
759759 for ( $i = 2; $i < count( $tag_components ); $i++ ) {
760 -
 760+
761761 $component = trim( $tag_components[$i] );
762 -
 762+
763763 if ( $component == 'mandatory' ) {
764764 $is_mandatory = true;
765765 } elseif ( $component == 'hidden' ) {
@@ -769,10 +769,10 @@
770770 $is_list = true;
771771 } elseif ( $component == 'edittools' ) { // free text only
772772 $free_text_components[] = 'edittools';
773 - }
774 -
 773+ }
 774+
775775 $sub_components = array_map( 'trim', explode( '=', $component, 2 ) );
776 -
 776+
777777 if ( count( $sub_components ) == 1 ) {
778778 // add handling for single-value params, for custom input types
779779 $field_args[$sub_components[0]] = true;
@@ -812,7 +812,7 @@
813813 if ( array_key_exists( $div_id, $show_on_select ) )
814814 $show_on_select[$div_id][] = $option;
815815 else
816 - $show_on_select[$div_id] = array($option);
 816+ $show_on_select[$div_id] = array( $option );
817817 } else {
818818 $show_on_select[$val] = array();
819819 }
@@ -1207,20 +1207,20 @@
12081208
12091209 // Generate a hidden field with a placeholder value that will be replaced
12101210 // by the multiple-instances template output at form submission.
1211 - ////<input type="hidden" value="@replace_Town___mayors@" name="Town[town_mayors]" />
 1211+ //// <input type="hidden" value="@replace_Town___mayors@" name="Town[town_mayors]" />
12121212 if ( $holds_template ) {
1213 - $cur_value = self::makePlaceholderInWikiText( self::placeholderFormat($template_name,$field_name) );
 1213+ $cur_value = self::makePlaceholderInWikiText( self::placeholderFormat( $template_name, $field_name ) );
12141214 }
1215 -
 1215+
12161216 $new_text = $this->formFieldHTML( $form_field, $cur_value );
12171217
1218 - // Add a field just after the hidden field, within the HTML, to locate
 1218+ // Add a field just after the hidden field, within the HTML, to locate
12191219 // where the multiple-templates HTML, stored in $multipleTemplateString,
12201220 // should be inserted.
12211221 if ( $holds_template ) {
12221222 $new_text .= self::makePlaceholderInFormHTML( self::placeholderFormat( $template_name, $field_name ) );
12231223 }
1224 -
 1224+
12251225 // If this field is disabled, add a hidden field holding
12261226 // the value of this field, because disabled inputs for some
12271227 // reason don't submit their value.
@@ -1255,7 +1255,7 @@
12561256 $input_name = $tag_components[1];
12571257 $input_label = null;
12581258 $attr = array();
1259 -
 1259+
12601260 // if it's a query, ignore all standard inputs except run query
12611261 if ( ( $is_query && $input_name != 'run query' ) || ( !$is_query && $input_name == 'run query' ) ) {
12621262 $new_text = "";
@@ -1389,7 +1389,7 @@
13901390 // Note: this cleanup step could also be done with a regexp, instead of
13911391 // keeping a track array (e.g., /@replace_(.*)@/)
13921392 $reptmp = self::makePlaceholderInWikiText( $curPlaceholder );
1393 - if ( $curPlaceholder != null && $data_text && strpos( $data_text, $reptmp, 0 ) !== false) {
 1393+ if ( $curPlaceholder != null && $data_text && strpos( $data_text, $reptmp, 0 ) !== false ) {
13941394 $data_text = preg_replace( '/' . $reptmp . '/', $template_text . $reptmp, $data_text );
13951395 } else {
13961396 $data_text .= $template_text . "\n";
@@ -1441,7 +1441,7 @@
14421442 // re-parsed on the next go.
14431443 $section_num--;
14441444 }
1445 - } else { //if ( $allow_multiple ) {
 1445+ } else { // if ( $allow_multiple ) {
14461446 $form_text .= $section;
14471447 }
14481448 $curPlaceholder = null;
@@ -1451,13 +1451,13 @@
14521452 // Remove all the remaining placeholder
14531453 // tags in the HTML and wiki-text.
14541454 foreach ( $placeholderFields as $stringToReplace ) {
1455 - //remove the @<replacename>@ tags from the data that is submitted
1456 - $data_text = preg_replace('/'.self::makePlaceholderInWikiText( $stringToReplace ).'/', '',$data_text);
1457 -
1458 - //remove the @<insertHTML>@ tags from the generated HTML form
1459 - $form_text = preg_replace( '/' . self::makePlaceholderInFormHTML( $stringToReplace ) . '/', '', $form_text );
 1455+ // remove the @<replacename>@ tags from the data that is submitted
 1456+ $data_text = preg_replace( '/' . self::makePlaceholderInWikiText( $stringToReplace ) . '/', '', $data_text );
 1457+
 1458+ // remove the @<insertHTML>@ tags from the generated HTML form
 1459+ $form_text = preg_replace( '/' . self::makePlaceholderInFormHTML( $stringToReplace ) . '/', '', $form_text );
14601460 }
1461 -
 1461+
14621462 // if it wasn't included in the form definition, add the
14631463 // 'free text' input as a hidden field at the bottom
14641464 if ( ! $free_text_was_included ) {
@@ -1475,8 +1475,8 @@
14761476 $form_text .= SFFormUtils::hiddenFieldHTML( 'partial', 1 );
14771477 } else {
14781478 $free_text = null;
1479 - $existing_page_content = preg_replace( array( '/�\{/m','/\}�/m' ),
1480 - array( '{{','}}' ),
 1479+ $existing_page_content = preg_replace( array( '/�\{/m', '/\}�/m' ),
 1480+ array( '{{', '}}' ),
14811481 $existing_page_content );
14821482 $existing_page_content = preg_replace( '/\{\{\{insertionpoint\}\}\}/', '', $existing_page_content );
14831483 }
Index: trunk/extensions/SemanticForms/includes/SF_AutoeditAPI.php
@@ -2,7 +2,7 @@
33
44 /**
55 * File holding the SFAutoEditAPI class
6 - *
 6+ *
77 * @author Stephan Gambke
88 * @file
99 * @ingroup SemanticForms
@@ -59,12 +59,12 @@
6060 if ( $result === true ) {
6161
6262 $options = $handler->getOptions();
63 - $result = wfMsgReplaceArgs( $oktext, array($options['target'], $options['form']) );
 63+ $result = wfMsgReplaceArgs( $oktext, array( $options['target'], $options['form'] ) );
6464
6565 } else {
6666
67 - $result->setResponseCode('400 Bad Request');
68 - $result = wfMsgReplaceArgs( $errortext, array($result) );
 67+ $result->setResponseCode( '400 Bad Request' );
 68+ $result = wfMsgReplaceArgs( $errortext, array( $result ) );
6969 }
7070
7171 // initialize parser
@@ -78,23 +78,23 @@
7979
8080 if ( $parseroptions == null ) {
8181 $parseroptions = new ParserOptions();
82 - $wgParser->Options($parseroptions);
 82+ $wgParser->Options( $parseroptions );
8383 }
8484
8585 $parseroptions->enableLimitReport( false );
8686
8787
88 - $result = new AjaxResponse($wgParser->parse( $result, $title, $parseroptions )->getText());
89 - $result->setContentType('text/html');
90 -
 88+ $result = new AjaxResponse( $wgParser->parse( $result, $title, $parseroptions )->getText() );
 89+ $result->setContentType( 'text/html' );
 90+
9191 return $result;
9292 }
9393
9494 /**
9595 * Getter/setter for the ApiQuery flag.
96 - *
 96+ *
9797 * If this is set, we are in an API query, else we are in an Ajax query.
98 - *
 98+ *
9999 * @param bool $isApiQuery Optional. The new value
100100 * @return The old value
101101 */
@@ -111,7 +111,7 @@
112112
113113 /**
114114 * Converts an options string into an options array and stores it
115 - *
 115+ *
116116 * @param string $options
117117 * @return the options array
118118 */
@@ -221,13 +221,13 @@
222222
223223 /**
224224 * This method will try to store the data in mOptions.
225 - *
 225+ *
226226 * It will return true on success or an error message on failure.
227227 * The used form and target page will be available in mOptions after
228228 * execution of the method.
229229 *
230230 * This method also sets HTTP response headers according to the result.
231 - *
 231+ *
232232 * @param bool $prefillFromExisting If this is set, existing values in the page will be used to prefill the form.
233233 * @return true or an error message
234234 */
@@ -309,7 +309,7 @@
310310 return $this->reportError( wfMsg( 'sf_autoedit_nosemanticform',
311311 array(
312312 $this->mOptions['target'],
313 - $this->mOptions['form']) )
 313+ $this->mOptions['form'] ) )
314314 );
315315 }
316316 } else {
@@ -320,7 +320,7 @@
321321
322322 ////////////////////////////////////////////////////////////////////////
323323 // Store the modified form
324 - //$wgOut->clearHTML();
 324+ // $wgOut->clearHTML();
325325 $wgRequest = new FauxRequest( $data, true );
326326
327327 // get the MW form
@@ -395,12 +395,12 @@
396396 $this->addToArray( $data, $name, $input->getAttribute( 'value' ) );
397397 break;
398398
399 - //case 'button':
 399+ // case 'button':
400400 case 'hidden':
401401 case 'image':
402402 case 'password':
403 - //case 'reset':
404 - //case 'submit':
 403+ // case 'reset':
 404+ // case 'submit':
405405 case 'text':
406406 $this->addToArray( $data, $name, $input->getAttribute( 'value' ) );
407407 break;
@@ -425,7 +425,7 @@
426426 $values = array();
427427 $options = $select->getElementsByTagName( 'option' );
428428
429 - if ( count( $options ) && (!$select->hasAttribute( "multiple" ) || $options->item( 0 )->hasAttribute( 'selected' ) ) ) {
 429+ if ( count( $options ) && ( !$select->hasAttribute( "multiple" ) || $options->item( 0 )->hasAttribute( 'selected' ) ) ) {
430430 $this->addToArray( $data, $name, $options->item( 0 )->getAttribute( 'value' ) );
431431 }
432432
@@ -486,7 +486,7 @@
487487 // $toplevel: if this is a toplevel value.
488488 private function addToArray( &$array, $key, $value, $toplevel = true ) {
489489 $matches = array();
490 -
 490+
491491 if ( preg_match( '/^([^\[\]]*)\[([^\[\]]*)\](.*)/', $key, $matches ) ) {
492492
493493 // for some reason toplevel keys get their spaces encoded by MW.
@@ -553,7 +553,7 @@
554554 private function reportError( $msg ) {
555555 if ( $this->isApiQuery() ) {
556556 header( 'HTTP/Status: 400 Bad Request' );
557 - $this->getResult()->addValue( null, 'result', array('code' => '400', '*' => $msg) );
 557+ $this->getResult()->addValue( null, 'result', array( 'code' => '400', '*' => $msg ) );
558558 }
559559 return $msg;
560560 }
Index: trunk/extensions/SemanticForms/includes/SF_FormLinker.php
@@ -38,7 +38,7 @@
3939 }
4040 $properties = $store->getInProperties( $value );
4141 $propertyNames = array();
42 - foreach( $properties as $property ) {
 42+ foreach ( $properties as $property ) {
4343 // SMW 1.6+
4444 if ( $property instanceof SMWDIProperty ) {
4545 $property_name = $property->getKey();
@@ -133,11 +133,11 @@
134134 }
135135
136136 global $sfgContLang;
137 -
 137+
138138 $store = smwfGetStore();
139139 $subject = Title::makeTitleSafe( $page_namespace, $page_name );
140140 $form_names = SFUtils::getSMWPropertyValues( $store, $subject, $prop_smw_id );
141 -
 141+
142142 // If we're using a non-English language, check for the English
143143 // string as well.
144144 if ( ! class_exists( 'SF_LanguageEn' ) || ! $sfgContLang instanceof SF_LanguageEn ) {
@@ -205,7 +205,7 @@
206206 }
207207
208208 $fe = SFUtils::getSpecialPage( 'FormEdit' );
209 -
 209+
210210 $fe_url = $fe->getTitle()->getLocalURL();
211211 if ( count( $default_forms ) > 0 ) {
212212 $form_edit_url = $fe_url . "/" . $default_forms[0] . "/" . SFUtils::titleURLString( $target_page_title );
@@ -333,7 +333,7 @@
334334 if ( $title->isSubpage() ) {
335335 return array();
336336 }
337 -
 337+
338338 // If we're still here, just return the default form for the
339339 // namespace, which may well be null.
340340 if ( NS_MAIN === $namespace ) {
Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
@@ -145,10 +145,10 @@
146146 $param_value = explode( "=", $value, 2 );
147147 if ( count( $param_value ) == 2 && $param_value[1] != null ) {
148148 // Handles <Parameter name="size">20</Parameter>
149 - $xml .= '<Parameter name="'.$param_value[0].'">'.$param_value[1].'</Parameter>';
 149+ $xml .= '<Parameter name="' . $param_value[0] . '">' . $param_value[1] . '</Parameter>';
150150 } else {
151151 // Handles <Parameter name="mandatory" />
152 - $xml .= '<Parameter name="'.$param_value[0].'"/>';
 152+ $xml .= '<Parameter name="' . $param_value[0] . '"/>';
153153 }
154154 }
155155 }
@@ -171,7 +171,7 @@
172172 $form_array = array();
173173 $hasExistingValues = false;
174174 if ( !is_null( $pageSchemaObj ) ) {
175 - $form_array = $pageSchemaObj->getObject('semanticforms_Form');
 175+ $form_array = $pageSchemaObj->getObject( 'semanticforms_Form' );
176176 if ( !is_null( $form_array ) ) {
177177 $hasExistingValues = true;
178178 }
@@ -254,7 +254,7 @@
255255 $hasExistingValues = false;
256256 $inputType = null;
257257 if ( !is_null( $psField ) ) {
258 - $fieldValues = $psField->getObject('semanticforms_FormInput');
 258+ $fieldValues = $psField->getObject( 'semanticforms_FormInput' );
259259 if ( !is_null( $fieldValues ) ) {
260260 $hasExistingValues = true;
261261 $inputType = PageSchemas::getValueFromObject( $fieldValues, 'InputType' );
@@ -303,7 +303,7 @@
304304 }
305305
306306 public static function getMainFormInfo( $pageSchemaObj ) {
307 - //return $pageSchemaObj->getObject( 'semanticforms_Form' );
 307+ // return $pageSchemaObj->getObject( 'semanticforms_Form' );
308308 // We don't just call getObject() here, because sometimes, for
309309 // some reason, this gets called before SF registers itself
310310 // with Page Schemas, which means that getObject() would return
@@ -332,7 +332,7 @@
333333 $fieldFormArray = $psField->getObject( 'semanticforms_FormInput' );
334334 if ( !is_null( $fieldFormArray ) ) {
335335 $formField = SFFormField::create( $i, $template_fields[$i] );
336 - foreach ($fieldFormArray as $var => $val ) {
 336+ foreach ( $fieldFormArray as $var => $val ) {
337337 if ( $var == 'InputType' ) {
338338 $formField->setInputType( $val );
339339 } elseif ( $var == 'mandatory' ) {
@@ -379,8 +379,8 @@
380380 public static function getFieldsFromTemplateSchema( $psTemplate ) {
381381 $psFields = $psTemplate->getFields();
382382 $templateFields = array();
383 - foreach( $psFields as $psField ) {
384 - $prop_array = $psField->getObject('semanticmediawiki_Property');
 383+ foreach ( $psFields as $psField ) {
 384+ $prop_array = $psField->getObject( 'semanticmediawiki_Property' );
385385 $propertyName = PageSchemas::getValueFromObject( $prop_array, 'name' );
386386 if ( $psField->getLabel() === '' ) {
387387 $fieldLabel = $psField->getName();
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
@@ -32,7 +32,7 @@
3333 $vars['sfgBadNumberErrorStr'] = wfMsg( 'sf_bad_number_error' );
3434 // This error message isn't currently used, but it might be
3535 // in the future, if SMW begins to support integers again.
36 - //$vars['sfgBadIntegerErrorStr'] = wfMsg( 'sf_bad_integer_error' );
 36+ // $vars['sfgBadIntegerErrorStr'] = wfMsg( 'sf_bad_integer_error' );
3737 $vars['sfgBadDateErrorStr'] = wfMsg( 'sf_bad_date_error' );
3838 $vars['sfgAnonEditWarning'] = wfMsg( 'sf_autoedit_anoneditwarning' );
3939 $vars['sfgSaveAndContinueSummary'] = wfMsg( 'sf_formedit_saveandcontinue_summary', wfMsg( 'sf_formedit_saveandcontinueediting' ) );
@@ -425,7 +425,7 @@
426426 global $wgHooks, $wgExtensionFunctions;
427427
428428 $numRows = isset( $fieldArgs['rows'] ) && $fieldArgs['rows'] > 0 ? $fieldArgs['rows'] : 5;
429 - $FCKEditorHeight = ($wgFCKEditorHeight < 300) ? 300 : $wgFCKEditorHeight;
 429+ $FCKEditorHeight = ( $wgFCKEditorHeight < 300 ) ? 300 : $wgFCKEditorHeight;
430430
431431 $newWinMsg = wfMsg( 'rich_editor_new_window' );
432432 $javascript_text = '
@@ -840,11 +840,11 @@
841841 public static function getFormDefinition( &$parser, &$form_def = null, &$form_id = null ) {
842842
843843 $cachedDef = self::getFormDefinitionFromCache( $form_id, $parser );
844 -
 844+
845845 if ( $cachedDef ) {
846846 return $cachedDef;
847847 }
848 -
 848+
849849 if ( $form_id !== null ) {
850850
851851 $form_article = Article::newFromID( $form_id );
@@ -867,7 +867,7 @@
868868 // us with what we need
869869 $form_def = "__NOEDITSECTION__" . strtr( $form_def, array( '{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>' ) );
870870
871 - $title = is_object( $parser->getTitle() )?$parser->getTitle():new Title();
 871+ $title = is_object( $parser->getTitle() ) ? $parser->getTitle():new Title();
872872
873873 // parse wiki-text
874874 $output = $parser->parse( $form_def, $title, $parser->getOptions() );
@@ -882,7 +882,7 @@
883883 * Get a form definition from cache
884884 */
885885 protected static function getFormDefinitionFromCache ( &$form_id, &$parser ) {
886 -
 886+
887887 global $sfgCacheFormDefinitions;
888888
889889 // use cache if allowed
@@ -900,20 +900,20 @@
901901
902902 wfDebug( "Cache hit: Got form definition $cachekey from cache\n" );
903903 return $cached_def;
904 -
 904+
905905 } else {
906906 wfDebug( "Cache miss: Form definition $cachekey not found in cache\n" );
907907 }
908908 }
909 -
 909+
910910 return null;
911911 }
912 -
 912+
913913 /**
914914 * Store a form definition in cache
915915 */
916916 protected static function cacheFormDefinition ( &$form_id, &$parser, &$output ) {
917 -
 917+
918918 global $sfgCacheFormDefinitions;
919919
920920 // store in cache if allowed
@@ -923,19 +923,19 @@
924924 $cachekey = self::getCacheKey( $form_id, $parser );
925925
926926 if ( $output->getCacheTime() == -1 ) {
927 -
 927+
928928 $form_article = Article::newFromID( $form_id );
929929 self::purgeCache( $form_article );
930930 wfDebug( "Caching disabled for form definition $cachekey\n" );
931 -
 931+
932932 } else {
933933
934934 $cachekeyForForm = self::getCacheKey( $form_id );
935 -
 935+
936936 // update list of form definitions
937937 $arrayOfStoredDatasets = $cache->get( $cachekeyForForm );
938938 $arrayOfStoredDatasets[ $cachekey ] = $cachekey; // just need the key defined, don't care for the value
939 -
 939+
940940 // We cache indefinitely ignoring $wgParserCacheExpireTime.
941941 // The reasoning is that there really is not point in expiring
942942 // rarely changed forms automatically (after one day per
@@ -943,10 +943,10 @@
944944 // form definition.
945945 // A side effect of this is, that there is no need to
946946 // distinguish between MW <1.17 and >=1.17.
947 -
 947+
948948 // store form definition with current user options
949949 $cache->set( $cachekey, $output->getText() );
950 -
 950+
951951 // store updated list of form definitions
952952 $cache->set( $cachekeyForForm, $arrayOfStoredDatasets );
953953
@@ -954,10 +954,10 @@
955955 }
956956
957957 }
958 -
 958+
959959 return null;
960960 }
961 -
 961+
962962 /**
963963 * Deletes the form definition associated with the given wiki page
964964 * from the main cache.
@@ -975,21 +975,21 @@
976976
977977 // get references to stored datasets
978978 $arrayOfStoredDatasets = $cache->get( $cachekeyForForm );
979 -
 979+
980980 if ( $arrayOfStoredDatasets !== false ) {
981 -
 981+
982982 // delete stored datasets
983983 foreach ( $arrayOfStoredDatasets as $key ) {
984984 $cache->delete( $key );
985985 wfDebug( "Deleted cached form definition $key.\n" );
986986 }
987 -
 987+
988988 // delete references to datasets
989989 $cache->delete( $cachekeyForForm );
990990 wfDebug( "Deleted cached form definition references $cachekeyForForm.\n" );
991991 }
992992
993 -
 993+
994994 }
995995
996996 return true;
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -137,7 +137,7 @@
138138 if ( is_callable( array( $wgOut, 'includeJQuery' ) ) ) {
139139 $wgOut->includeJQuery();
140140 }
141 -
 141+
142142 return true;
143143 }
144144
@@ -168,19 +168,19 @@
169169 // - support unlabelled params, for backwards compatibility
170170 // - parse and sanitize all parameter values
171171 foreach ( $params as $i => $param ) {
172 -
 172+
173173 $elements = explode( '=', $param, 2 );
174174
175175 // set param_name and value
176176 if ( count( $elements ) > 1 ) {
177 -
 177+
178178 $param_name = trim( $elements[0] );
179 -
 179+
180180 // parse (and sanitize) parameter values
181181 $value = trim( $parser->recursiveTagParse( $elements[1] ) );
182 -
 182+
183183 } else {
184 -
 184+
185185 $param_name = null;
186186
187187 // parse (and sanitize) parameter values
@@ -200,7 +200,7 @@
201201 } elseif ( $param_name == 'target' ) {
202202 $inTargetName = $value;
203203 } elseif ( $param_name == null && $value == 'popup'
204 - && version_compare( $wgVersion, '1.16', '>=' )) {
 204+ && version_compare( $wgVersion, '1.16', '>=' ) ) {
205205 self::loadScriptsForPopupForm( $parser );
206206 $classStr = 'popupformlink';
207207 }
@@ -251,14 +251,14 @@
252252 }
253253 if ( $inLinkType == 'button' ) {
254254 $str =
255 - Xml::tags( 'form', array('action' => $link_url, 'method' => 'get', 'class' => $classStr),
256 - Xml::tags( 'button', array('type' => 'submit', 'value' => $inLinkStr), $inLinkStr ) .
 255+ Xml::tags( 'form', array( 'action' => $link_url, 'method' => 'get', 'class' => $classStr ),
 256+ Xml::tags( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
257257 $hidden_inputs
258258 );
259259 } elseif ( $inLinkType == 'post button' ) {
260260 $str =
261 - Xml::tags( 'form', array('action' => $link_url, 'method' => 'post', 'class' => $classStr),
262 - Xml::tags( 'button', array('type' => 'submit', 'value' => $inLinkStr), $inLinkStr ) .
 261+ Xml::tags( 'form', array( 'action' => $link_url, 'method' => 'post', 'class' => $classStr ),
 262+ Xml::tags( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
263263 $hidden_inputs
264264 );
265265 } else {
@@ -266,7 +266,7 @@
267267 // exist, make it a red link.
268268 if ( ! empty( $inTargetName ) ) {
269269 $targetTitle = Title::newFromText( $inTargetName );
270 - if ( is_null( $targetTitle) || !$targetTitle->exists() ) {
 270+ if ( is_null( $targetTitle ) || !$targetTitle->exists() ) {
271271 $classStr .= " new";
272272 }
273273 }
@@ -279,7 +279,7 @@
280280
281281 static function renderFormInput ( &$parser ) {
282282 global $wgVersion;
283 -
 283+
284284 $params = func_get_args();
285285 array_shift( $params ); // don't need the parser
286286 // set defaults
@@ -316,7 +316,7 @@
317317 } elseif ( $param_name == 'remote autocompletion' ) {
318318 $inRemoteAutocompletion = true;
319319 } elseif ( $param_name == null && $value == 'popup'
320 - && version_compare( $wgVersion, '1.16', '>=' )) {
 320+ && version_compare( $wgVersion, '1.16', '>=' ) ) {
321321 self::loadScriptsForPopupForm( $parser );
322322 $classStr = 'popupforminput';
323323 }
@@ -333,7 +333,7 @@
334334 }
335335
336336 $fs = SFUtils::getSpecialPage( 'FormStart' );
337 -
 337+
338338 $fs_url = $fs->getTitle()->getLocalURL();
339339 $str = <<<END
340340 <form name="createbox" action="$fs_url" method="get" class="$classStr">
@@ -404,7 +404,7 @@
405405 $subcomponents = explode( '=', $component, 2 );
406406 $key = ( isset( $subcomponents[0] ) ) ? $subcomponents[0] : '';
407407 $val = ( isset( $subcomponents[1] ) ) ? $subcomponents[1] : '';
408 - if ( ! empty( $key ) ){
 408+ if ( ! empty( $key ) ) {
409409 $str .= ' ' .
410410 Xml::element( 'input',
411411 array(
@@ -485,7 +485,7 @@
486486 # let '\n' represent newlines
487487 $delimiter = str_replace( '\n', "\n", $delimiter );
488488 $new_delimiter = str_replace( '\n', "\n", $new_delimiter );
489 -
 489+
490490 if ( $delimiter == '' ) {
491491 $values_array = preg_split( '/(.)/u', $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
492492 } else {
@@ -525,7 +525,7 @@
526526
527527 $results = array();
528528 $template = trim( $template );
529 -
 529+
530530 foreach ( $values_array as $cur_value ) {
531531 $cur_value = trim( $cur_value );
532532 // ignore a value if it's null
@@ -534,7 +534,7 @@
535535 $results[] = '{{' . $template . '|' . $cur_value . '}}';
536536 }
537537 }
538 -
 538+
539539 return array( implode( $new_delimiter, $results ), 'noparse' => false, 'isHTML' => false );
540540 }
541541
@@ -568,7 +568,7 @@
569569 $template, '1=' . $old_value );
570570 // special handling if preprocessor class is set to
571571 // 'Preprocessor_Hash'
572 - if ($bracketed_value instanceof PPNode_Hash_Array) {
 572+ if ( $bracketed_value instanceof PPNode_Hash_Array ) {
573573 $bracketed_value = $bracketed_value->value;
574574 }
575575 $results_array[] = $parser->replaceVariables(
@@ -579,7 +579,7 @@
580580
581581
582582 static function renderAutoEdit ( &$parser ) {
583 -
 583+
584584 global $wgTitle;
585585
586586 // set defaults
@@ -636,11 +636,11 @@
637637 }
638638
639639 if ( $summary == null ) {
640 - $summary = wfMsg('sf_autoedit_summary', "[[$wgTitle]]" );
 640+ $summary = wfMsg( 'sf_autoedit_summary', "[[$wgTitle]]" );
641641 }
642 -
 642+
643643 $formcontent .=
644 - Xml::input( 'wpSummary', false, $summary, array('type' => 'hidden') );
 644+ Xml::input( 'wpSummary', false, $summary, array( 'type' => 'hidden' ) );
645645
646646 $form = Xml::tags( 'form', array( 'class' => 'autoedit-data' ), $formcontent );
647647
@@ -698,7 +698,7 @@
699699
700700 return true;
701701 }
702 -
 702+
703703 // load scripts and style files for AutoEdit
704704 private static function loadScriptsForAutoEdit ( &$parser ) {
705705
@@ -716,14 +716,14 @@
717717 // load extensions JavaScript
718718 $parser->getOutput()->addHeadItem(
719719 '<script type="text/javascript" src="' . $sfgScriptPath
720 - . '/libs/SF_autoedit.js"></script> ' ."\n",
 720+ . '/libs/SF_autoedit.js"></script> ' . "\n",
721721 'sf_autoedit_script'
722722 );
723723
724724 // load extensions style sheet
725725 $parser->getOutput()->addHeadItem(
726726 '<link rel="stylesheet" href="' . $sfgScriptPath
727 - . '/skins/SF_autoedit.css"/> ' ."\n",
 727+ . '/skins/SF_autoedit.css"/> ' . "\n",
728728 'sf_autoedit_style'
729729 );
730730
Index: trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php
@@ -48,7 +48,7 @@
4949 // Ignore 'noinclude' sections and 'includeonly' tags.
5050 $templateText = StringUtils::delimiterReplace( '<noinclude>', '</noinclude>', '', $templateText );
5151 $templateText = strtr( $templateText, array( '<includeonly>' => '', '</includeonly>' => '' ) );
52 -
 52+
5353 // First, look for "arraymap" parser function calls
5454 // that map a property onto a list.
5555 if ( $ret = preg_match_all( '/{{#arraymap:{{{([^|}]*:?[^|}]*)[^\[]*\[\[([^:]*:?[^:]*)::/mis', $templateText, $matches ) ) {
@@ -66,7 +66,7 @@
6767 print 'Semantic Forms error: backtrace limit exceeded during parsing! Please increase the value of <a href="http://www.php.net/manual/en/pcre.configuration.php#ini.pcre.backtrack-limit">pcre.backtrack-limit</a> in the PHP settings.';
6868 }
6969 }
70 -
 70+
7171 // Second, look for normal property calls.
7272 if ( preg_match_all( '/\[\[([^:|\[\]]*:*?[^:|\[\]]*)::{{{([^\]\|}]*).*?\]\]/mis', $templateText, $matches ) ) {
7373 foreach ( $matches[1] as $i => $propertyName ) {
@@ -100,9 +100,9 @@
101101 if ( preg_match_all( '/#declare:(.*?)}}/mis', $templateText, $matches ) ) {
102102 foreach ( $matches[1] as $i => $match ) {
103103 $setValues = explode( '|', $match );
104 - foreach( $setValues as $valuePair ) {
 104+ foreach ( $setValues as $valuePair ) {
105105 $keyAndVal = explode( '=', $valuePair );
106 - if ( count( $keyAndVal ) == 2) {
 106+ if ( count( $keyAndVal ) == 2 ) {
107107 $propertyName = trim( $keyAndVal[0] );
108108 $fieldName = trim( $keyAndVal[1] );
109109 if ( ! in_array( $fieldName, $fieldNamesArray ) ) {
@@ -113,7 +113,7 @@
114114 }
115115 }
116116 }
117 -
 117+
118118 // Finally, get any non-semantic fields defined.
119119 if ( preg_match_all( '/{{{([^|}]*)/mis', $templateText, $matches ) ) {
120120 foreach ( $matches[1] as $i => $fieldName ) {
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextInput.php
@@ -41,25 +41,25 @@
4242 public static function getOtherPropTypeListsHandled() {
4343 return array( '_wpg' );
4444 }
45 -
 45+
4646 /**
4747 * Gets the HTML for the preview image or null if there is none.
48 - *
 48+ *
4949 * @since 2.3.3
50 - *
 50+ *
5151 * @param string $imageName
52 - *
 52+ *
5353 * @return string|null
5454 */
5555 protected static function getPreviewImage( $imageName ) {
5656 $previewImage = null;
57 -
 57+
5858 $imageTitle = Title::newFromText( $imageName, NS_FILE );
59 -
 59+
6060 if ( !is_object( $imageTitle ) ) {
6161 return $previewImage;
6262 }
63 -
 63+
6464 $api = new ApiMain( new FauxRequest( array(
6565 'action' => 'query',
6666 'format' => 'json',
@@ -68,12 +68,12 @@
6969 'titles' => $imageTitle->getFullText(),
7070 'iiurlwidth' => 200
7171 ), true ), true );
72 -
 72+
7373 $api->execute();
7474 $result = $api->getResultData();
7575
7676 $url = false;
77 -
 77+
7878 if ( array_key_exists( 'query', $result ) && array_key_exists( 'pages', $result['query'] ) ) {
7979 foreach ( $result['query']['pages'] as $page ) {
8080 foreach ( $page['imageinfo'] as $imageInfo ) {
@@ -82,14 +82,14 @@
8383 }
8484 }
8585 }
86 -
 86+
8787 if ( $url !== false ) {
8888 $previewImage = Html::element(
8989 'img',
9090 array( 'src' => $url )
9191 );
9292 }
93 -
 93+
9494 return $previewImage;
9595 }
9696
@@ -112,13 +112,13 @@
113113 }
114114
115115 $cssClasses = array( 'sfFancyBox', 'sfUploadable' );
116 -
 116+
117117 $showPreview = array_key_exists( 'image preview', $other_args );
118 -
 118+
119119 if ( $showPreview ) {
120120 $cssClasses[] = 'sfImagePreview';
121121 }
122 -
 122+
123123 $linkAttrs = array(
124124 'href' => $upload_window_url,
125125 'class' => implode( ' ', $cssClasses ),
@@ -126,9 +126,9 @@
127127 'rev' => $style,
128128 'data-input-id' => $input_id
129129 );
130 -
 130+
131131 $text = "\t" . Xml::element( 'a', $linkAttrs, $upload_label ) . "\n";
132 -
 132+
133133 if ( $showPreview ) {
134134 $text .= Html::rawElement(
135135 'div',
@@ -136,7 +136,7 @@
137137 self::getPreviewImage( $cur_value )
138138 );
139139 }
140 -
 140+
141141 return $text;
142142 }
143143
@@ -216,7 +216,7 @@
217217 } else {
218218 $default_filename = '';
219219 }
220 -
 220+
221221 $text .= self::uploadableHTML( $input_id, $delimiter, $default_filename, $cur_value, $other_args );
222222 }
223223 $spanClass = 'inputSpan';
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php
@@ -50,10 +50,10 @@
5151
5252 if ( array_key_exists( 'editor', $other_args ) &&
5353 $other_args['editor'] == 'wikieditor' &&
54 -
 54+
5555 method_exists( $wgOut, 'getResourceLoader' ) &&
5656 in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) &&
57 -
 57+
5858 class_exists( 'WikiEditorHooks' ) ) {
5959
6060 // load modules for all enabled features
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_FormInput.php
@@ -273,9 +273,9 @@
274274 /**
275275 * Method to make new style input types compatible with old-style call from
276276 * the SF parser.
277 - *
 277+ *
278278 * @deprecated Do not use/override this in new input type classes
279 - *
 279+ *
280280 * TODO: remove/refactor once SF uses forminput objects properly
281281 */
282282 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php
@@ -19,15 +19,15 @@
2020 }
2121
2222 public static function getDefaultPropTypes() {
23 - return array('_txt' => array(), '_cod' => array());
 23+ return array( '_txt' => array(), '_cod' => array() );
2424 }
2525
2626 public static function getOtherPropTypesHandled() {
27 - return array('_wpg', '_str');
 27+ return array( '_wpg', '_str' );
2828 }
2929
3030 public static function getOtherPropTypeListsHandled() {
31 - return array('_wpg', '_str');
 31+ return array( '_wpg', '_str' );
3232 }
3333
3434 public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
@@ -40,10 +40,10 @@
4141
4242 if ( array_key_exists( 'editor', $other_args ) &&
4343 $other_args['editor'] == 'wikieditor' &&
44 -
 44+
4545 method_exists( $wgOut, 'getResourceLoader' ) &&
4646 in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) &&
47 -
 47+
4848 class_exists( 'WikiEditorHooks' ) ) {
4949
5050 // load modules for all enabled features
@@ -132,7 +132,7 @@
133133 if ( $is_mandatory ) {
134134 $spanClass .= ' mandatoryFieldSpan';
135135 }
136 - $text = Xml::tags( 'span', array('class' => $spanClass), $text );
 136+ $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text );
137137
138138 return $text;
139139 }
Index: trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php
@@ -32,7 +32,7 @@
3333 if ( strlen( $substr ) == 0 ) {
3434 $this->dieUsage( 'The substring must be specified', 'param_substr' );
3535 }
36 -
 36+
3737 if ( !is_null( $attribute ) ) {
3838 $data = self::getAllValuesForProperty( false, $attribute, $substr );
3939 } elseif ( !is_null( $relation ) ) {
@@ -48,7 +48,7 @@
4949 } else {
5050 $data = array();
5151 }
52 -
 52+
5353 // to prevent JS parsing problems, display should be the same
5454 // even if there are no results
5555 /*
@@ -124,7 +124,7 @@
125125 $db = wfGetDB( DB_SLAVE );
126126 $sql_options = array();
127127 $sql_options['LIMIT'] = $sfgMaxAutocompleteValues;
128 -
 128+
129129 if ( $is_relation ) {
130130 $value_field = 'o_ids.smw_title';
131131 $from_clause = $db->tableName( 'smw_rels2' ) . " r JOIN " . $db->tableName( 'smw_ids' ) . " p_ids ON r.p_id = p_ids.smw_id JOIN " . $db->tableName( 'smw_ids' ) . " o_ids ON r.o_id = o_ids.smw_id";
@@ -132,21 +132,21 @@
133133 $value_field = 'a.value_xsd';
134134 $from_clause = $db->tableName( 'smw_atts2' ) . " a JOIN " . $db->tableName( 'smw_ids' ) . " p_ids ON a.p_id = p_ids.smw_id";
135135 }
136 -
 136+
137137 $property_name = str_replace( ' ', '_', $property_name );
138138 $conditions = "p_ids.smw_title = '$property_name'";
139 -
 139+
140140 if ( $substring != null ) {
141141 $substring = str_replace( "'", "\'", strtolower( $substring ) );
142142 // utf8 conversion is needed in case MediaWiki is using
143143 // binary data storage
144144 $conditions .= " AND (REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '" . $substring . "%' OR REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '% " . $substring . "%')";
145145 }
146 -
 146+
147147 $sql_options['ORDER BY'] = $value_field;
148148 $res = $db->select( $from_clause, "DISTINCT $value_field",
149149 $conditions, __METHOD__, $sql_options );
150 -
 150+
151151 while ( $row = $db->fetchRow( $res ) ) {
152152 if ( $substring != null ) {
153153 $values[] = str_replace( '_', ' ', $row[0] );
@@ -156,8 +156,8 @@
157157 }
158158 }
159159 $db->freeResult( $res );
160 -
 160+
161161 return $values;
162162 }
163 -
 163+
164164 }
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -209,7 +209,7 @@
210210 if ( is_null( $text ) ) {
211211 $text = $title->getText();
212212 }
213 - $l = class_exists('DummyLinker') ? new DummyLinker : new Linker;
 213+ $l = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
214214 return $l->makeLinkObj( $title, htmlspecialchars( $text ) );
215215 }
216216
@@ -645,11 +645,11 @@
646646 * type, for use by both Javascript autocompletion and comboboxes.
647647 */
648648 public static function getAutocompleteValues( $source_name, $source_type ) {
649 -
 649+
650650 if ( $source_name == null ) {
651651 return null;
652652 }
653 -
 653+
654654 $names_array = array();
655655 // The query depends on whether this is a property, category,
656656 // concept or namespace.
@@ -713,10 +713,10 @@
714714 // unused character (here, "\1"), then do the explode, then
715715 // convert them back.
716716 $pattern = '/({{.*)\|(.*}})/';
717 - while ( preg_match($pattern, $str, $matches) ) {
718 - $str = preg_replace($pattern, "$1" . "\1" . "$2", $str);
 717+ while ( preg_match( $pattern, $str, $matches ) ) {
 718+ $str = preg_replace( $pattern, "$1" . "\1" . "$2", $str );
719719 }
720 - return array_map( array('SFUtils', 'convertBackToPipes'), explode('|', $str) );
 720+ return array_map( array( 'SFUtils', 'convertBackToPipes' ), explode( '|', $str ) );
721721 }
722722
723723 /**
@@ -836,21 +836,21 @@
837837
838838 return true;
839839 }
840 -
 840+
841841 /**
842842 * Compatibility helper function.
843843 * Since 1.17 SpecialPageFactory::getPage should be used.
844844 * SpecialPage::getPage is deprecated in 1.18.
845 - *
 845+ *
846846 * @since 2.3.3
847 - *
 847+ *
848848 * @param string $pageName
849 - *
 849+ *
850850 * @return SpecialPage|null
851851 */
852852 public static function getSpecialPage( $pageName ) {
853853 $hasFactory = class_exists( 'SpecialPageFactory' ) && method_exists( 'SpecialPageFactory', 'getPage' );
854854 return $hasFactory ? SpecialPageFactory::getPage( $pageName ) : SpecialPage::getPage( $pageName );
855855 }
856 -
 856+
857857 }