Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php |
— | — | @@ -52,6 +52,31 @@ |
53 | 53 | return $this->m_label; |
54 | 54 | } |
55 | 55 | |
| 56 | + /** |
| 57 | + * Obtain an HTML-formatted representation of the label. |
| 58 | + * The $linker is a Linker object used for generating hyperlinks. |
| 59 | + * If it is NULL, no links will be created. |
| 60 | + */ |
| 61 | + public function getHTMLText($linker = NULL) { |
| 62 | + if ( ($linker === NULL) || ($this->m_label == '') ) { |
| 63 | + return htmlspecialchars($this->m_label); |
| 64 | + } |
| 65 | + switch ($this->m_mode) { |
| 66 | + case SMW_PRINT_CATS: return htmlspecialchars($this->m_label); |
| 67 | + case SMW_PRINT_RELS: return $linker->makeLinkObj($this->m_title, $this->m_label); |
| 68 | + case SMW_PRINT_ATTS: return $linker->makeKnownLinkObj($this->m_title, $this->m_label); |
| 69 | + case SMW_PRINT_THIS: default: return htmlspecialchars($this->m_label); |
| 70 | + } |
| 71 | + |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Obtain a Wiki-formatted representation of the label. |
| 76 | + */ |
| 77 | + public function getWikiText() { |
| 78 | + return $this->m_label; |
| 79 | + } |
| 80 | + |
56 | 81 | public function getTitle() { |
57 | 82 | return $this->m_title; |
58 | 83 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinters.php |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | if ($this->mShowHeaders) { // building headers |
133 | 133 | $result .= "\n\t\t<tr>"; |
134 | 134 | foreach ($res->getPrintRequests() as $pr) { |
135 | | - $result .= "\t\t\t<th>" . $pr->getLabel() . "</th>\n"; |
| 135 | + $result .= "\t\t\t<th>" . $pr->getHTMLText($this->mLinker) . "</th>\n"; |
136 | 136 | } |
137 | 137 | $result .= "\n\t\t</tr>"; |
138 | 138 | } |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | if ($first_value) { // first value in any column, print header |
266 | 266 | $first_value = false; |
267 | 267 | if ( $this->mShowHeaders && ('' != $field->getPrintRequest()->getLabel()) ) { |
268 | | - $result .= $field->getPrintRequest()->getLabel() . ' '; |
| 268 | + $result .= $field->getPrintRequest()->getHTMLText($this->mLinker) . ' '; |
269 | 269 | } |
270 | 270 | } |
271 | 271 | $result .= $text; // actual output value |