r23848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23847‎ | r23848 | r23849 >
Date:17:19, 7 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
moved "attribute" parameter into abstract base class (usually not changed in subclasses).
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Error.php (modified) (history)
  • /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_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -9,6 +9,8 @@
1010 */
1111 abstract class SMWDataValue {
1212
 13+ protected $m_attribute = false;
 14+
1315 /*********************************************************************/
1416 /* Static methods for initialisation */
1517 /*********************************************************************/
@@ -96,10 +98,13 @@
9799 abstract public function setXSDValue($value, $unit);
98100
99101 /**
100 - * Set the attribute to which this value refers. Used to generate search links.
101 - * The atriubte is given as a simple wiki text title, without namespace prefix.
 102+ * Set the attribute to which this value refers. Used to generate search links and
 103+ * to find custom settings that relate to the attribute.
 104+ * The attribute is given as a simple wiki text title, without namespace prefix.
102105 */
103 - abstract public function setAttribute($attribute);
 106+ public function setAttribute($attstring) {
 107+ $this->m_attribute = $attstring;
 108+ }
104109
105110 /**
106111 * Define a particular output format. Output formats are user-supplied strings
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Error.php
@@ -7,7 +7,6 @@
88 */
99 class SMWErrorValue extends SMWDataValue {
1010
11 - private $m_attribute = null;
1211 private $m_error;
1312 private $m_value;
1413 private $m_infolinks = Array();
@@ -17,10 +16,6 @@
1817 $this->m_value = $uservalue;
1918 }
2019
21 - /*********************************************************************/
22 - /* Set methods */
23 - /*********************************************************************/
24 -
2520 public function setUserValue($value) {
2621 $this->m_value = $value;
2722 return true;
@@ -30,20 +25,12 @@
3126 $this->setUserValue($value); // no units, compatible syntax
3227 }
3328
34 - public function setAttribute($attribute) {
35 - $this->m_attribute = $attribute;
36 - }
37 -
3829 public function setOutputFormat($formatstring){
3930 //do nothing
4031 }
4132 public function setError($errormsg){
4233 $this->m_error = $errormsg;
4334 }
44 -
45 - /*********************************************************************/
46 - /* Get methods */
47 - /*********************************************************************/
4835
4936 public function getShortWikiText($linked = NULL) {
5037 //TODO: support linking
@@ -104,5 +91,3 @@
10592 return false;
10693 }
10794 }
108 -
109 -?>
\ No newline at end of file
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php
@@ -14,17 +14,12 @@
1515
1616 class SMWURIValue extends SMWDataValue {
1717
18 - private $m_attribute = null;
1918 private $m_error = '';
2019 private $m_value = '';
2120 private $m_xsdvalue = '';
2221 private $m_infolinks = Array();
2322 private $m_mode = '';
2423
25 - /*********************************************************************/
26 - /* Set methods */
27 - /*********************************************************************/
28 -
2924 function SMWURIValue($mode) {
3025 switch ($mode) {
3126 default: case 'url':
@@ -71,17 +66,10 @@
7267 $this-> setUserValue($value);
7368 }
7469
75 - public function setAttribute($attribute) {
76 - $this->m_attribute = $attribute;
 70+ public function setOutputFormat($formatstring){
 71+ //TODO
7772 }
7873
79 - public function setOutputFormat($formatstring){
80 - //TODO
81 - }
82 - /*********************************************************************/
83 - /* Get methods */
84 - /*********************************************************************/
85 -
8674 public function getShortWikiText($linked = NULL) {
8775 //TODO: Support linking
8876 wfDebug("\r\n getShortWikiText: ".$this->m_value);
@@ -150,4 +138,3 @@
151139 }
152140 }
153141
154 -?>
\ No newline at end of file
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php
@@ -33,9 +33,6 @@
3434 $this->m_xsdvalue = $value; // lazy parsing
3535 }
3636
37 - public function setAttribute($attribute) { // ignore
38 - }
39 -
4037 public function setOutputFormat($formatstring) {
4138 // no output formats supported, ignore
4239 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_String.php
@@ -8,16 +8,11 @@
99 */
1010 class SMWStringValue extends SMWDataValue {
1111
12 - private $m_attribute = null;
1312 private $m_error = '';
1413 private $m_value = '';
1514 private $m_xsdvalue = '';
1615 private $m_infolinks = Array();
1716
18 - /*********************************************************************/
19 - /* Set methods */
20 - /*********************************************************************/
21 -
2217 public function setUserValue($value) {
2318 if ($value!='') {
2419 $this->m_xsdvalue = smwfXMLContentEncode($value);
@@ -39,18 +34,10 @@
4035 $this->setUserValue($value); // no units, XML compatible syntax
4136 }
4237
43 - public function setAttribute($attribute) {
44 - $this->m_attribute = $attribute;
45 - }
46 -
4738 public function setOutputFormat($formatstring){
4839 //ToDo
4940 }
5041
51 - /*********************************************************************/
52 - /* Get methods */
53 - /*********************************************************************/
54 -
5542 public function getShortWikiText($linked = NULL) {
5643 //TODO: Support linking
5744 return $this->m_value;
@@ -114,5 +101,3 @@
115102
116103
117104 }
118 -
119 -?>
\ No newline at end of file
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_NAry.php
@@ -85,10 +85,6 @@
8686 }
8787 }
8888
89 - public function setAttribute($attribute) {
90 - /// TODO
91 - }
92 -
9389 public function setOutputFormat($formatstring) {
9490 /// TODO
9591 }
@@ -218,9 +214,5 @@
219215 return $this->isValid() ? $this->m_values : null;
220216 }
221217
222 -
223 -
224 -
225 -
226218 }
227219

Status & tagging log