r102359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102358‎ | r102359 | r102360 >
Date:01:09, 8 November 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
strict comparisons for empty strings
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/forminputs/SM_FormInputs.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/forminputs/jquery.mapforminput.js (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/services/OpenLayers/jquery.openlayersinput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/services/OpenLayers/jquery.openlayersinput.js
@@ -30,7 +30,7 @@
3131
3232 var text = coord.dms( normalProjectionLocation.lat, normalProjectionLocation.lon );
3333
34 - if ( title != '' ) {
 34+ if ( title !== '' ) {
3535 text = '<b>' + title + '</b><hr />' + text;
3636 }
3737
@@ -60,7 +60,7 @@
6161 this.projectAndShowLocation( new OpenLayers.LonLat( coordinate.lon, coordinate.lat ), '' );
6262 };
6363
64 - if ( options.geonamesusername != '' ) {
 64+ if ( options.geonamesusername !== '' ) {
6565 this.geocodeAddress = function( address ) {
6666 $.getJSON(
6767 'http://api.geonames.org/searchJSON?callback=?',
Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php
@@ -78,7 +78,7 @@
7979
8080 $comparator = SMW_CMP_EQ;
8181
82 - if ( $value == '' ) {
 82+ if ( $value === '' ) {
8383 $this->addError( wfMsg( 'smw_novalues' ) );
8484 } else {
8585 SMWDataValue::prepareValue( $value, $comparator );
Index: trunk/extensions/SemanticMaps/includes/forminputs/jquery.mapforminput.js
@@ -90,7 +90,7 @@
9191 } );
9292
9393 this.geofield.blur( function() {
94 - if ( this.value == '' ) {
 94+ if ( this.value === '' ) {
9595 this.value = mw.msg( 'semanticmaps_enteraddresshere' );
9696 $( this ).css( 'color', 'darkgray' );
9797 }
Index: trunk/extensions/SemanticMaps/includes/forminputs/SM_FormInputs.php
@@ -85,7 +85,7 @@
8686 // Add the form input hook for the service.
8787 $field_args = array();
8888
89 - if ( $mainName != '' ) {
 89+ if ( $mainName !== '' ) {
9090 $field_args['service_name'] = $mainName;
9191 }
9292
Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php
@@ -275,7 +275,7 @@
276276 $jsonObj['title'] = $parser->parse( $jsonObj['title'], $parser->getTitle(), new ParserOptions() )->getText();
277277 $jsonObj['text'] = $parser->parse( $jsonObj['text'], $parser->getTitle(), new ParserOptions() )->getText();
278278
279 - $hasTitleAndtext = $jsonObj['title'] != '' && $jsonObj['text'] != '';
 279+ $hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== '';
280280 $jsonObj['text'] = ( $hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title'] ) . $jsonObj['text'];
281281 $jsonObj['title'] = strip_tags( $jsonObj['title'] );
282282
Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php
@@ -132,7 +132,7 @@
133133 * @param string $template
134134 */
135135 public function setTemplate( $template ) {
136 - $this->template = $template == '' ? false : $template;
 136+ $this->template = $template === '' ? false : $template;
137137 }
138138
139139 /**
@@ -285,7 +285,7 @@
286286 }
287287 }
288288
289 - if ( count( $properties ) > 0 && $text != '' ) {
 289+ if ( count( $properties ) > 0 && $text !== '' ) {
290290 $text .= $this->subjectSeparator;
291291 }
292292
@@ -329,7 +329,7 @@
330330 if ( $this->titleLinkSeperate ) {
331331 $txt = $object->getTitle()->getText();
332332
333 - if ( $this->pageLinkText != '' ) {
 333+ if ( $this->pageLinkText !== '' ) {
334334 $txt = str_replace( '$1', $txt, $this->pageLinkText );
335335 }
336336 $text .= Html::element(
@@ -405,7 +405,7 @@
406406 $propertyValue = $object->getLongText( $this->outputmode, $wgUser->getSkin() );
407407 }
408408
409 - return $propertyName . ( $propertyName == '' ? '' : ': ' ) . $propertyValue;
 409+ return $propertyName . ( $propertyName === '' ? '' : ': ' ) . $propertyValue;
410410 }
411411
412412 /**
@@ -483,7 +483,7 @@
484484 }
485485 }
486486 } // Icon can be set even for regular, non-compound queries If it is, though, we have to translate the name into a URL here
487 - elseif ( $this->icon != '' ) {
 487+ elseif ( $this->icon !== '' ) {
488488 $icon = MapsMapper::getFileUrl( $this->icon );
489489 }
490490