r107708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107707‎ | r107708 | r107709 >
Date:04:40, 31 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
kill dead code
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_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_CategoriesInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.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_RadioButtonInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
@@ -139,7 +139,7 @@
140140 $listSeparator = ',';
141141 $key_values_str = str_replace( "\\$listSeparator", "\a", $val );
142142 $key_values_array = explode( $listSeparator, $key_values_str );
143 - foreach ( $key_values_array as $i => $value ) {
 143+ foreach ( $key_values_array as $value ) {
144144 // replace beep back with comma, trim
145145 $value = str_replace( "\a", $listSeparator, trim( $value ) );
146146 $param_value = explode( "=", $value, 2 );
@@ -225,7 +225,6 @@
226226 }
227227
228228 public static function getTemplateEditingHTML( $psTemplate ) {
229 - $form_array = array();
230229 $hasExistingValues = false;
231230 $templateLabel = null;
232231 $addAnotherText = null;
@@ -328,7 +327,6 @@
329328 $form_fields = array();
330329 $fieldsInfo = $psTemplate->getFields();
331330 foreach ( $fieldsInfo as $i => $psField ) {
332 - $fieldName = $psField->getName();
333331 $fieldFormArray = $psField->getObject( 'semanticforms_FormInput' );
334332 if ( !is_null( $fieldFormArray ) ) {
335333 $formField = SFFormField::create( $i, $template_fields[$i] );
@@ -356,8 +354,6 @@
357355 * the current Page Schemas schema.
358356 */
359357 public static function getPagesToGenerate( $pageSchemaObj ) {
360 - global $wgOut, $wgUser;
361 -
362358 $psTemplates = $pageSchemaObj->getTemplates();
363359 foreach ( $psTemplates as $psTemplate ) {
364360 $title = Title::makeTitleSafe( NS_TEMPLATE, $psTemplate->getName() );
@@ -431,7 +427,7 @@
432428 * Generate pages (form and templates) specified in the list.
433429 */
434430 public static function generatePages( $pageSchemaObj, $selectedPages ) {
435 - global $wgOut, $wgUser;
 431+ global $wgUser;
436432
437433 $psTemplates = $pageSchemaObj->getTemplates();
438434
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php
@@ -380,7 +380,7 @@
381381 }
382382
383383 static function getShowFCKEditor() {
384 - global $wgUser, $wgDefaultUserOptions;
 384+ global $wgUser;
385385
386386 // Differentiate between FCKeditor and the newer CKeditor,
387387 // which isn't handled here
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -595,7 +595,7 @@
596596 $params = func_get_args();
597597 array_shift( $params ); // don't need the parser
598598
599 - foreach ( $params as $i => $param ) {
 599+ foreach ( $params as $param ) {
600600
601601 $elements = explode( '=', $param, 2 );
602602
Index: trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php
@@ -82,7 +82,7 @@
8383 // Then, get calls to #set and #set_internal
8484 // (thankfully, they have basically the same syntax).
8585 if ( preg_match_all( '/#(set|set_internal):(.*?}}})\s*}}/mis', $templateText, $matches ) ) {
86 - foreach ( $matches[2] as $i => $match ) {
 86+ foreach ( $matches[2] as $match ) {
8787 if ( preg_match_all( '/([^|{]*?)=\s*{{{([^|}]*)/mis', $match, $matches2 ) ) {
8888 foreach ( $matches2[1] as $i => $propertyName ) {
8989 $fieldName = trim( $matches2[2][$i] );
@@ -98,7 +98,7 @@
9999
100100 // Then, get calls to #declare.
101101 if ( preg_match_all( '/#declare:(.*?)}}/mis', $templateText, $matches ) ) {
102 - foreach ( $matches[1] as $i => $match ) {
 102+ foreach ( $matches[1] as $match ) {
103103 $setValues = explode( '|', $match );
104104 foreach ( $setValues as $valuePair ) {
105105 $keyAndVal = explode( '=', $valuePair );
@@ -116,7 +116,7 @@
117117
118118 // Finally, get any non-semantic fields defined.
119119 if ( preg_match_all( '/{{{([^|}]*)/mis', $templateText, $matches ) ) {
120 - foreach ( $matches[1] as $i => $fieldName ) {
 120+ foreach ( $matches[1] as $fieldName ) {
121121 $fieldName = trim( $fieldName );
122122 if ( !empty( $fieldName ) && ( ! in_array( $fieldName, $fieldNamesArray ) ) ) {
123123 $cur_pos = stripos( $templateText, $fieldName );
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_ComboBoxInput.php
@@ -37,7 +37,6 @@
3838 if ( array_key_exists( 'class', $other_args ) ) {
3939 $className .= ' ' . $other_args['class'];
4040 }
41 - $disabled_text = ( $is_disabled ) ? 'disabled' : '';
4241
4342 if ( array_key_exists( 'size', $other_args ) ) {
4443 $size = $other_args['size'];
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoryInput.php
@@ -26,12 +26,8 @@
2727 return null;
2828 }
2929
30 - global $sfgTabIndex, $sfgFieldNum;
 30+ global $sfgTabIndex;
3131
32 - $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
33 - if ( array_key_exists( 'class', $other_args ) ) {
34 - $className .= ' ' . $other_args['class'];
35 - }
3632 if ( array_key_exists( 'top category', $other_args ) ) {
3733 $top_category = $other_args['top category'];
3834 } else {
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateInput.php
@@ -49,8 +49,6 @@
5050 public static function getMainHTML( $date, $input_name, $is_mandatory, $is_disabled, $other_args ) {
5151 global $sfgTabIndex, $sfgFieldNum, $wgAmericanDates;
5252
53 - $input_id = "input_$sfgFieldNum";
54 -
5553 if ( $date ) {
5654 // Can show up here either as an array or a string,
5755 // depending on whether it came from user input or a
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_CategoriesInput.php
@@ -28,12 +28,7 @@
2929
3030 global $sfgTabIndex, $sfgFieldNum, $wgCapitalLinks;
3131
32 - $className = ( $is_mandatory ) ? 'mandatoryField' : 'createboxInput';
33 - if ( array_key_exists( 'class', $other_args ) ) {
34 - $className .= ' ' . $other_args['class'];
35 - }
3632 $input_id = "input_$sfgFieldNum";
37 - $info_id = "info_$sfgFieldNum";
3833 // get list delimiter - default is comma
3934 if ( array_key_exists( 'delimiter', $other_args ) ) {
4035 $delimiter = $other_args['delimiter'];
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_RadioButtonInput.php
@@ -64,7 +64,7 @@
6565 }
6666 $itemAttrs = array( 'class' => $itemClass );
6767
68 - foreach ( $possible_values as $i => $possible_value ) {
 68+ foreach ( $possible_values as $possible_value ) {
6969 $sfgTabIndex++;
7070 $sfgFieldNum++;
7171 $input_id = "input_$sfgFieldNum";
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_DateTimeInput.php
@@ -86,7 +86,6 @@
8787 }
8888 }
8989 } else {
90 - $cur_date = getdate();
9190 $hour = null;
9291 $minute = null;
9392 $second = '00'; // default at least this value
Index: trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php
@@ -27,7 +27,6 @@
2828 $category = $params['category'];
2929 $concept = $params['concept'];
3030 $external_url = $params['external_url'];
31 - $limit = $params['limit'];
3231
3332 if ( strlen( $substr ) == 0 ) {
3433 $this->dieUsage( 'The substring must be specified', 'param_substr' );
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -339,7 +339,7 @@
340340 self::loadJavascriptAndCSS( $parser );
341341 return;
342342 }
343 - global $sfgScriptPath, $smwgScriptPath, $wgScriptPath, $wgJsMimeType, $sfgUseFormEditPage;
 343+ global $sfgScriptPath, $smwgScriptPath, $wgJsMimeType, $sfgUseFormEditPage;
344344 global $smwgJQueryIncluded, $smwgJQUIAutoIncluded;
345345 // jQuery and jQuery UI are used so often in forms, we might as
346346 // well assume they'll always be used, and include them in
@@ -650,7 +650,6 @@
651651 return null;
652652 }
653653
654 - $names_array = array();
655654 // The query depends on whether this is a property, category,
656655 // concept or namespace.
657656 if ( $source_type == 'property' || $source_type == 'attribute' || $source_type == 'relation' ) {
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -333,7 +333,7 @@
334334 * only a page formula exists).
335335 */
336336 function formHTML( $form_def, $form_submitted, $source_is_page, $form_id = null, $existing_page_content = null, $page_name = null, $page_name_formula = null, $is_query = false, $is_embedded = false ) {
337 - global $wgRequest, $wgUser, $wgOut, $wgParser;
 337+ global $wgRequest, $wgUser, $wgParser;
338338 global $sfgTabIndex; // used to represent the current tab index in the form
339339 global $sfgFieldNum; // used for setting various HTML IDs
340340
@@ -481,7 +481,6 @@
482482 // Placeholder name in the form
483483 $curPlaceholder = null;
484484 // Used to store the HTML code of the multiple template, to reinsert it into the right spot
485 - $multipleTemplateString = "";
486485 // This array will keep track of all the replaced @<name>@ strings
487486 $placeholderFields = array();
488487
@@ -1533,13 +1532,14 @@
15341533 else
15351534 $form_text .= SFFormUtils::formBottom( $form_is_disabled );
15361535 }
1537 - $starttime = wfTimestampNow();
 1536+
15381537 $page_article = new Article( $this->mPageTitle, 0 );
1539 - $edittime = $page_article->getTimestamp();
 1538+
15401539 if ( !$is_query ) {
15411540 $form_text .= SFFormUtils::hiddenFieldHTML( 'wpStarttime', wfTimestampNow() );
15421541 $form_text .= SFFormUtils::hiddenFieldHTML( 'wpEdittime', $page_article->getTimestamp() );
15431542 }
 1543+
15441544 $form_text .= "\t</form>\n";
15451545
15461546 // Add general Javascript code.
Index: trunk/extensions/SemanticForms/includes/SF_AutoeditAPI.php
@@ -422,7 +422,6 @@
423423 if ( !$name )
424424 continue;
425425
426 - $values = array();
427426 $options = $select->getElementsByTagName( 'option' );
428427
429428 if ( count( $options ) && ( !$select->hasAttribute( "multiple" ) || $options->item( 0 )->hasAttribute( 'selected' ) ) ) {
@@ -462,7 +461,7 @@
463462 private function parseDataFromQueryString( &$data, $queryString ) {
464463 $params = explode( '&', $queryString );
465464
466 - foreach ( $params as $i => $param ) {
 465+ foreach ( $params as $param ) {
467466 $elements = explode( '=', $param, 2 );
468467
469468 $key = trim( urldecode( $elements[0] ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r107892Follow-up to r107708 - removed $sfgFieldNum (similarly unneeded)yaron15:54, 3 January 2012

Status & tagging log