r23865 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23864‎ | r23865 | r23866 >
Date:13:20, 8 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Return user-caption for short text outputs only (always normalise the long versions)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_NAry.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_String.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php
@@ -80,23 +80,23 @@
8181 public function getShortWikiText($linked = NULL) {
8282 //TODO: Support linking
8383 wfDebug("\r\n getShortWikiText: ".$this->m_caption);
84 - return $this->m_value;
 84+ return $this->m_caption;
8585 }
8686
8787 public function getShortHTMLText($linker = NULL) {
88 - return $this->getShortWikiText($linker);
 88+ return htmlspecialchars($this->getShortWikiText($linker)); /// TODO: support linking
8989 }
9090
9191 public function getLongWikiText($linked = NULL) {
9292 if (! ($this->m_error === '')){
9393 return ('<span class="smwwarning">' . $this->m_error . '</span>');
9494 } else {
95 - return $this->getShortWikiText($linked);
 95+ return $this->m_value;
9696 }
9797 }
9898
9999 public function getLongHTMLText($linker = NULL) {
100 - return '<span class="external free">'.$this->m_caption.'</span>';
 100+ return '<span class="external free">' . htmlspecialchars($this->m_value) . '</span>'; /// TODO support linking
101101 }
102102
103103 public function getXSDValue() {
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_String.php
@@ -55,7 +55,7 @@
5656 if (! ($this->m_error === '')){
5757 return ('<span class="smwwarning">' . $this->m_error . '</span>');
5858 } else {
59 - return $this->getShortWikiText($linked);
 59+ return $this->m_value;
6060 }
6161 }
6262
@@ -63,7 +63,7 @@
6464 if (! ($this->m_error === '')){
6565 return ('<span class="smwwarning">' . $this->m_error . '</span>');
6666 } else {
67 - return $this->getShortHTMLText($linked);
 67+ return htmlspecialchars($this->m_value);
6868 }
6969 }
7070
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_NAry.php
@@ -27,7 +27,7 @@
2828 * constructor to create n-ary data value types and set their initial
2929 * value appropriately.
3030 *
31 - * TODO: move all setup of values to parseUserValue and only call setUserValue here.
 31+ * FIXME: move all setup of values to parseUserValue and only call setUserValue here.
3232 */
3333 function SMWNAryValue($type, $value,$caption=false) {
3434 $this->m_type = $type;
@@ -92,6 +92,10 @@
9393 }
9494
9595 public function getShortWikiText($linked = NULL) {
 96+ if ($this->m_caption !== false) {
 97+ return $this->m_caption;
 98+ }
 99+ /// TODO: beautify with (...) like LongText
96100 $result = '';
97101 $first = true;
98102 foreach ($this->m_values as $value) {
@@ -106,7 +110,10 @@
107111 }
108112
109113 public function getShortHTMLText($linker = NULL) {
110 - /// TODO: beautify with (...) like WikiText
 114+ if ($this->m_caption !== false) {
 115+ return $this->m_caption;
 116+ }
 117+ /// TODO: beautify with (...) like LongText
111118 $result = '';
112119 $first = true;
113120 foreach ($this->m_values as $value) {

Status & tagging log