Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Initialization file for SemanticInternalObjects. |
| 4 | + * Initialization file for Semantic Internal Objects. |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup SemanticInternalObjects |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | |
37 | 37 | function siofRegisterParserFunctions( &$parser ) { |
38 | 38 | $parser->setFunctionHook( 'set_internal', array( 'SIOHandler', 'doSetInternal' ) ); |
| 39 | + $parser->setFunctionHook( 'set_internal_recurring_event', array( 'SIOHandler', 'doSetInternalRecurringEvent' ) ); |
39 | 40 | return true; // always return true, in order not to stop MW's hook processing! |
40 | 41 | } |
41 | 42 | |
— | — | @@ -42,6 +43,7 @@ |
43 | 44 | switch ( $langCode ) { |
44 | 45 | default: |
45 | 46 | $magicWords['set_internal'] = array ( 0, 'set_internal' ); |
| 47 | + $magicWords['set_internal_recurring_event'] = array ( 0, 'set_internal_recurring_event' ); |
46 | 48 | } |
47 | 49 | return true; |
48 | | -} |
\ No newline at end of file |
| 50 | +} |
Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php |
— | — | @@ -284,6 +284,32 @@ |
285 | 285 | self::$mInternalObjects[] = $internalObject; |
286 | 286 | } |
287 | 287 | |
| 288 | + public static function doSetInternalRecurringEvent( &$parser ) { |
| 289 | + $params = func_get_args(); |
| 290 | + array_shift( $params ); // We already know the $parser ... |
| 291 | + |
| 292 | + // first param should be a standalone property name |
| 293 | + $objToPagePropName = array_shift( $params ); |
| 294 | + |
| 295 | + $results = SMWParserExtensions::getDatesForRecurringEvent( $params ); |
| 296 | + if ( $results == null ) { |
| 297 | + return null; |
| 298 | + } |
| 299 | + |
| 300 | + list( $property, $all_date_strings, $unused_params ) = $results; |
| 301 | + |
| 302 | + // Mimic a call to #set_internal for each date. |
| 303 | + foreach ( $all_date_strings as $date_string ) { |
| 304 | + $first_params = array( |
| 305 | + $parser, |
| 306 | + $objToPagePropName, |
| 307 | + "$property=$date_string" |
| 308 | + ); |
| 309 | + $cur_params = array_merge( $first_params, $unused_params ); |
| 310 | + call_user_func_array( 'SIOHandler::doSetInternal', $cur_params ); |
| 311 | + } |
| 312 | + } |
| 313 | + |
288 | 314 | public static function updateData( $subject ) { |
289 | 315 | $sioSQLStore = new SIOSQLStore(); |
290 | 316 | // Find all "pages" in the SMW IDs table that are internal |