igor@142: igor@150: $wgHooks['ParserAfterTidy'][] = 'wfLiLaLoParserAfterTidy'; igor@142: $wgExtensionFunctions[] = "wfLiLaLoExtension"; igor@142: igor@150: /* igor@150: igor@150: More on this technic: igor@150: http://www.mediawiki.org/wiki/Manual:Tag_extensions#How_can_I_avoid_modification_of_my_extension.27s_HTML_output.3F igor@150: igor@150: igor@150: HTML tooltips from: igor@150: http://www.walterzorn.com/tooltip/tooltip_e.htm#download igor@150: igor@150: Also: igor@150: http://sixrevisions.com/tutorials/javascript_tutorial/create_lightweight_javascript_tooltip/ igor@150: igor@150: */ igor@150: igor@142: function wfLiLaLoExtension() { igor@142: global $wgParser; igor@142: $wgParser->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='
-n | show 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. |
$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: ?>