r88939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88938‎ | r88939 | r88940 >
Date:22:04, 26 May 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for SMW 1.6
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -121,25 +121,33 @@
122122 return $categories;
123123 }
124124
 125+ static function registerProperty( $id, $typeid, $label ) {
 126+ if ( class_exists( 'SMWDIProperty' ) ) {
 127+ SMWDIProperty::registerProperty( $id, $typeid, $label, true );
 128+ } else {
 129+ SMWPropertyValue::registerProperty( $id, $typeid, $label, true );
 130+ }
 131+ }
 132+
125133 static function initProperties() {
126134 global $sfgContLang;
127135 $sf_props = $sfgContLang->getPropertyLabels();
128136 if ( array_key_exists( SF_SP_HAS_DEFAULT_FORM, $sf_props ) )
129 - SMWPropertyValue::registerProperty( '_SF_DF', '__spf', $sf_props[SF_SP_HAS_DEFAULT_FORM], true );
 137+ self::registerProperty( '_SF_DF', '__spf', $sf_props[SF_SP_HAS_DEFAULT_FORM] );
130138 if ( array_key_exists( SF_SP_HAS_ALTERNATE_FORM, $sf_props ) )
131 - SMWPropertyValue::registerProperty( '_SF_AF', '__spf', $sf_props[SF_SP_HAS_ALTERNATE_FORM], true );
 139+ self::registerProperty( '_SF_AF', '__spf', $sf_props[SF_SP_HAS_ALTERNATE_FORM] );
132140 if ( array_key_exists( SF_SP_CREATES_PAGES_WITH_FORM, $sf_props ) )
133 - SMWPropertyValue::registerProperty( '_SF_CP', '__spf', $sf_props[SF_SP_CREATES_PAGES_WITH_FORM], true );
 141+ self::registerProperty( '_SF_CP', '__spf', $sf_props[SF_SP_CREATES_PAGES_WITH_FORM] );
134142 if ( array_key_exists( SF_SP_PAGE_HAS_DEFAULT_FORM, $sf_props ) )
135 - SMWPropertyValue::registerProperty( '_SF_PDF', '__spf', $sf_props[SF_SP_PAGE_HAS_DEFAULT_FORM], true );
 143+ self::registerProperty( '_SF_PDF', '__spf', $sf_props[SF_SP_PAGE_HAS_DEFAULT_FORM] );
136144 if ( array_key_exists( SF_SP_HAS_FIELD_LABEL_FORMAT, $sf_props ) )
137 - SMWPropertyValue::registerProperty( '_SF_FLF', '_str', $sf_props[SF_SP_HAS_FIELD_LABEL_FORMAT], true );
 145+ self::registerProperty( '_SF_FLF', '_str', $sf_props[SF_SP_HAS_FIELD_LABEL_FORMAT] );
138146 // also initialize hardcoded English values, if it's a non-English-language wiki
139 - SMWPropertyValue::registerProperty( '_SF_DF_BACKUP', '__spf', 'Has default form', true );
140 - SMWPropertyValue::registerProperty( '_SF_AF_BACKUP', '__spf', 'Has alternate form', true );
141 - SMWPropertyValue::registerProperty( '_SF_CP_BACKUP', '__spf', 'Creates pages with form', true );
142 - SMWPropertyValue::registerProperty( '_SF_PDF_BACKUP', '__spf', 'Page has default form', true );
143 - SMWPropertyValue::registerProperty( '_SF_FLF_BACKUP', '_str', 'Has field label format', true );
 147+ self::registerProperty( '_SF_DF_BACKUP', '__spf', 'Has default form' );
 148+ self::registerProperty( '_SF_AF_BACKUP', '__spf', 'Has alternate form' );
 149+ self::registerProperty( '_SF_CP_BACKUP', '__spf', 'Creates pages with form' );
 150+ self::registerProperty( '_SF_PDF_BACKUP', '__spf', 'Page has default form' );
 151+ self::registerProperty( '_SF_FLF_BACKUP', '_str', 'Has field label format' );
144152
145153 return true;
146154 }