Index: trunk/extensions/SemanticMediaWiki/includes/SMW_InlineQueries.php |
— | — | @@ -437,7 +437,7 @@ |
438 | 438 | return new SMWAttributeIterator($this->dbr, $res, $print_data[3]); |
439 | 439 | case SMW_IQ_PRINT_RSEL: |
440 | 440 | global $wgContLang; |
441 | | - return new SMWFixedIterator($this->makeTitleString($wgContLang->getNsText($row[$print_data[2] . 'namespace']) . ':' . $row[$print_data[2] . 'title'],'',$linked,$subject)); |
| 441 | + return new SMWFixedIterator($this->makeTitleString($wgContLang->getNsText($row[$print_data[2] . 'namespace']) . ':' . $row[$print_data[2] . 'title'],NULL,$linked,$subject)); |
442 | 442 | case SMW_IQ_PRINT_ASEL: // TODO: allow selection of attribute conditionals, and print them here |
443 | 443 | return new SMWFixedIterator('---'); |
444 | 444 | } |
— | — | @@ -586,9 +586,10 @@ |
587 | 587 | $qparts[2] = mb_substr($qparts[2],0,$altpos); |
588 | 588 | } else { |
589 | 589 | $label = ucfirst($qparts[0]); |
| 590 | + if ( '' === $label) $label = NULL; |
590 | 591 | } |
591 | 592 | if ($cat_sep == $op) { // eventually print all categories for the selected subjects |
592 | | - if ('' == $label) $label = $wgContLang->getNSText(NS_CATEGORY); |
| 593 | + if (NULL === $label) $label = $wgContLang->getNSText(NS_CATEGORY); |
593 | 594 | $result->mPrint['C'] = array($label,SMW_IQ_PRINT_CATS); |
594 | 595 | } elseif ( '::' == $op ) { |
595 | 596 | $result->mPrint['R:' . $qparts[0]] = array($this->makeTitleString($wgContLang->getNsText(SMW_NS_RELATION) . ':' . $qparts[0],$label,true), |
— | — | @@ -890,16 +891,19 @@ |
891 | 892 | * |
892 | 893 | * $subject states whether the given title is the subject (to which special |
893 | 894 | * settings for linking apply). |
894 | | - * If $label is empty the standard label of the given article will be used. |
| 895 | + * If $label is null the standard label of the given article will be used. |
| 896 | + * If $label is the empty string, an empty string is returned. |
895 | 897 | * $linked states whether the result should be a hyperlink |
896 | 898 | * $exists states whether $text is known to be anexisting article, in which |
897 | 899 | * case we can save a DB lookup when creating links. |
898 | 900 | */ |
899 | | - public function makeTitleString($text,$label='',$linked,$exists=false) { |
| 901 | + public function makeTitleString($text,$label,$linked,$exists=false) { |
| 902 | + if ( '' === $label) return ''; // no link desired |
900 | 903 | $title = Title::newFromText( $text ); |
901 | | - if ($title == NULL) { |
| 904 | + if ($title === NULL) { |
902 | 905 | return $text; // TODO maybe report an error here? |
903 | 906 | } elseif ( $linked ) { |
| 907 | + if ( NULL === $label ) $label = $title->getText(); |
904 | 908 | if ($exists) |
905 | 909 | return $this->mLinker->makeKnownLinkObj($title, $label); |
906 | 910 | else return $this->mLinker->makeLinkObj($title, $label); |
— | — | @@ -943,7 +947,7 @@ |
944 | 948 | global $wgContLang; |
945 | 949 | $row = $this->mDB->fetchRow($this->mRes); |
946 | 950 | if ($row) |
947 | | - return array($this->mIQ->makeTitleString($wgContLang->getNsText(NS_CATEGORY) . ':' . $row['cl_to'],'',$this->mLinked)); |
| 951 | + return array($this->mIQ->makeTitleString($wgContLang->getNsText(NS_CATEGORY) . ':' . $row['cl_to'],NULL,$this->mLinked)); |
948 | 952 | else return false; |
949 | 953 | } |
950 | 954 | } |
— | — | @@ -991,7 +995,7 @@ |
992 | 996 | global $wgContLang; |
993 | 997 | $row = $this->mDB->fetchRow($this->mRes); |
994 | 998 | if ($row) { |
995 | | - return array($this->mIQ->makeTitleString($wgContLang->getNsText($row['object_namespace']) . ':' . $row['object_title'],'',$this->mLinked)); |
| 999 | + return array($this->mIQ->makeTitleString($wgContLang->getNsText($row['object_namespace']) . ':' . $row['object_title'],NULL,$this->mLinked)); |
996 | 1000 | } else return false; |
997 | 1001 | } |
998 | 1002 | } |