r44256 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44255‎ | r44256 | r44257 >
Date:18:11, 5 December 2008
Author:mkroetzsch
Status:deferred
Tags:
Comment:
Extended and cleaned up documentation
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
@@ -13,10 +13,14 @@
1414 * @ingroup SMWQuery
1515 */
1616 class SMWPrintRequest {
17 - const PRINT_CATS = 0; // print all direct categories of the current element
18 - const PRINT_PROP = 1; // print all property values of a certain attribute of the current element
19 - const PRINT_THIS = 2; // print the current element
20 - const PRINT_CCAT = 3; // check whether current element is in given category
 17+ /// Query mode to print all direct categories of the current element.
 18+ const PRINT_CATS = 0;
 19+ /// Query mode to print all property values of a certain attribute of the current element.
 20+ const PRINT_PROP = 1;
 21+ /// Query mode to print the current element (page in result set).
 22+ const PRINT_THIS = 2;
 23+ /// Query mode to print whether current element is in given category (Boolean printout).
 24+ const PRINT_CCAT = 3;
2125
2226 protected $m_mode; // type of print request
2327 protected $m_label; // string for labelling results, contains no markup
@@ -70,7 +74,6 @@
7175 return $this->m_data->getShortHTMLText($linker);
7276 case SMWPrintRequest::PRINT_THIS: default: return htmlspecialchars($this->m_label);
7377 }
74 -
7578 }
7679
7780 /**
@@ -81,7 +84,7 @@
8285 return $this->m_label;
8386 } else {
8487 switch ($this->m_mode) {
85 - case SMWPrintRequest::PRINT_CATS:
 88+ case SMWPrintRequest::PRINT_CATS:
8689 return $this->m_label; // TODO: link to Special:Categories
8790 case SMWPrintRequest::PRINT_PROP:
8891 return $this->m_data->getShortWikiText($linked);
@@ -92,6 +95,9 @@
9396 }
9497 }
9598
 99+ /**
 100+ * Convenience method for accessing the text in either HTML or Wiki format.
 101+ */
96102 public function getText($outputmode, $linker = NULL) {
97103 switch ($outputmode) {
98104 case SMW_OUTPUT_WIKI: return $this->getWikiText($linker);
@@ -100,19 +106,10 @@
101107 }
102108
103109 /**
104 - * @deprecated Use SMWPrintRequest::getData(). This method will vanish in SMW 1.5.
 110+ * Return additional data related to the print request. The result might be
 111+ * an object of class SMWPropertyValue or Title, or simply NULL if no data
 112+ * is required for the given type of printout.
105113 */
106 - public function getTitle() {
107 - if ($this->m_data instanceof Title) {
108 - return $this->m_data;
109 - } else {
110 - return NULL;
111 - }
112 - }
113 -
114 - /**
115 - * Return additional data related to the print request. Might be
116 - */
117114 public function getData() {
118115 return $this->m_data;
119116 }
@@ -138,7 +135,9 @@
139136
140137 /**
141138 * Return a hash string that is used to eliminate duplicate
142 - * print requests.
 139+ * print requests. The hash also includes the chosen label,
 140+ * so it is possible to print the same date with different
 141+ * labels.
143142 */
144143 public function getHash() {
145144 $hash = $this->m_mode . ':' . $this->m_label . ':';
@@ -185,6 +184,13 @@
186185 case SMWPrintRequest::PRINT_THIS: default: return ''; // no current serialisation
187186 }
188187 }
 188+
 189+ /**
 190+ * @deprecated Use SMWPrintRequest::getData(). This method will vanish in SMW 1.5.
 191+ */
 192+ public function getTitle() {
 193+ return ($this->m_data instanceof Title)?$this->m_data:NULL;
 194+ }
189195 }
190196
191197 /**
@@ -532,7 +538,7 @@
533539 return false;
534540 }
535541 }
536 -
 542+
537543 public function getSize() {
538544 return 1;
539545 }
@@ -969,4 +975,3 @@
970976 return $result;
971977 }
972978 }
973 -

Status & tagging log