Index: trunk/extensions/SemanticDrilldown/includes/SD_GlobalFunctions.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | if (!defined('MEDIAWIKI')) die(); |
10 | 10 | |
11 | | -define('SD_VERSION','0.6.1'); |
| 11 | +define('SD_VERSION','0.6.2'); |
12 | 12 | |
13 | 13 | // constants for special properties |
14 | 14 | define('SD_SP_HAS_FILTER', 1); |
— | — | @@ -162,19 +162,33 @@ |
163 | 163 | } |
164 | 164 | |
165 | 165 | function sdfInitProperties() { |
166 | | - global $sdgContLang; |
167 | | - $sd_props = $sdgContLang->getPropertyLabels(); |
168 | | - SMWPropertyValue::registerProperty('_SD_F', '_wpg', $sd_props[SD_SP_HAS_FILTER], true); |
169 | | - SMWPropertyValue::registerProperty('_SD_CP', '_wpp', $sd_props[SD_SP_COVERS_PROPERTY], true); |
170 | | - SMWPropertyValue::registerProperty('_SD_V', '_str', $sd_props[SD_SP_HAS_VALUE], true); |
171 | | - SMWPropertyValue::registerProperty('_SD_VC', '_wpc', $sd_props[SD_SP_GETS_VALUES_FROM_CATEGORY], true); |
172 | | - SMWPropertyValue::registerProperty('_SD_TP', '_str', $sd_props[SD_SP_USES_TIME_PERIOD], true); |
173 | | - SMWPropertyValue::registerProperty('_SD_IT', '_str', $sd_props[SD_SP_HAS_INPUT_TYPE], true); |
174 | | - SMWPropertyValue::registerProperty('_SD_RF', '_wpg', $sd_props[SD_SP_REQUIRES_FILTER], true); |
175 | | - SMWPropertyValue::registerProperty('_SD_L', '_str', $sd_props[SD_SP_HAS_LABEL], true); |
176 | | - SMWPropertyValue::registerProperty('_SD_DT', '_str', $sd_props[SD_SP_HAS_DRILLDOWN_TITLE], true); |
177 | | - SMWPropertyValue::registerProperty('_SD_DP', '_str', $sd_props[SD_SP_HAS_DISPLAY_PARAMETERS], true); |
178 | | - |
| 166 | + global $sdgContLang, $wgLanguageCode; |
| 167 | + $sd_property_vals = array( |
| 168 | + SD_SP_HAS_FILTER => array('_SD_F', '_wpg'), |
| 169 | + SD_SP_COVERS_PROPERTY => array('_SD_CP', '_wpp'), |
| 170 | + SD_SP_HAS_VALUE => array('_SD_V', '_str'), |
| 171 | + SD_SP_GETS_VALUES_FROM_CATEGORY => array('_SD_VC', '_wpc'), |
| 172 | + SD_SP_USES_TIME_PERIOD => array('_SD_TP', '_str'), |
| 173 | + SD_SP_HAS_INPUT_TYPE => array('_SD_IT', '_str'), |
| 174 | + SD_SP_REQUIRES_FILTER => array('_SD_RF', '_wpg'), |
| 175 | + SD_SP_HAS_LABEL => array('_SD_L', '_str'), |
| 176 | + SD_SP_HAS_DRILLDOWN_TITLE => array('_SD_DT', '_str'), |
| 177 | + SD_SP_HAS_DISPLAY_PARAMETERS => array('_SD_DP', '_str'), |
| 178 | + ); |
| 179 | + // register main property labels |
| 180 | + $sd_prop_labels = $sdgContLang->getPropertyLabels(); |
| 181 | + foreach ($sd_prop_labels as $prop_id => $prop_alias) { |
| 182 | + $prop_vals = $sd_property_vals[$prop_id]; |
| 183 | + SMWPropertyValue::registerProperty($prop_vals[0], $prop_vals[1], $prop_alias, true); |
| 184 | + } |
| 185 | + // if it's not English, add the English-language aliases as well |
| 186 | + if ($wgLanguageCode != 'en') { |
| 187 | + $sd_prop_aliases = $sdgContLang->getPropertyAliases(); |
| 188 | + foreach ($sd_prop_aliases as $prop_alias => $prop_id) { |
| 189 | + $prop_vals = $sd_property_vals[$prop_id]; |
| 190 | + SMWPropertyValue::registerProperty($prop_vals[0], $prop_vals[1], $prop_alias, true); |
| 191 | + } |
| 192 | + } |
179 | 193 | return true; |
180 | 194 | } |
181 | 195 | |