r57759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57758‎ | r57759 | r57760 >
Date:09:42, 15 October 2009
Author:mkroetzsch
Status:deferred
Tags:
Comment:
avoid printing namespace when displaying data values for which it is fixed anyway
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php
@@ -62,7 +62,7 @@
6363 case '_wpp' : case '__sup':
6464 $this->m_fixNamespace = SMW_NS_PROPERTY;
6565 break;
66 - case '_wpc' : case '__suc':
 66+ case '_wpc' : case '__suc': case '__sin':
6767 $this->m_fixNamespace = NS_CATEGORY;
6868 break;
6969 case '_wpf' : case '__spf':
@@ -157,7 +157,7 @@
158158 return $this->getErrorText();
159159 }
160160 if ( ($linked === NULL) || ($linked === false) || ($this->m_outformat == '-') ) {
161 - return $this->getPrefixedText();
 161+ return $this->m_fixNamespace == NS_MAIN?$this->getPrefixedText():$this->getText();
162162 } elseif ($this->m_namespace == NS_IMAGE) { // embed images instead of linking to their page
163163 return '[[' . str_replace("'", ''', $this->getPrefixedText()) . '|' . $this->m_textform . '|frameless|border|text-top]]';
164164 } else { // this takes care of all other cases, esp. it is right for Media:
@@ -172,7 +172,7 @@
173173 return $this->getErrorText();
174174 }
175175 if ( ($linker === NULL) || ($this->m_outformat == '-') ) {
176 - return htmlspecialchars($this->getPrefixedText());
 176+ return htmlspecialchars($this->m_fixNamespace == NS_MAIN?$this->getPrefixedText():$this->getText());
177177 } elseif ($this->getNamespace() == NS_MEDIA) { // this extra case is really needed
178178 return $linker->makeMediaLinkObj($this->getTitle(), $this->m_textform);
179179 } else { // all others use default linking, no embedding of images here
@@ -339,9 +339,13 @@
340340 $this->m_title = $title;
341341 }
342342
343 - /// Get the (default) caption for this value.
 343+ /**
 344+ * Get the (default) caption for this value.
 345+ * If a fixed namespace is set, we do not return the namespace prefix explicitly.
 346+ */
344347 protected function getCaption() {
345 - return $this->m_caption !== false?$this->m_caption:$this->getPrefixedText();
 348+ return $this->m_caption !== false?$this->m_caption:
 349+ ($this->m_fixNamespace == NS_MAIN?$this->getPrefixedText():$this->getText());
346350 }
347351
348352 /**

Status & tagging log