r26153 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26152‎ | r26153 | r26154 >
Date:13:51, 26 September 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Ad hoc solution for registering own special property labels.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php
@@ -53,6 +53,22 @@
5454 }
5555
5656 /**
 57+ * Extends the array of special properties with a mapping from an $id to a
 58+ * language dependent label.
 59+ * NOTE: this function is provided for ad hoc compatibility with the Halo project.
 60+ * A better solution will replace it at some time.
 61+ */
 62+ function addSpecialProperty($id, $label) {
 63+ if (array_key_exists($id, $this->smwSpecialProperties)) {
 64+ trigger_error('The ID "' . $id . '" already belongs to the special property "' . $this->smwSpecialProperties[$key] . '" and thus cannot be used for "' . $label . '".', E_USER_WARNING);
 65+ } elseif ($id < 1000) {
 66+ trigger_error('IDs below 1000 are not allowed for custom special properties. Registration of "' . $label . '" failed.', E_USER_WARNING);
 67+ } else {
 68+ $this->smwSpecialProperties[$id] = $label;
 69+ }
 70+ }
 71+
 72+ /**
5773 * Function that returns all content messages (those that are stored
5874 * in some article, and can thus not be translated to individual users).
5975 */

Status & tagging log