Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -121,25 +121,33 @@ |
122 | 122 | return $categories; |
123 | 123 | } |
124 | 124 | |
| 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 | + |
125 | 133 | static function initProperties() { |
126 | 134 | global $sfgContLang; |
127 | 135 | $sf_props = $sfgContLang->getPropertyLabels(); |
128 | 136 | 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] ); |
130 | 138 | 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] ); |
132 | 140 | 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] ); |
134 | 142 | 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] ); |
136 | 144 | 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] ); |
138 | 146 | // 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' ); |
144 | 152 | |
145 | 153 | return true; |
146 | 154 | } |