http://www.mediawiki.org/wiki/Special:Code/MediaWiki/93841

Revision: 93841
Author:   kipcool
Date:     2011-08-03 17:35:55 +0000 (Wed, 03 Aug 2011)
Log Message:
-----------
array_key_exists

Modified Paths:
--------------
    trunk/extensions/Wikidata/OmegaWiki/Editor.php

Modified: trunk/extensions/Wikidata/OmegaWiki/Editor.php
===================================================================
--- trunk/extensions/Wikidata/OmegaWiki/Editor.php      2011-08-03 17:31:52 UTC 
(rev 93840)
+++ trunk/extensions/Wikidata/OmegaWiki/Editor.php      2011-08-03 17:35:55 UTC 
(rev 93841)
@@ -474,7 +474,7 @@
                                $addValues = $editor->getAddValues( $idPath );
                                $i = 0 ;
                                foreach ( $addValues as $value ) {
-                                       if ( ! $results[$i] ) {
+                                       if ( ! array_key_exists($i, $results ) 
) {
                                                $results[$i] = new ArrayRecord( 
$structure );
                                        }
                                        $results[$i]->setAttributeValue( 
$attribute, $value );
@@ -865,7 +865,7 @@
                                $addValues = $editor->getAddValues( $idPath );
                                $i = 0 ;
                                foreach ( $addValues as $value ) {
-                                       if ( ! $results[$i] ) {
+                                       if ( ! array_key_exists($i, $results ) 
) {
                                                $results[$i] = new ArrayRecord( 
$this->getAddStructure() );
                                        }
                                        $results[$i]->setAttributeValue( 
$attribute, $value );
@@ -1494,6 +1494,7 @@
                        $syntransId = $idPath->getKeyStack()->peek( 0 
)->syntransId;
                        if ( ! $syntransId ) $syntransId = 0 ; // in the case 
of a DM option attribute, there is no syntrans in the PathId
 
+                       // note: it is normal that the "updateSelectOptions(" 
has no closing parenthesis. An additional parameter and ')' is added by the 
function updateSuggestValue (suggest.js)
                        $parameters = array(
                                "level" => $this->attributesLevelName,
                                "definedMeaningId" => 
$idPath->getDefinedMeaningId(),
@@ -1503,17 +1504,17 @@
                        );
                        return getSuggest( $this->addId( $idPath->getId() ), 
$this->suggestType(), $parameters );
                }
-               else
-                       return '';
+               else return '';
        }
 
        public function getEditHTML( IdStack $idPath, $value ) {
                global $wgOptionSuffix;
+               // note: it is normal that the "updateSelectOptions(" has no 
closing parenthesis. An additional parameter and ')' is added by the function 
updateSuggestValue (suggest.js)
                $parameters = array(
                        "level" => $this->attributesLevelName,
                        "onUpdate" => 'updateSelectOptions(\'' . 
$this->updateId( $idPath->getId() ) . $wgOptionSuffix . '\''
                );
-               
+
                return getSuggest( $this->updateId( $idPath->getId() ), 
$this->suggestType(), $parameters );
        }
 }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to