r67056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67055‎ | r67056 | r67057 >
Date:21:06, 29 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed more yoda-conditions
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_LinkUtils.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -60,11 +60,11 @@
6161 $page_name = $wgRequest->getVal( 'page_name' );
6262 // This form can be used to create a sub-page for an
6363 // existing page
64 - if ( '' != $super_page )
 64+ if ( $super_page != '' )
6565 {
6666 $page_name = "$super_page/$page_name";
6767 }
68 - if ( '' != $page_name ) {
 68+ if ( $page_name != '' ) {
6969 // Append the namespace prefix to the page name,
7070 // if a namespace was not already entered.
7171 if ( strpos( $page_name, ":" ) === false && $target_namespace != '' )
@@ -173,7 +173,7 @@
174174 }
175175 }
176176
177 - if ( '' != $params ) {
 177+ if ( $params != '' ) {
178178 $redirect_url .= ( strpos( $redirect_url, "?" ) > - 1 ) ? '&' : '?';
179179 $redirect_url .= $params;
180180 }
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -351,7 +351,7 @@
352352 foreach ( $values_array as $cur_value ) {
353353 $cur_value = trim( $cur_value );
354354 // ignore a value if it's null
355 - if ( '' != $cur_value ) {
 355+ if ( $cur_value != '' ) {
356356 // remove whitespaces
357357 $results[] = str_replace( $var, $cur_value, $formula );
358358 }
@@ -399,14 +399,16 @@
400400 $values_array = explode( $parser->mStripState->unstripNoWiki( $delimiter ), $value );
401401 $results = array();
402402 $template = trim( $template );
 403+
403404 foreach ( $values_array as $cur_value ) {
404405 $cur_value = trim( $cur_value );
405406 // ignore a value if it's null
406 - if ( '' != $cur_value ) {
 407+ if ( $cur_value != '' ) {
407408 // remove whitespaces
408409 $results[] = '{{' . $template . '|' . $cur_value . '}}';
409410 }
410411 }
 412+
411413 return array( implode( $new_delimiter, $results ), 'noparse' => false, 'isHTML' => false );
412414 }
413415
Index: trunk/extensions/SemanticForms/includes/SF_LinkUtils.php
@@ -31,7 +31,7 @@
3232 global $wgCapitalLinks;
3333
3434 $namespace = wfUrlencode( $title->getNsText() );
35 - if ( '' != $namespace ) {
 35+ if ( $namespace != '' ) {
3636 $namespace .= ':';
3737 }
3838 if ( $wgCapitalLinks ) {
@@ -50,7 +50,7 @@
5151 global $wgCapitalLinks;
5252
5353 $namespace = $title->getNsText();
54 - if ( '' != $namespace ) {
 54+ if ( $namespace != '' ) {
5555 $namespace .= ':';
5656 }
5757 if ( $wgCapitalLinks ) {
@@ -67,13 +67,17 @@
6868 * (which should be a category, property, or namespace page)
6969 */
7070 static function getFormsThatPagePointsTo( $page_name, $page_namespace, $prop_smw_id, $backup_prop_smw_id, $prop_id ) {
71 - if ( $page_name == NULL )
 71+ if ( $page_name == NULL ) {
7272 return array();
 73+ }
7374
7475 global $sfgContLang;
75 - // produce a useful error message if SMW isn't installed
76 - if ( ! function_exists( 'smwfGetStore' ) )
 76+
 77+ // Produce a useful error message if SMW isn't installed.
 78+ if ( ! function_exists( 'smwfGetStore' ) ) {
7779 die( "ERROR: <a href=\"http://semantic-mediawiki.org\">Semantic MediaWiki</a> must be installed for Semantic Forms to run!" );
 80+ }
 81+
7882 $store = smwfGetStore();
7983 $title = Title::makeTitleSafe( $page_namespace, $page_name );
8084 $property = SMWPropertyValue::makeProperty( $prop_smw_id );

Status & tagging log