Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php |
— | — | @@ -10,6 +10,23 @@ |
11 | 11 | class SDUtils { |
12 | 12 | |
13 | 13 | /** |
| 14 | + * Helper function to handle getPropertyValues() in both SMW 1.6 |
| 15 | + * and earlier versions. |
| 16 | + */ |
| 17 | + public static function getSMWPropertyValues( $store, $pageName, $pageNamespace, $propID, $requestOptions = null ) { |
| 18 | + // SMWDIProperty was added in SMW 1.6 |
| 19 | + if ( class_exists( 'SMWDIProperty' ) ) { |
| 20 | + $page = new SMWDIWikiPage( $pageName, $pageNamespace, null ); |
| 21 | + $property = new SMWDIProperty( $propID ); |
| 22 | + return $store->getPropertyValues( $page, $property, $requestOptions ); |
| 23 | + } else { |
| 24 | + $title = Title::makeTitleSafe( $pageNamespace, $pageName ); |
| 25 | + $property = SMWPropertyValue::makeProperty( $propID ); |
| 26 | + return $store->getPropertyValues( $title, $property, $requestOptions ); |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + /** |
14 | 31 | * Gets a list of the names of all categories in the wiki that aren't |
15 | 32 | * children of some other category - this list additionally includes, |
16 | 33 | * and excludes, categories that are manually set with |
— | — | @@ -115,9 +132,7 @@ |
116 | 133 | */ |
117 | 134 | static function getValuesForProperty( $subject, $subject_namespace, $special_prop ) { |
118 | 135 | $store = smwfGetStore(); |
119 | | - $subject_title = Title::newFromText( $subject, $subject_namespace ); |
120 | | - $property = SMWPropertyValue::makeProperty( $special_prop ); |
121 | | - $res = $store->getPropertyValues( $subject_title, $property ); |
| 136 | + $res = self::getSMWPropertyValues( $store, $subject, $subject_namespace, $special_prop ); |
122 | 137 | $values = array(); |
123 | 138 | foreach ( $res as $prop_val ) { |
124 | 139 | // depends on version of SMW |