Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php |
— | — | @@ -276,11 +276,7 @@ |
277 | 277 | */ |
278 | 278 | public function getTitle() { |
279 | 279 | if ( ( $this->isValid() ) && ( $this->m_title === null ) ) { |
280 | | - if ( $this->m_dataitem->getInterwiki() == '' ) { |
281 | | - $this->m_title = Title::makeTitleSafe( $this->m_dataitem->getNamespace(), $this->m_dataitem->getDBkey() ); |
282 | | - } else { // interwiki title objects must be built from full input texts |
283 | | - $this->m_title = Title::newFromText( $this->getPrefixedText() ); |
284 | | - } |
| 280 | + $this->m_title = $this->m_dataitem->getTitle(); |
285 | 281 | } |
286 | 282 | |
287 | 283 | if ( $this->m_title === null ) { // should not normally happen, but anyway ... |
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php |
— | — | @@ -74,6 +74,25 @@ |
75 | 75 | return $this->m_dbkey; |
76 | 76 | } |
77 | 77 | |
| 78 | + /** |
| 79 | + * Create a MediaWiki Title object for this SMWDIWikiPage. The result |
| 80 | + * can be null if an error occurred. |
| 81 | + * |
| 82 | + * @todo From MW 1.17 on, makeTitleSafe supports interwiki prefixes. |
| 83 | + * This function can be simplified when compatibility to MW 1.16 is |
| 84 | + * dropped. |
| 85 | + * @return mixed Title or null |
| 86 | + */ |
| 87 | + public function getTitle() { |
| 88 | + if ( $this->m_interwiki == '' ) { |
| 89 | + return Title::makeTitleSafe( $this->m_namespace, $this->m_dbkey, '' ); |
| 90 | + } else { |
| 91 | + $datavalue = new SMWWikiPageValue( '_wpg' ); |
| 92 | + $datavalue->setDataItem( $this ); |
| 93 | + return Title::newFromText( $datavalue->getPrefixedText() ); |
| 94 | + } |
| 95 | + } |
| 96 | + |
78 | 97 | public function getSerialization() { |
79 | 98 | return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki ); |
80 | 99 | } |