r86434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86433‎ | r86434 | r86435 >
Date:20:39, 19 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added method to register dataitems
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Number.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Number.php
@@ -82,7 +82,7 @@
8383 }
8484 list( $number ) = sscanf( $numstring, "%f" );
8585 if ( count( $parts ) >= 3 ) {
86 - $unit = SMWNumberValue::normalizeUnit( $parts[2] );
 86+ $unit = self::normalizeUnit( $parts[2] );
8787 }
8888 }
8989
@@ -104,7 +104,7 @@
105105 $this->m_unitin = false;
106106 $this->m_unitvalues = false;
107107 $number = $unit = '';
108 - $error = SMWNumberValue::parseNumberValue( $value, $number, $unit );
 108+ $error = self::parseNumberValue( $value, $number, $unit );
109109 if ( $error == 1 ) { // no number found
110110 $this->addError( wfMsgForContent( 'smw_nofloat', $value ) );
111111 } elseif ( $error == 2 ) { // number is too large for this platform
Index: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php
@@ -56,7 +56,7 @@
5757 }
5858
5959 wfProfileIn( __METHOD__ . '-parse' );
60 - $options = new ParserOptions;
 60+ $options = new ParserOptions();
6161 $output = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getID() );
6262
6363 wfProfileOut( __METHOD__ . '-parse' );
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
@@ -298,6 +298,19 @@
299299 }
300300
301301 /**
 302+ * A function for registering/overwriting dataitems for SMW. Should be
 303+ * called from within the hook 'smwInitDatatypes'.
 304+ *
 305+ * @since 0.8
 306+ *
 307+ * @param string $id
 308+ * @param string $className
 309+ */
 310+ static public function registerDataItem( $id, $className ) {
 311+ self::$mTypeDiClasses[$id] = $className;
 312+ }
 313+
 314+ /**
302315 * A function for registering/overwriting datatypes for SMW. Should be
303316 * called from within the hook 'smwInitDatatypes'.
304317 *

Status & tagging log