/** * Handle the #set_internal_recurring_event parser function. */ public static function doSetInternalRecurringEvent(&$parser) { $params = func_get_args(); array_shift($params); // We already know the $parser ... // First param should be a standalone property name. $objToPagePropName = array_shift($params); // The location of this function changed in SMW 1.5.3 if (class_exists('SMWSetRecurringEvent')) { $results = SMWSetRecurringEvent::getDatesForRecurringEvent($params); } else { $results = SMWParserExtensions::getDatesForRecurringEvent($params); } if ($results == null) { return null; } list($property, $all_date_strings, $unused_params) = $results; // Mimic a call to #set_internal for each date. foreach ($all_date_strings as $date_string) { $first_params = array(&$parser, $objToPagePropName, "{$property}={$date_string}"); $cur_params = array_merge($first_params, $unused_params); call_user_func_array('SIOHandler::doSetInternal', $cur_params); } }
/** * This callback function strips out the semantic attributes from a wiki * link. Expected parameter: array(linktext, properties, value, caption) */ static public function parsePropertiesCallback( $semanticLink ) { global $smwgInlineErrors, $smwgStoreAnnotations; wfProfileIn( 'smwfParsePropertiesCallback (SMW)' ); if ( array_key_exists( 1, $semanticLink ) ) { $property = $semanticLink[1]; } else { $property = ''; } if ( array_key_exists( 2, $semanticLink ) ) { $value = $semanticLink[2]; } else { $value = ''; } if ( $value === '' ) { // silently ignore empty values wfProfileOut( 'smwfParsePropertiesCallback (SMW)' ); return ''; } if ( $property == 'SMW' ) { switch ( $value ) { case 'on': SMWParserExtensions::$mTempStoreAnnotations = true; break; case 'off': SMWParserExtensions::$mTempStoreAnnotations = false; break; } wfProfileOut( 'smwfParsePropertiesCallback (SMW)' ); return ''; } if ( array_key_exists( 3, $semanticLink ) ) { $valueCaption = $semanticLink[3]; } else { $valueCaption = false; } // Extract annotations and create tooltip. $properties = preg_split( '/:[=:]/u', $property ); foreach ( $properties as $singleprop ) { $dv = SMWParseData::addProperty( $singleprop, $value, $valueCaption, SMWParserExtensions::$mTempParser, $smwgStoreAnnotations && SMWParserExtensions::$mTempStoreAnnotations ); } $result = $dv->getShortWikitext( true ); if ( ( $smwgInlineErrors && $smwgStoreAnnotations && SMWParserExtensions::$mTempStoreAnnotations ) && ( !$dv->isValid() ) ) { $result .= $dv->getErrorText(); } wfProfileOut( 'smwfParsePropertiesCallback (SMW)' ); return $result; }