igor@142: setHook( "lilalo", "renderLiLaLoPRE" ); igor@150: global $wgOut; igor@150: $wgOut->addHTML(''); igor@142: } igor@142: igor@150: $markerList = array(); igor@150: igor@142: function renderLiLaLoPRE( $input ) { igor@150: global $markerList; igor@143: preg_match('/[^\n]*l3: local_session_id=([0-9-]*)[^\n]*[\n]/', $input, $matches); igor@143: $session_id=$matches[1]; igor@150: if ($session_id) { igor@143: preg_match('/([0-9]*)-([0-9]*)/', $session_id, $matches); igor@143: $session_start_time = intval($matches[2]); igor@143: $hour=intval(date('G', $session_start_time)); igor@143: $min=intval(date('i', $session_start_time)); igor@143: $sec=intval(date('s', $session_start_time)); igor@143: $input = preg_replace('/[^\n]*l3: local_session_id=([0-9-]*)[^\n]*[\n]/', '', $input); igor@143: $input = preg_replace('/((..):(..):(...)(#[^\n]*))/e', igor@143: '\'$2:$3:$4$5\'', igor@143: $input); igor@143: # .strval($session_start_time+3600*(intval($2)-$hour)+60*(intval($3)-$min)+(intval($4)-$sec)) igor@150: $time_prefix="$hour:$min:$sec "; igor@150: } igor@150: else igor@150: { igor@150: $tip_text='
-nshow numerical addresses instead of trying to determine symbolic host names.
This is useful if you are trying to determine why the route to your nameserver has vanished.
'; igor@150: #$tip_text='1'; igor@150: $tip=" onmouseover=\"Tip('".$tip_text."')\" onmouseout=\"UnTip()\""; igor@150: $input = preg_replace('/(%#.*)/', '$1', $input); igor@150: } igor@150: $output = "
$time_prefix$input
"; igor@150: $markercount = count($markerList); igor@150: $marker = "xx-lilalo-marker".$markercount."-xx"; igor@150: $markerList[$markercount] = $output; igor@150: return $marker; igor@150: igor@142: } igor@142: igor@150: function wfLiLaLoParserAfterTidy(&$parser, &$text) { igor@150: // find markers in $text igor@150: // replace markers with actual output igor@150: global $markerList; igor@150: $keys = array(); igor@150: $marker_count = count($markerList); igor@150: igor@150: for ($i = 0; $i < $marker_count; $i++) { igor@150: $keys[$i] = 'xx-lilalo-marker' . $i . '-xx'; igor@150: } igor@150: igor@150: $text = str_replace($keys, $markerList, $text); igor@150: #$text = $marker_count; igor@150: return true; igor@150: } igor@142: ?>