Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php |
— | — | @@ -336,7 +336,10 @@ |
337 | 337 | * in spite of it being of the right basic type. False is only returned |
338 | 338 | * if the data item is fundamentally incompatible with the data value. |
339 | 339 | * |
| 340 | + * @since 1.6 |
| 341 | + * |
340 | 342 | * @param $dataitem SMWDataItem |
| 343 | + * |
341 | 344 | * @return boolean |
342 | 345 | */ |
343 | 346 | abstract protected function loadDataItem( SMWDataItem $dataItem ); |
— | — | @@ -411,6 +414,8 @@ |
412 | 415 | * accessing null. Hence, one must not assume that a non-null return |
413 | 416 | * value here implies that isValid() returns true. |
414 | 417 | * |
| 418 | + * @since 1.6 |
| 419 | + * |
415 | 420 | * @return SMWDataItem |
416 | 421 | */ |
417 | 422 | public function getDataItem() { |
— | — | @@ -508,6 +513,11 @@ |
509 | 514 | /** |
510 | 515 | * Return text serialisation of info links. Ensures more uniform layout |
511 | 516 | * throughout wiki (Factbox, Property pages, ...). |
| 517 | + * |
| 518 | + * @param integer $outputformat Element of the SMW_OUTPUT_ enum |
| 519 | + * @param $linker |
| 520 | + * |
| 521 | + * @return string |
512 | 522 | */ |
513 | 523 | public function getInfolinkText( $outputformat, $linker = null ) { |
514 | 524 | $result = ''; |
— | — | @@ -640,6 +650,8 @@ |
641 | 651 | /** |
642 | 652 | * Return TRUE if a value was defined and understood by the given type, |
643 | 653 | * and false if parsing errors occured or no value was given. |
| 654 | + * |
| 655 | + * @return boolean |
644 | 656 | */ |
645 | 657 | public function isValid() { |
646 | 658 | $this->unstub(); |
— | — | @@ -649,6 +661,8 @@ |
650 | 662 | /** |
651 | 663 | * Return a string that displays all error messages as a tooltip, or |
652 | 664 | * an empty string if no errors happened. |
| 665 | + * |
| 666 | + * @return string |
653 | 667 | */ |
654 | 668 | public function getErrorText() { |
655 | 669 | return smwfEncodeMessages( $this->mErrors ); |
— | — | @@ -657,6 +671,8 @@ |
658 | 672 | /** |
659 | 673 | * Return an array of error messages, or an empty array |
660 | 674 | * if no errors occurred. |
| 675 | + * |
| 676 | + * @return array |
661 | 677 | */ |
662 | 678 | public function getErrors() { |
663 | 679 | return $this->mErrors; |
— | — | @@ -667,6 +683,8 @@ |
668 | 684 | * way. This representation is used by exporters, e.g. to be further decomposed into |
669 | 685 | * RDF triples or to generate OWL/XML serialisations. |
670 | 686 | * If the value is empty or invalid, NULL is returned. |
| 687 | + * |
| 688 | + * @return SMWExpData or null |
671 | 689 | */ |
672 | 690 | public function getExportData() { // default implementation: encode values as untyped string |
673 | 691 | if ( $this->isValid() ) { |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php |
— | — | @@ -257,24 +257,25 @@ |
258 | 258 | * @return array of SMWDIProperty |
259 | 259 | */ |
260 | 260 | public static function findPropertyDataItems( $diProperty ) { |
261 | | - if ( $diProperty !== null ) { |
| 261 | + if ( !is_null( $diProperty ) ) { |
262 | 262 | $propertyDiWikiPage = $diProperty->getDiWikiPage(); |
263 | | - } |
| 263 | + |
| 264 | + if ( !is_null( $propertyDiWikiPage ) ) { |
| 265 | + $listDiProperty = new SMWDIProperty( '_LIST' ); |
| 266 | + $dataItems = smwfGetStore()->getPropertyValues( $propertyDiWikiPage, $listDiProperty ); |
264 | 267 | |
265 | | - if ( ( $diProperty === null ) || ( $propertyDiWikiPage === null ) ) { |
266 | | - return array(); // no property known -> no types |
267 | | - } else { |
268 | | - $listDiProperty = new SMWDIProperty( '_LIST' ); |
269 | | - $dataitems = smwfGetStore()->getPropertyValues( $propertyDiWikiPage, $listDiProperty ); |
270 | | - |
271 | | - if ( count( $dataitems ) == 1 ) { |
272 | | - $propertyListValue = new SMWPropertyListValue( '__pls' ); |
273 | | - $propertyListValue->setDataItem( reset( $dataitems ) ); |
274 | | - return $propertyListValue->isvalid() ? $propertyListValue->getPropertyDataItems() : array(); |
275 | | - } else { |
276 | | - return array(); |
| 268 | + if ( count( $dataItems ) == 1 ) { |
| 269 | + $propertyListValue = new SMWPropertyListValue( '__pls' ); |
| 270 | + $propertyListValue->setDataItem( $dataItems[0] ); |
| 271 | + |
| 272 | + if ( $propertyListValue->isvalid() ) { |
| 273 | + return $propertyListValue->getPropertyDataItems(); |
| 274 | + } |
| 275 | + } |
277 | 276 | } |
278 | 277 | } |
| 278 | + |
| 279 | + return array(); |
279 | 280 | } |
280 | 281 | |
281 | 282 | ////// Internal helper functions |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_PropertyList.php |
— | — | @@ -64,15 +64,17 @@ |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @see SMWDataValue::loadDataItem() |
| 68 | + * |
68 | 69 | * @param $dataitem SMWDataItem |
| 70 | + * |
69 | 71 | * @return boolean |
70 | 72 | */ |
71 | 73 | protected function loadDataItem( SMWDataItem $dataItem ) { |
72 | 74 | if ( $dataItem->getDIType() == SMWDataItem::TYPE_STRING ) { |
73 | 75 | $this->m_dataitem = $dataItem; |
74 | 76 | $this->m_diProperties = array(); |
75 | | - $propertyKeys = explode( ';', $dataItem->getString() ); |
76 | | - foreach ( $propertyKeys as $propertyKey ) { |
| 77 | + |
| 78 | + foreach ( explode( ';', $dataItem->getString() ) as $propertyKey ) { |
77 | 79 | try { |
78 | 80 | $this->m_diProperties[] = new SMWDIProperty( $propertyKey ); |
79 | 81 | } catch ( SMWDataItemException $e ) { |
— | — | @@ -81,7 +83,9 @@ |
82 | 84 | $this->addError( wfMsgForContent( 'smw_parseerror' ) ); |
83 | 85 | } |
84 | 86 | } |
| 87 | + |
85 | 88 | $this->m_caption = false; |
| 89 | + |
86 | 90 | return true; |
87 | 91 | } else { |
88 | 92 | return false; |